-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
error on ?NNN binding #584
Comments
Reference: #473 |
The problem here is that from SQLite's perspective, the Unfortunately, this causes an issue in your second example, in which you've manually specified the parameters indices. You are trying to reuse parameters between the two statements, so when this library "consumes" them for the first statement, it ends up failing in the second statement. (I'm assuming you are getting a "not enough args to execute query" error.) To fix this, this library should no longer attempt to "consume" parameters in each loop iteration. Instead, use For example, consider your first query. if _, err := db.Exec(`
UPDATE tempstorage SET value = ?, expired = ? WHERE key = ?;
INSERT INTO tempstorage(key, value, expired) SELECT ?, ?, ? WHERE changes() = 0;
`, value, expiredOnMilis, key, key, value, expiredOnMilis); err != nil {
panic(err)
} Let's follow the algorithm I proposed to find the Go index for the first Note that this will not work if someone tries to mix parameter forms. For example: if _, err := db.Exec(`
UPDATE tempstorage SET value = ?002 WHERE key = ?001;
UPDATE tempstorage SET expired = ?003 WHERE key = ?001;
DELETE FROM tempstorage WHERE key = ?;
`, key, value, expiredOnMilis, otherKey); err != nil {
panic(err)
} In this case, the algorithm would translate the |
This one work:
but this one doesn't:
I don't know if this error is from upstream, please investigate.
Thanks
The text was updated successfully, but these errors were encountered: