Execute a session statement - validates resources and returns session change request Following PostgreSQL/Oracle pattern: executor validates, pipeline handles session updates
(
&self,
stmt: &SessionStatement,
)
| 6821 | /// Execute a session statement - validates resources and returns session change request |
| 6822 | /// Following PostgreSQL/Oracle pattern: executor validates, pipeline handles session updates |
| 6823 | fn execute_session_statement( |
| 6824 | &self, |
| 6825 | stmt: &SessionStatement, |
| 6826 | ) -> Result<QueryResult, ExecutionError> { |
| 6827 | use crate::ast::SessionSetClause; |
| 6828 | use crate::exec::result::SessionResult; |
| 6829 | |
| 6830 | match stmt { |
| 6831 | SessionStatement::Set(set_stmt) => { |
| 6832 | match &set_stmt.clause { |
| 6833 | SessionSetClause::Graph { graph_expression } => { |
| 6834 | // Validate graph exists in catalog |
| 6835 | // Validate graph exists in catalog using new catalog system |
| 6836 | let validated = |
| 6837 | self.validate_graph_expression_via_catalog(graph_expression); |
| 6838 | |
| 6839 | if !validated { |
| 6840 | // Return error if graph doesn't exist |
| 6841 | let graph_name = match graph_expression { |
| 6842 | GraphExpression::Reference(path) => path.to_string(), |
| 6843 | GraphExpression::Union { .. } => "UNION expression".to_string(), |
| 6844 | GraphExpression::CurrentGraph => { |
| 6845 | "CURRENT_GRAPH (invalid in SESSION SET)".to_string() |
| 6846 | } |
| 6847 | }; |
| 6848 | return Err(ExecutionError::CatalogError(format!( |
| 6849 | "Graph does not exist: {}", |
| 6850 | graph_name |
| 6851 | ))); |
| 6852 | } |
| 6853 | |
| 6854 | let session_result = SessionResult::SetGraph { |
| 6855 | graph_expression: graph_expression.clone(), |
| 6856 | validated: true, // Graph existence has been validated |
| 6857 | }; |
| 6858 | Ok(QueryResult::for_session(session_result)) |
| 6859 | } |
| 6860 | SessionSetClause::Schema { schema_reference } => { |
| 6861 | // Validate schema exists in catalog |
| 6862 | let validated = self.validate_schema_exists_via_catalog(schema_reference); |
| 6863 | |
| 6864 | if !validated { |
| 6865 | return Err(ExecutionError::CatalogError(format!( |
| 6866 | "Schema does not exist: {}", |
| 6867 | schema_reference |
| 6868 | ))); |
| 6869 | } |
| 6870 | |
| 6871 | let session_result = SessionResult::SetSchema { |
| 6872 | schema_reference: schema_reference.clone(), |
| 6873 | validated: true, // Schema existence has been validated |
| 6874 | }; |
| 6875 | Ok(QueryResult::for_session(session_result)) |
| 6876 | } |
| 6877 | SessionSetClause::TimeZone { time_zone } => { |
| 6878 | let session_result = SessionResult::SetTimeZone { |
| 6879 | timezone: time_zone.clone(), |
| 6880 | }; |
no test coverage detected