Fast path DML execution that bypasses parsing and rewriting
(
conn: &Connection,
query: &str,
schema_cache: &SchemaCache,
)
| 324 | |
| 325 | /// Fast path DML execution that bypasses parsing and rewriting |
| 326 | pub fn execute_fast_path( |
| 327 | conn: &Connection, |
| 328 | query: &str, |
| 329 | schema_cache: &SchemaCache, |
| 330 | ) -> Result<Option<usize>, rusqlite::Error> { |
| 331 | // Check if query qualifies for fast path |
| 332 | if let Some(table_name) = can_use_fast_path(query) { |
| 333 | // Skip SELECT queries here, they need special handling |
| 334 | if matches!(crate::query::QueryTypeDetector::detect_query_type(query), crate::query::QueryType::Select) { |
| 335 | return Ok(None); |
| 336 | } |
| 337 | |
| 338 | // Check if table has decimal columns |
| 339 | match table_has_decimal_columns(conn, &table_name, schema_cache) { |
| 340 | Ok(false) => { |
| 341 | // No decimal columns, execute directly |
| 342 | let rows_affected = conn.execute(query, [])?; |
| 343 | return Ok(Some(rows_affected)); |
| 344 | } |
| 345 | _ => { |
| 346 | // Has decimal columns or error checking, fall back to normal path |
| 347 | return Ok(None); |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | Ok(None) |
| 353 | } |
| 354 | |
| 355 | /// Fast path SELECT execution that bypasses parsing and rewriting |
| 356 | pub fn query_fast_path( |
no test coverage detected