Skip to main content

strip_comments

Function strip_comments 

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

Remove SQL comments (both line -- and block /* */) from a SQL string.

Known limitation: Does not track string literal context. Comment-like sequences inside single-quoted strings (e.g., '-- not a comment') will be incorrectly stripped. This is acceptable for its current use case (detect_source_table editability detection on user-entered SQL) but should not be used for SQL transformation before execution.