Commit Graph

293 Commits

Author SHA1 Message Date
drh
52f0c6205c Fix a bug in the geopoly_ccw() function. Test cases in TH3.
FossilOrigin-Name: 773c5c1d9c0ec40c51949c38c9dc17e778086f3f92791cca9b85288de0076dab
2018-11-24 20:44:46 +00:00
drh
6ab91a7a7a Add the SQLITE_DEFAULT_DEFENSIVE compile-time option. Fix up test cases
so that they work with DEFENSIVE enabled.

FossilOrigin-Name: 3212733cb6d1a59516d67a86df7c7b1d2456a1b2e5d7080c26b0e87b2609c65d
2018-11-07 02:17:01 +00:00
drh
0f0d3ddf71 Enable DEFENSIVE mode by default for tests. This requires lots of case of
turning DEFENSIVE off in order to dodgy things to the database for testing
purposes.  No all of those cases are yet handled, so "make test" does not run
to completion.

FossilOrigin-Name: a1d6c6712c3304fd736077432c8c180692cf7d79be7f3a073510b6dab0eb951f
2018-11-06 19:26:04 +00:00
drh
fc25721c9e Only allow shadow table to be written from within a recursive SQL call.
Omit the SQLITE_PREPARE_SHADOW flag.  Some tests are failing because the
tests depend on being able to write to shadow tables.

FossilOrigin-Name: d890c6582524677666e6f5b5817331dec332ade16b2f744cbb8a3c7dd9b63e21
2018-11-06 14:03:07 +00:00
drh
84c501bac1 Initial code to make shadow tables read-only to ordinary SQL. The now
xShadowName method is added to the sqlite3_module object and is used
to identify potential shadow tables.  The SQLITE_PREPARE_SHADOW argument
to sqlite3_prepare_v3() is defined.  It is designed to permit writing to
shadow tables, but is currently an unused placeholder.

FossilOrigin-Name: 31942b3dd3f66eb0d9977bf1cadc2f2d7be7967cce2b55784be0b939dfef1985
2018-11-05 23:01:45 +00:00
drh
5f8cb730af Replace the new geopoly_reverse() function with geopoly_ccw(). The
geopoly_ccw() function only reverses the vertex order if doing so is necessary
to get the correct right-hand winding rule on the polygon.

FossilOrigin-Name: 075066944b13b18d339ccf87ae16f0b91bf00f40bd70f71c6beba6aa6c43f0b6
2018-10-08 18:55:56 +00:00
drh
bc36320f02 Add the geopoly_reverse() function to the GeoPoly extension.
FossilOrigin-Name: 690dd18a5768c5a8cdfa92d5b01901c1a7b1fb6ebb90399f56a3112e41609f92
2018-10-08 12:58:59 +00:00
drh
bebf54438e Changes to geopoly to silience false-positive warnings coming out of clang.
FossilOrigin-Name: 11d9015f31d1ea2fd27174d4ceea08a145fdbb92a175bec0aae4b90f991694bc
2018-10-05 15:10:00 +00:00
drh
60afcb80ee Add the geopoly_regular(X,Y,R,N) function to the geopoly extension.
FossilOrigin-Name: 4505bbae58357eacab262b642b2a56d6dd380de72faceb5bbfd042eb94a12c06
2018-09-28 14:01:17 +00:00
drh
601c8f2829 Make most geopoly functions pure.
FossilOrigin-Name: 944e167a98e995c5750c1fcd44df857d6b10c1cbb91731fad2849415c42b2cfc
2018-09-28 13:18:24 +00:00
drh
b2d83494d3 Rig geopoly to use sqlite3AtoF() if it is available, as that routine is much
faster than atof().

FossilOrigin-Name: 470c6c07d0eb70806ac257c1c8ad877e041bbc14ff9a5c490edb51b2956ae726
2018-09-28 00:16:57 +00:00
drh
17e65ae4c0 Small performance optimization in the JSON parser of Geopoly.
FossilOrigin-Name: fb520e71035258d5490be33ee28575df2caefa5d5a301c8bbdf1471551c96282
2018-09-27 23:57:45 +00:00
drh
50db3e8d51 Enhance the GeoPOLY extension so that it always stores its polygons in the
binary format, which is faster and more compact.

FossilOrigin-Name: dc35f7b1754a78fa0d70c92754de07bb3c28d0d31cb929ee8a3a47ac4f3d446e
2018-09-27 20:37:52 +00:00
mistachkin
ed008ecede Fix some harmless compiler warnings seen with MSVC.
FossilOrigin-Name: 78862252da7f59d4737ed16f4ccf100cea27d8b421db31051afbaa8d96f24de3
2018-09-12 01:05:26 +00:00
mistachkin
3c4b61333f Fix harmless compiler warning.
FossilOrigin-Name: 88b39c46c15ab6bdd0ac9536ddb6fb09862d578d0f691c57d039b0a906f1c25c
2018-09-06 16:47:10 +00:00
drh
7894b8547d Add the randomshape.tcl test-case generator script to the util subdirectory
of the rtree extension.

FossilOrigin-Name: 8f48991dcbb01e21d065fbba7782a6d1aebaa8065841a70a76af1e5a21f18ea4
2018-09-06 14:01:56 +00:00
drh
a83a74c428 Fix excess memory usage in the JSON parser of GEOPOLY.
FossilOrigin-Name: 9057e27e12ded07a9ea0b2868036d3019f7bc5be3a67e3d341f56b762d3de9d9
2018-09-06 11:14:17 +00:00
drh
9a09b7b31d Fix a problem with geopoly trying to update both the _shape and an auxiliary
column in the same UPDATE statement.

FossilOrigin-Name: 14c955152d0580abc3df1b363789f2925e013b9c957e550b1e6ebe83a82bae6c
2018-09-06 02:40:15 +00:00
drh
9c1d7c6d4c Additional test cases for geopoly.
FossilOrigin-Name: 19b5eb45e090c4b7169a52d881495ee2eafc59f80e3db2288fc1814ba76134ac
2018-08-29 21:01:22 +00:00
drh
17f19eadb8 Fixes to the UPDATE logic in Geopoly.
FossilOrigin-Name: 7c3cee0a2a5ccacff27400c38bd708f7b9b968eb013a8fa685d876dfe85e12a6
2018-08-29 20:52:40 +00:00
drh
c0d2117f1c Add the geopoly_group_bbox() aggregate function to the Geopoly module.
FossilOrigin-Name: 2d4debccbc027405a33aeb10f9d65f6fe4bfb5eb1be5a4d8b82158caba04643f
2018-08-29 15:50:47 +00:00
drh
58726ca4b9 Stricter enforcement of the JSON and GeoJSON standards in the Geopoly extension.
FossilOrigin-Name: c0bf3ff3af4d34ef7801c16e39128e894b00699313f4915f57aa73b57642f7fd
2018-08-28 19:23:41 +00:00
drh
79931a1517 Fix new issues in the geopoly module discovered by TH3.
FossilOrigin-Name: 22fff9afc2fb20906173f258aa8feae9b52acc69a0ca7baf4e914d29c4279a23
2018-08-28 15:51:10 +00:00
drh
74e0aaece1 Minor changes to the visual01.txt test script.
FossilOrigin-Name: 4bc28eed32154be0e62fe69acd30f828c2e6f59c6579618ecad8ecf632a90517
2018-08-27 17:05:59 +00:00
drh
b2a18c95f0 Split the three-argument version of geopoly_within() off into a separate
function named geopoly_contains_point().

FossilOrigin-Name: 5a0e1541037b5bbc1b4bf26a7da304c9b32ea72960aca8b9309cf2180757c8a4
2018-08-27 15:55:37 +00:00
drh
e6474b77b8 Enhance the geopoly virtual table so that it does a better job of optimizing
geopoly_within() queries.

FossilOrigin-Name: 1f717385340f295064a7649cfc36ad048573cbacb6faa20f5c6067328c40c745
2018-08-25 23:03:27 +00:00
drh
27d62540e5 Provide the two-argument geopoly_within(P1,P2) routine that determines if
polygon P2 is contained within polygon P1.  Make this function available to
the query planner for optimized rtree lookups.  Update the visual01.txt
script to verify that the new functionality actually works.

FossilOrigin-Name: 6eb5d09b7f9d9bf8edbf993dccc2e2f702b95ba96cf68445609feb0ccc3ac0f7
2018-08-25 19:51:49 +00:00
drh
95327f539b Fix a harmless compiler warning.
FossilOrigin-Name: d49be9838d237b57ba1f12ed00e2d3411314ee1b9c30ef7bbaf65aca20d0870e
2018-08-25 18:57:12 +00:00
drh
b7d376ee13 Fix a problem in the geopoly json parser associated with spaces before a
coordinate number.

FossilOrigin-Name: 9d8d3af89ab241fd6c68e043e559359c85653aa0e31270b658ff01867ae929c4
2018-05-29 17:17:22 +00:00
drh
b0af3d1f97 The geopoly virtual table seems to be working. But only thinly tested so far.
FossilOrigin-Name: 4288f1ad5966701eac4cfe3061e8ce98e34e0d6c112307668729642a06458d5f
2018-05-28 23:59:03 +00:00
drh
48e4ef56c3 Untested incremental check-in. Add the geopoly_xform() function. Complete
basic logic for the geopoly virtual table.

FossilOrigin-Name: ed06cc32568a3abaa0535b379e0ee3b04ffb7582dcda6405670620d1fbe8996c
2018-05-28 13:23:23 +00:00
drh
f403e1af0b Minor correction.
FossilOrigin-Name: f20d9a99a477e1d592edb37d741d9d07b015d6772b4c8cf1541ef290d600ca6b
2018-05-26 12:21:21 +00:00
drh
ecdc742790 Untested incremental check-in. Basic infrastructure for geopoly in place,
except for the MATCH operator.

FossilOrigin-Name: b27451910b6880b166d4777e05b14ab2731c3483b5ed0f42c459bbb61c6cd095
2018-05-25 22:39:29 +00:00
drh
66c43599ce Incremental check-in: Progress toward implementing the geopoly vtab.
FossilOrigin-Name: 9b7d6f986a19f8fbe26d880dc368870a10df80e06097be34ee3639f78c50be61
2018-05-25 20:53:42 +00:00
drh
748b8fda90 Forward port the geopoly extension functions into the r-tree extension,
with the idea of creating a new spatial index based on simply polygons.

FossilOrigin-Name: 0593aac88a8c25ddafba4c29a181ee083dfc3dab44335feb6f12fdea6ce7fb27
2018-05-25 19:22:47 +00:00
drh
338e311acb When doing a one-pass UPDATE or DELETE on virtual tables, close the cursor
prior to running VUpdate.  This allows one-pass to work on virtual tables
that do not allow concurrent reads and writes.  Enhance rtree to take
advantage of this new capability.

FossilOrigin-Name: b816023ce07d01024d5769e16db924374a49bf909edd12dc1344a0a1ef693db5
2018-05-24 23:51:57 +00:00
drh
30fc7f8009 New test case for reading and writing the same rtree concurrently.
FossilOrigin-Name: 3ba08e53d54165f5541756ad13a4c2f0b18516cb612a256e056ed1ff76c1fa83
2018-05-24 22:42:27 +00:00
drh
c8c9cdd9dd Do not allow RTree writes when a read cursor is active on the same virtual
table, as the writes might rebalance and disrupt the read cursors.  Return
the new SQLITE_LOCKED_VTAB error code if this happens.

FossilOrigin-Name: d4ce66610851c825cb712f985216b63e015c753fdd5521f929c67ad18bfd7664
2018-05-24 22:31:01 +00:00
drh
a02fd67b99 Avoid unnecessary sqlite3_finalize() operations.
FossilOrigin-Name: 16f71032a3a2919cb226b25b5256a370adb5c55fa506d4774b7f83dc8868e793
2018-05-18 16:53:07 +00:00
drh
136c9903bf Fix a prepare-statement leak.
FossilOrigin-Name: 95fd296ffc8130526a1453cbdca6ce47f22fc5b5c474aa31d66b627d0c7393a1
2018-05-18 16:46:09 +00:00
drh
252f39619a Improved error messages. Limit the number of auxiliary columns to 100.
FossilOrigin-Name: 059d20abd57727e6d312f15b640359ef778786f577d9b50b17b57195db2d0aef
2018-05-18 15:21:43 +00:00
drh
26fb126622 Fix an issue with rtreecheck() and auxiliary data columns.
FossilOrigin-Name: 46715136078a51ca7dd08b83214d6ad0e85728af8a26cd342077b8dd4ada1d60
2018-05-16 19:56:20 +00:00
drh
7578456c25 Do not allow auxiliary columns in the rtree to interfere with query planning.
Begin adding test cases.

FossilOrigin-Name: 9abe023e1afa7dc1a7eba7fbb3128401de129873d86b7c71c221decca26a821c
2018-05-16 19:07:07 +00:00
drh
1e76c22b4a Fix the OOM issue mentioned in the previous check-in.
FossilOrigin-Name: c489d8e44eac4cd355096ab66bb40f13ef662f31e080c9f1f2ee379fe55b207a
2018-05-16 18:18:24 +00:00
drh
e297196524 Initial implementation of the ability to have auxiliary columns in an rtree
virtual table that store arbitrary content.  It mostly works, but there are
some minor issues in OOM corner cases.

FossilOrigin-Name: 0c87fec970221f954e0a92f3ef0437b382255479fac5b403ee37b1bb5ab29719
2018-05-16 17:57:30 +00:00
drh
a090ab90d6 Convert the schema creation logic in the rtree extension to use the
new sqlite3_str interface.

FossilOrigin-Name: fd8b8c4196d3f0f6cb129f43ebf473ada86eefdf16181fa70ceee21e1232b5e1
2018-05-14 15:26:05 +00:00
drh
cdf88760da More test case updates. Tests are all running now.
FossilOrigin-Name: dab5e5294813891469660cceb211ac1a1e526715bb57dcdbb1ab90321e6a4dad
2018-05-02 19:42:33 +00:00
dan
eab0e10304 In extensions rtree, fts3 and fts5, ensure that when dynamic buffers are bound
to persistent SQL statements using SQLITE_STATIC, the binding is replaced with
an SQL NULL before the buffer is freed. Otherwise, a user may obtain a pointer
to the persistent statement using sqlite3_next_stmt() and attempt to access
the freed buffer using sqlite3_expanded_sql() or similar.

FossilOrigin-Name: 2a5f813bc61f9e780f2ccbda425611f65ad523b6d486a1e5e2b9d5e9f1d260a2
2018-02-07 18:02:50 +00:00
dan
2f94935409 Allow the shell to be built from the configure script with
SQLITE_OMIT_VIRTUALTABLE defined.

FossilOrigin-Name: 136bf323e42dc90e1780199a381bcbb084b069eca5c7343ee6fc6e2550831536
2018-01-20 15:48:45 +00:00
drh
468c649331 Add unnecessary initializations to some local variables in the rtree module
to suppress false-positive compiler warnings coming out of MSVC.

FossilOrigin-Name: 64487d658cb3b6c8c67f1e198c70813c963de52599f3ea974bdc2aa432e74de9
2017-12-16 04:37:15 +00:00
dan
7e2b38c53b Add tests cases and fix minor issues in the rtreecheck() function.
FossilOrigin-Name: d6130cd226c0ca95e02f0cbabfdc27071acdcf83e0d0cb0eaa47d992479ed9a1
2017-10-25 18:17:24 +00:00
mistachkin
8c66e5b73e Fix compilation issue (C99-ism) seen with MSVC.
FossilOrigin-Name: 61870b42b033189509b244c76d28932f7a447b887ffe04a3c81461148e54cfb5
2017-10-25 18:00:58 +00:00
dan
1917e92fdb Add SQL scalar function rtreecheck() to the rtree module. For running checks
to ensure the shadow tables used by an rtree virtual table are internally
consistent.

FossilOrigin-Name: dde0bb3eab1316c3247b1755594527ca70955aab4ad4907190731f7ec092b327
2017-10-25 16:38:34 +00:00
drh
9616805728 Fix a potential use of an uninitialized pointer in RTree following an OOM
error.

FossilOrigin-Name: fd4ec0cdbd84f3333dd4c7a4236491bce6b9ab21fb2c088751ca1279b31bd864
2017-09-21 13:11:47 +00:00
drh
6362bbe68d The RTREE extension should return SQLITE_CORRUPT_VTAB, not just SQLITE_CORRUPT
when it encounters incorrectly formatted shadow tables.

FossilOrigin-Name: 0712f057ef3dcd907984dda30f6d961a29b61c1d2b25627028c4e227ec85dbba
2017-08-17 18:17:24 +00:00
dan
865c3c58ab Add test cases for ticket [be436a7f4587ce517] using virtual table modules fts5
and rtree.

FossilOrigin-Name: 2101b4208787d297788e05f2bd82d4a9aff26e2237a7016ac857a52fb5252ce0
2017-08-17 14:12:16 +00:00
drh
7524b613c5 Preserve the error code from xConnect or xCreate methods in virtual table
implementations when they are encountered during parsing.

FossilOrigin-Name: dcdf091388251292ff9939bdff920708320bc64dacfe0fa1878c5ffd11b679c9
2017-08-09 22:55:09 +00:00
drh
22930062d5 Add a destructor argument to sqlite3_bind_pointer()
and sqlite3_result_pointer().

FossilOrigin-Name: 3d9e841f6011480ebb8a6d860da72af7fa545983e08835ddef2cac96e5f5cd4b
2017-07-27 03:48:02 +00:00
mistachkin
885f410472 Remove some 'breakpoint' commands in test files.
FossilOrigin-Name: d14fc621e918915bbf8e04597eb238ea78dff3d9c5eb4402cb88692d00dbdfee
2017-07-19 18:01:42 +00:00
drh
a690ff360b Change the error message text for SQLITE_ERROR to omit the part about
"missing database" as that meaning is now obsolete (since approx SQLite 2.0).

FossilOrigin-Name: 732f90d6327c5c6368fc8b4cc207bd644ef08e3ae6d2e7295258ab099deaba63
2017-07-07 19:43:23 +00:00
drh
c7b1ee5f6e Enhance the RTree module to detect node truncation early and report an error.
FossilOrigin-Name: 66de6f4a9504ec2670b7273de8fb6955c80e03f7f73414ea6b80fd8a99f75976
2017-07-01 15:21:17 +00:00
drh
2c2f392dca Add interfaces sqlite3_prepare_v3() and sqlite3_prepare16_v3() with the
extra prepFlags argument.  Add the SQLITE_PREPARE_PERSISTENT option as one
bit in that argument.

FossilOrigin-Name: 4a25c5883380fe5990d8180adb58c3bdc7a3d081bc4c69cd4de3cd57074fb251
2017-06-01 00:54:35 +00:00
drh
f8a2e8c2d2 Fix requirements marks and harmless compiler warnings.
FossilOrigin-Name: 198ff4c01d86d193a54745764d69376cab8e94747a4daa444690f7e1ec87800b
2017-05-06 17:12:52 +00:00
dan
5b09d13a58 Have the rtree module close any open blob-handle within the xSavepoint method.
This prevents such an open blob handle from interfering with DROP TABLE
operations.

FossilOrigin-Name: fa4416adc2a9a3a80db1d5befc0b95c3d0fc41affe38f7f2f45cdfae3f1b49eb
2017-04-08 13:52:41 +00:00
drh
297e2bdb8e Make sure the RTree sqlite3_blob handle is reset prior to renaming the table.
FossilOrigin-Name: 1cdae2db3c54970a1811e597065724578408c84d49d75b8fe25d56281ddc2e94
2017-04-08 01:09:14 +00:00
dan
6b904f5e01 Avoid a technically undefined right-shift of a signed value in rtree.c.
FossilOrigin-Name: a144875fe44ff3a30bab299d50b7dbec2ee21f8c73e692a71ee1f7c54b5f0c76
2017-03-20 19:26:27 +00:00
drh
dc5ece86ae Remove the CLANG_VERSION macro, since we have learned that version numbers in
clang are "marketing" and are inconsistent and unreliable.  Builds using clang
will still use the GCC_VERSION macro since clang works hard to be gcc
compatible.

FossilOrigin-Name: 810d29320b853b3a01aa50d8f2a0bceacf79e0aa
2017-02-15 15:09:09 +00:00
drh
a39284bfa8 Cleanup the usage of the SQLITE_DISABLE_INTRINSIC compile-time option.
Remove the SQLITE_RUNTIME_BYTEORDER compile-time option.  Use
-DSQLITE_BYTEORDER=0 instead.  Fix a bug in R-Tree that occurs when compiling
on a known little-endian machine without the use of intrinsic byteswapping
functions.

FossilOrigin-Name: 798fb9d70d2e5f95e64237b04d6692360133381a
2017-02-09 17:12:22 +00:00
dan
9fcb6ddc1e Fix a build problem affecting non-amalgamation rtree builds.
FossilOrigin-Name: bb7f445ba1df53cd4a169612b18fc533016102b7
2017-02-07 14:45:18 +00:00
drh
364ca6a90e Fix SQLITE_BYTEORDER #defines in R-Tree when compiled separately from the
amalgamation.

FossilOrigin-Name: a136609c98ed3cc673c5a3c2578d49db3f2518d1
2017-02-07 13:51:48 +00:00
drh
edd9bcb372 Make the cellMargin() routine of R-Tree slightly smaller and faster while also
fixing a harmless compiler warning.

FossilOrigin-Name: 07fe6228208684d579c4f6c334c90eb6262a9233
2017-02-07 12:58:38 +00:00
drh
b18bf843f7 Fix a minor typo in a comment in R-Tree. No changes to code.
FossilOrigin-Name: f77ee9e941f22b0b2e88871df4466fdde9cde131
2017-02-07 00:55:47 +00:00
drh
04128ace8d Remove a small amount of unnecessary code from R-Tree.
FossilOrigin-Name: e5aea894267addb4dc9b21de24a20417b0be508a
2017-02-06 16:52:32 +00:00
drh
9630f3ba08 Remove incorrect testcase() macros from R-Tree.
FossilOrigin-Name: 853a58a75ecbd01ebbf7e07fbd8c4fc9bef54a99
2017-02-06 01:19:07 +00:00
drh
fe05491b87 In RTREE, use an sqlite3_blob object rather than an sqlite3_stmt object
for reading content out of the %_node shadow table.

FossilOrigin-Name: 97ccf3e4de11ffea46993cb7fb7ab559b9810705
2017-02-04 14:24:05 +00:00
drh
010e312f8f Close sqlite3_blob objects on xSync rather than waiting until xCommit.
FossilOrigin-Name: 95ee745fceb4a48c683f34c404c380fe5e7d684a
2017-02-04 13:12:12 +00:00
drh
3accc7e1af Remove the unused pReadNode prepared statement from each RTREE object.
FossilOrigin-Name: e51dc0ec60d45cd57564735b6b2bb254a588533e
2017-02-02 16:30:25 +00:00
drh
ce655a2367 Fix a potential uninitialized (though harmless) variable in RTREE.
FossilOrigin-Name: a1c74e09d63aca630d022ed074866433eed6b493
2017-02-02 16:08:27 +00:00
drh
413e207e31 The sqlite3_blob_close() interface can cause recursive invocations of
nodeBlobReset() in RTREE.  Make sure that does not cause problems.

FossilOrigin-Name: 88333441cbf26bfde2acebf2a3f75b5ebbdfb0ae
2017-02-02 15:35:54 +00:00
drh
2033d1c8ca Change RTREE so that the sqlite3_blob object is closed whenever the cursor
count drops to zero and there is not a pending write transaction.

FossilOrigin-Name: 9bb4eafe1a60176ed2e731bb7e3067c0b8a46615
2017-02-02 14:40:06 +00:00
drh
6d683c5c6e Use the sqlite3_blob interface for reading values from the %_node shadow
table in RTREE.  This is a work in progress.  There are still some minor
problems.

FossilOrigin-Name: fc4917d730b29b0bf60fea5e0166728635783e9c
2017-02-02 02:28:45 +00:00
mistachkin
6890d3e458 Fix harmless compiler warnings seen with MSVC.
FossilOrigin-Name: 0c66cf0f0a9ada2ddcb8d61001ef791b86226416
2017-02-01 23:06:17 +00:00
mistachkin
2fa517bf2a Fix C99-style variable declaration issue seen with older versions of MSVC.
FossilOrigin-Name: 54d285464a222c59327eb6c917c1cc0125a55a27
2017-02-01 22:59:29 +00:00
mistachkin
2e52532217 Fix harmless compiler warnings seen with MSVC.
FossilOrigin-Name: 997f765bc6706769ae15f3e719354473e02bd78b
2017-02-01 22:43:08 +00:00
drh
31a1349515 Unwind the RTREE dimension loop inside of rtreeCallbackConstraint().
FossilOrigin-Name: 4854ea9c18e7d8066c90b41568d0fae97b01ea6d
2017-02-01 17:08:56 +00:00
drh
5db59b33c4 Completely unroll the dimension loop inside of cellArea() in RTREE.
FossilOrigin-Name: 3c4c0126c287f844220b65e00fec17c059fbb7c8
2017-02-01 16:41:30 +00:00
drh
0e6f67b754 Precompute the nDim2 value in the Rtree object and use that to make loops
over coordinates faster.

FossilOrigin-Name: f1f3c8cc733a05c12dd980f2dfa0ab4ccd76c04b
2017-02-01 15:49:02 +00:00
drh
03626e3812 Use compiler intrinsic functions (when available) for byteswapping in RTREE.
FossilOrigin-Name: 82fcd54a5941c20895ffc22d8009c1ebdae44eda
2017-02-01 15:24:32 +00:00
drh
14494fa712 More RTREE performance optimizations related to decoding values.
FossilOrigin-Name: c5395e7496d0cd593f5e16ee5f6719d020dc0c66
2017-02-01 02:25:28 +00:00
drh
fcbd6cdb41 R-TREE optimization: unwrap the coordinate decode loop in
rtreeCallbackConstraint().

FossilOrigin-Name: 0bf7b51896ec441f62490964c7a44a3c75c6b7e2
2017-01-31 21:22:03 +00:00
dan
9c8753c0a8 Fix a problem in rtreeD.test causing it to fail in OMIT_BUILTIN_TEST builds.
FossilOrigin-Name: d6b3779e6dad038d8bc35139cf314bf1e6e91977
2016-11-17 20:05:00 +00:00
dan
ea5e5f0b89 Fix a case in which the rtree module was ignoring an OOM while generating an error message.
FossilOrigin-Name: 788f86bebe413b5a0ab41ba3d75ba8728827a964
2016-10-10 10:06:59 +00:00
drh
2e5c5052fd Fix typos in comments. No changes to running code.
FossilOrigin-Name: a07269f2a0f87e0b736127f528f6caf3b63f9052
2016-08-27 20:21:51 +00:00
drh
f1e2c8e1ff Fix the rtreeG.test test case.
FossilOrigin-Name: 9589e9377118efc356c73ea1aab2d7e6c2f7fc36
2016-05-23 18:27:07 +00:00
drh
e62c2fe179 Fix RTREE so that it does not run queries against the sqlite_stat1 if that
table does not exist.

FossilOrigin-Name: 48526a2fe5373e3d19e8b813cc8a342d6b7c9c3d
2016-05-23 18:12:04 +00:00
drh
daa14559d2 Remove an extra "finish_test" from the end of rtreeC.test.
FossilOrigin-Name: bfbb6dd84b5e1335e1eae857a03fa33a71fd67a5
2016-05-23 18:06:51 +00:00
dan
5782bc27fa Improve the error messages generated by the rtree module when a constraint fails.
FossilOrigin-Name: 3ad2531efb64b7c53b777ddf3681203217052b32
2016-05-23 16:16:13 +00:00
drh
2ea74dc805 Adjust the cost estimates for RTREE such that the expected number of rows and
expected cost is halved for each additional constraint.

FossilOrigin-Name: fd7cd0609381a85673d1f737ebeb19dde3de180f
2016-03-05 20:28:24 +00:00
dan
06f8c635ef Add tests for the rtree module to verify that attempts to insert non-integer primary key values or non-numeric dimensions into an rtree table are handled correctly.
FossilOrigin-Name: f653fce90846b700441e8fa5f1930c1ec5e38e31
2015-10-03 12:23:18 +00:00
dan
4f20cd402b Avoid passing constraints that are unusable due to LEFT or CROSS joins to virtual table xBestIndex() methods.
FossilOrigin-Name: 80ee56dda7db3860f8be5f6968c8745138f8453f
2015-06-08 18:05:54 +00:00
drh
18070e08c5 Fix incorrect validation of the size of the BLOB returned by a geometry
function on the RHS of a MATCH operator in RTree.  The old code worked for
64-bit systems (by chance) but fails on 32-bit.

FossilOrigin-Name: 10cc44f5a63e6cadf6940bb7310a177ee7fa6ee2
2015-05-22 23:17:28 +00:00
drh
fd29973f11 Update with fixes and enhancements from trunk.
FossilOrigin-Name: 9605d008f5c763137e9734d033fe4510ca316858
2015-05-22 18:40:48 +00:00
dan
6b76418e67 Have r-tree prefer to use the constraint "col MATCH ?" over "rowid = ?".
FossilOrigin-Name: b9fb95194d4f7c535f1d175fd2e18d69d76e8fc4
2015-05-22 16:08:42 +00:00
drh
4f03f413bc Add the sqlite3_value_dup() and sqlite3_value_free() interfaces. Use
these interfaces to enhance R-Tree to add the
sqlite3_rtree_query_info.apSqlParam field.

FossilOrigin-Name: a7ee40c4fc62843ac5b96ba47ca14a66e8cd6961
2015-05-20 21:28:32 +00:00
drh
856d446efe Allow R-Tree geometry functions to take 8-byte BLOB arguments which are
passed directly through to the underlying callback, and which can be used
to pass pointers into the callback.

FossilOrigin-Name: b271ed56532a78323accc8a7cb348d55f95c350e
2015-05-19 22:20:48 +00:00
mistachkin
6a12854024 Remove a couple stray test breakpoint calls.
FossilOrigin-Name: 2860cebeeaebd346de60c762aa3e51dbab008578
2015-05-08 00:58:39 +00:00
drh
e9c5f97683 Fix an assert in RTREE that would fire if the rtree table is misdeclared.
FossilOrigin-Name: 9a45409cc4078f2b6e68aa777f6ab86a14309833
2015-05-01 18:00:37 +00:00
drh
068a251d99 Simplify some code in rtree, to avoid confusing the optimizer in GCC on
some macs:
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00).
Prior to these changes, compiling with -O3 would cause incorrect code to
be generated.  The change to the nodeGetCell() routine is key.  The other
changes are merely cosmetic details discovered while bug hunting.

FossilOrigin-Name: 882181ff9dd75f32db266db6e476671021fc567b
2015-01-13 21:26:17 +00:00
mistachkin
7bb6e8e169 Get things compiling cleanly with MSVC and W4.
FossilOrigin-Name: c8725fa5fa361959b0f0a3fb36f204905d6f0ae9
2015-01-12 18:52:41 +00:00
drh
f0a88279bd Fix a harmless compiler warning in rtree.
FossilOrigin-Name: 30891c6b8ebe9dfc939f9695bb45a159fbaaf262
2015-01-01 16:47:43 +00:00
drh
051575cbf4 Do not use virtual (and hence redundant) WHERE-clause terms to restrict the
content of a automatic partial index.  Show when an automatic partial index
is used in the EXPLAIN QUERY PLAN output.

FossilOrigin-Name: b9ad601eab1d7298d369267eb697c7fa1bc16985
2014-10-25 12:28:25 +00:00
drh
b6b4b79f34 Fix a faulty assert() statement. Add comments to clarify the behavior of
the sqlite3OpenTableAndIndices() routine in insert.c.  Add test cases to
verify that the assert() statement is not firing inappropriately.
Ticket [369d57fb8e5ccdff06f1].

FossilOrigin-Name: 7029b3404d3f5f698a496934f3a3f2972051b257
2014-08-21 14:10:23 +00:00
dan
57ff60b19b Have calls to the xFilter() method of rtree virtual tables ensure that cursor is initialized before proceeding. Fix for [d2889096e7bdeac].
FossilOrigin-Name: 8cc41b0bf365af47c2061ffe44c86018945dd239
2014-07-29 11:54:18 +00:00
drh
9740726121 A different approach to the autoindex problem that deletes query-planner code
rather than adding it.

FossilOrigin-Name: f270fb6e9e0b5e77f918081962008c6195ab1e36
2014-06-17 12:33:55 +00:00
drh
6b7ff748a1 Allow an automatic index on a WHERE constraint where the RHS is does not
reference another table as long as the RHS is not a constant.

FossilOrigin-Name: 58acc2a8b38c5f13175c191697b4d2b663db1872
2014-06-17 09:00:54 +00:00
drh
65e6b0dd12 Add the sqlite3_rtree_query_callback() API to the RTree virtual table.
(Cherrypick from the sessions branch.)

FossilOrigin-Name: af2cbe64adab5f9e3b0f3da00d06428088589d7f
2014-04-28 17:56:19 +00:00
dan
d88e521f59 Fix an obscure bug causing sqlite3_close() to fail if there are virtual tables on the disconnect list when it is called.
FossilOrigin-Name: 6504aa47a8ebb13827be017c4cb4b2dc3c4c55f4
2014-03-12 19:38:38 +00:00
dan
87af14a639 Prevent the rtree module from reading sqlite_stat1 data from the wrong database.
FossilOrigin-Name: 7ce03c1b5552d830300575c5b41a874db7a2ec77
2014-03-12 12:44:46 +00:00
dan
3afca7d18c Add a test to see what happens if an rtree constructor encounters an SQLITE_BUSY error. No changes to code.
FossilOrigin-Name: 5527e23636eee192030f6a3c41628030b6c50bb8
2014-03-11 09:19:26 +00:00
dan
ff4b23ba9e Fix for [4065ac8595]: Do not order CROSS or LEFT joins, even if the right-hand-side is a virtual table.
FossilOrigin-Name: e2684ece455f53563ae6da7cbb5505d9a4a3076a
2013-11-12 12:17:16 +00:00
dan
14ec33f73b Fix typos in compile and run-time tests of the sqlite library version number in rtree.c.
FossilOrigin-Name: f58d57017199421167dae8ebc67db2f19be45082
2013-11-11 19:56:35 +00:00
dan
a9f5815b67 Add a way for virtual tables to return the expected number of rows for a scan (not just the overall cost) to SQLite. Have the rtree module make use of this.
FossilOrigin-Name: 5a3cfd747a85480d215784817c3821d87ecfa2f7
2013-11-11 19:01:33 +00:00
mistachkin
049d487e2e Modify several extensions to use the new exported function naming. Fix some shared library compilation issues.
FossilOrigin-Name: f2ab8747825ab5131ffab174aa0ffe5e474f6811
2013-07-04 23:53:56 +00:00
drh
5822d6feb2 Fix test cases for the new EXPLAIN QUERY PLAN format. Add the
wherecosttest tool.  Other fixes to logarithm cost.

FossilOrigin-Name: aa580e368e3c398b8377b80342dfdd906324c248
2013-06-10 23:30:09 +00:00
drh
44dc8e822b Fix EXPLAIN QUERY PLAN row counts for the rtree virtual table tests.
FossilOrigin-Name: 15328987cc876d7a4e34561b6b0e08937aefe4be
2013-06-03 18:14:31 +00:00
mistachkin
65eb64765c Correct test numbering on several rtree tests.
FossilOrigin-Name: 0adf8a3a4f2ca370568b35c9e8ce0e18f18701a2
2013-04-10 02:56:24 +00:00
mistachkin
48864df97d Many spelling fixes in comments. No changes to code.
FossilOrigin-Name: 6f6e2d50941e444ebc83604daddcc034137a05b7
2013-03-21 21:20:32 +00:00
mistachkin
806c00666f Enhance RTree virtual table creation error messages that involve the getNodeSize() function.
FossilOrigin-Name: 652233d646236d3fbca629813b20d075f00f3ed6
2013-01-17 03:18:38 +00:00
mistachkin
c197eedbb4 Fix several compiler warnings seen with MSVC.
FossilOrigin-Name: 8b5f617c2a5f0bf7bdbd9144aee58d69564db1e2
2012-10-01 20:12:30 +00:00
drh
0e3037ac36 Refactor the float-to-double rounding routines so that they compile without
warnings.

FossilOrigin-Name: f607ad27c1ede27af24dbee10ca867c8f7761ee3
2012-05-29 00:30:43 +00:00
drh
c6bff38216 Simplification to the coordinate rounding logic in RTree.
FossilOrigin-Name: df24072de27555c6b530b02e821ea8b066c554fc
2012-05-28 20:16:42 +00:00
drh
7923863602 When converting 64-bit floating point coordinates to 32-bit in RTree, take
care to round the values such that the size of the bounding box is enlarged.

FossilOrigin-Name: f4e8ff03eae70334632455a867859cfcc25682be
2012-05-28 19:19:25 +00:00
drh
2aad3da6ea Fix a typo in the rtree6.test script that prevented it from running.
FossilOrigin-Name: 221fe4a8ea5bea90031e459746ea71ff173e6f52
2012-04-03 17:05:16 +00:00
drh
f439fbdab5 The SQLITE_RTREE_INT_ONLY compile-time option causes the RTree extension
to use only integer math and store only integer coordinates.

FossilOrigin-Name: 02b7640f5118e0a635b68f65765191bb3171b7bd
2012-04-02 21:35:42 +00:00
drh
01ea399a84 Suppress harmless compiler warnings on windows in FTS4 and RTREE.
FossilOrigin-Name: 4fd68647c8d4b120e04d054617cef31001f44c6f
2012-03-19 14:51:19 +00:00
drh
64803bd2fa Fix minor issues with FTS and RTREE discovered by coverity.
FossilOrigin-Name: 1c27d842163e27c39bbe9409f50657b9de9ade6e
2011-12-22 17:31:17 +00:00
drh
30ddce6ff4 Added the tool/warnings-clang.sh script. Changes so that there are no
warnings with either gcc or clang even including FTS4 and RTREE and
both with and without SQLITE_THREADSAFE=0.

FossilOrigin-Name: 39408702a989f907261c298bf0947f3e68bd10fe
2011-10-15 00:16:30 +00:00
drh
086e4913b5 Fix a few minor and harmless clang warnings in FTS3 and RTREE.
FossilOrigin-Name: b3324f6cc27c3bfb32b12eacace2fc731c2dd644
2011-10-14 22:57:03 +00:00
drh
7fd3392981 More compiler warning fixes.
FossilOrigin-Name: ed2dda9329ca42e9c0be1986c78b091051e7598f
2011-06-20 19:00:30 +00:00
drh
051eb38a26 Fix various harmless compiler warnings in FTS3 and RTREE.
FossilOrigin-Name: fe62179efdea40887e23a16f898060b879013824
2011-06-20 17:24:29 +00:00
drh
7ee4fdd7ba Fix some minor and harmless compiler warnings.
FossilOrigin-Name: a4755e7088c3cc7c5ea191ce37f3950472f523ec
2011-05-25 23:18:02 +00:00
dan
133d7dab17 Add extended return code SQLITE_CORRUPT_VTAB. Returned when the tcontents of the sqlite tables used internally by a virtual table module are invalid or inconsistent.
FossilOrigin-Name: 8844e8bfb87314fb40ecb92705e8fff88f72bb38
2011-05-17 15:56:16 +00:00
dan
c6055c7374 Have r-tree virtual tables support on-conflict clauses.
FossilOrigin-Name: 822ab52f1023b1c4973c806cc75454acd4e95fd0
2011-04-28 18:46:46 +00:00
drh
fcd71b6010 Suppress many harmless compiler warnings, mostly signed/unsigned comparisons
within asserts or unused parameters in extensions.

FossilOrigin-Name: 3eeb0ff78d04891b5fd1a3d99a9fb8cfbed77a81
2011-04-05 22:08:24 +00:00
dan
fb1f98a1ac Fix a numbering issue in rtree6.test. Add a couple of extra tests.
FossilOrigin-Name: 0b7668a71ef8995ea0306c7d890f87761961426e
2011-03-23 10:52:23 +00:00
dan
8ad5c9492d Change the rtree module to support queries with multiple comparison operators (i.e. > or <) of the same type on a single column.
FossilOrigin-Name: 387b55aa9bb0f978641f9c2fa40f84fd98662047
2011-03-23 10:38:49 +00:00
drh
3fcdfb35a6 Fix quoting of the result in rtreeB.test.
FossilOrigin-Name: c6532b35cc5a81cc753a22e0165bfdd5143941f1
2011-03-02 22:07:29 +00:00
drh
befd5f3c20 Make sure the rtreenode() testing and analysis routine in the RTREE extension
can handle 64-bit rowids.  This fix is in response to a message on the
mailing list.

FossilOrigin-Name: 24602557fc3295fe2836d269175f12ec680ac011
2011-03-02 15:44:35 +00:00
dan
c79b6a8c51 Fix a (harmless) valgrind warning in the rtree extension.
FossilOrigin-Name: a94b9a395e0be9549d8c28e2b86b995c73c7b671
2010-12-02 11:24:58 +00:00
drh
6ea28d6d84 Fix various compiler warnings.
FossilOrigin-Name: c412f61229b6ab1ac90b932afd56f7c5e3ba1cfe
2010-11-26 16:49:59 +00:00