You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This the the minimal code to demonstrate the issue:
conststmt=env.DB.prepare(`UPDATE table SET column1 = ?, column2 = ? WHERE id = ?1`)awaitstmt.bind(id,value1,value2).run()
The code above will get the following error:
D1_ERROR: Wrong number of parameter bindings for SQL
If we change the code above to this way:
conststmt=env.DB.prepare(`UPDATE table SET column1 = ?, column2 = ? WHERE id = ?`)awaitstmt.bind(value1,value2,id).run()
Then the statement can be executed.
Also, we noticed ordered parameters can be mixed with anonymous parameters as long as anonymous parameters are after all the ordered parameters. For instance, this query can be executed successfully:
constquery=env.DB.prepare(`SELECT * FROM table WHERE id = ?1 AND column1 = ? AND column2 = ?`)awaitquery.bind(id,value1,value2).all()
Expected behavior
We expect queries with mixed ordered and anonymous parameters should be able to execute without any problems. In the bindings, we can bind ordered parameters first, and then anonymous parameters, regardless of how they appear in the query.
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
No response
The text was updated successfully, but these errors were encountered:
Which Cloudflare product(s) does this pertain to?
D1
What version(s) of the tool(s) are you using?
3.55.0 [wrangler]
What version of Node are you using?
No response
What operating system and version are you using?
Mac Sonoma 14.1.1
Describe the Bug
Observed behavior
This the the minimal code to demonstrate the issue:
The code above will get the following error:
If we change the code above to this way:
Then the statement can be executed.
Also, we noticed ordered parameters can be mixed with anonymous parameters as long as anonymous parameters are after all the ordered parameters. For instance, this query can be executed successfully:
Expected behavior
We expect queries with mixed ordered and anonymous parameters should be able to execute without any problems. In the bindings, we can bind ordered parameters first, and then anonymous parameters, regardless of how they appear in the query.
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
No response
The text was updated successfully, but these errors were encountered: