SQLite

Check-in [4394693882]
Login

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

Overview
Comment:Be sure to initialize the sqlite3_rtree_query_info.iRowid field for the leaves of the R-Tree when doing a query callback search.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | rtree-enhancements
Files: files | file ages | folders
SHA1: 4394693882c04c19ebe87ef7547c57e679554397
User & Date: drh 2014-04-21 15:53:45.432
Context
2014-04-21
18:13
Fix the generation of sqlite3_rtree_query_info.iRowid and add test cases to verify that it is fixed. (check-in: eba95ead49 user: drh tags: rtree-enhancements)
15:53
Be sure to initialize the sqlite3_rtree_query_info.iRowid field for the leaves of the R-Tree when doing a query callback search. (check-in: 4394693882 user: drh tags: rtree-enhancements)
15:21
Fix an off-by-one error in setting the "iLevel" field of the sqlite3_rtree_query_info structure passed into the RTree query callback. (check-in: d708f159ab user: drh tags: rtree-enhancements)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/rtree/rtree.c.
958
959
960
961
962
963
964



965
966
967
968
969
970
971
  int nCoord = pInfo->nCoord;                           /* No. of coordinates */
  int rc;                                             /* Callback return code */
  sqlite3_rtree_dbl aCoord[RTREE_MAX_DIMENSIONS*2];   /* Decoded coordinates */

  assert( pConstraint->op==RTREE_MATCH || pConstraint->op==RTREE_QUERY );
  assert( nCoord==2 || nCoord==4 || nCoord==6 || nCoord==8 || nCoord==10 );




  pCellData += 8;
  for(i=0; i<nCoord; i++, pCellData += 4){
    RTREE_DECODE_COORD(eInt, pCellData, aCoord[i]);
  }
  if( pConstraint->op==RTREE_MATCH ){
    rc = pConstraint->u.xGeom((sqlite3_rtree_geometry*)pInfo,
                              nCoord, aCoord, &i);







>
>
>







958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
  int nCoord = pInfo->nCoord;                           /* No. of coordinates */
  int rc;                                             /* Callback return code */
  sqlite3_rtree_dbl aCoord[RTREE_MAX_DIMENSIONS*2];   /* Decoded coordinates */

  assert( pConstraint->op==RTREE_MATCH || pConstraint->op==RTREE_QUERY );
  assert( nCoord==2 || nCoord==4 || nCoord==6 || nCoord==8 || nCoord==10 );

  if( pConstraint->op==RTREE_MATCH && pSearch->iLevel==1 ){
    pInfo->iRowid = readInt64(pCellData);
  }
  pCellData += 8;
  for(i=0; i<nCoord; i++, pCellData += 4){
    RTREE_DECODE_COORD(eInt, pCellData, aCoord[i]);
  }
  if( pConstraint->op==RTREE_MATCH ){
    rc = pConstraint->u.xGeom((sqlite3_rtree_geometry*)pInfo,
                              nCoord, aCoord, &i);