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

@@ -89,7 +89,7 @@ import { formatElapsedSeconds } from "@/lib/common/elapsedTime";
import { dataGridCellDisplayText, dataGridCellEditorText } from "@/lib/dataGrid/dataGridCellCoercion";
import { createColumnDrafts } from "@/lib/table/tableStructureEditorState";
import type { BuildSingleColumnAlterSqlOptions } from "@/lib/table/tableStructureEditorSql";
import { buildTableSelectSql, quoteTableIdentifier } from "@/lib/table/tableSelectSql";
import { buildTableSelectSql, quoteTableDataIdentifier } from "@/lib/table/tableSelectSql";
import { uuid } from "@/lib/common/utils";
import { compactHeaderColumnType, resolveHeaderColumnType } from "@/lib/dataGrid/dataGridColumnType";
import {
@@ -3958,6 +3958,7 @@ async function buildCurrentCountTarget(): Promise<{ sql: string; schema?: string
if (props.tableMeta) {
const sql = await buildDataGridCountSql({
databaseType: props.databaseType,
identifierQuote: connectionStore.connectionIdentifierQuote?.(props.connectionId),
catalog: props.tableMeta.catalog,
schema: props.tableMeta.schema,
tableName: props.tableMeta.tableName,
@@ -5612,6 +5613,7 @@ async function applyOrderBySearch() {
if (!tableMeta) return;
const sql = await buildTableSelectSql({
databaseType: resolvedDatabaseType.value,
identifierQuote: connectionStore.connectionIdentifierQuote?.(props.connectionId),
catalog: tableMeta.catalog,
schema: tableMeta.schema,
tableName: tableMeta.tableName,
@@ -5644,6 +5646,7 @@ async function applyWhereFilter() {
if (!tableMeta) return;
const sql = await buildTableSelectSql({
databaseType: resolvedDatabaseType.value,
identifierQuote: connectionStore.connectionIdentifierQuote?.(props.connectionId),
catalog: tableMeta.catalog,
schema: tableMeta.schema,
tableName: tableMeta.tableName,
@@ -5753,7 +5756,7 @@ function columnTypeCacheSignature(): string {
watch(() => [props.result.columns.join("\u0000"), columnFormatterSignatures.value.join("\u0000"), columnTypeCacheSignature()], clearCellFormatCache);
function quoteIdent(name: string): string {
return quoteTableIdentifier(props.databaseType, name);
return quoteTableDataIdentifier(props.databaseType, name, connectionStore.connectionIdentifierQuote?.(props.connectionId));
}
function queryColumnRef(name: string): string {
@@ -1048,6 +1048,7 @@ async function openNewQuery(row: ObjectBrowserRow) {
tabId,
await buildTableSelectSql({
databaseType: effectiveDatabaseType.value,
identifierQuote: connectionStore.connectionIdentifierQuote?.(props.connection.id),
schema: row.schema || selectedSchema.value,
tableName: row.name,
limit: 100,
@@ -1585,6 +1586,7 @@ async function exportDataLegacy(row: ObjectBrowserRow, format: "json" | "sql") {
const queryColumns = props.connection.db_type === "neo4j" ? (tableColumns ?? (await api.getColumns(props.connection.id, props.database, schema || props.database, row.name))).map((column) => column.name) : undefined;
const result = await fetchTableDataForExport({
databaseType: effectiveDatabaseType.value,
identifierQuote: connectionStore.connectionIdentifierQuote?.(props.connection.id),
schema,
tableName: row.name,
columns: queryColumns,
@@ -1394,6 +1394,7 @@ async function openData() {
const includeRowId = usesSyntheticRowIdKey(effectiveDbType, primaryKeys, tableType);
const sql = await buildTableSelectSql({
databaseType: effectiveDbType,
identifierQuote: connectionStore.connectionIdentifierQuote?.(node.connectionId),
schema: tableSchema,
tableName: node.label,
tableType,
@@ -3768,6 +3769,7 @@ async function exportDataLegacy(format: "csv" | "json" | "sql") {
const effectiveDbType = effectiveDatabaseTypeForConnection(config);
const result = await fetchTableDataForExport({
databaseType: effectiveDbType,
identifierQuote: connectionStore.connectionIdentifierQuote?.(connectionId),
schema: node.schema,
tableName: node.label,
tableType: node.tableType,