fix(sqlserver): preserve local temp table count sessions

This commit is contained in:
zipg authored and GitHub committed 2026-09-01 16:20:56 +08:00
1 parent a7922b9cbf
commit 440c41f5b9
6 files changed
+158 -8

No files matched your search

@@ -0,0 +1,12 @@
import { tokenizeSqlSemantic, unquoteSqlSemanticIdentifier } from "@/lib/sql/semantic/tokens";
import type { DatabaseType } from "@/types/database";
export function sqlServerCountUsesLocalTempTable(databaseType: DatabaseType | undefined, sql: string): boolean {
if (databaseType !== "sqlserver" || !sql) return false;
return tokenizeSqlSemantic(sql, "sqlserver").some((token) => {
if (token.kind !== "word" && token.kind !== "quoted_identifier") return false;
const identifier = token.kind === "quoted_identifier" ? unquoteSqlSemanticIdentifier(token) : token.text;
return identifier.startsWith("#") && !identifier.startsWith("##");
});
}