fix(neo4j): preserve cypher labels during query execution

This commit is contained in:
Hand Sonic authored and GitHub committed 2026-09-29 11:29:53 +08:00
1 parent 62bf47a0e9
commit 77c542248d
9 files changed
+84 -11

No files matched your search

+1 -1
View File
@@ -378,7 +378,7 @@ function findSqlParameterOccurrences(sql: string, options?: SqlParameterOptions)
const occurrences: ParameterOccurrence[] = [];
const databaseType = options?.databaseType;
const nativeSqlServerParameters = collectNativeSqlServerParameters(sql, databaseType);
const supportsNamedParameters = databaseType !== "saphana";
const supportsNamedParameters = databaseType !== "saphana" && databaseType !== "neo4j";
const enabledSyntaxes = options?.enabledSyntaxes ? new Set(options.enabledSyntaxes) : null;
const isSyntaxEnabled = (syntax: SqlParameterSyntax) => !enabledSyntaxes || enabledSyntaxes.has(syntax);
const complexTypeFieldSeparators = supportsNamedParameters && isSyntaxEnabled("named") ? collectComplexTypeFieldSeparators(sql, databaseType) : new Set<number>();
@@ -3,11 +3,11 @@
// DBX runs two client-side substitution systems before sending SQL to a backend:
// the placeholder parameter dialog (`sqlParameters.ts`, five syntaxes) and the
// `@set name = value;` expansion (`sqlVariables.ts`). This module lets users opt
// out of individual syntaxes per database type. Every toggle defaults to `true`,
// so an empty/absent config reproduces the historical "always substitute" behaviour.
// out of individual syntaxes per database type. SQL syntaxes default to `true`,
// except Neo4j's `:label` patterns, which are not named parameters.
//
// Storage is sparse: only syntaxes explicitly turned off (`false`) are persisted,
// keyed by database type. Anything not stored resolves to enabled.
// keyed by database type. Unset values use the database-specific defaults.
import type { DatabaseType } from "@/types/database";
import type { SqlParameterSyntax } from "@/lib/sql/sqlParameters";
@@ -72,7 +72,7 @@ export function resolveSqlVariableSyntaxToggles(overrides: SqlVariableSyntaxOver
const partial = dbType ? overrides?.[dbType] : undefined;
return {
positional: partial?.positional ?? true,
named: partial?.named ?? true,
named: dbType === "neo4j" ? false : (partial?.named ?? true),
shell: partial?.shell ?? true,
mybatis: partial?.mybatis ?? true,
sqlserver: partial?.sqlserver ?? true,