]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
libdnf: Use single-quotes around string literals used in SQL statements
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>
Sun, 3 May 2020 21:15:15 +0000 (23:15 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 5 May 2020 12:18:41 +0000 (13:18 +0100)
If sqlite is built with -DSQLITE_DQS=0 in accordance with
https://sqlite.org/quirks.html#dblquote, migration to version 1.2 of the
history database would fail with:

  History database cannot be created: .../var/lib/dnf/history.sqlite.
  Error: SQLite error on ":memory:": Executing an SQL statement failed:
  no such column: 1.2

Signed-off-by: Peter Kjellerstedt <pkj@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/libdnf/libdnf/0001-Use-single-quotes-around-string-literals-used-in-SQL.patch [new file with mode: 0644]
meta/recipes-devtools/libdnf/libdnf_0.47.0.bb

diff --git a/meta/recipes-devtools/libdnf/libdnf/0001-Use-single-quotes-around-string-literals-used-in-SQL.patch b/meta/recipes-devtools/libdnf/libdnf/0001-Use-single-quotes-around-string-literals-used-in-SQL.patch
new file mode 100644 (file)
index 0000000..6be484f
--- /dev/null
@@ -0,0 +1,36 @@
+From 96ca7d0049461df2293dd0000edcbc69b64255e0 Mon Sep 17 00:00:00 2001
+From: Peter Kjellerstedt <pkj@axis.com>
+Date: Sun, 3 May 2020 22:40:39 +0200
+Subject: [PATCH] Use single-quotes around string literals used in SQL
+ statements
+
+If sqlite is built with -DSQLITE_DQS=0 in accordance with
+https://sqlite.org/quirks.html#dblquote, migration to version 1.2 of the
+history database would fail with:
+
+  History database cannot be created: /var/lib/dnf/history.sqlite.
+  Error: SQLite error on ":memory:": Executing an SQL statement failed:
+  no such column: 1.2
+
+Upstream-Status: Submitted [https://github.com/rpm-software-management/libdnf/pull/951]
+Signed-off-by: Peter Kjellerstedt <pkj@axis.com>
+---
+ libdnf/transaction/sql/migrate_tables_1_2.sql | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libdnf/transaction/sql/migrate_tables_1_2.sql b/libdnf/transaction/sql/migrate_tables_1_2.sql
+index 49b75315..f80ad1c4 100644
+--- a/libdnf/transaction/sql/migrate_tables_1_2.sql
++++ b/libdnf/transaction/sql/migrate_tables_1_2.sql
+@@ -1,9 +1,9 @@
+ R"**(
+ BEGIN TRANSACTION;
+     ALTER TABLE trans
+-        ADD comment TEXT DEFAULT "";
++        ADD comment TEXT DEFAULT '';
+     UPDATE config
+-        SET value = "1.2"
++        SET value = '1.2'
+         WHERE key = 'version';
+ COMMIT;
+ )**"
index 1b4b7e423335111a697a0cfb5485461606b748ac..1b06d66b19ca34e28438dd94a30bff30b4380f27 100644 (file)
@@ -8,6 +8,7 @@ SRC_URI = "git://github.com/rpm-software-management/libdnf;branch=dnf-4-master \
            file://0001-Get-parameters-for-both-libsolv-and-libsolvext-libdn.patch \
            file://0001-Add-WITH_TESTS-option.patch \
            file://0001-Look-fo-sphinx-only-if-documentation-is-actually-ena.patch \
+           file://0001-Use-single-quotes-around-string-literals-used-in-SQL.patch \
            "
 
 SRCREV = "8330eea6985c4e4b53796f858de5b6b38b1ddf5c"