Skip to content

Commit 9ae0f51

Browse files
author
SPRINX0\prochazka
committed
handled MySQL string style "xxx"
1 parent 502c37d commit 9ae0f51

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/options.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export const mysqlSplitterOptions: SplitterOptions = {
6565
...defaultSplitterOptions,
6666

6767
allowCustomDelimiter: true,
68-
stringsBegins: ["'", '`'],
69-
stringsEnds: { "'": "'", '`': '`' },
70-
stringEscapes: { "'": '\\', '`': '`' },
68+
stringsBegins: ["'", '`', '"'],
69+
stringsEnds: { "'": "'", '`': '`', '"': '"' },
70+
stringEscapes: { "'": '\\', '`': '`', '"': '\\' },
7171
};
7272

7373
export const mssqlSplitterOptions: SplitterOptions = {

src/splitter.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ test('correct split 2 queries - with escaped string', () => {
3333
expect(output).toEqual(["INSERT INTO names (name) VALUES('one\\\\')", "INSERT INTO names (name) VALUES('two\\\\')"]);
3434
});
3535

36+
test('mysql - use quote styles', () => {
37+
const output = splitQuery(`SELECT "'";SELECT '"';SELECT 3`, mysqlSplitterOptions);
38+
expect(output).toEqual([`SELECT "'"`, `SELECT '"'`, `SELECT 3`]);
39+
});
40+
3641
test('incorrect used escape', () => {
3742
const output = splitQuery('query1\\', mysqlSplitterOptions);
3843
expect(output).toEqual(['query1\\']);

0 commit comments

Comments
 (0)