fix(jdbc): send rowOffset for generic JDBC table pagination
This commit is contained in:
7 files changed
+119
-3
No files matched your search
@@ -67,6 +67,29 @@ export function jdbcDriverProfileUsesSchemaQualification(driverProfile?: string)
|
||||
return inferJdbcDialect({ db_type: "jdbc", driver_profile: driverProfile }) === "jdbc";
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a JDBC-backed table view must let the driver skip `rowOffset` rows
|
||||
* instead of expecting SQL pagination.
|
||||
*
|
||||
* Generic JDBC (`DatabaseType::Jdbc` → `AgentMaxRows`) and Iris (`IrisTop`) are
|
||||
* the two dialects that cannot express a page offset in the generated SELECT:
|
||||
* generic JDBC emits no LIMIT/OFFSET at all and Iris only has `TOP`. Without the
|
||||
* driver-side offset the agent re-runs the same unbounded statement for every
|
||||
* page, so the grid keeps rendering page one (#9015).
|
||||
*
|
||||
* The Oracle, Dameng and Yashan driver families are excluded because the JDBC
|
||||
* agent passes `maxRows + 1` to `Statement.setMaxRows` for them, which caps the
|
||||
* result set *before* the skipped rows — those drivers paginate in SQL instead.
|
||||
*/
|
||||
const JDBC_STATEMENT_MAX_ROWS_URL_PREFIXES = ["jdbc:oracle:", "jdbc:dm:", "jdbc:yasdb:"];
|
||||
|
||||
export function jdbcConnectionUsesDriverRowOffset(connection: JdbcDialectConnection | undefined, effectiveDatabaseType: DatabaseType | undefined): boolean {
|
||||
if (connection?.db_type !== "jdbc") return false;
|
||||
if (effectiveDatabaseType !== "iris" && effectiveDatabaseType !== "jdbc") return false;
|
||||
const url = connection.connection_string?.trim().toLowerCase() ?? "";
|
||||
return !JDBC_STATEMENT_MAX_ROWS_URL_PREFIXES.some((prefix) => url.startsWith(prefix));
|
||||
}
|
||||
|
||||
export function effectiveDatabaseTypeForConnection(connection?: JdbcDialectConnection): DatabaseType | undefined {
|
||||
if (!connection) return undefined;
|
||||
if (connection.db_type === "gbase" && isGbase8sProfile(connection.driver_profile)) return "informix";
|
||||
|
||||
Reference in new issue
Block a user