Fix a parameter binding issue when storing chart names in the database (#10717)
Stelios Fragkakis committed
Mar 8, 2021 at 11:32 UTC
790af9620f400471d274339db4ec7dd7a9f18982
2 files changed
+9
-4
database/sqlite/Makefile.am
new
+4
@@ -0,0 +1,4 @@
1
+# SPDX-License-Identifier: GPL-3.0-or-later
2
+
3
+AUTOMAKE_OPTIONS = subdir-objects
4
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
database/sqlite/sqlite_functions.c
+5
-4
@@ -530,11 +530,12 @@ int sql_store_chart(
530
goto bind_fail;
531
532
param++;
533
- if (name) {
533
+ if (name && *name)
534
rc = sqlite3_bind_text(res, 5, name, -1, SQLITE_STATIC);
535
- if (unlikely(rc != SQLITE_OK))
536
- goto bind_fail;
537
- }
535
+ else
536
+ rc = sqlite3_bind_null(res, 5);
537
+ if (unlikely(rc != SQLITE_OK))
538
+ goto bind_fail;
539
540
param++;
541
rc = sqlite3_bind_text(res, 6, family, -1, SQLITE_STATIC);