Skip to content

Commit 9f23701

Browse files
committed
Added support for geopoly
Fixes rogerbinns#253
1 parent f5a4e3f commit 9f23701

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

doc/changes.rst

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Added constants:
99

1010
* SQLITE_CONFIG_MEMDB_MAXSIZE, SQLITE_FCNTL_SIZE_LIMIT
1111

12+
Added support for the geopoly extension (:issue:`253`)
1213

1314
3.26.0-r1
1415
=========

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def finalize_options(self):
553553
v=beparent.finalize_options(self)
554554

555555
if self.enable_all_extensions:
556-
exts=["fts4", "fts3", "fts3_parenthesis", "rtree", "stat4", "json1", "fts5", "rbu"]
556+
exts=["fts4", "fts3", "fts3_parenthesis", "rtree", "stat4", "json1", "fts5", "rbu", "geopoly"]
557557
if find_in_path("icu-config"):
558558
exts.append("icu")
559559
if not self.enable:
@@ -637,7 +637,7 @@ def finalize_options(self):
637637
"memsys" not in e.lower() and \
638638
e.lower() not in ("fts4", "fts3", "rtree", "icu", "iotrace",
639639
"stat2", "stat3", "stat4", "dbstat_vtab",
640-
"fts5", "json1", "rbu"):
640+
"fts5", "json1", "rbu", "geopoly"):
641641
write("Unknown enable "+e, sys.stderr)
642642
raise ValueError("Bad enable "+e)
643643

tests.py

+12
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,18 @@ def check(pattern, expectedrows):
20092009
check("x1>2 AND x2<7 AND y1>17.2 AND y2<=8", [])
20102010
check("x1>5 AND x2<=6 AND y1>-11 AND y2<=8", [1])
20112011

2012+
def testGeopolyExtenstion(self):
2013+
"Check geopoly extension if present"
2014+
if not self.checkOptionalExtension("geopoly", "CREATE VIRTUAL TABLE newtab USING geopoly()"):
2015+
return
2016+
found=0
2017+
for row in self.db.cursor().execute(
2018+
"CREATE VIRTUAL TABLE newtab USING geopoly();"
2019+
"INSERT INTO newtab(_shape) VALUES('[[0,0],[1,0],[0.5,1],[0,0]]');"
2020+
"SELECT * FROM newtab WHERE geopoly_overlap(_shape, $1);", ("[[0,0],[1,0],[0.5,1],[0,0]]",)):
2021+
found+=1
2022+
self.assertEqual(found, 1)
2023+
20122024
def testICUExtension(self):
20132025
"Check ICU extension if present"
20142026
if not self.checkOptionalExtension("icu", "select lower('I', 'tr_tr')"):

0 commit comments

Comments
 (0)