Skip to content

Commit b098e23

Browse files
committed
fix: multiple line string in mariadb
1 parent ec76173 commit b098e23

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

pegjs/mariadb.pegjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3502,6 +3502,7 @@ literal_datetime
35023502
single_quote_char
35033503
= [^"\\\0-\x1F\x7f]
35043504
/ escape_char
3505+
/ [\n]
35053506

35063507
single_char
35073508
= [^'\\]

pegjs/mysql.pegjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3786,6 +3786,7 @@ literal_datetime
37863786
single_quote_char
37873787
= [^"\\\0-\x1F\x7f]
37883788
/ escape_char
3789+
/ [\n]
37893790

37903791
single_char
37913792
= [^'\\] // remove \0-\x1F\x7f pnCtrl char [^'\\\0-\x1F\x7f]

test/mysql-mariadb.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,15 @@ describe('mysql', () => {
12131213
'SELECT * FROM (`table`, `table2` AS `t2`, `jacob` AS `jacobian`) LEFT JOIN `table3` AS `t3` ON `t2`.`id` = `t3`.`table2_id`'
12141214
]
12151215
},
1216+
{
1217+
title: 'newline in string',
1218+
sql: [
1219+
`SELECT "asd
1220+
"`,
1221+
`SELECT "asd
1222+
"`
1223+
]
1224+
}
12161225
]
12171226
SQL_LIST.forEach(sqlInfo => {
12181227
const { title, sql } = sqlInfo

0 commit comments

Comments
 (0)