pub fn validate_read_only(
sql: &str,
dialect: &impl Dialect,
) -> Result<StatementKind, SqlError>Expand description
Validates that a SQL query is read-only and classifies it for pagination.
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
Returns the classified StatementKind on success so callers that
paginate can dispatch Select to a subquery-wrapped fetch and route
NonSelect through a single-page pass-through.
ยงErrors
Returns SqlError if the query is not allowed in read-only mode.