Skip to main content

sql_mutations

Function sql_mutations 

Source
pub fn sql_mutations(src: &str) -> Vec<(usize, usize, String, String)>
Expand description

The mutations inside one string literal’s source text (quotes included), as (start, end, from, to) offsets into it. The caller has established that the literal is SQL (the checker ties it to a D1 call: see build_model); the scan runs on the literal’s decoded text, so an escape such as \n is the newline it stands for, and is mapped back to the source span it came from. Three kinds: a comparison <↔<=, >↔>=; max(↔min(; and, in a WHERE of two or more AND conjuncts, dropping one conjunct (to is empty). A CASE … END is one unit, never split. The result is only text: a mutant the checker’s SQL check refuses is invalid.