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

Prepared statement when single parameter is null #219

Open
schveiguy opened this issue Sep 3, 2020 · 2 comments
Open

Prepared statement when single parameter is null #219

schveiguy opened this issue Sep 3, 2020 · 2 comments

Comments

@schveiguy
Copy link
Collaborator

Not sure if this is a bug, but this threw me for a loop:

conn.exec("INSERT INTO sometable (nullableCol) VALUES (?)", null);

This results in an error saying the number of parameters mismatch. But why? Because null matches a Variant[] before it matches the varargs version!

I think the way to fix this is to handle the Variant[] case specifically in the varargs template, but only if the single parameter is not typeof(null).

@Abscissa
Copy link

Abscissa commented Sep 4, 2020 via email

@schveiguy
Copy link
Collaborator Author

Yes, the new API has methods that accept MySQLVal[], which would have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants