mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 23:16:30 +03:00
sql: make all queries persistent and update to upstream sqlx
&str queries are not persistent by default. To make queries persistent, they have to be constructed with sqlx::query. Upstream sqlx does not contain the change that make all queries persistent, but it is not needed anymore. but
This commit is contained in:
@@ -2860,7 +2860,9 @@ pub(crate) async fn get_chat_cnt(context: &Context) -> Result<usize, Error> {
|
||||
// no database, no chats - this is no error (needed eg. for information)
|
||||
let count = context
|
||||
.sql
|
||||
.count("SELECT COUNT(*) FROM chats WHERE id>9 AND blocked=0;")
|
||||
.count(sqlx::query(
|
||||
"SELECT COUNT(*) FROM chats WHERE id>9 AND blocked=0;",
|
||||
))
|
||||
.await?;
|
||||
Ok(count as usize)
|
||||
} else {
|
||||
@@ -3030,7 +3032,10 @@ pub(crate) async fn delete_and_reset_all_device_msgs(context: &Context) -> Resul
|
||||
.sql
|
||||
.execute(sqlx::query("DELETE FROM msgs WHERE from_id=?;").bind(DC_CONTACT_ID_DEVICE as i32))
|
||||
.await?;
|
||||
context.sql.execute("DELETE FROM devmsglabels;").await?;
|
||||
context
|
||||
.sql
|
||||
.execute(sqlx::query("DELETE FROM devmsglabels;"))
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user