mongo query splitter, copy as mongo insert

This commit is contained in:
Jan Prochazka
2021-12-02 10:00:48 +01:00
parent 368993597c
commit 536897a84c
10 changed files with 67 additions and 14 deletions

View File

@@ -113,7 +113,7 @@ function scanToken(context: SplitLineContext): Token {
return EOLN_TOKEN;
}
if (ch == '-' && s[pos + 1] == '-') {
if (context.options.doubleDashComments && ch == '-' && s[pos + 1] == '-') {
while (pos < context.end && s[pos] != '\n') pos++;
return {
type: 'comment',
@@ -121,7 +121,7 @@ function scanToken(context: SplitLineContext): Token {
};
}
if (ch == '/' && s[pos + 1] == '*') {
if (context.options.multilineComments && ch == '/' && s[pos + 1] == '*') {
pos += 2;
while (pos < context.end) {
if (s[pos] == '*' && s[pos + 1] == '/') break;
@@ -222,7 +222,7 @@ export function splitQueryLine(context: SplitLineContext) {
}
export function getInitialDelimiter(options: SplitterOptions) {
return options?.allowSemicolon === false ? null : SEMICOLON
return options?.allowSemicolon === false ? null : SEMICOLON;
}
export function splitQuery(sql: string, options: SplitterOptions = null): string[] {
const usedOptions = {