Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// based on code from Brian White @mscdex mariasql library - https://github.com/mscdex/node-mariasql/blob/master/lib/Client.js#L272-L332
// License: https://github.com/mscdex/node-mariasql/blob/master/LICENSE

const RE_PARAM = /(?:\?)|(?::(\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g,
const RE_PARAM = /(?:\?)|(?::(\d+|(?:[a-zA-Z][a-zA-Z0-9_\.]*)))/g,
DQUOTE = 34,
SQUOTE = 39,
BSLASH = 92;
Expand Down
269 changes: 269 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions test/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ describe('given input query with named parameters', () => {
compile(query, { id: Number(123) })
.should.eql([ 'SELECT * FROM items WHERE deleted = "0000-00-00 00:00:00" AND id = ?',
[ 123 ] ]);

query = 'SELECT * FROM items WHERE deleted = "0000-00-00 00:00:00" AND `dot.id` = :dot.id';
compile(query, { 'dot.id': Number(123) })
.should.eql([ 'SELECT * FROM items WHERE deleted = "0000-00-00 00:00:00" AND `dot.id` = ?',
[ 123 ] ]);
});

it('should throw error when query contains placeholders but parameters object not passed', () => {
Expand Down