Skip to main content

validate_single_statement

Function validate_single_statement 

Source
pub fn validate_single_statement(
    sql: &str,
    dialect: &impl Dialect,
) -> Result<(), SqlError>
Expand description

Validates that a SQL string contains exactly one statement.

Unlike validate_read_only, any statement type is accepted. Use this where the input is embedded into a wrapper (e.g. EXPLAIN {query}) that must never smuggle additional statements past the driver.

ยงErrors

Returns SqlError::MultiStatement if the input holds more than one statement, or SqlError::Query if it is empty or fails to parse.