fix(kingbase): quote MySQL-compatible identifiers

This commit is contained in:
zipg authored and GitHub committed 2026-07-13 18:51:32 +08:00
1 parent 5ceca7fb3e
commit d1cce3ed1e
39 files changed
+373 -23

No files matched your search

@@ -3,7 +3,7 @@ import { useI18n } from "vue-i18n";
import { useConnectionStore } from "@/stores/connectionStore";
import { useQueryStore } from "@/stores/queryStore";
import { useSettingsStore } from "@/stores/settingsStore";
import { buildTableSelectSql, quoteTableIdentifier } from "@/lib/table/tableSelectSql";
import { buildTableSelectSql, quoteTableDataIdentifier } from "@/lib/table/tableSelectSql";
import { editableRowIdentifierColumns, usesSyntheticRowIdKey } from "@/lib/table/tableEditing";
import { tableMetaForDataTab } from "@/lib/table/tableDataTabMeta";
import * as api from "@/lib/backend/api";
@@ -40,7 +40,7 @@ export function useDataGridActions(activeTab: ComputedRef<QueryTab | undefined>)
function quoteIdent(tab: QueryTab, name: string): string {
const config = connectionStore.getConfig(tab.connectionId);
return quoteTableIdentifier(effectiveDatabaseTypeForConnection(config), name);
return quoteTableDataIdentifier(effectiveDatabaseTypeForConnection(config), name, connectionStore.connectionIdentifierQuote?.(tab.connectionId));
}
function buildTableSql(tab: QueryTab, options: { orderBy?: string; limit?: number; offset?: number; whereInput?: string } = {}): Promise<string> {
@@ -51,6 +51,7 @@ export function useDataGridActions(activeTab: ComputedRef<QueryTab | undefined>)
const useRowId = usesSyntheticRowIdKey(effectiveDbType, primaryKeys, tableMeta?.tableType);
return buildTableSelectSql({
databaseType: effectiveDbType,
identifierQuote: connectionStore.connectionIdentifierQuote?.(tab.connectionId),
schema: tableMeta?.schema,
tableName: tableMeta?.tableName ?? "",
tableType: tableMeta?.tableType,
@@ -56,6 +56,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
await connectionStore.ensureConnected(target.connectionId);
if (!config) throw new Error("Connection config not found");
const effectiveDbType = effectiveDatabaseTypeForConnection(config);
const identifierQuote = connectionStore.connectionIdentifierQuote?.(target.connectionId);
const querySchema = metadataSchemaForConnection(config, target.database, target.schema);
const targetTableType = target.tableType ?? "TABLE";
if (config.db_type === "neo4j") {
@@ -63,6 +64,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
const primaryKeys = editableRowIdentifierColumns(effectiveDbType, columns, undefined, targetTableType);
const sql = await buildTableSelectSql({
databaseType: effectiveDbType,
identifierQuote,
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,
@@ -86,6 +88,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
}
const sql = await buildTableSelectSql({
databaseType: effectiveDbType,
identifierQuote,
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,
@@ -113,6 +116,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
if (fellBackToLimitZero) {
const emptySql = await buildTableSelectSql({
databaseType: effectiveDbType,
identifierQuote,
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,
@@ -139,6 +143,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
if (!fellBackToLimitZero && (useRowId || config.db_type === "tdengine")) {
const newSql = await buildTableSelectSql({
databaseType: effectiveDbType,
identifierQuote,
schema: target.schema,
catalog: target.catalog,
tableName: target.tableName,