/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// In PRAGMA foo='bar', `'bar'` must be a constant string (it cannot be a /// bound parameter), so we need to escape manually. According to /// <https://www.sqlite.org/faq.html>, the only character that must be escaped is /// the single quote, which is escaped by placing two single quotes in a row. pubfn escape_string_for_pragma(s: &str) -> String {
s.replace('\'', "''")
}
#[cfg(test)] mod test { usesuper::*; #[test] fn test_escape_string_for_pragma() {
assert_eq!(escape_string_for_pragma("foobar"), "foobar");
assert_eq!(escape_string_for_pragma("'foo'bar'"), "''foo''bar''");
assert_eq!(escape_string_for_pragma("''"), "''''");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-18)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.