/ Check-in [f653fce9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f653fce90846b700441e8fa5f1930c1ec5e38e31
User & Date: dan 2015-10-03 12:23:18
Context
2015-10-03
15:38
Update fts5 to support the table function syntax. "... FROM fts5_tbl WHERE fts5_tbl MATCH ?1 AND rank MATCH ?1" can now be written "FROM fts5_tbl(?1, ?2)". check-in: 41d17d9e user: dan tags: trunk
12:23
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. check-in: f653fce9 user: dan tags: trunk
2015-10-02
20:04
Update fts5 to avoid using a statement journal for UPDATE and DELETE operations that affect at most a single row. check-in: 5c83b9db user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/rtree/rtree1.test.

    30     30   #   rtree-5.*: Test DELETE
    31     31   #   rtree-6.*: Test UPDATE
    32     32   #   rtree-7.*: Test renaming an r-tree table.
    33     33   #   rtree-8.*: Test constrained scans of r-tree data.
    34     34   #
    35     35   #   rtree-12.*: Test that on-conflict clauses are supported.
    36     36   #   rtree-13.*: Test that bug [d2889096e7bdeac6d] has been fixed.
           37  +#   rtree-14.*: Test if a non-integer is inserted into the PK column of an
           38  +#               r-tree table, it is converted to an integer before being
           39  +#               inserted. Also that if a non-numeric is inserted into one
           40  +#               of the min/max dimension columns, it is converted to the
           41  +#               required type before being inserted.
    37     42   #
    38     43   
    39     44   ifcapable !rtree {
    40     45     finish_test
    41     46     return
    42     47   }
    43     48   
................................................................................
   530    535     WITH r(x) AS (
   531    536       SELECT 1 UNION ALL
   532    537       SELECT 2 UNION ALL
   533    538       SELECT 3
   534    539     )
   535    540     SELECT * FROM r CROSS JOIN t9 WHERE id=x;
   536    541   } {1 1 0.0 0.0 2 2 0.0 0.0}
          542  +
          543  +#-------------------------------------------------------------------------
          544  +# Test if a non-integer is inserted into the PK column of an r-tree
          545  +# table, it is converted to an integer before being inserted. Also
          546  +# that if a non-numeric is inserted into one of the min/max dimension
          547  +# columns, it is converted to the required type before being inserted.
          548  +#
          549  +do_execsql_test 14.1 {
          550  +  CREATE VIRTUAL TABLE t10 USING rtree(ii, x1, x2);
          551  +}
          552  +
          553  +do_execsql_test 14.2 {
          554  +  INSERT INTO t10 VALUES(NULL,   1, 2);
          555  +  INSERT INTO t10 VALUES(NULL,   2, 3);
          556  +  INSERT INTO t10 VALUES('4xxx', 3, 4);
          557  +  INSERT INTO t10 VALUES(5.0,    4, 5);
          558  +  INSERT INTO t10 VALUES(6.4,    5, 6);
          559  +}
          560  +do_execsql_test 14.3 {
          561  +  SELECT * FROM t10;
          562  +} {
          563  +  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
          564  +}
          565  +
          566  +do_execsql_test 14.4 {
          567  +  DELETE FROM t10;
          568  +  INSERT INTO t10 VALUES(1, 'one', 'two');
          569  +  INSERT INTO t10 VALUES(2, '52xyz', '81...');
          570  +}
          571  +do_execsql_test 14.5 {
          572  +  SELECT * FROM t10;
          573  +} {
          574  +  1 0.0 0.0
          575  +  2 52.0 81.0
          576  +}
          577  +
          578  +do_execsql_test 14.4 {
          579  +  DROP TABLE t10;
          580  +  CREATE VIRTUAL TABLE t10 USING rtree_i32(ii, x1, x2);
          581  +  INSERT INTO t10 VALUES(1, 'one', 'two');
          582  +  INSERT INTO t10 VALUES(2, '52xyz', '81...');
          583  +  INSERT INTO t10 VALUES(3, 42.3, 49.9);
          584  +}
          585  +do_execsql_test 14.5 {
          586  +  SELECT * FROM t10;
          587  +} {
          588  +  1 0 0
          589  +  2 52 81
          590  +  3 42 49
          591  +}
   537    592   
   538    593   finish_test