-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Proposal for named parameters binding #133
Comments
Nice: yes. But a little too high-level for this driver, so I'm probably not adding this for now. |
While waiting for this feature :
Usage :
Returns :
Very basic, can be enhanced |
I created module to transform query with named placeholders + parameters hash into unnamed + array See similar discussion in node-mysql2 sidorares/node-mysql2#117 Example: var mysql = require('mysql');
var toUnnamed = require('named-placeholders')();
var q = toUnnamed('select 1+:test', { test: 123});
var sql = q[0];
var parameters = q[1];
mysl.createConnection().query(sql, parameters); Not sure if it should belong to core driver (maybe should, most other mysql clients expose pdo-style parameters). |
Here's a library for this also supporting ?? syntax: var sql = require('yesql').mysql
var selectById = sql('SELECT * from ::table_name WHERE id = :id;')
connection.query(selectById({id: 5, table_name: 'pokemon'}), callback) |
@felixge Is this still a no no for this library? (since it's been almost 7 years) |
The module is part of the mysqljs org. Use it when you need it. |
It would be nice support this
The text was updated successfully, but these errors were encountered: