gimm260-data-visualization/server/node_modules/named-placeholders
2022-12-13 01:08:09 -07:00
..
node_modules Add table from PA 13 to page. 2022-12-13 01:08:09 -07:00
Changelog.md Add table from PA 13 to page. 2022-12-13 01:08:09 -07:00
index.js Add table from PA 13 to page. 2022-12-13 01:08:09 -07:00
LICENSE Add table from PA 13 to page. 2022-12-13 01:08:09 -07:00
package.json Add table from PA 13 to page. 2022-12-13 01:08:09 -07:00
README.md Add table from PA 13 to page. 2022-12-13 01:08:09 -07:00

Flattr this git repo

NPM

Build Status

named-placeholders

compiles "select foo where foo.id = :bar and foo.baz < :baz" into "select foo where foo.id = ? and foo.baz < ?" + ["bar", "baz"]

usage

npm install named-placeholders

see this mysql2 discussion

var mysql = require('mysql');
var toUnnamed = require('named-placeholders')();

var q = toUnnamed('select 1+:test', { test: 123});
mysql.createConnection().query(q[0], q[1]);

credits

parser is based on @mscdex code of his excellent node-mariasql library