fix(jdbc): send rowOffset for generic JDBC table pagination
This commit is contained in:
7 files changed
+119
-3
No files matched your search
@@ -20,6 +20,7 @@ import {
|
||||
gaussdbIdentifierQuoteStyle,
|
||||
gaussdbTargetServerType,
|
||||
inferJdbcDialect,
|
||||
jdbcConnectionUsesDriverRowOffset,
|
||||
metadataSchemaForConnection,
|
||||
objectListSchemaForConnection,
|
||||
setGaussdbConnectionMode,
|
||||
@@ -328,6 +329,29 @@ describe("jdbc dialect inference", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("JDBC driver row offset", () => {
|
||||
it("lets the driver skip rows for dialects without SQL offset pagination", () => {
|
||||
// Unknown vendor dialects stay on the generic JDBC dialect, which emits a
|
||||
// bare SELECT, so the page offset can only be applied by the driver (#9015).
|
||||
expect(jdbcConnectionUsesDriverRowOffset({ db_type: "jdbc", connection_string: "jdbc:sybase:Tds:db.example.com:5000/app" }, "jdbc")).toBe(true);
|
||||
expect(jdbcConnectionUsesDriverRowOffset({ db_type: "jdbc", connection_string: "jdbc:hsqldb:hsql://127.0.0.1:9001/probe" }, "jdbc")).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps the Caché/IRIS ResultSet offset behavior", () => {
|
||||
expect(jdbcConnectionUsesDriverRowOffset({ db_type: "jdbc", connection_string: "jdbc:Cache://localhost:1972/USER" }, "iris")).toBe(true);
|
||||
});
|
||||
|
||||
it("leaves SQL-paginated dialects and driver-capped JDBC drivers alone", () => {
|
||||
expect(jdbcConnectionUsesDriverRowOffset({ db_type: "jdbc", connection_string: "jdbc:mysql://localhost:3306/app" }, "mysql")).toBe(false);
|
||||
expect(jdbcConnectionUsesDriverRowOffset({ db_type: "jdbc", connection_string: "jdbc:oracle:thin:@localhost:1521:XE" }, "oracle")).toBe(false);
|
||||
// YashanDB keeps the generic dialect, but its agent applies
|
||||
// Statement.setMaxRows, which would cap the result set before the skipped rows.
|
||||
expect(jdbcConnectionUsesDriverRowOffset({ db_type: "jdbc", connection_string: "jdbc:yasdb://localhost:1688/app" }, "jdbc")).toBe(false);
|
||||
expect(jdbcConnectionUsesDriverRowOffset({ db_type: "postgres" }, "postgres")).toBe(false);
|
||||
expect(jdbcConnectionUsesDriverRowOffset(undefined, "jdbc")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("GaussDB connection mode", () => {
|
||||
it("keeps native connections compatible and configures M mode for the vendor JDBC driver", () => {
|
||||
const connection = { db_type: "gaussdb", driver_profile: "gaussdb", driver_label: "GaussDB" } as ConnectionConfig;
|
||||
|
||||
Reference in new issue
Block a user