1 parent
f3d2b6cb01
commit
355f34f3c7
3 files changed
+30
-3
No files matched your search
@@ -531,6 +531,15 @@ END pkg_utils_without_replace;`;
|
||||
expect(rangeSqlTexts(splitSqlStatementRanges(`${packageSpecWithoutReplace}\nSELECT 1;`, "xugu"))).toEqual([packageSpecWithoutReplace, "SELECT 1"]);
|
||||
});
|
||||
|
||||
it("splits a declaration-only Oracle package body before following DML", () => {
|
||||
const packageBody = `CREATE OR REPLACE PACKAGE BODY packageName IS
|
||||
null;
|
||||
END packageName;`;
|
||||
|
||||
expect(rangeSqlTexts(splitSqlStatementRanges(`${packageBody}\nSELECT * FROM goods;`, "oracle"))).toEqual([packageBody, "SELECT * FROM goods"]);
|
||||
expect(rangeSqlTexts(splitSqlStatementRanges(`${packageBody}\n/\nSELECT * FROM goods;`, "oracle"))).toEqual([packageBody, "SELECT * FROM goods"]);
|
||||
});
|
||||
|
||||
it("splits plain CREATE TYPE AS OBJECT on semicolon without waiting for END", () => {
|
||||
const sql = "CREATE OR REPLACE TYPE address_t AS OBJECT (id INT);\nSELECT 1;";
|
||||
expect(rangeSqlTexts(splitSqlStatementRanges(sql, "xugu"))).toEqual(["CREATE OR REPLACE TYPE address_t AS OBJECT (id INT)", "SELECT 1"]);
|
||||
|
||||
@@ -1782,7 +1782,7 @@ function oraclePlSqlBlockEnd(sql: string): number | null {
|
||||
for (let index = 0; index < tokens.length; index += 1) {
|
||||
const token = tokens[index];
|
||||
if (token.kind === "semicolon") {
|
||||
const complete = objectKind === "spec" ? stack.length === 0 : sawBegin && stack.length === 0;
|
||||
const complete = objectKind !== null ? stack.length === 0 : sawBegin && stack.length === 0;
|
||||
if (complete) return token.to;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user