summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite/src/dbevents.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-13 20:35:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-13 20:35:18 +0300
commitaa5197082f1567e37b85911752b92a489d6515c3 (patch)
treed01f42ea2d7605dcdce9436a0cdb02c004b88bf8 /plugins/Dbx_sqlite/src/dbevents.cpp
parentc9c5aa41357e260e2cdec1742f64d2d594f312b8 (diff)
DbxSqlite: query optimization
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbevents.cpp')
-rw-r--r--plugins/Dbx_sqlite/src/dbevents.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp
index 5a287b03ad..48e3b6eb99 100644
--- a/plugins/Dbx_sqlite/src/dbevents.cpp
+++ b/plugins/Dbx_sqlite/src/dbevents.cpp
@@ -300,9 +300,12 @@ int CDbxSQLite::SetEventJson(MEVENT hDbEvent, const char *szSetting, DBVARIANT *
if (hDbEvent == 0)
return 1;
- { mir_cslock lock(m_csDbAccess);
- sqlite3_stmt *stmt = InitQuery("UPDATE events SET data=json_set(data, '$.?', ?) WHERE id = ?;", qEvEdit);
- sqlite3_bind_text(stmt, 1, szSetting, (int)mir_strlen(szSetting), nullptr);
+ CMStringA tmp(FORMAT, "$.%s", szSetting);
+ {
+ mir_cslock lock(m_csDbAccess);
+ sqlite3_stmt *stmt = InitQuery("UPDATE events SET data=json_set(data, ?, ?) WHERE id = ?;", qEvEdit);
+
+ sqlite3_bind_text(stmt, 1, tmp, tmp.GetLength(), nullptr);
switch (dbv->type) {
case DBVT_BYTE:
sqlite3_bind_int(stmt, 2, dbv->bVal);