pub fn normalize(sql: &str) -> StringExpand description
Normalize a SQL string for use as a cache key.
Applies:
- Collapse any sequence of whitespace (spaces, tabs, newlines) to a single ASCII space.
- Trim leading and trailing whitespace.
- Uppercase all characters outside of string literals (so
selectandSELECTproduce the same key).
This is a lightweight lexical normalization, not a full AST round-trip. It is suitable for prepared-statement cache key generation but does not guarantee two semantically identical queries will produce the same key (e.g. different identifier quoting styles will still differ).
§Example
use oxisql_parse::normalize;
assert_eq!(normalize("select id from users"), "SELECT ID FROM USERS");