Fix SQL syntax error

This commit is contained in:
Sergey Levitin 2020-10-23 22:26:27 +03:00
parent 844a198753
commit 7ba0a5b5a4

View file

@ -5,6 +5,7 @@ use sqlx::{sqlite::SqlitePool, Executor};
use std::{ use std::{
convert::Infallible, convert::Infallible,
fmt::{Debug, Display}, fmt::{Debug, Display},
str,
sync::Arc, sync::Arc,
}; };
use thiserror::Error; use thiserror::Error;
@ -114,14 +115,13 @@ where
}; };
let upd_dialogue = let upd_dialogue =
self.serializer.serialize(&dialogue).map_err(SqliteStorageError::SerdeError)?; self.serializer.serialize(&dialogue).map_err(SqliteStorageError::SerdeError)?;
self.pool self.pool
.acquire() .acquire()
.await? .await?
.execute( .execute(
sqlx::query( sqlx::query(
r#" r#"
INSERT INTO teloxide_dialogues VALUES (?, ?) WHERE chat_id = ? INSERT INTO teloxide_dialogues VALUES (?, ?)
ON CONFLICT(chat_id) DO UPDATE SET dialogue=excluded.dialogue ON CONFLICT(chat_id) DO UPDATE SET dialogue=excluded.dialogue
"#, "#,
) )