/ Check-in [95fd296f]
Login

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

Overview
Comment:Fix a prepare-statement leak.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | aux-data-in-rtree
Files: files | file ages | folders
SHA3-256:95fd296ffc8130526a1453cbdca6ce47f22fc5b5c474aa31d66b627d0c7393a1
User & Date: drh 2018-05-18 16:46:09
Context
2018-05-18
16:53
Avoid unnecessary sqlite3_finalize() operations. check-in: 16f71032 user: drh tags: aux-data-in-rtree
16:46
Fix a prepare-statement leak. check-in: 95fd296f user: drh tags: aux-data-in-rtree
15:21
Improved error messages. Limit the number of auxiliary columns to 100. check-in: 059d20ab user: drh tags: aux-data-in-rtree
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/rtree/rtree.c.

1723
1724
1725
1726
1727
1728
1729

1730
1731
1732
1733
1734
1735
1736
  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 */







>







1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
  int iCell = 0;

  rtreeReference(pRtree);

  /* Reset the cursor to the same state as rtreeOpen() leaves it in. */
  freeCursorConstraints(pCsr);
  sqlite3_free(pCsr->aPoint);
  sqlite3_finalize(pCsr->pReadAux);
  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 */

Changes to ext/rtree/rtree1.test.

633
634
635
636
637
638
639
640
641
642






643
644
645
  for {set i 12} {$i<=101} {incr i} {
     append sql ", +a$i"
  }
  append sql ");"
  catchsql $sql
} {1 {Too many columns for an rtree table}}











expand_all_sql db
finish_test







|
|
|
>
>
>
>
>
>



633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
  for {set i 12} {$i<=101} {incr i} {
     append sql ", +a$i"
  }
  append sql ");"
  catchsql $sql
} {1 {Too many columns for an rtree table}}

do_execsql_test 16.130 {
  DROP TABLE IF EXISTS rt1;
  CREATE VIRTUAL TABLE rt1 USING rtree(id, x1, x2, +aux);
  INSERT INTO rt1 VALUES(1, 1, 2, 'aux1');
  INSERT INTO rt1 VALUES(2, 2, 3, 'aux2');
  INSERT INTO rt1 VALUES(3, 3, 4, 'aux3');
  INSERT INTO rt1 VALUES(4, 4, 5, 'aux4');
  SELECT * FROM rt1 WHERE id IN (1, 2, 3, 4);
} {1 1.0 2.0 aux1 2 2.0 3.0 aux2 3 3.0 4.0 aux3 4 4.0 5.0 aux4}

expand_all_sql db
finish_test