fix(grid): honor include-database-name setting in SQL extractors
This commit is contained in:
1 parent
8c6acaad3d
commit
dd84e6c06a
5 files changed
+73
-5
No files matched your search
@@ -80,6 +80,8 @@ export interface UseDataGridExportOptions {
|
||||
sql: ComputedRef<string | undefined>;
|
||||
exportSql?: ComputedRef<string | undefined>;
|
||||
tableMeta: ComputedRef<DataGridTableMeta | undefined>;
|
||||
/** Editor setting "Include database name in generated SQL" — passed through to SQL extractors. */
|
||||
includeDatabaseName?: ComputedRef<boolean>;
|
||||
copyInsertTargetLabel?: ComputedRef<string | undefined>;
|
||||
mongoUpdateTarget?: ComputedRef<MongoCopyUpdateTarget | undefined>;
|
||||
databaseType: ComputedRef<DatabaseType | undefined>;
|
||||
@@ -722,6 +724,7 @@ export function useDataGridExport(options: UseDataGridExportOptions) {
|
||||
databaseType,
|
||||
identifierQuote,
|
||||
tableMeta,
|
||||
includeDatabaseName: options.includeDatabaseName,
|
||||
hasCellSelection,
|
||||
selectedCells,
|
||||
selectedCellMatrix,
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
import type { DataGridTableMeta } from "@/lib/dataGrid/dataGridSql";
|
||||
import { binaryCellClipboardText } from "@/lib/dataGrid/binaryCellDownload";
|
||||
import { formatError } from "@/lib/backend/errorUtils";
|
||||
import { tableMetaWithoutOptionalDatabaseQualifier } from "@/lib/table/tableSelectSql";
|
||||
import type { DatabaseType } from "@/types/database";
|
||||
|
||||
interface ExtractorRowItem {
|
||||
@@ -50,6 +51,8 @@ interface UseDataGridExtractorOptions {
|
||||
databaseType: ComputedRef<DatabaseType | undefined>;
|
||||
identifierQuote?: ComputedRef<string | undefined>;
|
||||
tableMeta: ComputedRef<DataGridTableMeta | undefined>;
|
||||
/** Editor setting "Include database name in generated SQL". When false, SQL extractors omit optional schema/database qualifiers. */
|
||||
includeDatabaseName?: ComputedRef<boolean>;
|
||||
hasCellSelection: ComputedRef<boolean>;
|
||||
selectedCells: ComputedRef<SelectionData>;
|
||||
selectedCellMatrix: ComputedRef<CellSelectionMatrix | null>;
|
||||
@@ -216,9 +219,13 @@ export function useDataGridExtractor(options: UseDataGridExtractorOptions) {
|
||||
const rows = rawRows.map((row) => row.map((value, index) => extractorCellValue(value, columnTypes[index], normalizeValues, presentBinaryText, index)));
|
||||
const tableMeta =
|
||||
descriptor.category === "sql"
|
||||
? compactTableMeta(
|
||||
options.tableMeta.value,
|
||||
columns.map((column) => column.sourceName ?? column.displayName),
|
||||
? tableMetaWithoutOptionalDatabaseQualifier(
|
||||
compactTableMeta(
|
||||
options.tableMeta.value,
|
||||
columns.map((column) => column.sourceName ?? column.displayName),
|
||||
),
|
||||
options.databaseType.value,
|
||||
options.includeDatabaseName?.value,
|
||||
)
|
||||
: undefined;
|
||||
const request: DataGridExtractRequest = {
|
||||
|
||||
Reference in new issue
Block a user