1 parent
e18d1ddedf
commit
6f3895edd8
4 files changed
+138
-3
No files matched your search
@@ -297,6 +297,7 @@ export function splitSqlStatementRanges(sql: string, databaseType?: DatabaseType
|
||||
let statementEnd = -1;
|
||||
let statementHitStart = 0;
|
||||
let pendingHintStart = -1;
|
||||
let pendingProxyDirectiveStart = -1;
|
||||
let customDelimiter: string | null = null;
|
||||
let state: QuoteState = "none";
|
||||
let dollarTag = "";
|
||||
@@ -308,8 +309,9 @@ export function splitSqlStatementRanges(sql: string, databaseType?: DatabaseType
|
||||
|
||||
const markContent = (pos: number) => {
|
||||
if (statementStart === -1) {
|
||||
statementStart = pendingHintStart === -1 ? pos : pendingHintStart;
|
||||
statementStart = pendingProxyDirectiveStart !== -1 ? pendingProxyDirectiveStart : pendingHintStart === -1 ? pos : pendingHintStart;
|
||||
pendingHintStart = -1;
|
||||
pendingProxyDirectiveStart = -1;
|
||||
}
|
||||
statementEnd = pos + 1;
|
||||
};
|
||||
@@ -318,6 +320,7 @@ export function splitSqlStatementRanges(sql: string, databaseType?: DatabaseType
|
||||
if (statementStart === -1) {
|
||||
statementEnd = -1;
|
||||
pendingHintStart = -1;
|
||||
pendingProxyDirectiveStart = -1;
|
||||
postgresDollarQuotedRoutine = false;
|
||||
oraclePlSqlStatementEnd = undefined;
|
||||
return;
|
||||
@@ -329,6 +332,7 @@ export function splitSqlStatementRanges(sql: string, databaseType?: DatabaseType
|
||||
statementStart = -1;
|
||||
statementEnd = -1;
|
||||
pendingHintStart = -1;
|
||||
pendingProxyDirectiveStart = -1;
|
||||
postgresDollarQuotedRoutine = false;
|
||||
oraclePlSqlStatementEnd = undefined;
|
||||
};
|
||||
@@ -433,11 +437,13 @@ export function splitSqlStatementRanges(sql: string, databaseType?: DatabaseType
|
||||
|
||||
// Line comments consume up to (and including) the newline.
|
||||
if (ch === "-" && next === "-") {
|
||||
pendingProxyDirectiveStart = -1;
|
||||
const newline = sql.indexOf("\n", i);
|
||||
i = newline === -1 ? len : newline + 1;
|
||||
continue;
|
||||
}
|
||||
if (startsHashLineComment(sql, i, databaseType, parameterOptions)) {
|
||||
pendingProxyDirectiveStart = -1;
|
||||
const newline = sql.indexOf("\n", i);
|
||||
i = newline === -1 ? len : newline + 1;
|
||||
continue;
|
||||
@@ -447,6 +453,9 @@ export function splitSqlStatementRanges(sql: string, databaseType?: DatabaseType
|
||||
const hintMarker = sql[i + 2];
|
||||
if (statementStart === -1 && pendingHintStart === -1 && (hintMarker === "+" || hintMarker === "@" || hintMarker === "&")) pendingHintStart = i;
|
||||
const close = sql.indexOf("*/", i + 2);
|
||||
if (statementStart === -1) {
|
||||
pendingProxyDirectiveStart = databaseType === "mysql" && sql.startsWith("/*proxy*/", i) ? i : -1;
|
||||
}
|
||||
i = close === -1 ? len : close + 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user