-
Notifications
You must be signed in to change notification settings - Fork 53
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
bind should check that bindParameterCount matches with # of bind args #2
Comments
For the record, if we wanted to go heavyweight we could roll in my separate project language-sqlite, which is (I believe) a complete parser and generator for the SQLite syntax. But then it would have to be kept up to date... |
The underlying sqlite implementation already parses the query string, adding another on top of it sounds like a lot of added complexity. What I had mind in for this particular issue was a lot simpler. In fact, it should be simple enough that I'll post a pull request.. |
Can't send a pull request right now, but here's the idea in a patch. Instead of using 'fail', it'd be nicer to use exception types. The below code now uses deprecated fail coming in from Prelude, so it gives a compiler warning.
|
The above patch will conflict with Joey's #7 - I can send a pull request if/when the other change goes in. |
Yes, I'll wait for Joey's changes to go in and then ask you to resubmit, I think. Shouldn't be long. |
I've merged Joey's patch (it was a lot easier to read than I expected :D). On Thu, Aug 16, 2012 at 5:50 AM, Janne Hellsten notifications@github.comwrote:
-- Irene Knapp |
Fail with an error rather than let sqlite convert missing parameters to NULLs. Add tests for the above.
Pull request here #9 |
Throw an error if # of bind params doesn't the query (#2)
Query parameter binding function
bind :: Statement -> [SQLData] -> IO ()
should check for the error case when the length of [SQLData] doesn't match with how many unique query parameters were present in the SQL query.
You can check the # of query params from a prepared statement by using bindParameterCount.
Would be a good idea to check the sqlite3 API specs for these parts first though.
The text was updated successfully, but these errors were encountered: