Rindle docs and package mapSkip to main content

strip_comments_and_literals

Function strip_comments_and_literals 

pub fn strip_comments_and_literals(sql: &str) -> String
Expand description

sql with comments removed (each replaced by one space) and single-quoted string literals blanked, for the lexical DDL scanners (design 227 review fix): SQL comments may sit between any two tokens — DROP -- reason\nTABLE kv is valid SQL — so keyword-adjacency scans must run over comment-free text, and literals are blanked so a DEFAULT 'drop column' cannot false-positive. Identifier quoting ("n", `n`, [n]) is preserved verbatim, doubled '' escapes are honored, and an unterminated span runs to the end of the text (harmless for scanning — such a statement fails real execution before any scanner’s verdict matters).