Execute raw SQL in a trigger-like context (no row bindings). Used by the cross-shard receiver to execute trigger-originated DML on the target node. The SQL is parsed and executed through the normal Control Plane → Data Plane path with cascade depth tracking.
(
state: &SharedState,
identity: &AuthenticatedIdentity,
tenant_id: TenantId,
sql: &str,
cascade_depth: u32,
)
| 168 | /// on the target node. The SQL is parsed and executed through the normal |
| 169 | /// Control Plane → Data Plane path with cascade depth tracking. |
| 170 | pub async fn fire_sql( |
| 171 | state: &SharedState, |
| 172 | identity: &AuthenticatedIdentity, |
| 173 | tenant_id: TenantId, |
| 174 | sql: &str, |
| 175 | cascade_depth: u32, |
| 176 | ) -> crate::Result<()> { |
| 177 | use crate::control::planner::procedural::executor::bindings::RowBindings; |
| 178 | use crate::control::planner::procedural::executor::core::{ |
| 179 | MAX_CASCADE_DEPTH, StatementExecutor, |
| 180 | }; |
| 181 | |
| 182 | if cascade_depth >= MAX_CASCADE_DEPTH { |
| 183 | return Err(crate::Error::BadRequest { |
| 184 | detail: format!("cross-shard cascade depth exceeded ({MAX_CASCADE_DEPTH})"), |
| 185 | }); |
| 186 | } |
| 187 | |
| 188 | let block = crate::control::planner::procedural::parse_block(sql).map_err(|e| { |
| 189 | crate::Error::BadRequest { |
| 190 | detail: format!("cross-shard SQL parse error: {e}"), |
| 191 | } |
| 192 | })?; |
| 193 | |
| 194 | let executor = StatementExecutor::with_source( |
| 195 | state, |
| 196 | identity.clone(), |
| 197 | tenant_id, |
| 198 | cascade_depth, |
| 199 | crate::event::EventSource::Trigger, |
| 200 | ); |
| 201 | let bindings = RowBindings::empty(); |
| 202 | |
| 203 | executor |
| 204 | .execute_block(&block, &bindings) |
| 205 | .await |
| 206 | .map_err(|e| crate::Error::BadRequest { |
| 207 | detail: format!("cross-shard SQL execution failed: {e}"), |
| 208 | }) |
| 209 | } |
no test coverage detected