diff options
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbevents.cpp')
-rw-r--r-- | plugins/Dbx_sqlite/src/dbevents.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index c8185fc815..70f3a6e740 100644 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -287,6 +287,13 @@ BOOL CDbxSQLite::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static void str2json(CMStringA &str)
+{
+ str.Replace("\\", "\\\\");
+}
+
int CDbxSQLite::SetEventJson(MEVENT hDbEvent, const char *szSetting, DBVARIANT *dbv)
{
if (hDbEvent == 0)
@@ -310,7 +317,18 @@ int CDbxSQLite::SetEventJson(MEVENT hDbEvent, const char *szSetting, DBVARIANT * break;
case DBVT_ASCIIZ:
case DBVT_UTF8:
- sqlite3_bind_text(stmt, 2, dbv->pszVal, (int)mir_strlen(dbv->pszVal), nullptr);
+ {
+ tmp = dbv->pszVal;
+ str2json(tmp);
+ sqlite3_bind_text(stmt, 2, tmp, tmp.GetLength(), nullptr);
+ }
+ break;
+ case DBVT_WCHAR:
+ {
+ tmp = T2Utf(dbv->pwszVal).get();
+ str2json(tmp);
+ sqlite3_bind_text(stmt, 2, tmp, tmp.GetLength(), nullptr);
+ }
break;
default:
return 2;
|