-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
Unhandled null parameters #116
Comments
Why are you passing a null value in the first place? This behavior is sort of intended; all parameters after the SQL query and before the callback functions are added as parameters to the query. Since your query doesn't have any parameters, you get this error. Using |
I see now. I for one never really liked the idea of variable length argument lists, and it seemed natural to pass a null for the bind values. Actually, even the formal parameter list in the docs isn’t clear on this since the comma is outside of the brackets. It would be nice to state explicitly in the description that everything before the callback will be treated as bind values. |
@jooadam - docs are a wiki, please edit as you see fit. |
lol, i can't believe adding [] was the trick. jesus! |
i did a quick note at https://github.com/mapbox/node-sqlite3/wiki/API let me know what you think @springmeyer ! peace! 🎱 |
looks good, @hems! |
Just to say this could have its place in the README too. I wanted to use a callback on my
This gives the following error output and actually fails to create the table:
It took me some time to understand the root cause of this error was the
|
The previous code will produce the following output:
Changing the second argument of
Database#all()
fromnull
to[]
produces the desired output.This handling of null values is both counterintuitive and undocumented. Other methods may be affected too.
The text was updated successfully, but these errors were encountered: