Skip to content

Commit

Permalink
Removed TODO.
Browse files Browse the repository at this point in the history
Tested whether we needed to account for \ escapes in backtick
literals in mysql REPL:
> CREATE DATABASE scratch;
> USE SCRATCH;
> CREATE TABLE `a``b` (id INT);
> SELECT * FROM `a``b`;
Empty set (0.01 sec)
> SELECT * FROM `a\`b`;
ERROR 1064 (42000): You have an error in your SQL syntax; ...

and by examination of https://dev.mysql.com/doc/refman/5.7/en/string-literals.html
re other escaping conventions.
  • Loading branch information
mikesamuel committed Feb 26, 2018
1 parent 8c09ab6 commit c021a92
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/SqlString.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ var CHARS_ESCAPE_MAP = {
'\'' : '\\\'',
'\\' : '\\\\'
};
var ONE_ID_PATTERN = '`(?:[^`]|``)+`'; // TODO(mikesamuel): Should allow ``?
// \ does not escape backquotes inside ID literals.
var ONE_ID_PATTERN = '`(?:[^`]|``)+`';
// One or more Identifiers separated by dots.
var QUALIFIED_ID_REGEXP = new RegExp(
'^' + ONE_ID_PATTERN + '(?:[.]' + ONE_ID_PATTERN + ')*$');
Expand Down

0 comments on commit c021a92

Please sign in to comment.