- Add sqlite3-django.patch to fix builds of django

OBS-URL: https://build.opensuse.org/package/show/server:database/sqlite3?expand=0&rev=235
This commit is contained in:
Martin Pluskal 2019-12-10 11:41:51 +00:00 committed by Git OBS Bridge
parent 8693102bf0
commit 5ce7153b11
3 changed files with 155 additions and 1 deletions

147
sqlite3-django.patch Normal file
View File

@ -0,0 +1,147 @@
Index: sqlite-src-3300100/ext/fts5/test/fts5misc.test
===================================================================
--- sqlite-src-3300100.orig/ext/fts5/test/fts5misc.test
+++ sqlite-src-3300100/ext/fts5/test/fts5misc.test
@@ -106,6 +106,31 @@ do_execsql_test 2.2.5 {
INSERT INTO vt0(vt0) VALUES('integrity-check');
}
+#-------------------------------------------------------------------------
+#
+reset_db
+do_execsql_test 7.0 {
+ CREATE VIRTUAL TABLE t1 USING fts5(x);
+ INSERT INTO t1(rowid, x) VALUES(1, 'hello world');
+ INSERT INTO t1(rowid, x) VALUES(2, 'well said');
+ INSERT INTO t1(rowid, x) VALUES(3, 'hello said');
+ INSERT INTO t1(rowid, x) VALUES(4, 'well world');
+
+ CREATE TABLE t2 (a, b);
+ INSERT INTO t2 VALUES(1, 'hello');
+ INSERT INTO t2 VALUES(2, 'world');
+ INSERT INTO t2 VALUES(3, 'said');
+ INSERT INTO t2 VALUES(4, 'hello');
+}
+
+do_execsql_test 7.1 {
+ SELECT rowid FROM t1 WHERE (rowid, x) IN (SELECT a, b FROM t2);
+}
+
+do_execsql_test 7.2 {
+ SELECT rowid FROM t1 WHERE rowid=2 AND t1 = 'hello';
+}
+
finish_test
Index: sqlite-src-3300100/src/wherecode.c
===================================================================
--- sqlite-src-3300100.orig/src/wherecode.c
+++ sqlite-src-3300100/src/wherecode.c
@@ -1307,7 +1307,9 @@ Bitmask sqlite3WhereCodeOneLoopStart(
pTerm = pLoop->aLTerm[j];
if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){
disableTerm(pLevel, pTerm);
- }else if( (pTerm->eOperator & WO_IN)!=0 ){
+ }else if( (pTerm->eOperator & WO_IN)!=0 &&
+ sqlite3ExprVectorSize(pTerm->pExpr->pLeft)==1
+ ){
Expr *pCompare; /* The comparison operator */
Expr *pRight; /* RHS of the comparison */
VdbeOp *pOp; /* Opcode to access the value of the IN constraint */
Index: sqlite-src-3300100/test/rowvaluevtab.test
===================================================================
--- /dev/null
+++ sqlite-src-3300100/test/rowvaluevtab.test
@@ -0,0 +1,91 @@
+# 2018 October 14
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set ::testprefix rowvaluevtab
+
+register_echo_module db
+
+do_execsql_test 1.0 {
+ CREATE TABLE t1(a, b, c);
+ CREATE INDEX t1b ON t1(b);
+ INSERT INTO t1 VALUES('one', 1, 1);
+ INSERT INTO t1 VALUES('two', 1, 2);
+ INSERT INTO t1 VALUES('three', 1, 3);
+ INSERT INTO t1 VALUES('four', 2, 1);
+ INSERT INTO t1 VALUES('five', 2, 2);
+ INSERT INTO t1 VALUES('six', 2, 3);
+ INSERT INTO t1 VALUES('seven', 3, 1);
+ INSERT INTO t1 VALUES('eight', 3, 2);
+ INSERT INTO t1 VALUES('nine', 3, 3);
+
+ WITH s(i) AS (
+ SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<10000
+ ) INSERT INTO t1 SELECT NULL, NULL, NULL FROM s;
+ CREATE VIRTUAL TABLE e1 USING echo(t1);
+}
+
+proc do_vfilter4_test {tn sql expected} {
+ set res [list]
+ db eval "explain $sql" {
+ if {$opcode=="VFilter"} {
+ lappend res $p4
+ }
+ }
+ uplevel [list do_test $tn [list set {} $res] [list {*}$expected]]
+}
+
+do_execsql_test 1.1 {
+ SELECT a FROM e1 WHERE (b, c) = (2, 2)
+} {five}
+do_vfilter4_test 1.1f {
+ SELECT a FROM e1 WHERE (b, c) = (?, ?)
+} {{SELECT rowid, a, b, c FROM 't1' WHERE b = ?}}
+
+do_execsql_test 1.2 {
+ SELECT a FROM e1 WHERE (b, c) > (2, 2)
+} {six seven eight nine}
+do_vfilter4_test 1.2f {
+ SELECT a FROM e1 WHERE (b, c) > (2, 2)
+} {
+ {SELECT rowid, a, b, c FROM 't1' WHERE b >= ?}
+}
+
+do_execsql_test 1.3 {
+ SELECT a FROM e1 WHERE (b, c) >= (2, 2)
+} {five six seven eight nine}
+do_vfilter4_test 1.3f {
+ SELECT a FROM e1 WHERE (b, c) >= (2, 2)
+} {
+ {SELECT rowid, a, b, c FROM 't1' WHERE b >= ?}
+}
+
+do_execsql_test 1.3 {
+ SELECT a FROM e1 WHERE (b, c) BETWEEN (1, 2) AND (2, 3)
+} {two three four five six}
+do_vfilter4_test 1.3f {
+ SELECT a FROM e1 WHERE (b, c) BETWEEN (1, 2) AND (2, 3)
+} {
+ {SELECT rowid, a, b, c FROM 't1' WHERE b >= ? AND b <= ?}
+}
+
+do_execsql_test 1.4 {
+ SELECT a FROM e1 WHERE (b, c) IN ( VALUES(2, 2) )
+} {five}
+do_vfilter4_test 1.4f {
+ SELECT a FROM e1 WHERE (b, c) IN ( VALUES(2, 2) )
+} {{SELECT rowid, a, b, c FROM 't1' WHERE b = ?}}
+
+finish_test
+

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Dec 10 11:30:35 UTC 2019 - Martin Pluskal <mpluskal@suse.com>
- Add sqlite3-django.patch to fix builds of django
-------------------------------------------------------------------
Fri Oct 11 15:05:00 UTC 2019 - Andreas Stieger <andreas.stieger@gmx.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package sqlite3
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -28,6 +28,7 @@ URL: http://www.sqlite.org/
Source0: http://www.sqlite.org/2019/sqlite-src-%{tarversion}.zip
Source1: baselibs.conf
Source2: http://www.sqlite.org/2019/sqlite-doc-%{tarversion}.zip
Patch0: sqlite3-django.patch
BuildRequires: automake
BuildRequires: libtool
BuildRequires: pkgconfig
@ -103,6 +104,7 @@ other documentation found on sqlite.org. The files can be found in
%prep
%setup -q -n sqlite-src-%{tarversion} -a2
%patch0 -p1
rm -v sqlite-doc-%{tarversion}/releaselog/current.html
ln -sv `echo %{version} | sed "s/\./_/g"`.html sqlite-doc-%{tarversion}/releaselog/current.html
find -type f -name sqlite.css~ -delete