From ccca1b0bea2ded2549f10c32b6ecf7d67ef36ce1 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 14 Dec 2019 18:47:32 +0300 Subject: [PATCH] Do not format! SQL queries --- src/chat.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 064baac0b..f9bb79ef9 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -646,8 +646,8 @@ pub fn create_or_lookup_by_contact_id( sql::execute( context, &context.sql, - format!( - "INSERT INTO chats (type, name, param, blocked, grpid, created_timestamp) VALUES({}, '{}', '{}', {}, '{}', {})", + "INSERT INTO chats (type, name, param, blocked, grpid, created_timestamp) VALUES(?, ?, ?, ?, ?, ?)", + params![ 100, chat_name, match contact_id { @@ -658,8 +658,7 @@ pub fn create_or_lookup_by_contact_id( create_blocked as u8, contact.get_addr(), time(), - ), - params![], + ] )?; let chat_id = sql::get_rowid(context, &context.sql, "chats", "grpid", contact.get_addr()); @@ -667,11 +666,8 @@ pub fn create_or_lookup_by_contact_id( sql::execute( context, &context.sql, - format!( - "INSERT INTO chats_contacts (chat_id, contact_id) VALUES({}, {})", - chat_id, contact_id - ), - params![], + "INSERT INTO chats_contacts (chat_id, contact_id) VALUES(?, ?)", + params![chat_id, contact_id], )?; if contact_id == DC_CONTACT_ID_SELF {