Skip to main content

is_select_query

Function is_select_query 

Source
pub fn is_select_query(sql: &str) -> bool
Expand description

Returns true if the SQL is a read-only query (SELECT, TABLE, SHOW, EXPLAIN).

SQL-012: WITH (CTEs) is treated as SELECT-like because the most common use case is read-only CTEs (WITH cte AS (SELECT ...) SELECT * FROM cte). Limitation: Writeable CTEs (WITH ... UPDATE/INSERT/DELETE) are also classified as SELECT and will route to execute_select. If you need to execute a writeable CTE, prefix it with a comment or use execute_modify directly. This trade-off favors the common read-only case.