14 files changed
+58
-13
No files matched your search
@@ -2270,6 +2270,7 @@ watch(
|
||||
redis_key_separator: config.redis_key_separator ?? ":",
|
||||
redis_scan_page_size: config.redis_scan_page_size ?? REDIS_SCAN_PAGE_SIZE_DEFAULT,
|
||||
etcd_endpoints: config.etcd_endpoints || "",
|
||||
gbase_server: config.gbase_server || "",
|
||||
informix_server: config.informix_server || "",
|
||||
external_config: config.external_config,
|
||||
attached_databases: config.attached_databases || [],
|
||||
|
||||
@@ -4576,6 +4576,7 @@ async function applyOrderBySearch() {
|
||||
if (!tableMeta) return;
|
||||
const sql = await buildTableSelectSql({
|
||||
databaseType: resolvedDatabaseType.value,
|
||||
driverProfile: props.connectionId ? connectionStore.getConfig(props.connectionId)?.driver_profile : undefined,
|
||||
identifierQuote: connectionStore.connectionIdentifierQuote?.(props.connectionId),
|
||||
catalog: tableMeta.catalog,
|
||||
database: tableMeta.database,
|
||||
@@ -4610,6 +4611,7 @@ async function applyWhereFilter() {
|
||||
if (!tableMeta) return;
|
||||
const sql = await buildTableSelectSql({
|
||||
databaseType: resolvedDatabaseType.value,
|
||||
driverProfile: props.connectionId ? connectionStore.getConfig(props.connectionId)?.driver_profile : undefined,
|
||||
identifierQuote: connectionStore.connectionIdentifierQuote?.(props.connectionId),
|
||||
catalog: tableMeta.catalog,
|
||||
database: tableMeta.database,
|
||||
|
||||
@@ -1179,6 +1179,7 @@ async function openNewQuery(row: ObjectBrowserRow) {
|
||||
tabId,
|
||||
await buildTableSelectSql({
|
||||
databaseType: effectiveDatabaseType.value,
|
||||
driverProfile: props.connection.driver_profile,
|
||||
identifierQuote: connectionStore.connectionIdentifierQuote?.(props.connection.id),
|
||||
catalog: props.catalog,
|
||||
database: props.database,
|
||||
|
||||
@@ -57,6 +57,7 @@ export function useDataGridActions(activeTab: ComputedRef<QueryTab | undefined>)
|
||||
const realColumns = tab.tableMeta?.columns.length ? tab.tableMeta.columns : undefined;
|
||||
return buildTableSelectSql({
|
||||
databaseType: effectiveDbType,
|
||||
driverProfile: config?.driver_profile,
|
||||
identifierQuote: connectionStore.connectionIdentifierQuote?.(tab.connectionId),
|
||||
database: tableMeta?.database,
|
||||
schema: tableMeta?.schema,
|
||||
|
||||
@@ -109,6 +109,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
|
||||
const primaryKeys = editableRowIdentifierColumns(effectiveDbType, columns, undefined, targetTableType);
|
||||
const sql = await buildTableSelectSql({
|
||||
databaseType: effectiveDbType,
|
||||
driverProfile: config.driver_profile,
|
||||
identifierQuote,
|
||||
schema: tableSchema,
|
||||
catalog: target.catalog,
|
||||
@@ -137,6 +138,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
|
||||
}
|
||||
const sql = await buildTableSelectSql({
|
||||
databaseType: effectiveDbType,
|
||||
driverProfile: config.driver_profile,
|
||||
identifierQuote,
|
||||
schema: tableSchema,
|
||||
catalog: target.catalog,
|
||||
@@ -180,6 +182,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
|
||||
if (fellBackToLimitZero) {
|
||||
const emptySql = await buildTableSelectSql({
|
||||
databaseType: effectiveDbType,
|
||||
driverProfile: config.driver_profile,
|
||||
identifierQuote,
|
||||
schema: tableSchema,
|
||||
catalog: target.catalog,
|
||||
@@ -224,6 +227,7 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
|
||||
if (!fellBackToLimitZero && !firstQueryFailed && (useRowId || config.db_type === "tdengine")) {
|
||||
const newSql = await buildTableSelectSql({
|
||||
databaseType: effectiveDbType,
|
||||
driverProfile: config.driver_profile,
|
||||
identifierQuote,
|
||||
schema: tableSchema,
|
||||
catalog: target.catalog,
|
||||
|
||||
@@ -307,6 +307,7 @@ export function useSidebarDataOpenRuntime() {
|
||||
const includeRowId = usesSyntheticRowIdKey(effectiveDbType, primaryKeys, tableType);
|
||||
const sql = await buildTableSelectSql({
|
||||
databaseType: effectiveDbType,
|
||||
driverProfile: config?.driver_profile,
|
||||
identifierQuote: connectionStore.connectionIdentifierQuote?.(node.connectionId),
|
||||
schema: tableSchema,
|
||||
database: node.database,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const dialogSource = readFileSync(new URL("../../../components/connection/ConnectionDialog.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("GBase 8s connection dialog", () => {
|
||||
it("hydrates DBSERVERNAME when editing a saved connection", () => {
|
||||
expect(dialogSource).toContain('gbase_server: config.gbase_server || ""');
|
||||
});
|
||||
});
|
||||
@@ -35,13 +35,13 @@ describe("qualifiedTableName — SQLite attached databases", () => {
|
||||
});
|
||||
|
||||
describe("qualifiedTableName — GBase 8s", () => {
|
||||
it("keeps the owner unquoted when the driver reports no identifier quote support", () => {
|
||||
expect(qualifiedTableName({ databaseType: "informix", identifierQuote: "", schema: "gbasedbt", tableName: "connection_smoke" })).toBe("gbasedbt.connection_smoke");
|
||||
it("omits the metadata owner for GBase 8s table data", () => {
|
||||
expect(qualifiedTableName({ databaseType: "informix", driverProfile: "gbase8s", identifierQuote: "", schema: "gbasedbt", tableName: "connection_smoke" })).toBe("connection_smoke");
|
||||
expect(quoteTableDataIdentifier("informix", "connection_smoke", "")).toBe("connection_smoke");
|
||||
});
|
||||
|
||||
it("keeps native Informix qualification when no driver capability was loaded", () => {
|
||||
expect(qualifiedTableName({ databaseType: "informix", schema: "gbasedbt", tableName: "connection_smoke" })).toBe("gbasedbt.connection_smoke");
|
||||
it("keeps native Informix owner qualification", () => {
|
||||
expect(qualifiedTableName({ databaseType: "informix", identifierQuote: "", schema: "gbasedbt", tableName: "connection_smoke" })).toBe("gbasedbt.connection_smoke");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ export interface BuildExportInsertStatementsOptions {
|
||||
|
||||
export interface BuildExportPageSqlOptions {
|
||||
databaseType?: DatabaseType;
|
||||
driverProfile?: string;
|
||||
identifierQuote?: string;
|
||||
schema?: string;
|
||||
tableName: string;
|
||||
@@ -79,6 +80,7 @@ export function buildInsertStatements(options: BuildExportInsertStatementsOption
|
||||
export async function buildExportPageSql(options: BuildExportPageSqlOptions): Promise<string> {
|
||||
return buildTableSelectSql({
|
||||
databaseType: options.databaseType,
|
||||
driverProfile: options.driverProfile,
|
||||
identifierQuote: options.identifierQuote,
|
||||
schema: options.schema,
|
||||
tableName: options.tableName,
|
||||
|
||||
@@ -6,6 +6,7 @@ import { isExplicitlyQuotedSqlIdentifier, quoteGaussDbJdbcIdentifier } from "@/l
|
||||
|
||||
export interface BuildTableSelectSqlOptions {
|
||||
databaseType?: DatabaseType;
|
||||
driverProfile?: string;
|
||||
identifierQuote?: string;
|
||||
schema?: string;
|
||||
tableName: string;
|
||||
@@ -50,8 +51,11 @@ function quoteCypherIdentifier(name: string): string {
|
||||
return `\`${name.replace(/`/g, "``")}\``;
|
||||
}
|
||||
|
||||
export function qualifiedTableName(options: Pick<BuildTableSelectSqlOptions, "databaseType" | "identifierQuote" | "schema" | "tableName" | "catalog" | "database">): string {
|
||||
const { databaseType, identifierQuote, schema, tableName, catalog, database } = options;
|
||||
export function qualifiedTableName(options: Pick<BuildTableSelectSqlOptions, "databaseType" | "driverProfile" | "identifierQuote" | "schema" | "tableName" | "catalog" | "database">): string {
|
||||
const { databaseType, driverProfile, identifierQuote, schema, tableName, catalog, database } = options;
|
||||
if (databaseType === "informix" && driverProfile?.trim().toLowerCase() === "gbase8s") {
|
||||
return quoteTableDataIdentifier(databaseType, tableName, identifierQuote);
|
||||
}
|
||||
// Doris / StarRocks multi-catalog: address external-catalog tables with the
|
||||
// 3-part `catalog.database.table` form, which the engines accept directly.
|
||||
if (catalog && catalog !== "internal" && (databaseType === "doris" || databaseType === "starrocks")) {
|
||||
|
||||
@@ -2383,6 +2383,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
try {
|
||||
const sql = await buildTableSelectSql({
|
||||
databaseType: effectiveDbType,
|
||||
driverProfile: conn?.driver_profile,
|
||||
identifierQuote,
|
||||
database: tableMeta.database,
|
||||
schema: tableMeta.schema,
|
||||
@@ -5098,6 +5099,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
while (true) {
|
||||
const sql = await api.buildTableSelectSql({
|
||||
databaseType: effectiveDbType,
|
||||
driverProfile: conn?.driver_profile,
|
||||
identifierQuote,
|
||||
database: tableMeta.database,
|
||||
schema: tableMeta.schema,
|
||||
|
||||
Reference in new issue
Block a user