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

Method handle_execute

src/query/extended.rs:1261–1927  ·  view source on GitHub ↗
(
        framed: &mut Framed<T, crate::protocol::PostgresCodec>,
        db: &Arc<DbHandler>,
        session: &Arc<SessionState>,
        portal: String,
        max_rows: i32,
    )

Source from the content-addressed store, hash-verified

1259 }
1260
1261 pub async fn handle_execute<T>(
1262 framed: &mut Framed<T, crate::protocol::PostgresCodec>,
1263 db: &Arc<DbHandler>,
1264 session: &Arc<SessionState>,
1265 portal: String,
1266 max_rows: i32,
1267 ) -> Result<(), PgSqliteError>
1268 where
1269 T: tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin,
1270 {
1271 println!("EXTENDED: handle_execute called for portal: '{}'", portal);
1272
1273 // Get the portal
1274 let (query, translated_query, bound_values, param_formats, result_formats, statement_name, inferred_param_types) = {
1275 let portals = session.portals.read().await;
1276 let portal_obj = portals.get(&portal)
1277 .ok_or_else(|| PgSqliteError::Protocol(format!("Unknown portal: {portal}")))?;
1278
1279 (portal_obj.query.clone(),
1280 portal_obj.translated_query.clone(),
1281 portal_obj.bound_values.clone(),
1282 portal_obj.param_formats.clone(),
1283 portal_obj.result_formats.clone(),
1284 portal_obj.statement_name.clone(),
1285 portal_obj.inferred_param_types.clone())
1286 };
1287
1288 // Special logging for orders queries
1289 if query.contains("orders") && query.contains("customer_id") {
1290 info!("EXECUTE: Orders query detected!");
1291 info!("EXECUTE: Query: {}", query);
1292 info!("EXECUTE: Statement name: {}", statement_name);
1293
1294 // Check what field_descriptions are stored for this statement
1295 let statements = session.prepared_statements.read().await;
1296
1297 // For unnamed statements, try both empty string and the actual value
1298 let stmt_opt = if statement_name.is_empty() {
1299 statements.get("")
1300 .or_else(|| statements.get(&statement_name))
1301 } else {
1302 statements.get(&statement_name)
1303 };
1304
1305 if let Some(stmt) = stmt_opt {
1306 info!("EXECUTE: Statement has {} field_descriptions", stmt.field_descriptions.len());
1307 for fd in &stmt.field_descriptions {
1308 info!("EXECUTE: {} -> type OID {}", fd.name, fd.type_oid);
1309 if fd.name.contains("total_amount") && fd.type_oid == 25 {
1310 info!("EXECUTE: ^^^ BUG DETECTED: total_amount has TEXT type!");
1311 }
1312 }
1313 } else {
1314 info!("EXECUTE: Statement not found! Available keys: {:?}",
1315 statements.keys().collect::<Vec<_>>());
1316 }
1317 }
1318

Callers

nothing calls this directly

Calls 15

ErrorResponseClass · 0.85
readMethod · 0.80
to_oidMethod · 0.80
to_error_responseMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected