Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(oceanbase): keep wildcard pagination on the same result cursor

efeire66187eef70e0
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue
index 5b4d195c1b..50a9b2ce0d 100644
--- a/apps/desktop/src/components/grid/DataGrid.vue
+++ b/apps/desktop/src/components/grid/DataGrid.vue
@@ -4370,6 +4370,7 @@ const editor = useDataGridEditor({
manualTransactionSessionId: computed(() => props.manualTransactionSessionId),
ensureManualTransactionSession: computed(() => props.ensureManualTransactionSession),
onManualTransactionMutation: () => props.onManualTransactionMutation?.(),
+ onSaveConflict: (message) => toast(message, 5000),
sql: computed(() => props.sql),
searchText,
whereFilterInput,
diff --git a/apps/desktop/src/components/grid/__tests__/DataGridRowIdSaveFeedback.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridRowIdSaveFeedback.spec.ts
new file mode 100644
index 0000000000..bafa4bc013
--- /dev/null
+++ b/apps/desktop/src/components/grid/__tests__/DataGridRowIdSaveFeedback.spec.ts
@@ -0,0 +1,120 @@
+// @vitest-environment happy-dom
+import { readFileSync } from "node:fs";
+import { URL as NodeURL } from "node:url";
+import { computed, createApp, defineComponent, h, nextTick, ref } from "vue";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { useDataGridEditor } from "@/composables/useDataGridEditor";
+
+const mocks = vi.hoisted(() => ({ prepare: vi.fn(), execute: vi.fn(), history: vi.fn() }));
+vi.mock("@/lib/backend/api", () => ({ prepareDataGridSave: mocks.prepare, executeBatch: mocks.execute }));
+vi.mock("@/stores/connectionStore", () => ({ useConnectionStore: () => ({ getConfig: () => undefined }) }));
+vi.mock("@/stores/historyStore", () => ({ useHistoryStore: () => ({ add: mocks.history }) }));
+vi.mock("@/stores/productionSafetyStore", () => ({ useProductionSafetyStore: () => ({}) }));
+
+// Execute the actual grid callback and toolbar handler with the real editor.
+// Mount only this save boundary, avoiding unrelated canvas/virtualization setup.
+const source = readFileSync(new NodeURL("../DataGrid.vue", import.meta.url), "utf8");
+function saveBoundary(toast: ReturnType<typeof vi.fn>) {
+ const callback = source.match(/onSaveConflict: (.+),\r?\n/);
+ const onSaveConflict = callback ? new Function("toast", `return (${callback[1]});`)(toast) : undefined;
+ const toolbar = source.match(/async function onToolbarCommit\(\) \{([\s\S]*?)\n\}/);
+ expect(toolbar).not.toBeNull();
+ let editor!: ReturnType<typeof useDataGridEditor>;
+ const result = ref({ columns: ["LABEL", "__DBX_PK_0"], rows: [["same", "ROW-22"]] });
+ const reload = vi.fn();
+ const host = document.createElement("div");
+ document.body.append(host);
+ const app = createApp(
+ defineComponent({
+ setup() {
+ editor = useDataGridEditor({
+ result: computed(() => result.value),
+ editable: computed(() => true),
+ databaseType: computed(() => "oceanbase-oracle"),
+ connectionId: computed(() => "connection-1"),
+ database: computed(() => "app"),
+ tableMeta: computed(() => ({ tableName: "NOPK", primaryKeys: ["__DBX_ROWID"], columns: [] })),
+ sourceColumns: computed(() => ["LABEL", "__DBX_ROWID"]),
+ onExecuteSql: computed(() => undefined),
+ sql: computed(() => "SELECT LABEL FROM NOPK"),
+ searchText: ref(""),
+ whereFilterInput: ref(""),
+ currentWhereInput: computed(() => undefined),
+ orderByInput: ref(""),
+ rowStatusFilter: ref("all"),
+ confirmDangerousRowDeletion: computed(() => true),
+ pageSize: ref(100),
+ currentPage: ref(1),
+ cacheKey: computed(() => undefined),
+ getRowItem: () => undefined,
+ emit: reload,
+ onSaveConflict,
+ });
+ editor.deletedRows.value.add(0);
+ const commit = new Function("saveChanges", `return async function() {${toolbar![1]}}`)(editor.saveChanges);
+ return () => h("button", { onClick: commit }, "commit");
+ },
+ }),
+ );
+ app.mount(host);
+ const wrapper = {
+ async commit() {
+ host.querySelector("button")!.click();
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ await nextTick();
+ },
+ unmount() {
+ app.unmount();
+ host.remove();
+ },
+ };
+ return { wrapper, editor, result, reload };
+}
+
+describe("DataGrid ROWID save feedback across reload", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ mocks.prepare.mockResolvedValue({ statements: ["DELETE FROM NOPK WHERE ROWIDTOCHAR(ROWID)='ROW-22';"], rollbackStatements: [] });
+ });
+
+ it("toasts the conflict through ToolbarCommit before an asynchronous empty-result replacement clears saveError", async () => {
+ mocks.execute.mockResolvedValue({ affected_rows: 0 });
+ const toast = vi.fn();
+ const { wrapper, editor, result, reload } = saveBoundary(toast);
+ await wrapper.commit();
+ expect(reload).toHaveBeenCalledTimes(1);
+ expect(editor.deletedRows.value.size).toBe(0);
+ expect(toast).toHaveBeenCalledTimes(1);
+ const message = toast.mock.calls[0][0];
+ expect(message).toMatch(/0\D+1/);
+ expect(message).toMatch(/another session|其他会话|其他工作階段/);
+ expect(toast).toHaveBeenCalledWith(message, 5000);
+ // The real result watcher discards indexed pending state after replacement.
+ result.value = { columns: ["LABEL", "__DBX_PK_0"], rows: [] };
+ await nextTick();
+ expect(editor.saveError.value).toBe("");
+ expect(toast).toHaveBeenCalledTimes(1);
+ wrapper.unmount();
+ });
+
+ it("does not toast a normal one-row deletion", async () => {
+ mocks.execute.mockResolvedValue({ affected_rows: 1 });
+ const toast = vi.fn();
+ const { wrapper } = saveBoundary(toast);
+ await wrapper.commit();
+ expect(toast).not.toHaveBeenCalled();
+ wrapper.unmount();
+ });
+
+ it("does not duplicate a normal execution failure through the conflict notification", async () => {
+ mocks.execute.mockRejectedValue(new Error("connection failed"));
+ const toast = vi.fn();
+ const { wrapper, editor, reload } = saveBoundary(toast);
+ await wrapper.commit();
+ expect(editor.saveError.value).toContain("connection failed");
+ expect(editor.deletedRows.value).toEqual(new Set([0]));
+ expect(reload).not.toHaveBeenCalled();
+ expect(toast).not.toHaveBeenCalled();
+ wrapper.unmount();
+ });
+});
diff --git a/apps/desktop/src/composables/__tests__/useDataGridEditor.spec.ts b/apps/desktop/src/composables/__tests__/useDataGridEditor.spec.ts
index 8f932c6180..b95cee729a 100644
--- a/apps/desktop/src/composables/__tests__/useDataGridEditor.spec.ts
+++ b/apps/desktop/src/composables/__tests__/useDataGridEditor.spec.ts
@@ -1400,6 +1400,80 @@ describe("useDataGridEditor saveChanges reload", () => {
message: "Cannot safely update or delete this row: more than one row matches.",
};
+ it.each(["oracle", "oceanbase-oracle"] as const)("reports a concurrently deleted ROWID target without keeping an impossible retry pending (%s)", async (databaseType) => {
+ mocks.prepareDataGridSave.mockResolvedValue({ statements: ["DELETE FROM orders_test WHERE ROWID='ROW-22'"], rollbackStatements: ["restore ROW-22"] });
+ mocks.executeBatch.mockResolvedValue({ affected_rows: 0 });
+ const { editor, emit } = createSaveTestEditor({ databaseType, primaryKeys: ["__DBX_ROWID"] });
+ editor.deletedRows.value.add(1);
+
+ await editor.saveChanges();
+
+ expect(editor.saveError.value).not.toBe("");
+ expect(editor.deletedRows.value.size).toBe(0);
+ expect(editor.isSaving.value).toBe(false);
+ expect(emit).toHaveBeenCalledWith("reload", undefined, "", undefined, undefined, 100, 0);
+ expect(mocks.addHistory).toHaveBeenCalledWith(expect.objectContaining({ success: false, rollback_sql: undefined, error: editor.saveError.value }));
+ });
+
+ it("keeps a successful ROWID deletion successful", async () => {
+ mocks.prepareDataGridSave.mockResolvedValue({ statements: ["DELETE FROM orders_test WHERE ROWID='ROW-21'"], rollbackStatements: [] });
+ mocks.executeBatch.mockResolvedValue({ affected_rows: 1 });
+ const { editor } = createSaveTestEditor({ databaseType: "oceanbase-oracle", primaryKeys: ["__DBX_ROWID"] });
+ editor.deletedRows.value.add(0);
+ await editor.saveChanges();
+ expect(editor.saveError.value).toBe("");
+ expect(mocks.addHistory).toHaveBeenCalledWith(expect.objectContaining({ success: true, affected_rows: 1 }));
+ });
+
+ it("reports partial ROWID deletion after a transactional batch and does not replay completed deletes", async () => {
+ mocks.prepareDataGridSave.mockResolvedValue({ statements: ["DELETE FROM orders_test WHERE ROWID='ROW-21'", "DELETE FROM orders_test WHERE ROWID='ROW-22'"], rollbackStatements: [] });
+ mocks.executeInTransaction.mockResolvedValue({ affected_rows: 1 });
+ const { editor, emit } = createSaveTestEditor({ databaseType: "oceanbase-oracle", primaryKeys: ["__DBX_ROWID"] });
+ editor.deletedRows.value.add(0);
+ editor.deletedRows.value.add(1);
+ await editor.saveChanges();
+ expect(mocks.executeInTransaction).toHaveBeenCalledTimes(1);
+ expect(editor.saveError.value).not.toBe("");
+ expect(editor.deletedRows.value.size).toBe(0);
+ expect(mocks.addHistory).toHaveBeenCalledWith(expect.objectContaining({ success: false }));
+ expect(emit).toHaveBeenCalledWith("reload", undefined, "", undefined, undefined, 100, 0);
+ await editor.saveChanges();
+ expect(mocks.executeInTransaction).toHaveBeenCalledTimes(1);
+ });
+
+ it("reports a manual transaction's zero-row ROWID delete without claiming rollback", async () => {
+ mocks.prepareDataGridSave.mockResolvedValue({ statements: ["DELETE FROM orders_test WHERE ROWID='ROW-22'"], rollbackStatements: ["restore ROW-22"] });
+ mocks.executeInManualTransaction.mockResolvedValue([{ affected_rows: 0 }]);
+ const { editor } = createSaveTestEditor({ databaseType: "oceanbase-oracle", primaryKeys: ["__DBX_ROWID"], manualTransactionSessionId: "manual-1" });
+ editor.deletedRows.value.add(1);
+ await editor.saveChanges();
+ expect(editor.saveError.value).not.toBe("");
+ expect(editor.deletedRows.value.size).toBe(0);
+ expect(mocks.addHistory).toHaveBeenCalledWith(expect.objectContaining({ success: false, rollback_sql: undefined }));
+ });
+
+ it("retains ROWID deletes when execution fails instead of treating the error as an already-missing target", async () => {
+ mocks.prepareDataGridSave.mockResolvedValue({ statements: ["delete ROW-22"], rollbackStatements: [] });
+ mocks.executeBatch.mockRejectedValue(new Error("delete connection failed"));
+ const { editor, emit } = createSaveTestEditor({ databaseType: "oceanbase-oracle", primaryKeys: ["__DBX_ROWID"] });
+ editor.deletedRows.value.add(1);
+ await editor.saveChanges();
+ expect(editor.saveError.value).toContain("delete connection failed");
+ expect(editor.deletedRows.value).toEqual(new Set([1]));
+ expect(emit).not.toHaveBeenCalled();
+ });
+
+ it("does not mistake a protected LOB PL/SQL block's unknown update count for a missed ROWID delete", async () => {
+ mocks.prepareDataGridSave.mockResolvedValue({ statements: ["BEGIN\nDELETE FROM orders_test WHERE ROWID='ROW-22';\nIF SQL%ROWCOUNT <> 1 THEN RAISE_APPLICATION_ERROR(-20001, 'LOB target changed or missing; reload before saving'); END IF;\nEND;"], rollbackStatements: [] });
+ mocks.executeBatch.mockResolvedValue({ affected_rows: 0 });
+ const { editor } = createSaveTestEditor({ databaseType: "oceanbase-oracle", primaryKeys: ["__DBX_ROWID"] });
+ editor.deletedRows.value.add(1);
+ await editor.saveChanges();
+ expect(editor.saveError.value).toBe("");
+ expect(editor.deletedRows.value.size).toBe(0);
+ expect(mocks.addHistory).toHaveBeenCalledWith(expect.objectContaining({ success: true }));
+ });
+
it("refuses a keyless save when the server counts more than one row matching the predicate the save sends", async () => {
mocks.prepareDataGridSave.mockResolvedValue({
statements: ["UPDATE orders_test SET status='shipped' WHERE status = 'pending'"],
diff --git a/apps/desktop/src/composables/useDataGridEditor.ts b/apps/desktop/src/composables/useDataGridEditor.ts
index ab1a15d0c1..3f229b0965 100644
--- a/apps/desktop/src/composables/useDataGridEditor.ts
+++ b/apps/desktop/src/composables/useDataGridEditor.ts
@@ -131,6 +131,7 @@ export interface UseDataGridEditorOptions {
manualTransactionSessionId?: ComputedRef<string | undefined>;
ensureManualTransactionSession?: ComputedRef<(() => Promise<string>) | undefined>;
onManualTransactionMutation?: () => void;
+ onSaveConflict?: (message: string) => void;
sql: ComputedRef<string | undefined>;
searchText: Ref<string>;
whereFilterInput: Ref<string>;
@@ -2258,8 +2259,24 @@ export function useDataGridEditor(options: UseDataGridEditorOptions) {
return;
}
}
+ // Anonymous PL/SQL reports zero for an unknown JDBC update count; its
+ // SQL%ROWCOUNT guard owns concurrency checks. Only compare plain DELETEs.
+ const rowIdDeleteCountKnown =
+ (resolvedDatabaseType.value === "oracle" || resolvedDatabaseType.value === "oceanbase-oracle") &&
+ usesSyntheticRowIdKey(resolvedDatabaseType.value, stmtOptions?.tableMeta.primaryKeys ?? []) &&
+ !joinedWriteTargets.value?.length &&
+ snapshot.dirtyRows.size === 0 &&
+ snapshot.newRows.length === 0 &&
+ snapshot.deletedRows.size > 0 &&
+ stmts.length === snapshot.deletedRows.size &&
+ stmts.every((statement) => /^\s*DELETE\s+FROM\b/i.test(statement));
+ const actualDeletedRows = apiResult?.affected_rows;
+ const deleteConflict =
+ rowIdDeleteCountKnown && typeof actualDeletedRows === "number" && Number.isInteger(actualDeletedRows) && actualDeletedRows >= 0 && actualDeletedRows < snapshot.deletedRows.size
+ ? i18n.global.t("grid.rowIdDeleteConflict", { actual: actualDeletedRows, expected: snapshot.deletedRows.size })
+ : undefined;
try {
- await recordDataGridHistory(stmts, rollbackStmts, Date.now() - start, snapshot, apiResult);
+ await recordDataGridHistory(stmts, rollbackStmts, Date.now() - start, snapshot, deleteConflict ? { ...apiResult, success: false, error: deleteConflict } : apiResult);
} catch (e) {
console.warn("[DBX] failed to record data grid history", e);
}
@@ -2281,10 +2298,15 @@ export function useDataGridEditor(options: UseDataGridEditorOptions) {
clearSavedPendingChanges(snapshot);
if (!hasPendingChanges.value) exitTransaction();
clearPendingChangeHistory();
+ // Notify before reload can replace the rows and clear their error state.
+ if (deleteConflict) options.onSaveConflict?.(deleteConflict);
if (shouldReloadAfterSqlSave && !savedRowsRefreshed) {
reloadCurrentData();
}
await finishSaveChanges(snapshot);
+ // These deletes reached a terminal result. Refresh and report the mismatch
+ // instead of leaving a missing ROWID queued for an impossible retry.
+ if (deleteConflict) saveError.value = deleteConflict;
}
function discardChanges() {
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index be8356566b..a8493933c1 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -2376,6 +2376,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "Tətbiq et",
layerPreviewCustomBasemapInvalid: "Ad və {z}, {x}, {y} ehtiva edən etibarlı HTTP(S) XYZ xəritə fraqmenti URL-i daxil edin.",
insertRowsNotSupported: "Cari saxlama hədəfi sətir əlavə etməyi dəstəkləmir.",
+ rowIdDeleteConflict: "Silinmə {expected} seçilmiş sətirdən {actual} sətirə təsir etdi. Bəzi hədəflər artıq başqa sessiya tərəfindən silinmiş və ya artıq uyğun gəlmir. Gözləyən silinmələr təmizləndi və nəticə yeniləndi; cari məlumatları yoxlayın.",
zoomIn: "Yaxınlaşdır",
zoomOut: "Uzaqlaşdır",
fitImage: "Görünüşə sığdır",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 70382f0777..9f9b61dee2 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -2823,6 +2823,7 @@ export default {
layerPreviewCustomBasemapApply: "Apply",
layerPreviewCustomBasemapInvalid: "Enter a name and a valid HTTP(S) XYZ tile URL containing {z}, {x}, and {y}.",
insertRowsNotSupported: "The current save target does not support adding rows.",
+ rowIdDeleteConflict: "Deletion affected {actual} of {expected} selected rows. Some targets may already have been deleted by another session or no longer match. Pending deletes were cleared and the result was refreshed; check the current data.",
zoomIn: "Zoom In",
zoomOut: "Zoom Out",
fitImage: "Fit to View",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index 6e32bb4f7e..400b9ee05b 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -2647,6 +2647,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "Aplicar",
layerPreviewCustomBasemapInvalid: "Introduzca un nombre y una URL XYZ HTTP(S) válida con los marcadores {z}, {x} y {y}.",
insertRowsNotSupported: "El destino de guardado actual no admite añadir filas.",
+ rowIdDeleteConflict: "La eliminación afectó a {actual} de {expected} filas seleccionadas. Es posible que algunos objetivos ya hayan sido eliminados por otra sesión o que ya no coincidan. Se borraron las eliminaciones pendientes y se actualizó el resultado; compruebe los datos actuales.",
zoomIn: "Acercar",
zoomOut: "Alejar",
fitImage: "Ajustar a la vista",
diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts
index a83b951b8b..231e1198c5 100644
--- a/apps/desktop/src/i18n/locales/id.ts
+++ b/apps/desktop/src/i18n/locales/id.ts
@@ -2657,6 +2657,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "Terapkan",
layerPreviewCustomBasemapInvalid: "Masukkan nama dan URL tile XYZ HTTP(S) yang valid berisi {z}, {x}, dan {y}.",
insertRowsNotSupported: "Target penyimpanan saat ini tidak mendukung penambahan baris.",
+ rowIdDeleteConflict: "Penghapusan memengaruhi {actual} dari {expected} baris yang dipilih. Beberapa target mungkin sudah dihapus oleh sesi lain atau tidak lagi cocok. Penghapusan tertunda telah dibersihkan dan hasilnya diperbarui; periksa data saat ini.",
zoomIn: "Perbesar",
zoomOut: "Perkecil",
fitImage: "Sesuaikan ke Tampilan",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index 83f8f613c9..ed3e034c63 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -2541,6 +2541,8 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "Applica",
layerPreviewCustomBasemapInvalid: "Inserisci un nome e un URL tile XYZ HTTP(S) valido con i segnaposto {z}, {x} e {y}.",
insertRowsNotSupported: "La destinazione di salvataggio corrente non supporta l'aggiunta di righe.",
+ rowIdDeleteConflict:
+ "L'eliminazione ha interessato {actual} delle {expected} righe selezionate. Alcuni target potrebbero essere già stati eliminati da un'altra sessione o non corrispondere più. Le eliminazioni in sospeso sono state cancellate e il risultato è stato aggiornato; controllare i dati attuali.",
zoomIn: "Ingrandisci",
zoomOut: "Rimpicciolisci",
fitImage: "Adatta alla Vista",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 001b19b212..3bcae9833c 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -2547,6 +2547,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "適用",
layerPreviewCustomBasemapInvalid: "名前と、{z}、{x}、{y} を含む有効な HTTP(S) XYZ タイル URL を入力してください。",
insertRowsNotSupported: "現在の保存先は行の追加に対応していません。",
+ rowIdDeleteConflict: "削除は選択した {expected} 行のうち {actual} 行にのみ反映されました。一部の対象は既に別のセッションで削除されたか、条件に一致しなくなった可能性があります。保留中の削除はクリアされ、結果は更新されました。最新のデータをご確認ください。",
zoomIn: "拡大",
zoomOut: "縮小",
fitImage: "表示領域に合わせる",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index 75681b69d7..79840d701b 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -2583,6 +2583,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "적용",
layerPreviewCustomBasemapInvalid: "이름과 {z}, {x}, {y}가 포함된 유효한 HTTP(S) XYZ 타일 URL을 입력하세요.",
insertRowsNotSupported: "현재 저장 대상은 행 추가를 지원하지 않습니다.",
+ rowIdDeleteConflict: "삭제가 선택한 {expected}행 중 {actual}행에만 적용되었습니다. 일부 대상은 다른 세션에서 이미 삭제되었거나 더 이상 일치하지 않을 수 있습니다. 보류 중인 삭제가 지워지고 결과가 새로 고쳐졌습니다. 현재 데이터를 확인하세요.",
zoomIn: "확대",
zoomOut: "축소",
fitImage: "보기에 맞춤",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 119e626996..de17722171 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -2542,6 +2542,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "Aplicar",
layerPreviewCustomBasemapInvalid: "Informe um nome e uma URL XYZ HTTP(S) válida contendo os marcadores {z}, {x} e {y}.",
insertRowsNotSupported: "O destino de salvamento atual não suporta a adição de linhas.",
+ rowIdDeleteConflict: "A exclusão afetou {actual} de {expected} linhas selecionadas. Alguns destinos podem já ter sido excluídos por outra sessão ou não corresponder mais. As exclusões pendentes foram limpas e o resultado foi atualizado; verifique os dados atuais.",
zoomIn: "Aproximar",
zoomOut: "Afastar",
fitImage: "Ajustar à Visualização",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index d5ac8d9fd1..df55d6b919 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -2717,6 +2717,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "Применить",
layerPreviewCustomBasemapInvalid: "Введите название и допустимый HTTP(S) URL XYZ-тайлов, содержащий {z}, {x} и {y}.",
insertRowsNotSupported: "Текущая цель сохранения не поддерживает добавление строк.",
+ rowIdDeleteConflict: "Удаление затронуло {actual} из {expected} выбранных строк. Некоторые цели могли быть уже удалены другим сеансом или больше не соответствуют условиям. Отложенные удаления очищены, результат обновлён; проверьте текущие данные.",
zoomIn: "Увеличить",
zoomOut: "Уменьшить",
fitImage: "По размеру окна",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index 1ac49e13a1..bf848fe794 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -2369,6 +2369,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "Uygula",
layerPreviewCustomBasemapInvalid: "Bir ad ve {z}, {x} ile {y} içeren geçerli bir HTTP(S) XYZ karo URL'si girin.",
insertRowsNotSupported: "Geçerli kaydetme hedefi satır eklemeyi desteklemiyor.",
+ rowIdDeleteConflict: "Silme işlemi seçilen {expected} satırdan {actual} satırı etkiledi. Bazı hedefler başka bir oturum tarafından zaten silinmiş veya artık eşleşmiyor olabilir. Bekleyen silmeler temizlendi ve sonuç yenilendi; güncel verileri kontrol edin.",
zoomIn: "Yakınlaştır",
zoomOut: "Uzaklaştır",
fitImage: "Görünüme Sığdır",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 3834ee5422..bd1bfd190a 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -2758,6 +2758,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "应用",
layerPreviewCustomBasemapInvalid: "请输入名称和有效的 HTTP(S) XYZ 瓦片地址,并包含 {z}、{x}、{y} 占位符。",
insertRowsNotSupported: "当前保存目标不支持新增行。",
+ rowIdDeleteConflict: "本次删除影响 {actual}/{expected} 行。部分目标可能已被其他会话删除或不再匹配。已清理本次待删除标记并刷新,请核对当前数据。",
zoomIn: "放大",
zoomOut: "缩小",
fitImage: "适合显示区域",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 6dafba6b2c..ebce3f91e7 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -2543,6 +2543,7 @@ export default withEnglishFallback({
layerPreviewCustomBasemapApply: "套用",
layerPreviewCustomBasemapInvalid: "請輸入名稱和有效的 HTTP(S) XYZ 圖磚位址,並包含 {z}、{x}、{y} 佔位符。",
insertRowsNotSupported: "目前的儲存目標不支援新增資料列。",
+ rowIdDeleteConflict: "本次刪除影響 {actual}/{expected} 列。部分目標可能已被其他工作階段刪除或不再符合。已清除本次待刪除標記並重新整理,請核對目前資料。",
zoomIn: "放大",
zoomOut: "縮小",
fitImage: "適合顯示區域",
diff --git a/apps/desktop/src/stores/__tests__/queryStore.hiddenPrimaryKey.spec.ts b/apps/desktop/src/stores/__tests__/queryStore.hiddenPrimaryKey.spec.ts
index e8cdd45fa7..880df432bc 100644
--- a/apps/desktop/src/stores/__tests__/queryStore.hiddenPrimaryKey.spec.ts
+++ b/apps/desktop/src/stores/__tests__/queryStore.hiddenPrimaryKey.spec.ts
@@ -2373,6 +2373,45 @@ describe("queryStore hidden primary key editing", () => {
expect(tab.result?.columns).toEqual(["NAME", "NAME"]);
});
+ it.each(["SELECT * FROM events", "SELECT t.* FROM events t"])("preserves a real __dbx_row_num column across OceanBase wildcard pages: %s", async (sql) => {
+ getConnectionConfig.mockReturnValue({ id: "ob-1", name: "OceanBase", db_type: "oceanbase-oracle", database: "app", query_timeout_secs: 30 });
+ analyzeEditableQueryEditability.mockResolvedValue({ editable: false, reason: "complex-query" });
+ prepareQueryPaginationExecutionPlan.mockImplementation(async (options) => ({
+ sqlToExecute: options.sql,
+ pageLimit: options.pagination.limit,
+ pageOffset: options.pagination.offset,
+ useAgentResultSession: true,
+ }));
+ let row = 0;
+ executeMulti.mockImplementation(async () => [
+ {
+ columns: ["ID", "__dbx_row_num"],
+ rows: Array.from({ length: 2 }, () => [++row, `user-${row}`]),
+ affected_rows: 0,
+ execution_time_ms: 1,
+ session_id: "ob-star-cursor",
+ has_more: row < 6,
+ },
+ ]);
+ const { useQueryStore } = await import("@/stores/queryStore");
+ const store = useQueryStore();
+ const tabId = store.createTab("ob-1", "app", "Query");
+ for (const offset of [0, 2, 4]) {
+ await store.executeTabSql(tabId, sql, { pagination: { limit: 2, offset, sessionId: offset ? "ob-star-cursor" : undefined } });
+ const result = store.tabs.find((item) => item.id === tabId)!.result;
+ expect(result?.columns).toEqual(["ID", "__dbx_row_num"]);
+ expect(result?.rows).toEqual([
+ [offset + 1, `user-${offset + 1}`],
+ [offset + 2, `user-${offset + 2}`],
+ ]);
+ }
+ expect(executeMulti).toHaveBeenCalledTimes(3);
+ for (const [index, call] of executeMulti.mock.calls.entries()) {
+ expect(call[2]).toBe(sql);
+ expect(call[5]).toEqual(expect.objectContaining({ pageSize: 2, fetchSize: 2, resultSessionId: index ? "ob-star-cursor" : undefined }));
+ }
+ });
+
it("does not execute an OceanBase offset plan rejected without a cursor", async () => {
getConnectionConfig.mockReturnValue({ id: "ob-1", name: "OceanBase", db_type: "oceanbase-oracle", database: "app", query_timeout_secs: 30 });
analyzeEditableQueryEditability.mockResolvedValue({ editable: false, reason: "complex-query" });
diff --git a/apps/desktop/src/stores/__tests__/queryStore.oceanbaseRowId.spec.ts b/apps/desktop/src/stores/__tests__/queryStore.oceanbaseRowId.spec.ts
index 5f499581e4..d7edf4942a 100644
--- a/apps/desktop/src/stores/__tests__/queryStore.oceanbaseRowId.spec.ts
+++ b/apps/desktop/src/stores/__tests__/queryStore.oceanbaseRowId.spec.ts
@@ -101,6 +101,25 @@ describe("OceanBase Oracle query ROWID preparation", () => {
expect(sql).not.toContain("ROWID");
});
+ it("preserves a business rowid alias and keeps its locator in a distinct hidden column", async () => {
+ const { analyzeEditableQueryEditability } = await import("@/lib/sql/sqlAnalysis");
+ mocks.analyze.mockImplementation(async (sql: string) => analyzeEditableQueryEditability(sql));
+ mocks.getColumns.mockResolvedValue([
+ { name: "ID", data_type: "NUMBER", is_nullable: false, is_primary_key: false },
+ { name: "BUSINESS_ROWID", data_type: "VARCHAR2(100)", is_nullable: true, is_primary_key: false },
+ ]);
+ mocks.executeMulti.mockResolvedValue([{ columns: ["ID", "rowid", "__DBX_PK_0", "__DBX_PK_1"], rows: [[6, "physical-6", "visible", "ROW-6"]], affected_rows: 0, execution_time_ms: 1 }]);
+ const originalSql = 'select ID, BUSINESS_ROWID AS "rowid", \'visible\' AS "__DBX_PK_0" from sipf.t_sipf_debug_log order by ID';
+ const { store, id, sql } = await executedQuery(originalSql);
+ expect(sql).toBe('select ID, BUSINESS_ROWID AS "rowid", \'visible\' AS "__DBX_PK_0", ROWIDTOCHAR(ROWID) AS "__DBX_PK_1" from sipf.t_sipf_debug_log order by ID');
+ expect(mocks.preparePlan.mock.calls[0]![0].sql).toBe(sql);
+ const tab = store.tabs.find((item) => item.id === id)!;
+ expect(tab.result?.hidden_column_indexes).toEqual([3]);
+ expect(tab.result?.rows).toEqual([[6, "physical-6", "visible", "ROW-6"]]);
+ await vi.waitFor(() => expect(tab.querySourceColumns).toEqual(["ID", "BUSINESS_ROWID", undefined, "__DBX_ROWID"]));
+ expect(tab.tableMeta?.primaryKeys).toEqual(["__DBX_ROWID"]);
+ });
+
it("hides the projected ROWID while retaining two row identities for editing", async () => {
const { analyzeEditableQueryEditability } = await import("@/lib/sql/sqlAnalysis");
mocks.analyze.mockImplementation(async (sql: string) => analyzeEditableQueryEditability(sql));
diff --git a/apps/desktop/src/stores/__tests__/queryStore.queryResultExport.spec.ts b/apps/desktop/src/stores/__tests__/queryStore.queryResultExport.spec.ts
index 00bab72415..1f06c7d91e 100644
--- a/apps/desktop/src/stores/__tests__/queryStore.queryResultExport.spec.ts
+++ b/apps/desktop/src/stores/__tests__/queryStore.queryResultExport.spec.ts
@@ -116,6 +116,71 @@ describe("queryStore query result export", () => {
expect(queryResultTransferIncomplete(result!)).toBe(false);
});
+ it.each(["SELECT * FROM events", "SELECT t.* FROM events t"])("exports every wildcard page and its real __dbx_row_num column: %s", async (sql) => {
+ mocks.getConfig.mockReturnValue({ id: "ob-1", db_type: "oceanbase-oracle", database: "app" });
+ mocks.prepareQueryPaginationExecutionPlan.mockImplementation(async (request) => ({
+ sqlToExecute: request.sql,
+ pageLimit: 2,
+ pageOffset: request.pagination.offset,
+ useAgentResultSession: true,
+ }));
+ let row = 0;
+ mocks.executeMulti.mockImplementation(async () => [
+ {
+ columns: ["ID", "__dbx_row_num"],
+ column_types: ["NUMBER", "VARCHAR2"],
+ rows: Array.from({ length: 2 }, () => [++row, `user-${row}`]),
+ has_more: row < 6,
+ session_id: "ob-export-cursor",
+ execution_time_ms: 0,
+ affected_rows: 0,
+ },
+ ]);
+ const { useQueryStore } = await import("@/stores/queryStore");
+ const store = useQueryStore();
+ const id = store.createTab("ob-1", "app", "Query");
+ const tab = store.tabs.find((item) => item.id === id)!;
+ tab.lastExecutedSql = sql;
+ tab.result = { columns: ["ID", "__dbx_row_num"], rows: [[1, "user-1"]], has_more: true, execution_time_ms: 0, affected_rows: 0 };
+ const result = await store.fetchTabResultForExport(id, undefined, true);
+ expect(result?.columns).toEqual(["ID", "__dbx_row_num"]);
+ expect(result?.rows).toEqual(Array.from({ length: 6 }, (_, index) => [index + 1, `user-${index + 1}`]));
+ expect(mocks.executeMulti).toHaveBeenCalledTimes(3);
+ for (const [index, call] of mocks.executeMulti.mock.calls.entries()) {
+ expect(call[2]).toBe(sql);
+ expect(call[5]).toEqual(expect.objectContaining({ pageSize: 2, fetchSize: 2, resultSessionId: index ? "ob-export-cursor" : undefined }));
+ }
+ expect(mocks.closeQuerySession).toHaveBeenCalledWith("ob-1", "app", "ob-export-cursor", id, undefined);
+ });
+
+ it.each(["SELECT * FROM events", "SELECT t.* FROM events t"])("releases the wildcard export cursor when a later fetch fails: %s", async (sql) => {
+ mocks.getConfig.mockReturnValue({ id: "ob-1", db_type: "oceanbase-oracle", database: "app" });
+ mocks.prepareQueryPaginationExecutionPlan.mockResolvedValue({ sqlToExecute: sql, pageLimit: 2, pageOffset: 0, useAgentResultSession: true });
+ mocks.executeMulti.mockResolvedValueOnce([
+ {
+ columns: ["ID", "__dbx_row_num"],
+ rows: [
+ [1, "user-1"],
+ [2, "user-2"],
+ ],
+ has_more: true,
+ session_id: "ob-export-cursor",
+ execution_time_ms: 0,
+ affected_rows: 0,
+ },
+ ]);
+ mocks.executeMulti.mockRejectedValueOnce(new Error("Query cancelled"));
+ const { useQueryStore } = await import("@/stores/queryStore");
+ const store = useQueryStore();
+ const id = store.createTab("ob-1", "app", "Query");
+ const tab = store.tabs.find((item) => item.id === id)!;
+ tab.lastExecutedSql = sql;
+ tab.result = { columns: ["ID", "__dbx_row_num"], rows: [[1, "user-1"]], has_more: true, execution_time_ms: 0, affected_rows: 0 };
+ await expect(store.fetchTabResultForExport(id, undefined, true)).rejects.toThrow("Query cancelled");
+ expect(mocks.executeMulti.mock.calls[1]![5].resultSessionId).toBe("ob-export-cursor");
+ expect(mocks.closeQuerySession).toHaveBeenCalledWith("ob-1", "app", "ob-export-cursor", id, undefined);
+ });
+
it.each(["CALL update_and_list_items()", "INSERT INTO items VALUES (1) RETURNING id", "WITH changed AS (DELETE FROM items RETURNING id) SELECT * FROM changed"])("does not replay a result-producing mutation during transfer: %s", async (sql) => {
mocks.getConfig.mockReturnValue({ id: "oracle-1", db_type: "oracle", database: "app" });
const { useQueryStore } = await import("@/stores/queryStore");
diff --git a/crates/dbx-core/src/data/query_result_export.rs b/crates/dbx-core/src/data/query_result_export.rs
index f20200164c..4507125ad6 100644
--- a/crates/dbx-core/src/data/query_result_export.rs
+++ b/crates/dbx-core/src/data/query_result_export.rs
@@ -2637,21 +2637,25 @@ mod tests {
}
#[test]
- fn oceanbase_duplicate_projection_export_requires_cursor_and_follows_its_end() {
- let mut req = request("csv", None, None);
- req.database_type = DatabaseType::OceanbaseOracle;
- req.sql = "SELECT a.name, a.* FROM people a ORDER BY a.id".into();
- req.query_base_sql = req.sql.clone();
- req.use_agent_cursor = true;
- assert!(!supports_streaming_offset_pagination(&req, 100));
- assert_eq!(streaming_pagination_preflight_error(&req, 100, false, false), None);
- assert!(should_fetch_next_page(true, true, 100, 100, 100));
- assert!(!should_fetch_next_page(true, false, 100, 100, 100));
- req.use_agent_cursor = false;
- assert_eq!(
- streaming_pagination_preflight_error(&req, 100, false, false),
- Some(STREAMING_PAGINATION_UNSUPPORTED_ERROR)
- );
+ fn oceanbase_wildcard_and_duplicate_projection_export_require_cursor_and_follow_its_end() {
+ for sql in
+ ["SELECT * FROM events", "SELECT t.* FROM events t", "SELECT a.name, a.* FROM people a ORDER BY a.id"]
+ {
+ let mut req = request("csv", None, None);
+ req.database_type = DatabaseType::OceanbaseOracle;
+ req.sql = sql.into();
+ req.query_base_sql = req.sql.clone();
+ req.use_agent_cursor = true;
+ assert!(!supports_streaming_offset_pagination(&req, 100));
+ assert_eq!(streaming_pagination_preflight_error(&req, 100, false, false), None);
+ assert!(should_fetch_next_page(true, true, 100, 100, 100));
+ assert!(!should_fetch_next_page(true, false, 100, 100, 100));
+ req.use_agent_cursor = false;
+ assert_eq!(
+ streaming_pagination_preflight_error(&req, 100, false, false),
+ Some(STREAMING_PAGINATION_UNSUPPORTED_ERROR)
+ );
+ }
}
#[test]
diff --git a/crates/dbx-sql-data/src/query_result_sql.rs b/crates/dbx-sql-data/src/query_result_sql.rs
index 1a7eea0f8e..e0f6703704 100644
--- a/crates/dbx-sql-data/src/query_result_sql.rs
+++ b/crates/dbx-sql-data/src/query_result_sql.rs
@@ -2022,10 +2022,10 @@ fn rownum_wrapper_projection_is_safe(statement: &str) -> bool {
let [Statement::Query(query)] = statements.as_slice() else {
return false;
};
- fn safe_projection(body: &SetExpr, allow_wildcard: bool) -> bool {
+ fn safe_projection(body: &SetExpr) -> bool {
match body {
- SetExpr::Query(query) => safe_projection(&query.body, allow_wildcard && query.with.is_none()),
- SetExpr::SetOperation { left, .. } => safe_projection(left, allow_wildcard),
+ SetExpr::Query(query) => safe_projection(&query.body),
+ SetExpr::SetOperation { left, .. } => safe_projection(left),
SetExpr::Select(select) => {
let mut names = HashSet::new();
select.projection.iter().all(|item| {
@@ -2039,15 +2039,19 @@ fn rownum_wrapper_projection_is_safe(statement: &str) -> bool {
name
}
SelectItem::Wildcard(_) | SelectItem::QualifiedWildcard(_, _) => {
- return allow_wildcard
- && select.projection.len() == 1
- && select.from.len() == 1
- && select.from[0].joins.is_empty()
- && matches!(&select.from[0].relation, TableFactor::Table { args: None, alias, .. }
- if alias.as_ref().is_none_or(|alias| alias.columns.is_empty()));
+ // SQL text cannot reveal wildcard columns, including a real
+ // quoted __dbx_row_num column. Keep one Agent cursor rather
+ // than adding a potentially ambiguous pagination helper.
+ return false;
}
_ => return select.projection.len() == 1,
};
+ // OceanBase resolves a derived-table ROWID output as its physical
+ // locator even when the user projected a quoted business alias.
+ // Keep that legal projection on the original Agent cursor.
+ if name.value.eq_ignore_ascii_case("ROWID") {
+ return false;
+ }
names.insert(if name.quote_style.is_some() {
name.value.clone()
} else {
@@ -2058,7 +2062,7 @@ fn rownum_wrapper_projection_is_safe(statement: &str) -> bool {
_ => false,
}
}
- safe_projection(&query.body, query.with.is_none())
+ safe_projection(&query.body)
}
fn add_rownum_limit(statement: &str, limit: usize, offset: usize) -> String {
@@ -2674,8 +2678,6 @@ mod tests {
#[test]
fn oceanbase_safe_projections_keep_bounded_sql_at_every_offset() {
for sql in [
- "SELECT * FROM people",
- "SELECT a.* FROM people a",
"SELECT a.id, a.name FROM people a",
"SELECT a.id AS left_id, b.id AS right_id FROM people a JOIN people b ON a.id=b.id",
"SELECT a.id AS label, a.name AS \"label\" FROM people a",
@@ -2697,6 +2699,44 @@ mod tests {
}
}
+ #[test]
+ fn oceanbase_wildcard_keeps_one_cursor_when_real_columns_are_unknown() {
+ // Either table can contain a quoted "__dbx_row_num" column, invisible
+ // in the SQL text. UI paging and streaming export share this plan.
+ for sql in ["SELECT * FROM events", "SELECT t.* FROM events t"] {
+ for offset in [0, 2, 4] {
+ let mut options = QueryPaginationExecutionPlanOptions {
+ sql: sql.into(),
+ query_base_sql: sql.into(),
+ database_type: Some(DatabaseType::OceanbaseOracle),
+ pagination: QueryPagination {
+ limit: 2,
+ offset,
+ session_id: (offset > 0).then(|| "same-cursor".into()),
+ },
+ use_agent_cursor: true,
+ first_page_uses_actual_sql: true,
+ };
+ let plan = build_query_pagination_execution_plan(options.clone());
+ assert_eq!(plan.sql_to_execute, sql);
+ assert!(plan.use_agent_result_session);
+ assert_eq!(plan.page_limit, Some(2));
+ assert_eq!(plan.page_offset, Some(offset));
+ assert!(plan.page_sql.is_none());
+ assert!(plan.pagination_row_number_column.is_none());
+ assert!(!plan.single_execution);
+ assert!(plan.pagination_error.is_none());
+
+ // Existing sessions remain usable even if cursor availability
+ // changes after the first page.
+ if offset > 0 {
+ options.use_agent_cursor = false;
+ assert_eq!(build_query_pagination_execution_plan(options), plan);
+ }
+ }
+ }
+ }
+
#[test]
fn oceanbase_existing_session_wins_over_projection_and_cursor_availability() {
let sql = "SELECT a.name, a.* FROM people a";
@@ -2763,6 +2803,12 @@ mod tests {
#[test]
fn oceanbase_unsafe_projection_uses_cursor_at_every_offset() {
for sql in [
+ "SELECT * FROM people",
+ "SELECT a.* FROM people a",
+ "SELECT ID, BUSINESS_ROWID AS \"rowid\" FROM DBX_LOB_NOPK ORDER BY ID",
+ "SELECT BUSINESS_ROWID AS ROWID FROM DBX_LOB_NOPK",
+ "SELECT BUSINESS_ROWID AS \"RoWiD\", ROWIDTOCHAR(ROWID) AS \"__DBX_PK_0\" FROM DBX_LOB_NOPK",
+ "SELECT t.\"rowid\" FROM DBX_LOB_NOPK t",
"SELECT a.name, a.* FROM people a ORDER BY a.id",
"SELECT a.name, a.name FROM people a",
"SELECT a.id, b.id FROM people a JOIN people b ON a.id = b.id",
@@ -5489,7 +5535,7 @@ WHERE u.id = picked.id;
#[test]
fn oceanbase_oracle_prefers_bounded_first_page_and_keeps_cursor_fallback() {
- let sql = "SELECT * FROM events";
+ let sql = "SELECT id FROM events";
let first_page = build_query_pagination_execution_plan(QueryPaginationExecutionPlanOptions {
sql: sql.to_string(),
query_base_sql: sql.to_string(),
@@ -5498,7 +5544,7 @@ WHERE u.id = picked.id;
use_agent_cursor: true,
first_page_uses_actual_sql: false,
});
- assert_eq!(first_page.sql_to_execute, "SELECT * FROM (SELECT * FROM events) WHERE ROWNUM <= 500;");
+ assert_eq!(first_page.sql_to_execute, "SELECT * FROM (SELECT id FROM events) WHERE ROWNUM <= 500;");
assert_eq!(first_page.page_sql.as_deref(), Some(first_page.sql_to_execute.as_str()));
assert_eq!(first_page.page_limit, Some(500));
assert_eq!(first_page.page_offset, Some(0));