mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 17:36:01 +00:00
split query fix
This commit is contained in:
@@ -2,14 +2,14 @@ import { SplitterOptions, defaultSplitterOptions } from './options';
|
|||||||
|
|
||||||
const SEMICOLON = ';';
|
const SEMICOLON = ';';
|
||||||
|
|
||||||
interface SplitStreamContext {
|
export interface SplitStreamContext {
|
||||||
options: SplitterOptions;
|
options: SplitterOptions;
|
||||||
currentDelimiter: string;
|
currentDelimiter: string;
|
||||||
pushOutput: (sql: string) => void;
|
pushOutput: (sql: string) => void;
|
||||||
commandPart: string;
|
commandPart: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SplitLineContext extends SplitStreamContext {
|
export interface SplitLineContext extends SplitStreamContext {
|
||||||
source: string;
|
source: string;
|
||||||
position: number;
|
position: number;
|
||||||
// output: string[];
|
// output: string[];
|
||||||
@@ -246,7 +246,8 @@ export function splitQuery(sql: string, options: SplitterOptions = null): string
|
|||||||
|
|
||||||
splitQueryLine(context);
|
splitQueryLine(context);
|
||||||
|
|
||||||
pushQuery(context);
|
const trimmed = context.commandPart.trim();
|
||||||
|
if (trimmed) context.pushOutput(trimmed);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user