query splitter - postgre dollar string

This commit is contained in:
Jan Prochazka
2021-06-02 21:49:32 +02:00
parent 352b443a3e
commit e8524d3fff
2 changed files with 34 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
import { mysqlSplitterOptions, mssqlSplitterOptions } from './options';
import { mysqlSplitterOptions, mssqlSplitterOptions, postgreSplitterOptions } from './options';
import { splitQuery } from './splitQuery';
test('simple query', () => {
@@ -59,3 +59,9 @@ test('multi line comment test', () => {
const output = splitQuery(input, mysqlSplitterOptions);
expect(output).toEqual(['SELECT 1 /* comment1;comment2\ncomment3*/', 'SELECT 2']);
});
test('dollar string', () => {
const input = 'CREATE PROC $$ SELECT 1; SELECT 2; $$ ; SELECT 3';
const output = splitQuery(input, postgreSplitterOptions);
expect(output).toEqual(['CREATE PROC $$ SELECT 1; SELECT 2; $$', 'SELECT 3']);
});