pub fn validate_read_only_with_dialect(
sql: &str,
dialect: &impl Dialect,
) -> Result<(), AppError>Expand description
Validates that a SQL query is read-only.
Parses the query using the given dialect and checks:
- Exactly one statement (multi-statement injection blocked)
- Statement type is read-only (SELECT, SHOW, DESCRIBE, USE, EXPLAIN)
- No dangerous functions (
LOAD_FILE) - No INTO OUTFILE/DUMPFILE clauses
ยงErrors
Returns AppError if the query is not allowed in read-only mode.