SQLite

Check-in [8cc41b0b]
Login

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

Overview
Comment:Have calls to the xFilter() method of rtree virtual tables ensure that cursor is initialized before proceeding. Fix for [d2889096e7bdeac].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8cc41b0bf365af47c2061ffe44c86018945dd239
User & Date: dan 2014-07-29 11:54:18
Context
2014-07-29
14:09
Add the SQLITE_TESTCTRL_ISINIT file control. (check-in: 8b651d4d user: drh tags: trunk)
12:40
Merge recent trunk changes, and especially the fix for the R-Tree problem described in ticket [d2889096e7bdeac6]. (check-in: 8f1beead user: drh tags: sessions)
11:54
Have calls to the xFilter() method of rtree virtual tables ensure that cursor is initialized before proceeding. Fix for [d2889096e7bdeac]. (check-in: 8cc41b0b user: dan tags: trunk)
2014-07-26
20:12
Remove an unreachable branch from the sqlite3_value_numeric_type() interface. (check-in: 5350229b user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/rtree/rtree.c.

1529
1530
1531
1532
1533
1534
1535

1536
1537


1538

1539
1540
1541
1542
1543
1544
1545
  RtreeNode *pRoot = 0;
  int ii;
  int rc = SQLITE_OK;
  int iCell = 0;

  rtreeReference(pRtree);


  freeCursorConstraints(pCsr);
  pCsr->iStrategy = idxNum;




  if( idxNum==1 ){
    /* Special case - lookup by rowid. */
    RtreeNode *pLeaf;        /* Leaf on which the required cell resides */
    RtreeSearchPoint *p;     /* Search point for the the leaf */
    i64 iRowid = sqlite3_value_int64(argv[0]);
    i64 iNode = 0;
    rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode);







>

|
>
>

>







1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
  RtreeNode *pRoot = 0;
  int ii;
  int rc = SQLITE_OK;
  int iCell = 0;

  rtreeReference(pRtree);

  /* Reset the cursor to the same state as rtreeOpen() leaves it in. */
  freeCursorConstraints(pCsr);
  sqlite3_free(pCsr->aPoint);
  memset(pCsr, 0, sizeof(RtreeCursor));
  pCsr->base.pVtab = (sqlite3_vtab*)pRtree;

  pCsr->iStrategy = idxNum;
  if( idxNum==1 ){
    /* Special case - lookup by rowid. */
    RtreeNode *pLeaf;        /* Leaf on which the required cell resides */
    RtreeSearchPoint *p;     /* Search point for the the leaf */
    i64 iRowid = sqlite3_value_int64(argv[0]);
    i64 iNode = 0;
    rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode);

Changes to ext/rtree/rtree1.test.

29
30
31
32
33
34
35

36
37
38
39
40
41
42
#   rtree-4.*: Test INSERT
#   rtree-5.*: Test DELETE
#   rtree-6.*: Test UPDATE
#   rtree-7.*: Test renaming an r-tree table.
#   rtree-8.*: Test constrained scans of r-tree data.
#
#   rtree-12.*: Test that on-conflict clauses are supported.

#

ifcapable !rtree {
  finish_test
  return
}








>







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#   rtree-4.*: Test INSERT
#   rtree-5.*: Test DELETE
#   rtree-6.*: Test UPDATE
#   rtree-7.*: Test renaming an r-tree table.
#   rtree-8.*: Test constrained scans of r-tree data.
#
#   rtree-12.*: Test that on-conflict clauses are supported.
#   rtree-13.*: Test that bug [d2889096e7bdeac6d] has been fixed.
#

ifcapable !rtree {
  finish_test
  return
}

509
510
511
512
513
514
515





















516
    do_test $testname.2 [list sql_uses_stmt db $sql] $uses
    do_execsql_test $testname.3 { SELECT * FROM t1 ORDER BY idx } $data

    do_test $testname.4 { rtree_check db t1 } 0
    db close
  }
}





















finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
    do_test $testname.2 [list sql_uses_stmt db $sql] $uses
    do_execsql_test $testname.3 { SELECT * FROM t1 ORDER BY idx } $data

    do_test $testname.4 { rtree_check db t1 } 0
    db close
  }
}

#-------------------------------------------------------------------------
# Test that bug [d2889096e7bdeac6d] has been fixed.
#
reset_db
do_execsql_test 13.1 {
  CREATE VIRTUAL TABLE t9 USING rtree(id, xmin, xmax);
  INSERT INTO t9 VALUES(1,0,0);            
  INSERT INTO t9 VALUES(2,0,0);
  SELECT * FROM t9 WHERE id IN (1, 2);
} {1 0.0 0.0 2 0.0 0.0}

do_execsql_test 13.2 {
  WITH r(x) AS (
    SELECT 1 UNION ALL
    SELECT 2 UNION ALL
    SELECT 3
  )
  SELECT * FROM r CROSS JOIN t9 WHERE id=x;
} {1 1 0.0 0.0 2 2 0.0 0.0}

finish_test