]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a bug in rowid=? query handling. More problems remain.
authordrh <drh@noemail.net>
Wed, 16 Apr 2014 14:45:11 +0000 (14:45 +0000)
committerdrh <drh@noemail.net>
Wed, 16 Apr 2014 14:45:11 +0000 (14:45 +0000)
FossilOrigin-Name: 5b0e6ba4a5050cf81cf41b977b28d714163569e0

ext/rtree/rtree.c
manifest
manifest.uuid

index 3754655bb0620ba686a065027b19677b9247bc20..26082ff51128db8b986bc375bfaf595a09bdd847 100644 (file)
@@ -1230,6 +1230,7 @@ static void traceQueue(RtreeCursor *pCur, const char *zPrefix){
     tracePoint(&pCur->aPoint[ii], ii, pCur);
   }
 }
+# define RTREE_QUEUE_TRACE(A,B) traceQueue(A,B)
 #else
 # define RTREE_QUEUE_TRACE(A,B)   /* no-op */
 #endif
@@ -1284,7 +1285,6 @@ static void rtreeSearchPointPop(RtreeCursor *p){
 */
 static int rtreeStepToLeaf(RtreeCursor *pCur){
   RtreeSearchPoint *p;
-  RtreeSearchPoint *pNew;
   Rtree *pRtree = RTREE_OF_CURSOR(pCur);
   RtreeNode *pNode;
   int eWithin;
@@ -1313,17 +1313,16 @@ static int rtreeStepToLeaf(RtreeCursor *pCur){
         RTREE_QUEUE_TRACE(pCur, "POP-S:");
         rtreeSearchPointPop(pCur);
       }
-      pNew = rtreeSearchPointNew(pCur, /*rScore*/0.0, x.iLevel-1);
-      if( pNew==0 ) return SQLITE_NOMEM;
-      pNew->eWithin = eWithin;
-      if( pNew->iLevel ){
-        pNew->id = cell.iRowid;
-        pNew->iCell = 0;
+      p = rtreeSearchPointNew(pCur, /*rScore*/0.0, x.iLevel-1);
+      if( p==0 ) return SQLITE_NOMEM;
+      p->eWithin = eWithin;
+      if( p->iLevel ){
+        p->id = cell.iRowid;
+        p->iCell = 0;
       }else{
-        pNew->id = x.id;
-        pNew->iCell = x.iCell;
+        p->id = x.id;
+        p->iCell = x.iCell;
       }
-      p = pNew;
       RTREE_QUEUE_TRACE(pCur, "PUSH-S:");
       break;
     }
@@ -1496,7 +1495,9 @@ static int rtreeFilter(
     rc = findLeafNode(pRtree, iRowid, &pLeaf, &p->id);
     pCsr->aNode[0] = pLeaf;
     p->eWithin = PARTLY_WITHIN;
-    if( rc ) rc = nodeRowidIndex(pRtree, pLeaf, iRowid, &iCell);
+    if( rc==SQLITE_OK ){
+      rc = nodeRowidIndex(pRtree, pLeaf, iRowid, &iCell);
+    }
     p->iCell = iCell;
     RTREE_QUEUE_TRACE(pCsr, "PUSH-F1:");
   }else{
index 83f2beda77d9952d4442ecaeded1a10d60d9ca04..df0b85687e3b8f8ff8773d969515ab4de83aaebb 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Bug\sfixes\sto\sthe\spriority-queue\simplementation\sfor\sR-Trees.\s\sImproved\stracing\ncapability.\s\sSome\squeries\swork\snow,\sbut\sstill\smany\sproblems.
-D 2014-04-16T13:00:08.915
+C Fix\sa\sbug\sin\srowid=?\squery\shandling.\s\sMore\sproblems\sremain.
+D 2014-04-16T14:45:11.945
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in e4ee6d36cdf6136aee0158675a3b24dd3bf31a5a
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -120,7 +120,7 @@ F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
 F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
 F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
-F ext/rtree/rtree.c 3105c5514d6dbf99c39aceac84c4c0f9e00f90ea
+F ext/rtree/rtree.c 4702eae330e9803ac51208ec0e26c5aceb0cd20b
 F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
 F ext/rtree/rtree1.test cf679265ecafff494a768ac9c2f43a70915a6290
 F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
@@ -1175,7 +1175,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 53688a25c23c394278a357829793889970aa4157
-R 67a30187386908beb1eb82f50c3b2dfd
+P a439ddd629c6bb5ea2e7e274673fee4f5c207acf
+R 759346bdeaafb6dce8a9cda8463bc2de
 U drh
-Z ba82d149b9f56c655f1e6f2a959cfc71
+Z 100295249b6d7d7223775c8a6bd7cd19
index b2db9c77b5e1f52fa8609bf1bf3bf9bb0986c4c7..810616495876338397437cfbb26c93835331b642 100644 (file)
@@ -1 +1 @@
-a439ddd629c6bb5ea2e7e274673fee4f5c207acf
\ No newline at end of file
+5b0e6ba4a5050cf81cf41b977b28d714163569e0
\ No newline at end of file