You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you attempt to do named-placeholders substitutions on SQL strings containing comments with odd numbers of single quote characters, things go awry. I'd guess that, during parsing, the single quote is probably pushing a state on the stack that it shouldn't, since we're in a comment.
Here's an easy example to reproduce
var resolve = require('named-placeholders')();
var sqlq = `
SELECT :foo AS foo
UNION ALL
-- dan's comment
SELECT :foo AS foo
UNION ALL
-- dan's other comment
SELECT :foo AS foo
`;
var resolvedQuery = resolve(sqlq, {'foo': 'woof'});
console.log(resolvedQuery[0]);
Notice the failed substitution in the second SELECT:
SELECT ? AS foo
UNION ALL
-- dan's comment
SELECT :foo AS foo
UNION ALL
-- dan's other comment
SELECT ? AS foo
Observed using named-placeholders version 1.1.1
The text was updated successfully, but these errors were encountered:
When you attempt to do
named-placeholders
substitutions on SQL strings containing comments with odd numbers of single quote characters, things go awry. I'd guess that, during parsing, the single quote is probably pushing a state on the stack that it shouldn't, since we're in a comment.Here's an easy example to reproduce
Notice the failed substitution in the second
SELECT
:Observed using
named-placeholders
version1.1.1
The text was updated successfully, but these errors were encountered: