fix(sqlserver): preserve temporary table names in statement ranges

This commit is contained in:
t8y2 committed 2026-08-01 13:15:52 +08:00
1 parent 93a119b424
commit 3bd194679d
2 files changed
+44 -34

No files matched your search

@@ -281,6 +281,11 @@ describe("splitSqlStatementRanges", () => {
expect(rangeSqlTexts(splitSqlStatementRanges(sql))).toEqual(["SELECT 1", "SELECT 2"]);
});
it("keeps SQL Server temporary table names instead of treating them as hash comments", () => {
const sql = "DROP TABLE IF EXISTS #Temp;\nSELECT * FROM ##GlobalTemp;";
expect(rangeSqlTexts(splitSqlStatementRanges(sql, "sqlserver"))).toEqual(["DROP TABLE IF EXISTS #Temp", "SELECT * FROM ##GlobalTemp"]);
});
it("keeps MyBatis placeholders instead of treating them as hash comments", () => {
const sql = "SELECT * FROM yd_org_decla_detail WHERE clr_ym = #{ym};\nSELECT 2";
expect(rangeSqlTexts(splitSqlStatementRanges(sql, "kingbase"))).toEqual(["SELECT * FROM yd_org_decla_detail WHERE clr_ym = #{ym}", "SELECT 2"]);