File tree Expand file tree Collapse file tree 2 files changed +8
-19
lines changed
Expand file tree Collapse file tree 2 files changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -2655,26 +2655,11 @@ single_quote_char
26552655 / escape_char
26562656
26572657single_char
2658- = [^'\\ ] // remove \0-\x1F\x7f pnCtrl char [^'\\\0-\x1F\x7f]
2658+ = [^'] // remove \0-\x1F\x7f pnCtrl char [^'\\\0-\x1F\x7f]
26592659 / escape_char
26602660
26612661escape_char
2662- = "\\ '" { return " \\ '" ; }
2663- / '\\ "' { return ' \\ "' ; }
2664- / "\\\\ " { return " \\\\ " ; }
2665- / "\\ /" { return " \\ /" ; }
2666- / "\\ b" { return " \b " ; }
2667- / "\\ f" { return " \f " ; }
2668- / "\\ n" { return " \n " ; }
2669- / "\\ r" { return " \r " ; }
2670- / "\\ t" { return " \t " ; }
2671- / "\\ u" h1 :hexDigit h2 :hexDigit h3 :hexDigit h4 :hexDigit {
2672- return String .fromCharCode (parseInt (" 0x" + h1 + h2 + h3 + h4));
2673- }
2674- / "\\ " { return " \\ " ; }
2675- / "''" { return " ''" }
2676- / '""' { return ' ""' }
2677- / '``' { return ' ``' }
2662+ = "''"
26782663
26792664line_terminator
26802665 = [\n\r ]
Original file line number Diff line number Diff line change @@ -266,8 +266,12 @@ describe('sqlite', () => {
266266 } )
267267 } )
268268 it ( 'should support LIKE with ESCAPE' , ( ) => {
269- const sql = `SELECT * FROM table_name WHERE column_name LIKE '%pattern%' ESCAPE '\'`
270- expect ( getParsedSql ( sql ) ) . to . be . equal ( `SELECT * FROM "table_name" WHERE "column_name" LIKE '%pattern%' ESCAPE '\'` )
269+ const sql = `SELECT * FROM table_name WHERE column_name LIKE '%pattern%' ESCAPE 'x'`
270+ expect ( getParsedSql ( sql ) ) . to . be . equal ( `SELECT * FROM "table_name" WHERE "column_name" LIKE '%pattern%' ESCAPE 'x'` )
271+ } )
272+ it ( 'should allow single backslash without escaping' , ( ) => {
273+ const sql = `SELECT * FROM table_name WHERE column_name LIKE '\\_%' ESCAPE '\\'`
274+ expect ( getParsedSql ( sql ) ) . to . be . equal ( `SELECT * FROM "table_name" WHERE "column_name" LIKE '\\_%' ESCAPE '\\'` )
271275 } )
272276 it ( 'should support string concatenation in LIKE opts' , ( ) => {
273277 const sql = `SELECT * FROM file WHERE path LIKE 'C:' || CHAR(92) || 'Users' || CHAR(92) || 'example.txt'`
You can’t perform that action at this time.
0 commit comments