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
This commit is contained in:
link2xt
2026-09-15 11:39:44 +00:00
committed by l
parent 3858c47ceb
commit dc9bba0697
2 changed files with 6 additions and 1 deletions

View File

@@ -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?;

View File

@@ -741,6 +741,11 @@ fn new_connection(path: &Path, passphrase: &str) -> Result<Connection> {
// 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.
// <https://sqlite.org/quirks.html#double_quoted_string_literals_are_accepted>
conn.set_db_config(DbConfig::SQLITE_DBCONFIG_DQS_DML, false)?;
conn.set_db_config(DbConfig::SQLITE_DBCONFIG_DQS_DDL, false)?;
Ok(conn)
}