1 parent
ba3872abef
commit
1d07cb05e0
22 files changed
+384
-83
No files matched your search
@@ -20,6 +20,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Download, Square, CheckSquare, Search, X, Loader2, Wrench } from "@lucide/vue";
|
||||
import { formatDataTransferDuration, useExportTracker } from "@/composables/useExportTracker";
|
||||
import { isQueryTimeoutErrorMessage } from "@/lib/sql/queryError";
|
||||
import type { SqlInsertDialect } from "@/lib/export/sqlInsertMode";
|
||||
|
||||
const { t } = useI18n();
|
||||
const { toast } = useToast();
|
||||
@@ -64,6 +65,7 @@ const POSTGRES_ALL_SCHEMAS = "__DBX_ALL_SCHEMAS__";
|
||||
// Options
|
||||
const includeStructure = ref(true);
|
||||
const includeData = ref(true);
|
||||
const insertDialect = ref<SqlInsertDialect>("source");
|
||||
const includeObjects = ref(true);
|
||||
const includeCreateDatabase = ref(false);
|
||||
const dropTableIfExists = ref(false);
|
||||
@@ -396,6 +398,7 @@ async function startExport() {
|
||||
selectedTables: !isPostgresAllSchemas.value && (includeStructure.value || includeData.value) ? buildSelectedTablesPayload(tables.value, selectedTables.value) : undefined,
|
||||
includeStructure: includeStructure.value,
|
||||
includeData: includeData.value,
|
||||
insertDialect: insertDialect.value,
|
||||
includeObjects: includeObjects.value,
|
||||
includeCreateDatabase: includeCreateDatabase.value,
|
||||
dropTableIfExists: dropTableIfExists.value,
|
||||
@@ -538,6 +541,7 @@ async function startAllDatabasesExport() {
|
||||
filePath,
|
||||
includeStructure: includeStructure.value,
|
||||
includeData: includeData.value,
|
||||
insertDialect: insertDialect.value,
|
||||
includeObjects: includeObjects.value,
|
||||
includeCreateDatabase: includeCreateDatabase.value,
|
||||
dropTableIfExists: dropTableIfExists.value,
|
||||
@@ -659,6 +663,7 @@ function resetState() {
|
||||
databaseFilter.value = "";
|
||||
includeStructure.value = true;
|
||||
includeData.value = true;
|
||||
insertDialect.value = "source";
|
||||
includeObjects.value = true;
|
||||
includeCreateDatabase.value = false;
|
||||
dropTableIfExists.value = false;
|
||||
@@ -947,6 +952,16 @@ watch(
|
||||
<Square v-else class="w-3.5 h-3.5 text-muted-foreground/40 shrink-0" />
|
||||
{{ t("databaseExport.includeData") }}
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<button type="button" class="flex items-center gap-2 text-left text-xs" :class="includeData ? 'cursor-pointer' : 'cursor-not-allowed text-muted-foreground/50'" :disabled="!includeData" @click="insertDialect = insertDialect === 'standard' ? 'source' : 'standard'">
|
||||
<CheckSquare v-if="includeData && insertDialect === 'standard'" class="w-3.5 h-3.5 text-primary shrink-0" />
|
||||
<Square v-else class="w-3.5 h-3.5 text-muted-foreground/40 shrink-0" />
|
||||
{{ t("databaseExport.standardSqlInsert") }}
|
||||
</button>
|
||||
<p class="pl-5 text-[11px] text-muted-foreground">
|
||||
{{ t("databaseExport.standardSqlInsertDescription") }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 cursor-pointer text-xs" @click="includeObjects = !includeObjects">
|
||||
<CheckSquare v-if="includeObjects" class="w-3.5 h-3.5 text-primary shrink-0" />
|
||||
<Square v-else class="w-3.5 h-3.5 text-muted-foreground/40 shrink-0" />
|
||||
|
||||
@@ -101,7 +101,7 @@ import { buildRenameObjectSql, supportsObjectRename } from "@/lib/table/objectRe
|
||||
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
|
||||
import { generateDatabaseExportId } from "@/lib/export/databaseExport";
|
||||
import { buildXlsxHeaderOverrides, hasXlsxHeaderComments, type XlsxExportOptions, type XlsxHeaderMode } from "@/lib/export/xlsxHeader";
|
||||
import { showSqlInsertModeDialog, type SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
||||
import { showSqlInsertModeDialog, type SqlInsertDialect, type SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
||||
import { copyToClipboard, eventTargetAllowsAppClipboardShortcut } from "@/lib/common/clipboard";
|
||||
import {
|
||||
defaultPasteTableMode,
|
||||
@@ -2321,14 +2321,14 @@ async function exportDataLegacy(row: ObjectBrowserRow, format: "json") {
|
||||
}
|
||||
}
|
||||
|
||||
async function exportData(row: ObjectBrowserRow, format: "csv" | "json" | "sql") {
|
||||
async function exportData(row: ObjectBrowserRow, format: "csv" | "json" | "sql", insertDialect: SqlInsertDialect = "source") {
|
||||
if (format === "json") {
|
||||
await exportDataLegacy(row, format);
|
||||
return;
|
||||
}
|
||||
const sqlExportOptions = format === "sql" ? await showSqlInsertModeDialog({ allowSplit: true }) : undefined;
|
||||
if (format === "sql" && sqlExportOptions === null) return;
|
||||
await exportTableData(row, format, undefined, "name", true, sqlExportOptions?.insertMode ?? "batch", sqlExportOptions?.splitMaxMb);
|
||||
await exportTableData(row, format, undefined, "name", true, sqlExportOptions?.insertMode ?? "batch", sqlExportOptions?.splitMaxMb, insertDialect);
|
||||
}
|
||||
|
||||
function showObjectBrowserXlsxHeaderDialog(hasComments: boolean): Promise<XlsxExportOptions | null> {
|
||||
@@ -2371,7 +2371,7 @@ async function exportDataXlsx(row: ObjectBrowserRow) {
|
||||
await exportTableData(row, "xlsx", columnInfos, exportOptions.headerMode, exportOptions.autoFilter);
|
||||
}
|
||||
|
||||
async function exportTableData(row: ObjectBrowserRow, format: "csv" | "xlsx" | "sql", columnInfos?: ColumnInfo[], headerMode: XlsxHeaderMode = "name", autoFilter = true, insertMode: SqlInsertMode = "batch", splitMaxMb?: number) {
|
||||
async function exportTableData(row: ObjectBrowserRow, format: "csv" | "xlsx" | "sql", columnInfos?: ColumnInfo[], headerMode: XlsxHeaderMode = "name", autoFilter = true, insertMode: SqlInsertMode = "batch", splitMaxMb?: number, insertDialect: SqlInsertDialect = "source") {
|
||||
const schema = row.schema || selectedSchema.value;
|
||||
const splitSqlOutput = format === "sql" && splitMaxMb !== undefined;
|
||||
|
||||
@@ -2446,7 +2446,7 @@ async function exportTableData(row: ObjectBrowserRow, format: "csv" | "xlsx" | "
|
||||
tableName: row.name,
|
||||
filePath,
|
||||
format,
|
||||
...(format === "sql" ? { insertMode, splitMaxMb } : {}),
|
||||
...(format === "sql" ? { insertMode, insertDialect, splitMaxMb } : {}),
|
||||
csvQuoteMode: settingsStore.editorSettings.csvQuoteMode,
|
||||
columns,
|
||||
columnComments: format === "xlsx" ? columnComments : undefined,
|
||||
@@ -3373,7 +3373,10 @@ function exportDataSubmenu(item: ObjectBrowserRow): ContextMenuItem {
|
||||
{ label: "CSV", action: () => exportData(item, "csv") },
|
||||
{ label: "JSON", action: () => exportData(item, "json") },
|
||||
];
|
||||
if (!isVictoriaMetrics.value) formats.push({ label: "SQL INSERT", action: () => exportData(item, "sql") });
|
||||
if (!isVictoriaMetrics.value) {
|
||||
formats.push({ label: "SQL INSERT", action: () => exportData(item, "sql", "source") });
|
||||
formats.push({ label: t("contextMenu.standardSqlInsert"), action: () => exportData(item, "sql", "standard") });
|
||||
}
|
||||
formats.push({ label: "XLSX", action: () => exportDataXlsx(item) });
|
||||
return {
|
||||
label: t("contextMenu.exportData"),
|
||||
|
||||
@@ -5492,7 +5492,10 @@ function exportDataSubmenu(includeSqlInsert = true): ContextMenuItem {
|
||||
{ label: "CSV", action: () => exportData("csv") },
|
||||
{ label: "JSON", action: () => exportData("json") },
|
||||
];
|
||||
if (includeSqlInsert) children.push({ label: "SQL INSERT", action: () => exportData("sql") });
|
||||
if (includeSqlInsert) {
|
||||
children.push({ label: "SQL INSERT", action: () => exportData("sql", "source") });
|
||||
children.push({ label: t("contextMenu.standardSqlInsert"), action: () => exportData("sql", "standard") });
|
||||
}
|
||||
children.push({ label: "XLSX", action: () => exportDataXlsx() });
|
||||
return {
|
||||
label: count > 1 ? t("contextMenu.exportDataMultiple", { count }) : t("contextMenu.exportData"),
|
||||
|
||||
@@ -540,4 +540,35 @@ describe("useSidebarTreeExportRuntime", () => {
|
||||
expect(apiMock.startTableExport).toHaveBeenCalledOnce();
|
||||
expect(apiMock.startTableExport).toHaveBeenCalledWith(expect.objectContaining({ tableName: "users", filePath: "users.csv" }), expect.any(Function));
|
||||
});
|
||||
|
||||
it.each([
|
||||
["source", undefined],
|
||||
["standard", "standard"],
|
||||
] as const)("serializes the %s SQL INSERT dialect for a table export", async (expectedDialect, requestedDialect) => {
|
||||
const activeNode = shallowRef({ id: "table-1", type: "table", label: "users", connectionId: "conn-1", database: "db", schema: "dbo", children: [] } as TreeNode);
|
||||
const connectionStore = {
|
||||
ensureConnected: vi.fn(),
|
||||
getConfig: vi.fn(() => ({ db_type: "sqlserver" })),
|
||||
connectionIdentifierQuote: vi.fn(() => "["),
|
||||
treeNodes: [],
|
||||
selectedTreeNodeIds: [],
|
||||
};
|
||||
const runtime = useSidebarTreeExportRuntime({
|
||||
activeNode,
|
||||
connectionStore: connectionStore as never,
|
||||
settingsStore: exportSettings() as never,
|
||||
acceptedSelectionIds: () => null,
|
||||
});
|
||||
|
||||
await runtime.exportData("sql", requestedDialect);
|
||||
|
||||
expect(apiMock.startTableExport).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
format: "sql",
|
||||
insertDialect: expectedDialect,
|
||||
identifierQuote: "[",
|
||||
}),
|
||||
expect.any(Function),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
structurePreviewDdlStorageType,
|
||||
} from "@/components/sidebar/sidebarTreeDialogState";
|
||||
import type { CsvQuoteMode } from "@/lib/export/csvQuoteMode";
|
||||
import type { SqlInsertDialect } from "@/lib/export/sqlInsertMode";
|
||||
|
||||
type StructureCopyFormat = "tsv" | "markdown";
|
||||
|
||||
@@ -90,6 +91,7 @@ interface ExportTableDataOptions {
|
||||
autoFilter?: boolean;
|
||||
outputDirectory?: string;
|
||||
suppressDoneToast?: boolean;
|
||||
insertDialect?: SqlInsertDialect;
|
||||
}
|
||||
|
||||
function joinExportFilePath(directory: string, fileName: string): string {
|
||||
@@ -434,7 +436,7 @@ export function useSidebarTreeExportRuntime(options: SidebarTreeExportRuntimeOpt
|
||||
}
|
||||
|
||||
async function exportTableData(target: SidebarTableExportTarget, format: "csv" | "xlsx" | "sql", exportOptions: ExportTableDataOptions = {}) {
|
||||
const { columnInfos, headerMode = "name", autoFilter = true, outputDirectory, suppressDoneToast = false } = exportOptions;
|
||||
const { columnInfos, headerMode = "name", autoFilter = true, outputDirectory, suppressDoneToast = false, insertDialect = "source" } = exportOptions;
|
||||
const { connectionId, database } = target;
|
||||
|
||||
let task: ExportTask | null = null;
|
||||
@@ -486,6 +488,7 @@ export function useSidebarTreeExportRuntime(options: SidebarTreeExportRuntimeOpt
|
||||
tableName: target.tableName,
|
||||
filePath: outputPath,
|
||||
format,
|
||||
...(format === "sql" ? { insertDialect } : {}),
|
||||
csvQuoteMode: target.csvQuoteMode,
|
||||
columns: queryColumns,
|
||||
columnComments,
|
||||
@@ -566,7 +569,7 @@ export function useSidebarTreeExportRuntime(options: SidebarTreeExportRuntimeOpt
|
||||
}
|
||||
}
|
||||
|
||||
async function exportData(format: "csv" | "json" | "sql") {
|
||||
async function exportData(format: "csv" | "json" | "sql", insertDialect: SqlInsertDialect = "source") {
|
||||
const targets = currentTableExportTargets();
|
||||
if (!targets.length) return;
|
||||
|
||||
@@ -584,7 +587,7 @@ export function useSidebarTreeExportRuntime(options: SidebarTreeExportRuntimeOpt
|
||||
|
||||
let exported = 0;
|
||||
for (const target of targets) {
|
||||
if (await exportTableData(target, format, { outputDirectory, suppressDoneToast: targets.length > 1 })) exported += 1;
|
||||
if (await exportTableData(target, format, { outputDirectory, suppressDoneToast: targets.length > 1, insertDialect })) exported += 1;
|
||||
}
|
||||
if (targets.length > 1 && exported > 0) toast(t("contextMenu.exportDataMultipleSuccess", { count: exported }));
|
||||
}
|
||||
|
||||
@@ -3884,6 +3884,7 @@ export default {
|
||||
restoreSqliteDatabaseFailed: "Failed to restore SQLite database: {message}",
|
||||
importData: "Import Data",
|
||||
exportData: "Export Data",
|
||||
standardSqlInsert: "Standard SQL INSERT",
|
||||
exportDataMultiple: "Export Data ({count} tables)",
|
||||
exportDataSelectDirectory: "Select export folder",
|
||||
exportDataMultipleSuccess: "Exported {count} tables",
|
||||
@@ -9210,6 +9211,8 @@ export default {
|
||||
dropTableIfExists: "Add DROP TABLE IF EXISTS before DDL",
|
||||
omitAutoIncrement: "Omit AUTO_INCREMENT (for fresh-install scripts)",
|
||||
includeData: "Table data (INSERT)",
|
||||
standardSqlInsert: "Use Standard SQL INSERT for table data",
|
||||
standardSqlInsertDescription: "Uses ANSI double-quoted identifiers and portable scalar literals. DDL and other objects keep the source database dialect.",
|
||||
includeObjects: "Views / Procedures / Functions / Sequences",
|
||||
splitSqlOutput: "Split SQL export into a ZIP archive",
|
||||
splitSqlPartMaxMb: "Maximum size per SQL part (MB)",
|
||||
|
||||
@@ -3796,6 +3796,7 @@ export default withEnglishFallback({
|
||||
restoreSqliteDatabaseFailed: "还原 SQLite 数据库失败:{message}",
|
||||
importData: "导入数据",
|
||||
exportData: "导出数据",
|
||||
standardSqlInsert: "标准 SQL INSERT",
|
||||
exportDataMultiple: "导出数据({count} 张表)",
|
||||
exportDataSelectDirectory: "选择导出文件夹",
|
||||
exportDataMultipleSuccess: "已导出 {count} 张表",
|
||||
@@ -9173,6 +9174,8 @@ export default withEnglishFallback({
|
||||
dropTableIfExists: "导出前添加 DROP TABLE IF EXISTS",
|
||||
omitAutoIncrement: "省略 AUTO_INCREMENT(用于全新安装的初始化脚本)",
|
||||
includeData: "表数据 (INSERT)",
|
||||
standardSqlInsert: "表数据使用标准 SQL INSERT",
|
||||
standardSqlInsertDescription: "使用 ANSI 双引号标识符和通用标量字面量;DDL 与其他对象仍保留源数据库方言。",
|
||||
includeObjects: "视图 / 存储过程 / 函数 / 序列",
|
||||
splitSqlOutput: "将 SQL 导出拆分为 ZIP 压缩包",
|
||||
splitSqlPartMaxMb: "每个 SQL 分片的最大大小(MB)",
|
||||
|
||||
@@ -3672,6 +3672,7 @@ export default withEnglishFallback({
|
||||
restoreSqliteDatabaseFailed: "還原 SQLite 資料庫失敗:{message}",
|
||||
importData: "匯入資料",
|
||||
exportData: "匯出資料",
|
||||
standardSqlInsert: "標準 SQL INSERT",
|
||||
exportDataMultiple: "匯出資料({count} 張表)",
|
||||
exportDataSelectDirectory: "選擇匯出資料夾",
|
||||
exportDataMultipleSuccess: "已匯出 {count} 張表",
|
||||
@@ -7802,6 +7803,8 @@ export default withEnglishFallback({
|
||||
dropTableIfExists: "匯出前新增 DROP TABLE IF EXISTS",
|
||||
omitAutoIncrement: "省略 AUTO_INCREMENT(用於全新安裝的初始化腳本)",
|
||||
includeData: "資料表資料 (INSERT)",
|
||||
standardSqlInsert: "資料表資料使用標準 SQL INSERT",
|
||||
standardSqlInsertDescription: "使用 ANSI 雙引號識別碼和通用純量常值;DDL 與其他物件仍保留來源資料庫方言。",
|
||||
includeObjects: "檢視 / 預存程序 / 函式 / 序列",
|
||||
splitSqlOutput: "將 SQL 匯出分割為 ZIP 壓縮檔",
|
||||
splitSqlPartMaxMb: "每個 SQL 分片的最大大小(MB)",
|
||||
|
||||
@@ -241,7 +241,7 @@ import type {
|
||||
TableAdminSqlOptions,
|
||||
VacuumTableSqlOptions,
|
||||
} from "@/lib/database/dbAdminSql";
|
||||
import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions } from "@/lib/export/databaseExport";
|
||||
import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions, BuildExportSqlInsertOptions } from "@/lib/export/databaseExport";
|
||||
import { loadBrowserAppState, saveBrowserAppState } from "@/lib/backend/browserAppStateStorage";
|
||||
import type { DataCompareFromTablesOptions, DataCompareFromTablesPreparation, DataCompareSyncPlan, DataCompareSyncPlanOptions, DataComparePreparation, DataComparePreparationOptions } from "@/lib/dataGrid/dataCompare";
|
||||
import { apiUrl, apiWebSocketUrl } from "@/lib/common/webPath";
|
||||
@@ -1933,7 +1933,7 @@ export async function buildExportInsertStatements(options: BuildExportInsertStat
|
||||
return post("/api/query/build-export-insert-statements", { options });
|
||||
}
|
||||
|
||||
export async function buildExportSqlInsert(options: BuildExportInsertStatementsOptions): Promise<string> {
|
||||
export async function buildExportSqlInsert(options: BuildExportSqlInsertOptions): Promise<string> {
|
||||
return post("/api/query/build-export-sql-insert", { options });
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import { decodeMeilisearchDocumentPage, decodeMeilisearchSearchResult, type Meil
|
||||
import type { XuguTablespaceInfo } from "@/types/database";
|
||||
import type { CreatedKey, EnqueuedTaskSummary, KeyCreateInput, KeyListItem, KeyPage, KeyUpdateInput, MeilisearchCreateIndexInput, MeilisearchSystemOverview, MeilisearchTask, TaskListInput, TaskPage, TaskSelector } from "@/types/meilisearchManagement";
|
||||
import type { CsvQuoteMode } from "@/lib/export/csvQuoteMode";
|
||||
import type { SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
||||
import type { SqlInsertDialect, SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
||||
|
||||
/** Normalize Tauri rejections once at the public backend boundary. */
|
||||
async function invokeBackend<T>(command: string, args?: Record<string, unknown>): Promise<T> {
|
||||
@@ -172,7 +172,7 @@ import type {
|
||||
TableAdminSqlOptions,
|
||||
VacuumTableSqlOptions,
|
||||
} from "@/lib/database/dbAdminSql";
|
||||
import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions } from "@/lib/export/databaseExport";
|
||||
import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions, BuildExportSqlInsertOptions } from "@/lib/export/databaseExport";
|
||||
|
||||
export interface SshPromptResolution {
|
||||
id: string;
|
||||
@@ -2259,7 +2259,7 @@ export async function buildExportInsertStatements(options: BuildExportInsertStat
|
||||
return invoke("build_export_insert_statements", { options });
|
||||
}
|
||||
|
||||
export async function buildExportSqlInsert(options: BuildExportInsertStatementsOptions): Promise<string> {
|
||||
export async function buildExportSqlInsert(options: BuildExportSqlInsertOptions): Promise<string> {
|
||||
return invoke("build_export_sql_insert", { options });
|
||||
}
|
||||
|
||||
@@ -5748,6 +5748,7 @@ export interface DatabaseExportRequest {
|
||||
failOnError?: boolean;
|
||||
preventOverwrite?: boolean;
|
||||
outputCompression?: "none" | "gzip";
|
||||
insertDialect?: SqlInsertDialect;
|
||||
snapshotSessionId?: string;
|
||||
batchSize: number;
|
||||
splitMaxMb?: number;
|
||||
@@ -5788,6 +5789,7 @@ export interface TableExportRequest {
|
||||
filePath: string;
|
||||
format: "csv" | "xlsx" | "json" | "markdown" | "sql" | "txt";
|
||||
insertMode?: SqlInsertMode;
|
||||
insertDialect?: SqlInsertDialect;
|
||||
csvQuoteMode?: CsvQuoteMode;
|
||||
columns?: string[];
|
||||
columnTypes?: Array<string | null | undefined>;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { buildTableSelectSql } from "@/lib/table/tableSelectSql.ts";
|
||||
import { uuid } from "@/lib/common/utils.ts";
|
||||
import { SINGLE_DATABASE_TYPES } from "@/lib/database/databaseCapabilitySets";
|
||||
import { isXuguSyntheticScope } from "@/lib/sidebar/xuguPublicSynonyms";
|
||||
import type { SqlInsertDialect } from "@/lib/export/sqlInsertMode";
|
||||
|
||||
export const DATABASE_EXPORT_ROW_LIMIT = 10_000;
|
||||
export const DATABASE_EXPORT_PAGE_SIZE = 500;
|
||||
@@ -31,6 +32,7 @@ export interface BuildDatabaseSqlExportOptions {
|
||||
tables: ExportedTableSql[];
|
||||
rowLimitPerTable?: number;
|
||||
insertBatchSize?: number;
|
||||
insertDialect?: SqlInsertDialect;
|
||||
connectionId?: string;
|
||||
database?: string;
|
||||
schema?: string;
|
||||
@@ -52,6 +54,10 @@ export interface BuildExportInsertStatementsOptions {
|
||||
batchSize?: number;
|
||||
}
|
||||
|
||||
export interface BuildExportSqlInsertOptions extends BuildExportInsertStatementsOptions {
|
||||
insertDialect?: SqlInsertDialect;
|
||||
}
|
||||
|
||||
export interface BuildExportPageSqlOptions {
|
||||
databaseType?: DatabaseType;
|
||||
driverProfile?: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DatabaseType, QueryResult } from "@/types/database";
|
||||
import * as api from "@/lib/backend/api";
|
||||
import { escapeCsvField, type CsvQuoteMode } from "@/lib/export/csvQuoteMode";
|
||||
import type { SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
||||
import type { SqlInsertDialect, SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
||||
|
||||
export type ExportCellValue = string | number | boolean | null;
|
||||
|
||||
@@ -45,6 +45,7 @@ export interface FormatSqlInsertOptions {
|
||||
spatialValues?: QueryResult["spatial_values"];
|
||||
rows: ExportCellValue[][];
|
||||
insertMode?: SqlInsertMode;
|
||||
insertDialect?: SqlInsertDialect;
|
||||
excludeColumns?: string[];
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import SqlInsertModeDialog from "@/components/export/SqlInsertModeDialog.vue";
|
||||
import i18n from "@/i18n";
|
||||
|
||||
export type SqlInsertMode = "batch" | "single";
|
||||
export type SqlInsertDialect = "source" | "standard";
|
||||
|
||||
export interface SqlExportOptions {
|
||||
insertMode: SqlInsertMode;
|
||||
@@ -10,6 +11,7 @@ export interface SqlExportOptions {
|
||||
}
|
||||
|
||||
export const DEFAULT_SQL_INSERT_MODE: SqlInsertMode = "batch";
|
||||
export const DEFAULT_SQL_INSERT_DIALECT: SqlInsertDialect = "source";
|
||||
|
||||
export function showSqlInsertModeDialog(options: { allowSplit?: boolean } = {}): Promise<SqlExportOptions | null> {
|
||||
if (typeof document === "undefined") return Promise.resolve({ insertMode: DEFAULT_SQL_INSERT_MODE });
|
||||
|
||||
Reference in new issue
Block a user