Attempt to dispatch `sql` as a NodeDB SQL extension. Returns `Some(result)` if the statement was handled (e.g. `PUBLISH TO`), or `None` if the SQL should be handled by the caller via `plan_sql`. The caller is responsible for handling `None`.
(
state: &SharedState,
identity: &AuthenticatedIdentity,
sql: &str,
)
| 23 | /// |
| 24 | /// The caller is responsible for handling `None`. |
| 25 | pub async fn dispatch_sql( |
| 26 | state: &SharedState, |
| 27 | identity: &AuthenticatedIdentity, |
| 28 | sql: &str, |
| 29 | ) -> Option<crate::Result<DispatchOutcome>> { |
| 30 | let trimmed = sql.trim().trim_end_matches(';').trim(); |
| 31 | let upper = trimmed.to_uppercase(); |
| 32 | |
| 33 | // ── PUBLISH TO <topic> <payload> ───────────────────────────────────────── |
| 34 | if upper.starts_with("PUBLISH TO ") { |
| 35 | return Some(handle_publish(state, identity, trimmed).await); |
| 36 | } |
| 37 | |
| 38 | // Not a handled NodeDB extension — caller should use plan_sql. |
| 39 | None |
| 40 | } |
| 41 | |
| 42 | /// Handle `PUBLISH TO <topic> <payload>` without pgwire coupling. |
| 43 | async fn handle_publish( |
no test coverage detected