Skip to main content

split_mysql_statements

Function split_mysql_statements 

Source
pub fn split_mysql_statements(sql: &str) -> Vec<String>
Expand description

Split MySQL SQL into individual statements at top-level ; terminators.

Respects single-quoted strings, double-quoted strings, backtick-quoted identifiers, single-line -- comments, and /* ... */ block comments. Does not handle MySQL’s DELIMITER // blocks — stored-procedure DDL that needs an alternate delimiter must be split by the caller (or re-written without DELIMITER, which works for most ALTER/CREATE patterns).

Returns owned Strings rather than borrowed slices so callers can pass them directly to mysql_async::query_drop without lifetime gymnastics.