]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add tests for the rtree module to verify that attempts to insert non-integer primary...
authordan <dan@noemail.net>
Sat, 3 Oct 2015 12:23:18 +0000 (12:23 +0000)
committerdan <dan@noemail.net>
Sat, 3 Oct 2015 12:23:18 +0000 (12:23 +0000)
FossilOrigin-Name: f653fce90846b700441e8fa5f1930c1ec5e38e31

ext/rtree/rtree1.test
manifest
manifest.uuid

index 0beb16cc9494468168c6c9b26c4ebbbc09a78770..c9192de192edd4a7c5db0c3eaf6b1d30685338b2 100644 (file)
@@ -34,6 +34,11 @@ set testprefix rtree1
 #
 #   rtree-12.*: Test that on-conflict clauses are supported.
 #   rtree-13.*: Test that bug [d2889096e7bdeac6d] has been fixed.
+#   rtree-14.*: Test if a non-integer is inserted into the PK column of an
+#               r-tree table, it is converted to an integer before being
+#               inserted. Also that if a non-numeric is inserted into one
+#               of the min/max dimension columns, it is converted to the
+#               required type before being inserted.
 #
 
 ifcapable !rtree {
@@ -535,4 +540,54 @@ do_execsql_test 13.2 {
   SELECT * FROM r CROSS JOIN t9 WHERE id=x;
 } {1 1 0.0 0.0 2 2 0.0 0.0}
 
+#-------------------------------------------------------------------------
+# Test if a non-integer is inserted into the PK column of an r-tree
+# table, it is converted to an integer before being inserted. Also
+# that if a non-numeric is inserted into one of the min/max dimension
+# columns, it is converted to the required type before being inserted.
+#
+do_execsql_test 14.1 {
+  CREATE VIRTUAL TABLE t10 USING rtree(ii, x1, x2);
+}
+
+do_execsql_test 14.2 {
+  INSERT INTO t10 VALUES(NULL,   1, 2);
+  INSERT INTO t10 VALUES(NULL,   2, 3);
+  INSERT INTO t10 VALUES('4xxx', 3, 4);
+  INSERT INTO t10 VALUES(5.0,    4, 5);
+  INSERT INTO t10 VALUES(6.4,    5, 6);
+}
+do_execsql_test 14.3 {
+  SELECT * FROM t10;
+} {
+  1 1.0 2.0   2 2.0 3.0   4 3.0 4.0   5 4.0 5.0   6 5.0 6.0
+}
+
+do_execsql_test 14.4 {
+  DELETE FROM t10;
+  INSERT INTO t10 VALUES(1, 'one', 'two');
+  INSERT INTO t10 VALUES(2, '52xyz', '81...');
+}
+do_execsql_test 14.5 {
+  SELECT * FROM t10;
+} {
+  1 0.0 0.0
+  2 52.0 81.0
+}
+
+do_execsql_test 14.4 {
+  DROP TABLE t10;
+  CREATE VIRTUAL TABLE t10 USING rtree_i32(ii, x1, x2);
+  INSERT INTO t10 VALUES(1, 'one', 'two');
+  INSERT INTO t10 VALUES(2, '52xyz', '81...');
+  INSERT INTO t10 VALUES(3, 42.3, 49.9);
+}
+do_execsql_test 14.5 {
+  SELECT * FROM t10;
+} {
+  1 0 0
+  2 52 81
+  3 42 49
+}
+
 finish_test
index 5bb7286a319019a202e5a72774abff931c06137a..e1606cc8f143cff8eec96f95f135e3f018e34240 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sfts5\sto\savoid\susing\sa\sstatement\sjournal\sfor\sUPDATE\sand\sDELETE\soperations\sthat\saffect\sat\smost\sa\ssingle\srow.
-D 2015-10-02T20:04:30.384
+C Add\stests\sfor\sthe\srtree\smodule\sto\sverify\sthat\sattempts\sto\sinsert\snon-integer\sprimary\skey\svalues\sor\snon-numeric\sdimensions\sinto\san\srtree\stable\sare\shandled\scorrectly.
+D 2015-10-03T12:23:18.660
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2143eeef6d0cc26006ae5fc4bb242a4a8b973412
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -236,7 +236,7 @@ F ext/rbu/test_rbu.c 2a3652241fa45d5eaa141775e4ae68c1d3582c03
 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
 F ext/rtree/rtree.c 0f9b595bd0debcbedf1d7a63d0e0678d619e6c9c
 F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
-F ext/rtree/rtree1.test 541bbcab74613907fea08b2ecdcdd5b7aa724cc9
+F ext/rtree/rtree1.test 96a80c08440c932cd72aac50660e7af2612d2cda
 F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
 F ext/rtree/rtree3.test a494da55c30ee0bc9b01a91c80c81b387b22d2dc
 F ext/rtree/rtree4.test c8fe384f60ebd49540a5fecc990041bf452eb6e0
@@ -1390,7 +1390,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 6f90839e91024e2006042f5eb7f21ca5b47a9b4a
-R c4ed86613c7c7ba1f8647ee3a7ddd45f
+P 5c83b9db46d61cfa76a1abed50467e2f02db0eb0
+R 196ea698193815c30e84c4eb112a664d
 U dan
-Z c935b0cc17e8eaea980f1eab0035d787
+Z 17a552709c7d631d9413f0310567b313
index 7529743fd4a0a6b63099f8916784709c534c82e2..df5d2154c5953092826fb0cb18cf6910ada62613 100644 (file)
@@ -1 +1 @@
-5c83b9db46d61cfa76a1abed50467e2f02db0eb0
\ No newline at end of file
+f653fce90846b700441e8fa5f1930c1ec5e38e31
\ No newline at end of file