fix(jdbc): send rowOffset for generic JDBC table pagination
This commit is contained in:
7 files changed
+119
-3
No files matched your search
@@ -179,6 +179,75 @@ describe("queryStore table data refresh", () => {
|
||||
expect(mocks.executeMulti).toHaveBeenCalledWith("cache-1", "USER", 'SELECT * FROM "SS"."SS_User" ORDER BY "ID" ASC', undefined, expect.any(String), expect.objectContaining({ maxRows: 100, fetchSize: 100, rowOffset: 100 }));
|
||||
});
|
||||
|
||||
it("uses JDBC ResultSet offset pagination for dialects that cannot paginate in SQL", async () => {
|
||||
mocks.getConnectionConfig.mockReturnValue({
|
||||
id: "sybase-1",
|
||||
name: "Sybase ASE 16",
|
||||
db_type: "jdbc",
|
||||
database: "app",
|
||||
connection_string: "jdbc:sybase:Tds:db.example.com:5000/app",
|
||||
query_timeout_secs: 30,
|
||||
});
|
||||
mocks.buildTableSelectSql.mockResolvedValue("SELECT * FROM dbo.users ORDER BY id ASC");
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("sybase-1", "app", "users", "data", "dbo");
|
||||
store.setTableMeta(tabId, {
|
||||
schema: "dbo",
|
||||
tableName: "users",
|
||||
tableType: "TABLE",
|
||||
columns: [{ name: "id", data_type: "int", is_nullable: false, column_default: null, is_primary_key: true, extra: null }],
|
||||
primaryKeys: ["id"],
|
||||
});
|
||||
const tab = store.tabs.find((candidate) => candidate.id === tabId)!;
|
||||
tab.orderByInput = "id ASC";
|
||||
tab.resultPageLimit = 100;
|
||||
tab.resultPageOffset = 100;
|
||||
|
||||
await store.refreshDataTab(tabId);
|
||||
|
||||
// Generic JDBC emits a bare SELECT, so the agent has to skip the offset;
|
||||
// otherwise page 2 re-renders page 1 (#9015).
|
||||
expect(mocks.buildTableSelectSql).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
databaseType: "jdbc",
|
||||
limit: 100,
|
||||
offset: 100,
|
||||
useDriverRowOffset: true,
|
||||
}),
|
||||
);
|
||||
expect(mocks.executeMulti).toHaveBeenCalledWith("sybase-1", "app", "SELECT * FROM dbo.users ORDER BY id ASC", undefined, expect.any(String), expect.objectContaining({ maxRows: 100, fetchSize: 100, rowOffset: 100 }));
|
||||
});
|
||||
|
||||
it("keeps YashanDB JDBC tabs on server-side pagination", async () => {
|
||||
mocks.getConnectionConfig.mockReturnValue({
|
||||
id: "yasdb-1",
|
||||
name: "YashanDB",
|
||||
db_type: "jdbc",
|
||||
database: "app",
|
||||
connection_string: "jdbc:yasdb://localhost:1688/app",
|
||||
query_timeout_secs: 30,
|
||||
});
|
||||
mocks.buildTableSelectSql.mockResolvedValue("SELECT * FROM app.users");
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("yasdb-1", "app", "users", "data");
|
||||
store.setTableMeta(tabId, {
|
||||
tableName: "users",
|
||||
tableType: "TABLE",
|
||||
columns: [{ name: "id", data_type: "int", is_nullable: false, column_default: null, is_primary_key: true, extra: null }],
|
||||
primaryKeys: ["id"],
|
||||
});
|
||||
const tab = store.tabs.find((candidate) => candidate.id === tabId)!;
|
||||
tab.resultPageLimit = 100;
|
||||
tab.resultPageOffset = 100;
|
||||
|
||||
await store.refreshDataTab(tabId);
|
||||
|
||||
expect(mocks.buildTableSelectSql).toHaveBeenCalledWith(expect.not.objectContaining({ useDriverRowOffset: true }));
|
||||
expect(mocks.executeMulti).toHaveBeenCalledWith("yasdb-1", "app", "SELECT * FROM app.users", undefined, expect.any(String), expect.not.objectContaining({ rowOffset: expect.anything() }));
|
||||
});
|
||||
|
||||
it("executes Doris external catalog data tabs against the catalog database, not the connection default database", async () => {
|
||||
mocks.getConnectionConfig.mockReturnValue({
|
||||
id: "doris-1",
|
||||
|
||||
Reference in new issue
Block a user