From dc9bba0697f73cb401c71b0be962aaa9b270470a Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 15 Sep 2026 11:39:44 +0000 Subject: [PATCH] refactor(sql): disable double-quoted string literals Double-quoted string literals are not standard and may be accidentally treated as an identifier if there is an identifier with the same name as the string contents: https://sqlite.org/quirks.html#double_quoted_string_literals_are_accepted --- src/chat.rs | 2 +- src/sql.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/chat.rs b/src/chat.rs index 8101b34dc..2a838a218 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -5021,7 +5021,7 @@ pub(crate) async fn delete_and_reset_all_device_msgs(context: &Context) -> Resul context .sql .execute( - r#"INSERT INTO devmsglabels (label) VALUES ("core-welcome-image"), ("core-welcome")"#, + "INSERT INTO devmsglabels (label) VALUES ('core-welcome-image'), ('core-welcome')", (), ) .await?; diff --git a/src/sql.rs b/src/sql.rs index 27671ebbb..ff1e722e7 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -741,6 +741,11 @@ fn new_connection(path: &Path, passphrase: &str) -> Result { // Default synchronous=FULL is much slower. NORMAL is sufficient for WAL mode. conn.pragma_update(None, "synchronous", "NORMAL".to_string())?; + // Disable double-quoted string literals misfeature. + // + conn.set_db_config(DbConfig::SQLITE_DBCONFIG_DQS_DML, false)?; + conn.set_db_config(DbConfig::SQLITE_DBCONFIG_DQS_DDL, false)?; + Ok(conn) }