sidorares / sidorares/node-mysql2
Updating multiple columns with a javascript object
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 680
- Avg merge
- 9h 7m
- Merged PRs (30d)
- 59
Description
Hello,
With node-mysql I was able to update multiple columns with this code, using a javascript object.
connection.query('update mytable set ? where id=?', [obj, obj.id], callback)
I just tried this query in node-mysql2 but this it fails with "Error: You have an error in your SQL syntax;". I am using the promisified API with connection.execute() (reason for switching to node-mysql2).
Am I missing something obvious, or is the "set ?" syntax not available ?
Thank you.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the connection.execute() API and the query-formatting behavior used by node-mysql2, comparing it with the node-mysql example in the issue. Determine whether SET ? with an object is supported through execute(); done means confirming the supported behavior or documenting the required API usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, nodejs
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100