/ Changes On Branch tree-stat1-fix
Login

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

Changes In Branch tree-stat1-fix Excluding Merge-Ins

This is equivalent to a diff from 3ad2531efb to 9589e93771

2016-05-23
19:02
Avoid a minor error message when running RTREE without an sqlite_stat1 table. (check-in: 276e92f5b4 user: drh tags: trunk)
18:27
Fix the rtreeG.test test case. (Closed-Leaf check-in: 9589e93771 user: drh tags: tree-stat1-fix)
18:12
Fix RTREE so that it does not run queries against the sqlite_stat1 if that table does not exist. (check-in: 48526a2fe5 user: drh tags: tree-stat1-fix)
18:06
Remove an extra "finish_test" from the end of rtreeC.test. (check-in: bfbb6dd84b user: drh tags: tree-stat1-fix)
16:16
Improve the error messages generated by the rtree module when a constraint fails. (check-in: 3ad2531efb user: dan tags: trunk)
16:15
Lemon enhancement: avoid unnecessary reduce actions that convert one non-terminal into another but have no side effects. (check-in: a86e782ad1 user: drh tags: trunk)

Changes to ext/rtree/rtree.c.

  3008   3008   static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){
  3009   3009     const char *zFmt = "SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'";
  3010   3010     char *zSql;
  3011   3011     sqlite3_stmt *p;
  3012   3012     int rc;
  3013   3013     i64 nRow = 0;
  3014   3014   
         3015  +  if( sqlite3_table_column_metadata(db,pRtree->zDb,"sqlite_stat1",
         3016  +          0,0,0,0,0,0)==SQLITE_ERROR ){
         3017  +    pRtree->nRowEst = RTREE_DEFAULT_ROWEST;
         3018  +    return SQLITE_OK;
         3019  +  }
  3015   3020     zSql = sqlite3_mprintf(zFmt, pRtree->zDb, pRtree->zName);
  3016   3021     if( zSql==0 ){
  3017   3022       rc = SQLITE_NOMEM;
  3018   3023     }else{
  3019   3024       rc = sqlite3_prepare_v2(db, zSql, -1, &p, 0);
  3020   3025       if( rc==SQLITE_OK ){
  3021   3026         if( sqlite3_step(p)==SQLITE_ROW ) nRow = sqlite3_column_int64(p, 0);

Changes to ext/rtree/rtreeC.test.

   344    344     WHERE (x1 BETWEEN xmin AND xmax);
   345    345   } {
   346    346     0 0 1 {SCAN TABLE xdir} 
   347    347     0 1 0 {SCAN TABLE rt VIRTUAL TABLE INDEX 2:B0D1}
   348    348     0 2 2 {SCAN TABLE ydir} 
   349    349     2 4
   350    350   }
   351         -
   352         -finish_test
   353         -
   354         -
   355    351   
   356    352   finish_test

Added ext/rtree/rtreeG.test.

            1  +# 2016-05-32
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# a legal notice, here is a blessing:
            5  +#
            6  +#    May you do good and not evil.
            7  +#    May you find forgiveness for yourself and forgive others.
            8  +#    May you share freely, never taking more than you give.
            9  +#
           10  +#***********************************************************************
           11  +# This file contains tests for the r-tree module.
           12  +#
           13  +# Verify that no invalid SQL is run during initialization
           14  +
           15  +if {![info exists testdir]} {
           16  +  set testdir [file join [file dirname [info script]] .. .. test]
           17  +} 
           18  +source $testdir/tester.tcl
           19  +ifcapable !rtree { finish_test ; return }
           20  +
           21  +db close
           22  +sqlite3_shutdown
           23  +test_sqlite3_log [list lappend ::log]
           24  +set ::log [list]
           25  +sqlite3 db test.db
           26  +
           27  +
           28  +set ::log {}
           29  +do_execsql_test rtreeG-1.1 {
           30  +  CREATE VIRTUAL TABLE t1 USING rtree(id,x0,x1,y0,y1);
           31  +} {}
           32  +do_test rtreeG-1.1log {
           33  +  set ::log
           34  +} {}
           35  +
           36  +do_execsql_test rtreeG-1.2 {
           37  +  INSERT INTO t1 VALUES(1,10,15,5,23),(2,20,21,5,23),(3,10,15,20,30);
           38  +  SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25;
           39  +} {1}
           40  +do_test rtreeG-1.2log {
           41  +  set ::log
           42  +} {}
           43  +
           44  +db close
           45  +sqlite3 db test.db
           46  +do_execsql_test rtreeG-1.3 {
           47  +  SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25;
           48  +} {1}
           49  +do_test rtreeG-1.3log {
           50  +  set ::log
           51  +} {}
           52  +
           53  +do_execsql_test rtreeG-1.4 {
           54  +  DROP TABLE t1;
           55  +} {}
           56  +do_test rtreeG-1.4log {
           57  +  set ::log
           58  +} {}
           59  +
           60  +db close
           61  +sqlite3_shutdown
           62  +test_sqlite3_log
           63  +sqlite3_initialize
           64  +sqlite3 db test.db
           65  +
           66  +finish_test