fix(jdbc): skip SQL-level row limiting for JDBC connections

This commit is contained in:
t8y2 committed 2026-06-17 01:00:09 +08:00
1 parent 63bb6a21ca
commit 0411fd46b6
5 files changed
+26 -1

No files matched your search

@@ -111,6 +111,9 @@ pub fn build_database_search_sql(options: DatabaseSearchSqlOptions) -> Option<Da
format!("SELECT TOP {limit} * FROM {table} WHERE ({where_clause})")
} else if options.database_type.is_some_and(uses_fetch_first) {
format!("SELECT * FROM {table} WHERE ({where_clause}) FETCH FIRST {limit} ROWS ONLY")
} else if options.database_type == Some(DatabaseType::Jdbc) {
// JDBC connections rely on Statement.setMaxRows() for row limiting.
format!("SELECT * FROM {table} WHERE ({where_clause});")
} else {
format!("SELECT * FROM {table} WHERE ({where_clause}) LIMIT {limit};")
};