1 parent
ba3872abef
commit
1d07cb05e0
22 files changed
+384
-83
No files matched your search
@@ -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