MCPcopy Create free account
hub / github.com/erans/pgsqlite / execute_fast_path

Function execute_fast_path

src/query/fast_path.rs:326–353  ·  view source on GitHub ↗

Fast path DML execution that bypasses parsing and rewriting

(
    conn: &Connection,
    query: &str,
    schema_cache: &SchemaCache,
)

Source from the content-addressed store, hash-verified

324
325/// Fast path DML execution that bypasses parsing and rewriting
326pub 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
356pub fn query_fast_path(

Callers 1

Calls 3

can_use_fast_pathFunction · 0.85
executeMethod · 0.45

Tested by

no test coverage detected