tags 811068 + patch
user ubuntu-de...@lists.ubuntu.com
usertag 811068 + xenial ubuntu-patch
thanks

Quilt patch attached.

Robie
From: Robie Basak <robie.ba...@canonical.com>
Date: Sun, 10 Apr 2016 19:03:00 +0000
Subject: [PATCH 1/1] Accept SQLITE_INDEX_CONSTRAINT_LIKE from sqlite

sqlite 3.10.0 added the SQLITE_INDEX_CONSTRAINT_LIKE,
SQLITE_INDEX_CONSTRAINT_GLOB and SQLITE_INDEX_CONSTRAINT_REGEXP
constraint operators to the list that xBestIndex can be supplied. See
https://www.sqlite.org/vtab.html for details.

Compiling against sqlite 3.11 (the current version in Ubuntu Xenial and
Debian stretch) causes a build failure because sqlite supplies
SQLITE_INDEX_CONSTRAINT_LIKE and libgda's implementation of xBestIndex
cannot understand it:

ERROR:gda-vprovider-data-model.c:1316:map_sqlite3_info_to_gda_filter: code 
should not be reached
FAIL check_vcnc (exit status: 134)

Since libgda already defines (and thus presumably implements)
GDA_SQL_OPERATOR_TYPE_LIKE, update the sqlite virtual provider to use
it.

With this change, libgda5 5.2.4 builds and passes tests again when built
against sqlite 3.11. However it may be necessary to implement
SQLITE_INDEX_CONSTRAINT_GLOB and SQLITE_INDEX_CONSTRAINT_REGEXP also to
cover all possible queries.

Though not necessary for Debian or Ubuntu, it may be necessary to make
this change conditional on >= 3.10 if it is required that builds against
older sqlite versions are still possible.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=764860
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=811068
Forwarded: https://bugzilla.gnome.org/show_bug.cgi?id=764860
Last-Update: 2016-04-10
---
 libgda/sqlite/virtual/gda-vprovider-data-model.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c 
b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index 0393eaf..d966ab1 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -1355,6 +1355,9 @@ map_sqlite3_info_to_gda_filter (sqlite3_index_info *info, 
GdaVconnectionDataMode
                        case SQLITE_INDEX_CONSTRAINT_MATCH:
                                filter->aConstraint[j].op = 
GDA_SQL_OPERATOR_TYPE_REGEXP;
                                break;
+                       case SQLITE_INDEX_CONSTRAINT_LIKE:
+                               filter->aConstraint[j].op = 
GDA_SQL_OPERATOR_TYPE_LIKE;
+                               break;
                        default:
                                g_assert_not_reached ();
                        }
-- 
2.5.0

Attachment: signature.asc
Description: PGP signature

Reply via email to