/ Check-in [b2f7eb3c]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Merge the R-Tree fix and the new SQLITE_TESTCTRL_ISINIT test control from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | threads
Files: files | file ages | folders
SHA1: b2f7eb3cc27ecf9a6a88907991148bca1a7d54b3
User & Date: drh 2014-07-29 14:16:42
Context
2014-07-29
15:18
Fix the threads build on Windows when SQLITE_MAX_WORKER_THREADS is greater than 0. check-in: f37db3a0 user: drh tags: threads
14:16
Merge the R-Tree fix and the new SQLITE_TESTCTRL_ISINIT test control from trunk. check-in: b2f7eb3c user: drh tags: threads
14:09
Add the SQLITE_TESTCTRL_ISINIT file control. check-in: 8b651d4d user: drh tags: trunk
00:42
Add some asserts to the Win32 mutex subsystem. check-in: e8f2dc5f user: mistachkin tags: threads
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/rtree/rtree.c.

  1529   1529     RtreeNode *pRoot = 0;
  1530   1530     int ii;
  1531   1531     int rc = SQLITE_OK;
  1532   1532     int iCell = 0;
  1533   1533   
  1534   1534     rtreeReference(pRtree);
  1535   1535   
         1536  +  /* Reset the cursor to the same state as rtreeOpen() leaves it in. */
  1536   1537     freeCursorConstraints(pCsr);
         1538  +  sqlite3_free(pCsr->aPoint);
         1539  +  memset(pCsr, 0, sizeof(RtreeCursor));
         1540  +  pCsr->base.pVtab = (sqlite3_vtab*)pRtree;
         1541  +
  1537   1542     pCsr->iStrategy = idxNum;
  1538         -
  1539   1543     if( idxNum==1 ){
  1540   1544       /* Special case - lookup by rowid. */
  1541   1545       RtreeNode *pLeaf;        /* Leaf on which the required cell resides */
  1542   1546       RtreeSearchPoint *p;     /* Search point for the the leaf */
  1543   1547       i64 iRowid = sqlite3_value_int64(argv[0]);
  1544   1548       i64 iNode = 0;
  1545   1549       rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode);

Changes to ext/rtree/rtree1.test.

    29     29   #   rtree-4.*: Test INSERT
    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  +#   rtree-13.*: Test that bug [d2889096e7bdeac6d] has been fixed.
    36     37   #
    37     38   
    38     39   ifcapable !rtree {
    39     40     finish_test
    40     41     return
    41     42   }
    42     43   
................................................................................
   509    510       do_test $testname.2 [list sql_uses_stmt db $sql] $uses
   510    511       do_execsql_test $testname.3 { SELECT * FROM t1 ORDER BY idx } $data
   511    512   
   512    513       do_test $testname.4 { rtree_check db t1 } 0
   513    514       db close
   514    515     }
   515    516   }
          517  +
          518  +#-------------------------------------------------------------------------
          519  +# Test that bug [d2889096e7bdeac6d] has been fixed.
          520  +#
          521  +reset_db
          522  +do_execsql_test 13.1 {
          523  +  CREATE VIRTUAL TABLE t9 USING rtree(id, xmin, xmax);
          524  +  INSERT INTO t9 VALUES(1,0,0);            
          525  +  INSERT INTO t9 VALUES(2,0,0);
          526  +  SELECT * FROM t9 WHERE id IN (1, 2);
          527  +} {1 0.0 0.0 2 0.0 0.0}
          528  +
          529  +do_execsql_test 13.2 {
          530  +  WITH r(x) AS (
          531  +    SELECT 1 UNION ALL
          532  +    SELECT 2 UNION ALL
          533  +    SELECT 3
          534  +  )
          535  +  SELECT * FROM r CROSS JOIN t9 WHERE id=x;
          536  +} {1 1 0.0 0.0 2 2 0.0 0.0}
          537  +
   516    538   finish_test

Changes to src/main.c.

  3374   3374       /*   sqlite3_test_control(SQLITE_TESTCTRL_SORTER_MMAP, db, nMax); */
  3375   3375       case SQLITE_TESTCTRL_SORTER_MMAP: {
  3376   3376         sqlite3 *db = va_arg(ap, sqlite3*);
  3377   3377         db->nMaxSorterMmap = va_arg(ap, int);
  3378   3378         break;
  3379   3379       }
  3380   3380   
         3381  +    /*   sqlite3_test_control(SQLITE_TESTCTRL_ISINIT);
         3382  +    **
         3383  +    ** Return SQLITE_OK if SQLite has been initialized and SQLITE_ERROR if
         3384  +    ** not.
         3385  +    */
         3386  +    case SQLITE_TESTCTRL_ISINIT: {
         3387  +      if( sqlite3GlobalConfig.isInit==0 ) rc = SQLITE_ERROR;
         3388  +      break;
         3389  +    }
  3381   3390     }
  3382   3391     va_end(ap);
  3383   3392   #endif /* SQLITE_OMIT_BUILTIN_TEST */
  3384   3393     return rc;
  3385   3394   }
  3386   3395   
  3387   3396   /*

Changes to src/sqlite.h.in.

  6189   6189   #define SQLITE_TESTCTRL_ISKEYWORD               16
  6190   6190   #define SQLITE_TESTCTRL_SCRATCHMALLOC           17
  6191   6191   #define SQLITE_TESTCTRL_LOCALTIME_FAULT         18
  6192   6192   #define SQLITE_TESTCTRL_EXPLAIN_STMT            19
  6193   6193   #define SQLITE_TESTCTRL_NEVER_CORRUPT           20
  6194   6194   #define SQLITE_TESTCTRL_VDBE_COVERAGE           21
  6195   6195   #define SQLITE_TESTCTRL_BYTEORDER               22
  6196         -#define SQLITE_TESTCTRL_SORTER_MMAP             23
  6197         -#define SQLITE_TESTCTRL_LAST                    23
         6196  +#define SQLITE_TESTCTRL_ISINIT                  23
         6197  +#define SQLITE_TESTCTRL_SORTER_MMAP             24
         6198  +#define SQLITE_TESTCTRL_LAST                    24
  6198   6199   
  6199   6200   /*
  6200   6201   ** CAPI3REF: SQLite Runtime Status
  6201   6202   **
  6202   6203   ** ^This interface is used to retrieve runtime status information
  6203   6204   ** about the performance of SQLite, and optionally to reset various
  6204   6205   ** highwater marks.  ^The first argument is an integer code for