Skip to content

Commit 3959e0b

Browse files
committed
feat: Enhance ODBC connection options by adding batch size configuration and logging
1 parent 5f8cbde commit 3959e0b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/webserver/database/connect.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,13 @@ fn make_sqlite_fun(name: &str, f: fn(&str) -> String) -> Function {
239239
})
240240
}
241241

242-
fn set_custom_connect_options_odbc(odbc_options: &mut OdbcConnectOptions, _config: &AppConfig) {
242+
fn set_custom_connect_options_odbc(odbc_options: &mut OdbcConnectOptions, config: &AppConfig) {
243243
// Allow fetching very large text fields when using ODBC by removing the max column size limit
244-
*odbc_options = std::mem::take(odbc_options).max_column_size(None);
244+
let batch_size = config.max_pending_rows.clamp(1, 1024);
245+
odbc_options.batch_size(batch_size);
246+
log::trace!("ODBC batch size set to {batch_size}");
247+
// Disables ODBC batching, but avoids truncation of large text fields
248+
odbc_options.max_column_size(None);
245249
}
246250

247251
fn set_database_password(options: &mut AnyConnectOptions, password: &str) {

0 commit comments

Comments
 (0)