Treatment of escaped back ticks
taylorgoolsby opened this issue · comments
Taylor Goolsby commented
Why are these different:
sql = sqltag`\`name\``
sql = mysql.format(sql.sql, sql.values)
// output is "\\`name\\`"
sql = mysql.format(`\`name\``)
// output is "`name`"
I ran these in runkit.
It's a problem for me because I have queries like this:
sql = sqltag`
UPDATE User SET
\`name\` = 'Taylor';
`
sql = mysql.format(sql.sql, sql.values)
Output:
UPDATE User SET
\`name\` = 'Taylor';
The above output is invalid syntax.
The correct output should look like this:
sql = mysql.format(`
UPDATE User SET
\`name\` = 'Taylor';
`)
Output:
UPDATE User SET
`name` = 'Taylor';
Blake Embrey commented
Sounds like an oversight with using raw strings on my side. I can investigate the trade-offs with changing this and get a fix out for you.
Taylor Goolsby commented
Nice! Thank you so much!