Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly too many arguments? #88

Open
khmseu opened this issue Nov 11, 2024 · 4 comments
Open

Possibly too many arguments? #88

khmseu opened this issue Nov 11, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@khmseu
Copy link

khmseu commented Nov 11, 2024

Output snippet:

private const string InsertRecordSql = "INSERT INTO importer.export ( fxtel , fxadr, fxname, fxres1, fxres2, fxanw, fxmand, fxdatei, fxusr1, fxusr2, fxname2, fxstr, fxplz, fxort, fxasp, fxzus, fxemail, fxprio, fxextra ) VALUES ( @tel, @adr, @name, @res1, @res2, @anw, @mand, @datei, @usr1, **@tel0, @tel1, @tel2, @tel3, @tel4, @tel5, @tel6, @tel7, @tel8, @tel9** ) "; 
    public readonly record struct InsertRecordArgs(string? Tel, string? Adr, string? Name, string? Res1, string? Res2, string? Anw, string? Mand, string? Datei, string? Usr1, string? Usr2, string? Name2, string? Str, string? Plz, string? Ort, string? Asp, string? Zus, string? Email, string? Prio, object? Extra);
    public async Task InsertRecord(InsertRecordArgs args)
    {
        {
            await using var connection = NpgsqlDataSource.Create(connectionString);
            await using var command = connection.CreateCommand(InsertRecordSql);
            command.Parameters.AddWithValue("@tel", args.Tel);
            command.Parameters.AddWithValue("@adr", args.Adr);
            command.Parameters.AddWithValue("@name", args.Name);
            command.Parameters.AddWithValue("@res1", args.Res1);
            command.Parameters.AddWithValue("@res2", args.Res2);
            command.Parameters.AddWithValue("@anw", args.Anw);
            command.Parameters.AddWithValue("@mand", args.Mand);
            command.Parameters.AddWithValue("@datei", args.Datei);
            command.Parameters.AddWithValue("@usr1", args.Usr1);
            command.Parameters.AddWithValue("@usr2", args.Usr2);
            command.Parameters.AddWithValue("@name2", args.Name2);
            command.Parameters.AddWithValue("@str", args.Str);
            command.Parameters.AddWithValue("@plz", args.Plz);
            command.Parameters.AddWithValue("@ort", args.Ort);
            command.Parameters.AddWithValue("@asp", args.Asp);
            command.Parameters.AddWithValue("@zus", args.Zus);
            command.Parameters.AddWithValue("@email", args.Email);
            command.Parameters.AddWithValue("@prio", args.Prio);
            command.Parameters.AddWithValue("@extra", args.Extra);
            await command.ExecuteScalarAsync();
        }
    }

InsertRecordSql has wrong argument names.

@SockworkOrange SockworkOrange added the bug Something isn't working label Nov 29, 2024
@doron050
Copy link
Collaborator

doron050 commented Nov 29, 2024

Hi @khmseu, thank you for submitting this. Please share your sqlc query and table creation. This will help us reproduce and investigate the issue.

Update:
In a small test I conducted with a similarly structured schema assumed from your code snippet, the "fx" prefix remained in the generated code. So, we would like more information to identify the bug.

@doron050
Copy link
Collaborator

Hi @khmseu :) just a quick reminder
if you can share your SQL files sqlc file it will be helpful

@doron050
Copy link
Collaborator

doron050 commented Jan 7, 2025

Hi, @khmseu we found the problem, you can use as many arguments as you like
I'll update here when the fix in released

@doron050
Copy link
Collaborator

doron050 commented Feb 4, 2025

Hi, @khmseu the bug is fixed in version v0.14.0
please update and try again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants