(
state: &SharedState,
identity: &AuthenticatedIdentity,
sql: &str,
upper: &str,
parts: &[&str],
)
| 7 | use crate::control::state::SharedState; |
| 8 | |
| 9 | pub(super) async fn dispatch( |
| 10 | state: &SharedState, |
| 11 | identity: &AuthenticatedIdentity, |
| 12 | sql: &str, |
| 13 | upper: &str, |
| 14 | parts: &[&str], |
| 15 | ) -> Option<PgWireResult<Vec<Response>>> { |
| 16 | // BACKUP/RESTORE TENANT are fully dispatched via typed AST (ast.rs). |
| 17 | |
| 18 | // Schedules: CREATE/DROP/ALTER/SHOW SCHEDULE |
| 19 | // CREATE SCHEDULE is fully dispatched via typed AST (ast.rs). |
| 20 | if upper.starts_with("DROP SCHEDULE ") { |
| 21 | return Some(super::super::schedule::drop_schedule( |
| 22 | state, identity, parts, |
| 23 | )); |
| 24 | } |
| 25 | // ALTER SCHEDULE is fully dispatched via typed AST (ast.rs). |
| 26 | if upper.starts_with("SHOW SCHEDULE HISTORY ") { |
| 27 | let name = parts.get(3).unwrap_or(&""); |
| 28 | return Some(super::super::schedule::show_schedule_history( |
| 29 | state, identity, name, |
| 30 | )); |
| 31 | } |
| 32 | if upper.starts_with("SHOW SCHEDULE") { |
| 33 | return Some(super::super::schedule::show_schedules(state, identity)); |
| 34 | } |
| 35 | |
| 36 | // Sequences: CREATE/DROP/ALTER/SHOW SEQUENCE |
| 37 | // CREATE SEQUENCE is fully dispatched via typed AST (ast.rs). |
| 38 | if upper.starts_with("DROP SEQUENCE ") { |
| 39 | return Some(super::super::sequence::drop_sequence( |
| 40 | state, identity, parts, |
| 41 | )); |
| 42 | } |
| 43 | // ALTER SEQUENCE is fully dispatched via typed AST (ast.rs). |
| 44 | if upper == "SHOW SEQUENCES" || upper.starts_with("SHOW SEQUENCES ") { |
| 45 | return Some(super::super::sequence::show_sequences(state, identity)); |
| 46 | } |
| 47 | |
| 48 | // Maintenance: ANALYZE, COMPACT, REINDEX, SHOW STORAGE, SHOW COMPACTION |
| 49 | if upper.starts_with("ANALYZE ") { |
| 50 | return Some(super::super::maintenance::handle_analyze(state, identity, sql).await); |
| 51 | } |
| 52 | if upper.starts_with("COMPACT ") { |
| 53 | return Some(super::super::maintenance::handle_compact( |
| 54 | state, identity, parts, |
| 55 | )); |
| 56 | } |
| 57 | // REINDEX is fully dispatched via typed AST (ast.rs). |
| 58 | if upper.starts_with("SHOW STORAGE ") { |
| 59 | return Some(super::super::maintenance::handle_show_storage( |
| 60 | state, identity, parts, |
| 61 | )); |
| 62 | } |
| 63 | if upper == "SHOW COMPACTION STATUS" || upper.starts_with("SHOW COMPACTION STATUS ") { |
| 64 | return Some(super::super::maintenance::handle_show_compaction_status( |
| 65 | state, identity, |
| 66 | )); |
nothing calls this directly
no test coverage detected