Execute transaction control statement using the modular transaction system
(
&self,
statement: &TransactionStatement,
context: &mut ExecutionContext,
session: Option<&Arc<std::sync::RwLock<UserSession>>>,
)
| 8937 | |
| 8938 | /// Execute transaction control statement using the modular transaction system |
| 8939 | fn execute_transaction_statement( |
| 8940 | &self, |
| 8941 | statement: &TransactionStatement, |
| 8942 | context: &mut ExecutionContext, |
| 8943 | session: Option<&Arc<std::sync::RwLock<UserSession>>>, |
| 8944 | ) -> Result<QueryResult, ExecutionError> { |
| 8945 | use crate::exec::write_stmt::TransactionCoordinator; |
| 8946 | |
| 8947 | // Use the provided context to maintain variable scope across transaction boundaries |
| 8948 | // Update the session ID if available to ensure transaction tracking works correctly |
| 8949 | if let Some(session_arc) = session { |
| 8950 | let session_read = session_arc.read().map_err(|e| { |
| 8951 | ExecutionError::RuntimeError(format!("Failed to read session: {}", e)) |
| 8952 | })?; |
| 8953 | let session_id = session_read.session_id.clone(); |
| 8954 | drop(session_read); |
| 8955 | // Update the context's session ID if it differs |
| 8956 | if context.session_id != session_id { |
| 8957 | context.session_id = session_id; |
| 8958 | } |
| 8959 | } |
| 8960 | |
| 8961 | // Delegate to the transaction coordinator using the provided context |
| 8962 | let result = TransactionCoordinator::execute_transaction_statement( |
| 8963 | statement, context, self, // Pass the QueryExecutor for WAL logging |
| 8964 | )?; |
| 8965 | |
| 8966 | Ok(result) |
| 8967 | } |
| 8968 | |
| 8969 | /// Log an operation for the current transaction (if any) |
| 8970 | pub fn log_transaction_operation( |
no test coverage detected