Skip to main content

escape_java_string

Function escape_java_string 

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

Escape SQL text for splicing into a Java plain "..." string literal.

Java string literals do not interpolate, but a raw newline, backslash, or double quote each either fails to compile or changes what the database receives. Used by java-jdbc and java-r2dbc, both of which pre-flatten SQL to one line via clean_sql_oneline, but the newline/tab/carriage-return escapes here make the function correct independent of that upstream choice.