Add support for the Geopoly extension to the R-Tree extension. This also

involves adding the SQLITE_INDEX_CONSTRAINT_FUNCTION capability to the 
xFindFunction method of the sqlite3_module object, and to the
sqlite3_index_info.aConstraint.op field in the xBestIndex implementation of
virtual tables.

FossilOrigin-Name: 666133e32ca8e95807f8437dc8401bc93e2e6508ab8e6ae1e6031b7cee1584ae
This commit is contained in:
drh 2018-08-27 17:13:12 +00:00
commit 5965fed24e
14 changed files with 2210 additions and 50 deletions

View File

@ -350,7 +350,8 @@ SRC += \
$(TOP)/ext/icu/icu.c
SRC += \
$(TOP)/ext/rtree/rtree.h \
$(TOP)/ext/rtree/rtree.c
$(TOP)/ext/rtree/rtree.c \
$(TOP)/ext/rtree/geopoly.c
SRC += \
$(TOP)/ext/session/sqlite3session.c \
$(TOP)/ext/session/sqlite3session.h
@ -552,7 +553,8 @@ EXTHDR += \
$(TOP)/ext/fts3/fts3_hash.h \
$(TOP)/ext/fts3/fts3_tokenizer.h
EXTHDR += \
$(TOP)/ext/rtree/rtree.h
$(TOP)/ext/rtree/rtree.h \
$(TOP)/ext/rtree/geopoly.c
EXTHDR += \
$(TOP)/ext/icu/sqliteicu.h
EXTHDR += \

View File

@ -338,7 +338,7 @@ SQLITE_TCL_DEP =
!IFNDEF OPT_FEATURE_FLAGS
!IF $(MINIMAL_AMALGAMATION)==0
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_GEOPOLY=1
!ENDIF
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
!ENDIF
@ -1413,6 +1413,7 @@ SRC09 = \
$(TOP)\ext\fts3\fts3_tokenizer.h \
$(TOP)\ext\icu\sqliteicu.h \
$(TOP)\ext\rtree\rtree.h \
$(TOP)\ext\rtree\geopoly.c \
$(TOP)\ext\rbu\sqlite3rbu.h \
$(TOP)\ext\session\sqlite3session.h
@ -1587,7 +1588,8 @@ EXTHDR = $(EXTHDR) \
$(TOP)\ext\fts3\fts3_hash.h \
$(TOP)\ext\fts3\fts3_tokenizer.h
EXTHDR = $(EXTHDR) \
$(TOP)\ext\rtree\rtree.h
$(TOP)\ext\rtree\rtree.h \
$(TOP)\ext\rtree\geopoly.c
EXTHDR = $(EXTHDR) \
$(TOP)\ext\icu\sqliteicu.h
EXTHDR = $(EXTHDR) \

44
configure vendored
View File

@ -911,6 +911,7 @@ enable_fts4
enable_fts5
enable_json1
enable_update_limit
enable_geopoly
enable_rtree
enable_session
enable_gcov
@ -1563,6 +1564,7 @@ Optional Features:
--enable-fts5 Enable the FTS5 extension
--enable-json1 Enable the JSON1 extension
--enable-update-limit Enable the UPDATE/DELETE LIMIT clause
--enable-geopoly Enable the GEOPOLY extension
--enable-rtree Enable the RTREE extension
--enable-session Enable the SESSION extension
--enable-gcov Enable coverage testing using gcov
@ -3932,13 +3934,13 @@ if ${lt_cv_nm_interface+:} false; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:3935: $ac_compile\"" >&5)
(eval echo "\"\$as_me:3937: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:3938: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:3940: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:3941: output\"" >&5)
(eval echo "\"\$as_me:3943: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@ -5144,7 +5146,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 5147 "configure"' > conftest.$ac_ext
echo '#line 5149 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -6669,11 +6671,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6672: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6674: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:6676: \$? = $ac_status" >&5
echo "$as_me:6678: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -7008,11 +7010,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7011: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7013: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:7015: \$? = $ac_status" >&5
echo "$as_me:7017: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -7113,11 +7115,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7116: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7118: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:7120: \$? = $ac_status" >&5
echo "$as_me:7122: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -7168,11 +7170,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7171: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7173: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:7175: \$? = $ac_status" >&5
echo "$as_me:7177: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -9548,7 +9550,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 9551 "configure"
#line 9553 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -9644,7 +9646,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 9647 "configure"
#line 9649 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11610,6 +11612,20 @@ if test "${enable_udlimit}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT"
fi
#########
# See whether we should enable GEOPOLY
# Check whether --enable-geopoly was given.
if test "${enable_geopoly+set}" = set; then :
enableval=$enable_geopoly; enable_geopoly=yes
else
enable_geopoly=no
fi
if test "${enable_geopoly}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_GEOPOLY"
enable_rtree=yes
fi
#########
# See whether we should enable RTREE
# Check whether --enable-rtree was given.

View File

@ -649,6 +649,16 @@ if test "${enable_udlimit}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT"
fi
#########
# See whether we should enable GEOPOLY
AC_ARG_ENABLE(geopoly, AC_HELP_STRING([--enable-geopoly],
[Enable the GEOPOLY extension]),
[enable_geopoly=yes],[enable_geopoly=no])
if test "${enable_geopoly}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_GEOPOLY"
enable_rtree=yes
fi
#########
# See whether we should enable RTREE
AC_ARG_ENABLE(rtree, AC_HELP_STRING([--enable-rtree],

1558
ext/rtree/geopoly.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2893,7 +2893,7 @@ static int reinsertNodeContent(Rtree *pRtree, RtreeNode *pNode){
/*
** Select a currently unused rowid for a new r-tree record.
*/
static int newRowid(Rtree *pRtree, i64 *piRowid){
static int rtreeNewRowid(Rtree *pRtree, i64 *piRowid){
int rc;
sqlite3_bind_null(pRtree->pWriteRowid, 1);
sqlite3_bind_null(pRtree->pWriteRowid, 2);
@ -3180,7 +3180,7 @@ static int rtreeUpdate(
/* Figure out the rowid of the new row. */
if( bHaveRowid==0 ){
rc = newRowid(pRtree, &cell.iRowid);
rc = rtreeNewRowid(pRtree, &cell.iRowid);
}
*pRowid = cell.iRowid;
@ -4222,6 +4222,10 @@ static void rtreecheck(
}
}
/* Conditionally include the geopoly code */
#ifdef SQLITE_ENABLE_GEOPOLY
# include "geopoly.c"
#endif
/*
** Register the r-tree module with database handle db. This creates the
@ -4251,6 +4255,11 @@ int sqlite3RtreeInit(sqlite3 *db){
void *c = (void *)RTREE_COORD_INT32;
rc = sqlite3_create_module_v2(db, "rtree_i32", &rtreeModule, c, 0);
}
#ifdef SQLITE_ENABLE_GEOPOLY
if( rc==SQLITE_OK ){
rc = sqlite3_geopoly_init(db);
}
#endif
return rc;
}

517
ext/rtree/visual01.txt Normal file
View File

@ -0,0 +1,517 @@
#!sqlite3
#
# This is a visual test case for the geopoly virtual table.
#
# Run this script in the sqlite3 CLI, and redirect output into an
# HTML file. This display the HTML in a webbrowser.
#
/* Test data.
** Lots of shapes to be displayed over a 1000x800 canvas.
*/
CREATE TEMP TABLE basis(name TEXT, jshape TEXT);
INSERT INTO basis(name,jshape) VALUES
('box-20','[[0,0],[20,0],[20,20],[0,20],[0,0]]'),
('house-70','[[0,0],[50,0],[50,50],[25,70],[0,50],[0,0]]'),
('line-40','[[0,0],[40,0],[40,5],[0,5],[0,0]]'),
('line-80','[[0,0],[80,0],[80,7],[0,7],[0,0]]'),
('arrow-50','[[0,0],[25,25],[0,50],[15,25],[0,0]]'),
('triangle-30','[[0,0],[30,0],[15,30],[0,0]]'),
('angle-30','[[0,0],[30,0],[30,30],[26,30],[26,4],[0,4],[0,0]]'),
('star-10','[[1,0],[5,2],[9,0],[7,4],[10,8],[7,7],[5,10],[3,7],[0,8],[3,4],[1,0]]');
CREATE TEMP TABLE xform(A,B,C,D,clr);
INSERT INTO xform(A,B,clr) VALUES
(1,0,'black'),
(0.707,0.707,'blue'),
(0.5,0.866,'red'),
(-0.866,0.5,'green');
CREATE TEMP TABLE xyoff(id1,id2,xoff,yoff,PRIMARY KEY(id1,id2,xoff,yoff))
WITHOUT ROWID;
INSERT INTO xyoff VALUES(1,1,811,659);
INSERT INTO xyoff VALUES(1,1,235,550);
INSERT INTO xyoff VALUES(1,1,481,620);
INSERT INTO xyoff VALUES(1,1,106,494);
INSERT INTO xyoff VALUES(1,1,487,106);
INSERT INTO xyoff VALUES(1,1,817,595);
INSERT INTO xyoff VALUES(1,1,240,504);
INSERT INTO xyoff VALUES(1,1,806,457);
INSERT INTO xyoff VALUES(1,1,608,107);
INSERT INTO xyoff VALUES(1,1,768,662);
INSERT INTO xyoff VALUES(1,2,808,528);
INSERT INTO xyoff VALUES(1,2,768,528);
INSERT INTO xyoff VALUES(1,2,771,171);
INSERT INTO xyoff VALUES(1,2,275,671);
INSERT INTO xyoff VALUES(1,2,326,336);
INSERT INTO xyoff VALUES(1,2,690,688);
INSERT INTO xyoff VALUES(1,2,597,239);
INSERT INTO xyoff VALUES(1,2,317,528);
INSERT INTO xyoff VALUES(1,2,366,223);
INSERT INTO xyoff VALUES(1,2,621,154);
INSERT INTO xyoff VALUES(1,3,829,469);
INSERT INTO xyoff VALUES(1,3,794,322);
INSERT INTO xyoff VALUES(1,3,358,387);
INSERT INTO xyoff VALUES(1,3,184,444);
INSERT INTO xyoff VALUES(1,3,729,500);
INSERT INTO xyoff VALUES(1,3,333,523);
INSERT INTO xyoff VALUES(1,3,117,595);
INSERT INTO xyoff VALUES(1,3,496,201);
INSERT INTO xyoff VALUES(1,3,818,601);
INSERT INTO xyoff VALUES(1,3,541,343);
INSERT INTO xyoff VALUES(1,4,603,248);
INSERT INTO xyoff VALUES(1,4,761,649);
INSERT INTO xyoff VALUES(1,4,611,181);
INSERT INTO xyoff VALUES(1,4,607,233);
INSERT INTO xyoff VALUES(1,4,860,206);
INSERT INTO xyoff VALUES(1,4,310,231);
INSERT INTO xyoff VALUES(1,4,727,539);
INSERT INTO xyoff VALUES(1,4,660,661);
INSERT INTO xyoff VALUES(1,4,403,133);
INSERT INTO xyoff VALUES(1,4,619,331);
INSERT INTO xyoff VALUES(2,1,712,578);
INSERT INTO xyoff VALUES(2,1,567,313);
INSERT INTO xyoff VALUES(2,1,231,423);
INSERT INTO xyoff VALUES(2,1,490,175);
INSERT INTO xyoff VALUES(2,1,898,353);
INSERT INTO xyoff VALUES(2,1,589,483);
INSERT INTO xyoff VALUES(2,1,188,462);
INSERT INTO xyoff VALUES(2,1,720,106);
INSERT INTO xyoff VALUES(2,1,793,380);
INSERT INTO xyoff VALUES(2,1,154,396);
INSERT INTO xyoff VALUES(2,2,324,218);
INSERT INTO xyoff VALUES(2,2,120,327);
INSERT INTO xyoff VALUES(2,2,655,133);
INSERT INTO xyoff VALUES(2,2,516,603);
INSERT INTO xyoff VALUES(2,2,529,572);
INSERT INTO xyoff VALUES(2,2,481,212);
INSERT INTO xyoff VALUES(2,2,802,107);
INSERT INTO xyoff VALUES(2,2,234,509);
INSERT INTO xyoff VALUES(2,2,501,269);
INSERT INTO xyoff VALUES(2,2,349,553);
INSERT INTO xyoff VALUES(2,3,495,685);
INSERT INTO xyoff VALUES(2,3,897,372);
INSERT INTO xyoff VALUES(2,3,350,681);
INSERT INTO xyoff VALUES(2,3,832,257);
INSERT INTO xyoff VALUES(2,3,778,149);
INSERT INTO xyoff VALUES(2,3,683,426);
INSERT INTO xyoff VALUES(2,3,693,217);
INSERT INTO xyoff VALUES(2,3,746,317);
INSERT INTO xyoff VALUES(2,3,805,369);
INSERT INTO xyoff VALUES(2,3,336,585);
INSERT INTO xyoff VALUES(2,4,890,255);
INSERT INTO xyoff VALUES(2,4,556,565);
INSERT INTO xyoff VALUES(2,4,865,555);
INSERT INTO xyoff VALUES(2,4,230,293);
INSERT INTO xyoff VALUES(2,4,247,251);
INSERT INTO xyoff VALUES(2,4,730,563);
INSERT INTO xyoff VALUES(2,4,318,282);
INSERT INTO xyoff VALUES(2,4,220,431);
INSERT INTO xyoff VALUES(2,4,828,336);
INSERT INTO xyoff VALUES(2,4,278,525);
INSERT INTO xyoff VALUES(3,1,324,656);
INSERT INTO xyoff VALUES(3,1,625,362);
INSERT INTO xyoff VALUES(3,1,155,570);
INSERT INTO xyoff VALUES(3,1,267,433);
INSERT INTO xyoff VALUES(3,1,599,121);
INSERT INTO xyoff VALUES(3,1,873,498);
INSERT INTO xyoff VALUES(3,1,789,520);
INSERT INTO xyoff VALUES(3,1,656,378);
INSERT INTO xyoff VALUES(3,1,831,601);
INSERT INTO xyoff VALUES(3,1,256,471);
INSERT INTO xyoff VALUES(3,2,332,258);
INSERT INTO xyoff VALUES(3,2,305,463);
INSERT INTO xyoff VALUES(3,2,796,341);
INSERT INTO xyoff VALUES(3,2,830,229);
INSERT INTO xyoff VALUES(3,2,413,271);
INSERT INTO xyoff VALUES(3,2,269,140);
INSERT INTO xyoff VALUES(3,2,628,441);
INSERT INTO xyoff VALUES(3,2,747,643);
INSERT INTO xyoff VALUES(3,2,584,435);
INSERT INTO xyoff VALUES(3,2,784,314);
INSERT INTO xyoff VALUES(3,3,722,233);
INSERT INTO xyoff VALUES(3,3,815,421);
INSERT INTO xyoff VALUES(3,3,401,267);
INSERT INTO xyoff VALUES(3,3,451,650);
INSERT INTO xyoff VALUES(3,3,329,485);
INSERT INTO xyoff VALUES(3,3,878,370);
INSERT INTO xyoff VALUES(3,3,162,616);
INSERT INTO xyoff VALUES(3,3,844,183);
INSERT INTO xyoff VALUES(3,3,161,216);
INSERT INTO xyoff VALUES(3,3,176,676);
INSERT INTO xyoff VALUES(3,4,780,128);
INSERT INTO xyoff VALUES(3,4,566,121);
INSERT INTO xyoff VALUES(3,4,646,120);
INSERT INTO xyoff VALUES(3,4,223,557);
INSERT INTO xyoff VALUES(3,4,251,117);
INSERT INTO xyoff VALUES(3,4,139,209);
INSERT INTO xyoff VALUES(3,4,813,597);
INSERT INTO xyoff VALUES(3,4,454,538);
INSERT INTO xyoff VALUES(3,4,616,198);
INSERT INTO xyoff VALUES(3,4,210,159);
INSERT INTO xyoff VALUES(4,1,208,415);
INSERT INTO xyoff VALUES(4,1,326,665);
INSERT INTO xyoff VALUES(4,1,612,133);
INSERT INTO xyoff VALUES(4,1,537,513);
INSERT INTO xyoff VALUES(4,1,638,438);
INSERT INTO xyoff VALUES(4,1,808,269);
INSERT INTO xyoff VALUES(4,1,552,121);
INSERT INTO xyoff VALUES(4,1,100,189);
INSERT INTO xyoff VALUES(4,1,643,664);
INSERT INTO xyoff VALUES(4,1,726,378);
INSERT INTO xyoff VALUES(4,2,478,409);
INSERT INTO xyoff VALUES(4,2,497,507);
INSERT INTO xyoff VALUES(4,2,233,148);
INSERT INTO xyoff VALUES(4,2,587,237);
INSERT INTO xyoff VALUES(4,2,604,166);
INSERT INTO xyoff VALUES(4,2,165,455);
INSERT INTO xyoff VALUES(4,2,320,258);
INSERT INTO xyoff VALUES(4,2,353,496);
INSERT INTO xyoff VALUES(4,2,347,495);
INSERT INTO xyoff VALUES(4,2,166,622);
INSERT INTO xyoff VALUES(4,3,461,332);
INSERT INTO xyoff VALUES(4,3,685,278);
INSERT INTO xyoff VALUES(4,3,427,594);
INSERT INTO xyoff VALUES(4,3,467,346);
INSERT INTO xyoff VALUES(4,3,125,548);
INSERT INTO xyoff VALUES(4,3,597,680);
INSERT INTO xyoff VALUES(4,3,820,445);
INSERT INTO xyoff VALUES(4,3,144,330);
INSERT INTO xyoff VALUES(4,3,557,434);
INSERT INTO xyoff VALUES(4,3,254,315);
INSERT INTO xyoff VALUES(4,4,157,339);
INSERT INTO xyoff VALUES(4,4,249,220);
INSERT INTO xyoff VALUES(4,4,391,323);
INSERT INTO xyoff VALUES(4,4,589,429);
INSERT INTO xyoff VALUES(4,4,859,592);
INSERT INTO xyoff VALUES(4,4,337,680);
INSERT INTO xyoff VALUES(4,4,410,288);
INSERT INTO xyoff VALUES(4,4,636,596);
INSERT INTO xyoff VALUES(4,4,734,433);
INSERT INTO xyoff VALUES(4,4,559,549);
INSERT INTO xyoff VALUES(5,1,549,607);
INSERT INTO xyoff VALUES(5,1,584,498);
INSERT INTO xyoff VALUES(5,1,699,116);
INSERT INTO xyoff VALUES(5,1,525,524);
INSERT INTO xyoff VALUES(5,1,304,667);
INSERT INTO xyoff VALUES(5,1,302,232);
INSERT INTO xyoff VALUES(5,1,403,149);
INSERT INTO xyoff VALUES(5,1,824,403);
INSERT INTO xyoff VALUES(5,1,697,203);
INSERT INTO xyoff VALUES(5,1,293,689);
INSERT INTO xyoff VALUES(5,2,199,275);
INSERT INTO xyoff VALUES(5,2,395,393);
INSERT INTO xyoff VALUES(5,2,657,642);
INSERT INTO xyoff VALUES(5,2,200,655);
INSERT INTO xyoff VALUES(5,2,882,234);
INSERT INTO xyoff VALUES(5,2,483,565);
INSERT INTO xyoff VALUES(5,2,755,640);
INSERT INTO xyoff VALUES(5,2,810,305);
INSERT INTO xyoff VALUES(5,2,731,655);
INSERT INTO xyoff VALUES(5,2,466,690);
INSERT INTO xyoff VALUES(5,3,563,584);
INSERT INTO xyoff VALUES(5,3,491,117);
INSERT INTO xyoff VALUES(5,3,779,292);
INSERT INTO xyoff VALUES(5,3,375,637);
INSERT INTO xyoff VALUES(5,3,253,553);
INSERT INTO xyoff VALUES(5,3,797,514);
INSERT INTO xyoff VALUES(5,3,229,480);
INSERT INTO xyoff VALUES(5,3,257,194);
INSERT INTO xyoff VALUES(5,3,449,555);
INSERT INTO xyoff VALUES(5,3,849,630);
INSERT INTO xyoff VALUES(5,4,329,286);
INSERT INTO xyoff VALUES(5,4,640,197);
INSERT INTO xyoff VALUES(5,4,104,150);
INSERT INTO xyoff VALUES(5,4,438,272);
INSERT INTO xyoff VALUES(5,4,773,226);
INSERT INTO xyoff VALUES(5,4,441,650);
INSERT INTO xyoff VALUES(5,4,242,340);
INSERT INTO xyoff VALUES(5,4,301,435);
INSERT INTO xyoff VALUES(5,4,171,397);
INSERT INTO xyoff VALUES(5,4,541,619);
INSERT INTO xyoff VALUES(6,1,651,301);
INSERT INTO xyoff VALUES(6,1,637,137);
INSERT INTO xyoff VALUES(6,1,765,643);
INSERT INTO xyoff VALUES(6,1,173,296);
INSERT INTO xyoff VALUES(6,1,263,192);
INSERT INTO xyoff VALUES(6,1,791,302);
INSERT INTO xyoff VALUES(6,1,860,601);
INSERT INTO xyoff VALUES(6,1,780,445);
INSERT INTO xyoff VALUES(6,1,462,214);
INSERT INTO xyoff VALUES(6,1,802,207);
INSERT INTO xyoff VALUES(6,2,811,685);
INSERT INTO xyoff VALUES(6,2,533,531);
INSERT INTO xyoff VALUES(6,2,390,614);
INSERT INTO xyoff VALUES(6,2,260,580);
INSERT INTO xyoff VALUES(6,2,116,377);
INSERT INTO xyoff VALUES(6,2,860,458);
INSERT INTO xyoff VALUES(6,2,438,590);
INSERT INTO xyoff VALUES(6,2,604,562);
INSERT INTO xyoff VALUES(6,2,241,242);
INSERT INTO xyoff VALUES(6,2,667,298);
INSERT INTO xyoff VALUES(6,3,787,698);
INSERT INTO xyoff VALUES(6,3,868,521);
INSERT INTO xyoff VALUES(6,3,412,587);
INSERT INTO xyoff VALUES(6,3,640,131);
INSERT INTO xyoff VALUES(6,3,748,410);
INSERT INTO xyoff VALUES(6,3,257,244);
INSERT INTO xyoff VALUES(6,3,411,195);
INSERT INTO xyoff VALUES(6,3,464,356);
INSERT INTO xyoff VALUES(6,3,157,339);
INSERT INTO xyoff VALUES(6,3,434,505);
INSERT INTO xyoff VALUES(6,4,480,671);
INSERT INTO xyoff VALUES(6,4,519,228);
INSERT INTO xyoff VALUES(6,4,404,513);
INSERT INTO xyoff VALUES(6,4,120,538);
INSERT INTO xyoff VALUES(6,4,403,663);
INSERT INTO xyoff VALUES(6,4,477,677);
INSERT INTO xyoff VALUES(6,4,690,154);
INSERT INTO xyoff VALUES(6,4,606,498);
INSERT INTO xyoff VALUES(6,4,430,665);
INSERT INTO xyoff VALUES(6,4,499,273);
INSERT INTO xyoff VALUES(7,1,118,526);
INSERT INTO xyoff VALUES(7,1,817,522);
INSERT INTO xyoff VALUES(7,1,388,638);
INSERT INTO xyoff VALUES(7,1,181,265);
INSERT INTO xyoff VALUES(7,1,442,332);
INSERT INTO xyoff VALUES(7,1,475,282);
INSERT INTO xyoff VALUES(7,1,722,633);
INSERT INTO xyoff VALUES(7,1,104,394);
INSERT INTO xyoff VALUES(7,1,631,262);
INSERT INTO xyoff VALUES(7,1,372,392);
INSERT INTO xyoff VALUES(7,2,600,413);
INSERT INTO xyoff VALUES(7,2,386,223);
INSERT INTO xyoff VALUES(7,2,839,174);
INSERT INTO xyoff VALUES(7,2,293,410);
INSERT INTO xyoff VALUES(7,2,281,391);
INSERT INTO xyoff VALUES(7,2,859,387);
INSERT INTO xyoff VALUES(7,2,478,347);
INSERT INTO xyoff VALUES(7,2,646,690);
INSERT INTO xyoff VALUES(7,2,713,234);
INSERT INTO xyoff VALUES(7,2,199,588);
INSERT INTO xyoff VALUES(7,3,389,256);
INSERT INTO xyoff VALUES(7,3,349,542);
INSERT INTO xyoff VALUES(7,3,363,345);
INSERT INTO xyoff VALUES(7,3,751,302);
INSERT INTO xyoff VALUES(7,3,423,386);
INSERT INTO xyoff VALUES(7,3,267,444);
INSERT INTO xyoff VALUES(7,3,243,182);
INSERT INTO xyoff VALUES(7,3,453,658);
INSERT INTO xyoff VALUES(7,3,126,345);
INSERT INTO xyoff VALUES(7,3,120,472);
INSERT INTO xyoff VALUES(7,4,359,654);
INSERT INTO xyoff VALUES(7,4,339,516);
INSERT INTO xyoff VALUES(7,4,710,452);
INSERT INTO xyoff VALUES(7,4,810,560);
INSERT INTO xyoff VALUES(7,4,644,692);
INSERT INTO xyoff VALUES(7,4,826,327);
INSERT INTO xyoff VALUES(7,4,465,462);
INSERT INTO xyoff VALUES(7,4,310,456);
INSERT INTO xyoff VALUES(7,4,577,613);
INSERT INTO xyoff VALUES(7,4,502,555);
INSERT INTO xyoff VALUES(8,1,601,620);
INSERT INTO xyoff VALUES(8,1,372,683);
INSERT INTO xyoff VALUES(8,1,758,399);
INSERT INTO xyoff VALUES(8,1,485,552);
INSERT INTO xyoff VALUES(8,1,159,563);
INSERT INTO xyoff VALUES(8,1,536,303);
INSERT INTO xyoff VALUES(8,1,122,263);
INSERT INTO xyoff VALUES(8,1,836,435);
INSERT INTO xyoff VALUES(8,1,544,146);
INSERT INTO xyoff VALUES(8,1,270,277);
INSERT INTO xyoff VALUES(8,2,849,281);
INSERT INTO xyoff VALUES(8,2,563,242);
INSERT INTO xyoff VALUES(8,2,704,463);
INSERT INTO xyoff VALUES(8,2,102,165);
INSERT INTO xyoff VALUES(8,2,797,524);
INSERT INTO xyoff VALUES(8,2,612,426);
INSERT INTO xyoff VALUES(8,2,345,372);
INSERT INTO xyoff VALUES(8,2,820,376);
INSERT INTO xyoff VALUES(8,2,789,156);
INSERT INTO xyoff VALUES(8,2,321,466);
INSERT INTO xyoff VALUES(8,3,150,332);
INSERT INTO xyoff VALUES(8,3,136,152);
INSERT INTO xyoff VALUES(8,3,468,528);
INSERT INTO xyoff VALUES(8,3,409,192);
INSERT INTO xyoff VALUES(8,3,820,216);
INSERT INTO xyoff VALUES(8,3,847,249);
INSERT INTO xyoff VALUES(8,3,801,267);
INSERT INTO xyoff VALUES(8,3,181,670);
INSERT INTO xyoff VALUES(8,3,398,563);
INSERT INTO xyoff VALUES(8,3,439,576);
INSERT INTO xyoff VALUES(8,4,123,309);
INSERT INTO xyoff VALUES(8,4,190,496);
INSERT INTO xyoff VALUES(8,4,571,531);
INSERT INTO xyoff VALUES(8,4,290,255);
INSERT INTO xyoff VALUES(8,4,244,412);
INSERT INTO xyoff VALUES(8,4,264,596);
INSERT INTO xyoff VALUES(8,4,253,420);
INSERT INTO xyoff VALUES(8,4,847,536);
INSERT INTO xyoff VALUES(8,4,120,288);
INSERT INTO xyoff VALUES(8,4,331,639);
/* Create the geopoly object from test data above */
CREATE VIRTUAL TABLE geo1 USING geopoly(type,clr);
INSERT INTO geo1(_shape,type,clr)
SELECT geopoly_xform(jshape,A,B,-B,A,xoff,yoff), basis.name, xform.clr
FROM basis, xform, xyoff
WHERE xyoff.id1=basis.rowid AND xyoff.id2=xform.rowid;
/* Query polygon */
CREATE TEMP TABLE querypoly(poly JSON, clr TEXT);
INSERT INTO querypoly(clr, poly) VALUES
('orange', '[[300,300],[400,350],[500,250],[480,500],[400,480],[300,550],[280,450],[320,400],[280,350],[300,300]]');
/* Generate the HTML */
.print '<html>'
.print '<h1>Everything</h1>'
.print '<svg width="1000" height="800" style="border:1px solid black">'
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',clr)
)
FROM geo1;
SELECT geopoly_svg(poly,
printf('style="fill:%s;fill-opacity:0.5;"',clr)
)
FROM querypoly;
.print '</svg>'
.print '<h1>Overlap Query</h1>'
.print '<pre>'
.print 'SELECT *'
.print ' FROM geo1, querypoly'
.print ' WHERE geopoly_overlap(_shape, poly);'
.print
EXPLAIN QUERY PLAN
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
)
FROM geo1, querypoly
WHERE geopoly_overlap(_shape, poly);
.print '</pre>'
.print '<svg width="1000" height="800" style="border:1px solid black">'
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
)
FROM geo1, querypoly
WHERE geopoly_overlap(_shape, poly);
SELECT geopoly_svg(poly,
printf('style="fill:%s;fill-opacity:0.5;"',clr)
)
FROM querypoly;
.print '</svg>'
.print '<h1>Bounding-Box Overlap Query</h1>'
.print '<svg width="1000" height="800" style="border:1px solid black">'
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
),
geopoly_svg(geopoly_bbox(_shape),
'style="fill:none;stroke:black;stroke-width:1"'
)
FROM geo1, querypoly
WHERE geopoly_overlap(geopoly_bbox(_shape), geopoly_bbox(poly));
SELECT geopoly_svg(poly,
printf('style="fill:%s;fill-opacity:0.5;"',clr)
)
FROM querypoly;
SELECT geopoly_svg(geopoly_bbox(poly),
'style="fill:none;stroke:black;stroke-width:3"'
)
FROM querypoly;
.print '</svg>'
.print '<h1>Within Query</h1>'
.print '<pre>'
.print 'SELECT *'
.print ' FROM geo1, querypoly'
.print ' WHERE geopoly_within(_shape, poly);'
.print
EXPLAIN QUERY PLAN
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
)
FROM geo1, querypoly
WHERE geopoly_within(_shape, poly);
.print '</pre>'
.print '<svg width="1000" height="800" style="border:1px solid black">'
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
)
FROM geo1, querypoly
WHERE geopoly_within(_shape, poly);
SELECT geopoly_svg(poly,
printf('style="fill:%s;fill-opacity:0.5;"',clr)
)
FROM querypoly;
.print '</svg>'
.print '<h1>Bounding-Box WITHIN Query</h1>'
.print '<svg width="1000" height="800" style="border:1px solid black">'
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
),
geopoly_svg(geopoly_bbox(_shape),
'style="fill:none;stroke:black;stroke-width:1"'
)
FROM geo1, querypoly
WHERE geopoly_within(geopoly_bbox(_shape), geopoly_bbox(poly));
SELECT geopoly_svg(poly,
printf('style="fill:%s;fill-opacity:0.5;"',clr)
)
FROM querypoly;
SELECT geopoly_svg(geopoly_bbox(poly),
'style="fill:none;stroke:black;stroke-width:3"'
)
FROM querypoly;
.print '</svg>'
.print '<h1>Not Overlap Query</h1>'
.print '<pre>'
.print 'SELECT *'
.print ' FROM geo1, querypoly'
.print ' WHERE NOT geopoly_overlap(_shape, poly);'
.print
EXPLAIN QUERY PLAN
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
)
FROM geo1, querypoly
WHERE NOT geopoly_overlap(_shape, poly);
.print '</pre>'
.print '<svg width="1000" height="800" style="border:1px solid black">'
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
)
FROM geo1, querypoly
WHERE NOT geopoly_overlap(_shape, poly);
SELECT geopoly_svg(poly,
printf('style="fill:%s;fill-opacity:0.5;"',clr)
)
FROM querypoly;
.print '</svg>'
.print '<h1>Not Within Query</h1>'
.print '<pre>'
.print 'SELECT *'
.print ' FROM geo1, querypoly'
.print ' WHERE NOT geopoly_within(_shape, poly);'
.print
EXPLAIN QUERY PLAN
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
)
FROM geo1, querypoly
WHERE NOT geopoly_within(_shape, poly);
.print '</pre>'
.print '<svg width="1000" height="800" style="border:1px solid black">'
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
)
FROM geo1, querypoly
WHERE NOT geopoly_within(_shape, poly);
SELECT geopoly_svg(poly,
printf('style="fill:%s;fill-opacity:0.5;"',clr)
)
FROM querypoly;
.print '</svg>'
.print '</html>'

View File

@ -229,7 +229,8 @@ SRC += \
SRC += \
$(TOP)/ext/rtree/sqlite3rtree.h \
$(TOP)/ext/rtree/rtree.h \
$(TOP)/ext/rtree/rtree.c
$(TOP)/ext/rtree/rtree.c \
$(TOP)/ext/rtree/geopoly.c
SRC += \
$(TOP)/ext/session/sqlite3session.c \
$(TOP)/ext/session/sqlite3session.h
@ -475,7 +476,8 @@ EXTHDR += \
$(TOP)/ext/fts3/fts3_hash.h \
$(TOP)/ext/fts3/fts3_tokenizer.h
EXTHDR += \
$(TOP)/ext/rtree/rtree.h
$(TOP)/ext/rtree/rtree.h \
$(TOP)/ext/rtree/geopoly.c
EXTHDR += \
$(TOP)/ext/icu/sqliteicu.h
EXTHDR += \

View File

@ -1,10 +1,10 @@
C Set\sSQLITE_PTRSIZE\sto\s4\swhen\scompiling\swith\sxlc\son\s32-bit\sAIX.
D 2018-08-24T19:04:08.056
C Add\ssupport\sfor\sthe\sGeopoly\sextension\sto\sthe\sR-Tree\sextension.\s\sThis\salso\ninvolves\sadding\sthe\sSQLITE_INDEX_CONSTRAINT_FUNCTION\scapability\sto\sthe\s\nxFindFunction\smethod\sof\sthe\ssqlite3_module\sobject,\sand\sto\sthe\nsqlite3_index_info.aConstraint.op\sfield\sin\sthe\sxBestIndex\simplementation\sof\nvirtual\stables.
D 2018-08-27T17:13:12.965
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6
F Makefile.in d06f463c5b623a61ac27f5cb8214fca9e53a6704d34d6b8f2124e2b1b293c88f
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 91d78669ce4a4267d6988d16b0bde831ea207e3a2e488efcba558a70dfa45a72
F Makefile.msc ab99b4a0aa33f1c0f39587be9df15c9db536acf7859828ff8c51e13eb5082874
F README.md 7764d56778d567913ef11c82da9ab94aefa0826f7c243351e4e2d7adaef6f373
F VERSION d3e3afdec1165a5e593dcdfffd8e0f33a2b0186067eb51a073ef6c4aec34923d
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@ -33,8 +33,8 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
F config.h.in 6376abec766e9a0785178b1823b5a587e9f1ccbc
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
F configure a46cba271ae08d635a1f331384c04563bdd37adb3d63cbdcffb1d91babfb64f5 x
F configure.ac 18c93e8bbeec8254832c4ea90eb06e7187fd150ef098baed02467eeb374afb17
F configure e80ab4e1f5c63a6979971712d35142ad69ef40da6ee4e4df3456be1a77439124 x
F configure.ac 3552d3aecade98a9d4b64bceb48ffb7726cbc85902efde956812942f060fbd0a
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
F doc/lemon.html ac63db056bce24b7368e29319cd1a7eb5f1798cc85922d96a80b6c3a4ff9f51b
@ -359,7 +359,8 @@ F ext/repair/test/checkfreelist01.test 3e8aa6aeb4007680c94a8d07b41c339aa635cc782
F ext/repair/test/checkindex01.test 6945d0ffc0c1dc993b2ce88036b26e0f5d6fcc65da70fc9df27c2647bb358b0f
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/rtree.c cb6d4bd43c118354fe5b5213843da058259467ecdbac0c6f71ead0fd89acf4ec
F ext/rtree/geopoly.c 01343c633cf59893abc0797571dbfe50d116a6474743941ba46b09ad085df271
F ext/rtree/rtree.c f3c2f1b5eea75b98d4d3dcdec2ebf2a69c036b53f2f3d196e61bf5016298255f
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test 309afc04d4287542b2cd74f933296832cc681c7b014d9405cb329b62053a5349
F ext/rtree/rtree2.test 5f25b01acd03470067a2d52783b2eb0a50bf836803d4342d20ca39e541220fe2
@ -385,6 +386,7 @@ F ext/rtree/rtreeconnect.test 225ad3fcb483d36cbee423a25052a6bbae762c9576ae926833
F ext/rtree/sqlite3rtree.h 9c5777af3d2921c7b4ae4954e8e5697502289d28
F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
F ext/rtree/visual01.txt a3bc394ac37a031d8eda690fa35a6532717df2ae54cd066e1b8f45566b0a8650
F ext/session/changeset.c 4ccbaa4531944c24584bf6a61ba3a39c62b6267a
F ext/session/session1.test 4532116484f525110eb4cfff7030c59354c0cde9def4d109466b0df2b35ad5cc
F ext/session/session2.test 284de45abae4cc1082bc52012ee81521d5ac58e0
@ -420,7 +422,7 @@ F ext/userauth/userauth.c 3410be31283abba70255d71fd24734e017a4497f
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
F main.mk d9872d31efa4a02e177f6d43b7fdae2a5f822e50d1eb72907f6575a567b85378
F main.mk 1cce6391d663fc1cb67075a951efaaab5c2852f59f5c356a74d1eed5387d3c8e
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
@ -450,7 +452,7 @@ F src/date.c ebe1dc7c8a347117bb02570f1a931c62dd78f4a2b1b516f4837d45b7d6426957
F src/dbpage.c 4aa7f26198934dbd002e69418220eae3dbc71b010bbac32bd78faf86b52ce6c3
F src/dbstat.c edabb82611143727511a45ca0859b8cd037851ebe756ae3db289859dd18b6f91
F src/delete.c 107e28d3ef8bd72fd11953374ca9107cd74e8b09c3ded076a6048742d26ce7d2
F src/expr.c d50257c6a73837598ddb75f6baf1c3766978377c3adec20611b390b6d8b7e0dc
F src/expr.c bf08bfe77ec3d54c230ad91ed62d2cba796f82420b58f43aa8250c9025f4c7f9
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c f59253c0be4b1e9dfcb073b6d6d6ab83090ae50c08b5c113b76013c4b157cd6a
F src/func.c 7c288b4ce309b5a8b8473514b88e1f8e69a80134509a8c0db8e39c858e367e7f
@ -500,7 +502,7 @@ F src/resolve.c 797088662ed61102485e3070ba3b3f7828bd5ef6a588223ba6865d77d52f6cea
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
F src/select.c ae7396a314cc1bb1d767947cd57094e3a9ffcbb155ebc1b1c391e028c44a9a04
F src/shell.c.in 6e0aad854be738a5d0368940459399be211e9ac43aebe92bb9ed46cfe38d0e1f
F src/sqlite.h.in 82b5768e36ce796ecf93c73bd88bad99def831ce7d470138e213ac693bf4ceab
F src/sqlite.h.in 5a2d431493020c2c9f2f37c9119d6439444e3c44a714566a5192b6911ac917e6
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7
F src/sqliteInt.h 2a670143a4f6b7d85958bac125e4d9d8ad14f016a3582e9d7c6907d9d50b75a0
@ -586,7 +588,7 @@ F src/walker.c ba7225773931760cf60bf22f34d0cce2588df7ce5ce0f215a52eb88234b55ac4
F src/where.c 155809967fbab889374dedf970ea6561b8fb519fcb165d6ba00776552ecc5cde
F src/whereInt.h b90ef9b9707ef750eab2a7a080c48fb4900315033274689def32d0cf5a81ebe4
F src/wherecode.c 2b6cd1b27736cc803060289e04ecf9849976106f4077aa67d1a2c0e3ec420159
F src/whereexpr.c 94f181d1bc6139973c3677e35b0f1ebfb2b82254620002abb9cb8eb02a58c0b8
F src/whereexpr.c d87df2c00ecc0c2ef4409562608d19cec259a6a03ca72b86fc999db9c07ce119
F src/window.c 4b503da928dace3e845b891381a4d98eeb8c5744313ae3643df8d8d21fdcca65
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
@ -1693,7 +1695,7 @@ F tool/mkshellc.tcl 1f45770aea226ac093a9c72f718efbb88a2a2833409ec2e1c4cecae42026
F tool/mksourceid.c d458f9004c837bee87a6382228ac20d3eae3c49ea3b0a5aace936f8b60748d3b
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
F tool/mksqlite3c.tcl 7fe318ab6e0f8b6f59a1268b9e61b403a7885418b59c43fce9974228eab5a8da
F tool/mksqlite3c.tcl 5fed3d75069d8f66f202d3b5200b0cea4aa7108481acd06732a06fdd42eb83a2
F tool/mksqlite3h.tcl 080873e3856eceb9d289a08a00c4b30f875ea3feadcbece796bd509b1532792c
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
F tool/mkvsix.tcl b9e0777a213c23156b6542842c238479e496ebf5
@ -1755,7 +1757,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P ef6729be85ed106212ed23a024d83b85b709207cf287436c0603a21c659f36ad
R 0f2d8093aae9a7e4f75df1b87b4bd0e1
U mistachkin
Z 5d877bbacdeea49203afbcd3a16fe3ab
P d158e5b12eec5b81d54c8f5902a972795423947a21d0212b6cceb2810aa6cc5c 4bc28eed32154be0e62fe69acd30f828c2e6f59c6579618ecad8ecf632a90517
R 8e52d60c2558b132e89c46c2b2e927ee
T +closed 4bc28eed32154be0e62fe69acd30f828c2e6f59c6579618ecad8ecf632a90517
U drh
Z 29251fdcd22ade960e4bf01a9382ce41

View File

@ -1 +1 @@
d158e5b12eec5b81d54c8f5902a972795423947a21d0212b6cceb2810aa6cc5c
666133e32ca8e95807f8437dc8401bc93e2e6508ab8e6ae1e6031b7cee1584ae

View File

@ -3738,7 +3738,7 @@ expr_code_doover:
** "glob(B,A). We want to use the A in "A glob B" to test
** for function overloading. But we use the B term in "glob(B,A)".
*/
if( nFarg>=2 && (pExpr->flags & EP_InfixFunc) ){
if( nFarg>=2 && ExprHasProperty(pExpr, EP_InfixFunc) ){
pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[1].pExpr);
}else if( nFarg>0 ){
pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[0].pExpr);

View File

@ -6440,6 +6440,7 @@ struct sqlite3_index_info {
#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
#define SQLITE_INDEX_CONSTRAINT_ISNULL 71
#define SQLITE_INDEX_CONSTRAINT_IS 72
#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
/*
** CAPI3REF: Register A Virtual Table Implementation

View File

@ -340,6 +340,7 @@ static int isLikeOrGlob(
** If the expression matches none of the patterns above, return 0.
*/
static int isAuxiliaryVtabOperator(
sqlite3 *db, /* Parsing context */
Expr *pExpr, /* Test this expression */
unsigned char *peOp2, /* OUT: 0 for MATCH, or else an op2 value */
Expr **ppLeft, /* Column expression to left of MATCH/op2 */
@ -363,16 +364,54 @@ static int isAuxiliaryVtabOperator(
if( pList==0 || pList->nExpr!=2 ){
return 0;
}
/* Built-in operators MATCH, GLOB, LIKE, and REGEXP attach to a
** virtual table on their second argument, which is the same as
** the left-hand side operand in their in-fix form.
**
** vtab_column MATCH expression
** MATCH(expression,vtab_column)
*/
pCol = pList->a[1].pExpr;
if( pCol->op!=TK_COLUMN || !IsVirtual(pCol->pTab) ){
return 0;
if( pCol->op==TK_COLUMN && IsVirtual(pCol->pTab) ){
for(i=0; i<ArraySize(aOp); i++){
if( sqlite3StrICmp(pExpr->u.zToken, aOp[i].zOp)==0 ){
*peOp2 = aOp[i].eOp2;
*ppRight = pList->a[0].pExpr;
*ppLeft = pCol;
return 1;
}
}
}
for(i=0; i<ArraySize(aOp); i++){
if( sqlite3StrICmp(pExpr->u.zToken, aOp[i].zOp)==0 ){
*peOp2 = aOp[i].eOp2;
*ppRight = pList->a[0].pExpr;
*ppLeft = pCol;
return 1;
/* We can also match against the first column of overloaded
** functions where xFindFunction returns a value of at least
** SQLITE_INDEX_CONSTRAINT_FUNCTION.
**
** OVERLOADED(vtab_column,expression)
**
** Historically, xFindFunction expected to see lower-case function
** names. But for this use case, xFindFunction is expected to deal
** with function names in an arbitrary case.
*/
pCol = pList->a[0].pExpr;
if( pCol->op==TK_COLUMN && IsVirtual(pCol->pTab) ){
sqlite3_vtab *pVtab;
sqlite3_module *pMod;
void (*xNotUsed)(sqlite3_context*,int,sqlite3_value**);
void *pNotUsed;
pVtab = sqlite3GetVTable(db, pCol->pTab)->pVtab;
assert( pVtab!=0 );
assert( pVtab->pModule!=0 );
pMod = (sqlite3_module *)pVtab->pModule;
if( pMod->xFindFunction!=0 ){
i = pMod->xFindFunction(pVtab,2, pExpr->u.zToken, &xNotUsed, &pNotUsed);
if( i>=SQLITE_INDEX_CONSTRAINT_FUNCTION ){
*peOp2 = i;
*ppRight = pList->a[1].pExpr;
*ppLeft = pCol;
return 1;
}
}
}
}else if( pExpr->op==TK_NE || pExpr->op==TK_ISNOT || pExpr->op==TK_NOTNULL ){
@ -1237,7 +1276,7 @@ static void exprAnalyze(
*/
if( pWC->op==TK_AND ){
Expr *pRight = 0, *pLeft = 0;
int res = isAuxiliaryVtabOperator(pExpr, &eOp2, &pLeft, &pRight);
int res = isAuxiliaryVtabOperator(db, pExpr, &eOp2, &pLeft, &pRight);
while( res-- > 0 ){
int idxNew;
WhereTerm *pNewTerm;

View File

@ -99,6 +99,7 @@ foreach hdr {
fts3Int.h
fts3_hash.h
fts3_tokenizer.h
geopoly.c
hash.h
hwtime.h
keywordhash.h
@ -392,6 +393,7 @@ foreach file {
fts3_unicode.c
fts3_unicode2.c
json1.c
rtree.c
icu.c
fts3_icu.c
@ -399,7 +401,6 @@ foreach file {
dbstat.c
dbpage.c
sqlite3session.c
json1.c
fts5.c
stmt.c
} {