support key value object place holder
See original GitHub issueplease support something like
p.execute("INSERT INTO chat_alert_item SET ?", {col1: value1, col2: value2});
you can see similar example in the documentation of npm mysql
var post = {id: 1, title: 'Hello MySQL'};
var query = connection.query('INSERT INTO posts SET ?', post, function (error, results, fields) {
if (error) throw error;
// Neat!
});
console.log(query.sql); // INSERT INTO posts SET `id` = 1, `title` = 'Hello MySQL'
currently in your implementation it gives
at PoolConnection.execute (/usr/src/app/node_modules/mysql2/lib/connection.js:688:20)
at /usr/src/app/node_modules/mysql2/lib/pool.js:180:29
at /usr/src/app/node_modules/mysql2/lib/pool.js:36:14
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Putting placeholders in a key/value List based on a Set of keys ...
What's a good way to do this in Java? Replace the Set<Long> and List<Object[]> by a Map<Long, BigInteger> . If ...
Read more >Zendesk Support placeholders reference
Zendesk Support placeholders are containers for dynamically generated ticket and user data. The format is a data reference contained within ...
Read more >Advanced: Placeholders | Jira Service Management Data ...
The placeholders available are all the attributes available in the create/edit dialog. The value of the attribute with the same name as the...
Read more >Placeholder objects - Micro Focus
You can use the following objects in a placeholder: sm : Refers to the value of a field in Service Manager. You can...
Read more >Assigning a Value Set to a Placeholder Object - EPLAN Help
If a placeholder object has different value sets then, when editing the placeholder object later, you can switch between the different value sets....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
thank you for your suggestion
but from the readme of this project
this means if it works in mysqljs/mysql it should work here. the code snippet is from their readme, it’s not only a valid use case, but it’s by the book.
isn’t
.query
is for select, while.execute
for updates/insert?then it
p.execute()
should usemysql.format
internallyyes, this is what I did
should be safe, see https://github.com/sidorares/node-mysql2/issues/553#issuecomment-437221838