fix(grid): reuse prepared row copy statements

This commit is contained in:
zipg authored and GitHub committed 2026-07-10 19:43:25 +08:00
1 parent ae4bbe1564
commit f7eec00c8e
3 files changed
+294 -62

No files matched your search

@@ -6185,9 +6185,8 @@ const {
copyRowAsInsert,
copyRowAsInsertWithoutPrimaryKeys,
prefetchRowAsInsertStatement,
canCopyPreparedInsert,
canCopyRowAsInsert,
prefetchRowAsUpdateStatement,
canCopyPreparedUpdate,
copyRowAsUpdate,
canCopyRowAsInsertWithoutPrimaryKeys,
canCopyRowAsUpdate,
@@ -8359,33 +8358,33 @@ function copySubmenu(): ContextMenuItem {
items.push({ label: singleRowSelected ? t("grid.copySelectedRowTsvWithHeaders") : t("grid.copySelectedRowsTsvWithHeaders", { count: selectedRowCount.value }), action: copySelectedRowsTsvWithHeaders });
}
if (isMultiRow.value) {
items.push({ label: labels.insertMerged, action: () => copyRowAsInsert("merged"), disabled: !canCopyPreparedInsert(false, "merged") });
items.push({ label: labels.insertRowByRow, action: () => copyRowAsInsert("row-by-row"), disabled: !canCopyPreparedInsert(false, "row-by-row") });
items.push({ label: labels.insertMerged, action: () => copyRowAsInsert("merged"), disabled: !canCopyRowAsInsert.value });
items.push({ label: labels.insertRowByRow, action: () => copyRowAsInsert("row-by-row"), disabled: !canCopyRowAsInsert.value });
} else {
items.push({ label: labels.insert, action: () => copyRowAsInsert(), disabled: !canCopyPreparedInsert(false) });
items.push({ label: labels.insert, action: () => copyRowAsInsert(), disabled: !canCopyRowAsInsert.value });
}
if (canCopyRowAsInsertWithoutPrimaryKeys.value) {
if (isMultiRow.value) {
items.push({
label: labels.insertNoPkMerged,
action: () => copyRowAsInsertWithoutPrimaryKeys("merged"),
disabled: !canCopyPreparedInsert(true, "merged"),
disabled: !canCopyRowAsInsertWithoutPrimaryKeys.value,
});
items.push({
label: labels.insertNoPkRowByRow,
action: () => copyRowAsInsertWithoutPrimaryKeys("row-by-row"),
disabled: !canCopyPreparedInsert(true, "row-by-row"),
disabled: !canCopyRowAsInsertWithoutPrimaryKeys.value,
});
} else {
items.push({
label: labels.insertNoPk,
action: () => copyRowAsInsertWithoutPrimaryKeys(),
disabled: !canCopyPreparedInsert(true),
disabled: !canCopyRowAsInsertWithoutPrimaryKeys.value,
});
}
}
if (canCopyRowAsUpdate.value) {
items.push({ label: labels.update, action: copyRowAsUpdate, disabled: !canCopyPreparedUpdate() });
items.push({ label: labels.update, action: copyRowAsUpdate });
}
items.push({ label: t("grid.copyAll"), action: copyAll });
items.push({ label: t("grid.copyColumnNames"), action: copyColumnNames });