question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

execute UPDATE SET ? error

See original GitHub issue

db.execute('update t set ? where id=?', [{a:97, b:98}, 1])

This errors ​​You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? WHERE id = ?' at line 1​​

Works fine if i use db.query The db.format it generates looks fine

how does SET ? work? is that not supposed to be used with prepared statements?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
scull7commented, Apr 2, 2018

It seems that this also fails:

db.execute({
  sql: 'INSERT INTO test SET ?',
  values: [ { foo: "bar", baz: "buzz" } ],
  namedParameters: false,
}, console.log)

ER_PARSE_ERROR (1064) - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘?’ at line 1

however, this succeeds:

db.query({
  sql: 'INSERT INTO test SET ?',
  values: [ { foo: "bar", baz: "buzz" } ],
  namedParameters: false,
}, console.log)
0reactions
scull7commented, Apr 2, 2018

@sidorares Thank you for the explanation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Update Set Errors - ServiceNow Community
The update set I have in Dev works just fine when I run the report. I have deleted it from Test instance and...
Read more >
The executeUpdate method must not return a result set error ...
The executeUpdate method must not return a result set error when inserting data into SQL Server Database.
Read more >
cursor.execute(""" UPDATE SET sqlite3.OperationalError: near ...
It always tells you exactly the position in the query where the syntax parser got confused about your query. In this case, it...
Read more >
Documentation: 15: UPDATE - PostgreSQL
UPDATE changes the values of the specified columns in all rows that satisfy the condition. Only the columns to be modified need be...
Read more >
UPDATE (Transact-SQL) - SQL Server - Microsoft Learn
WRITE clause to update a NULL column or set the value of ... The rest of the batch is not executed, and an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found