Lines Matching defs:pRtree

127255 ** formatted as a double. This macro assumes that local variable pRtree points
127259 (pRtree->eCoordType==RTREE_COORD_REAL32) ? \
127419 static void nodeZero(Rtree *pRtree, RtreeNode *p){
127420 memset(&p->zData[2], 0, pRtree->iNodeSize-2);
127439 static RtreeNode *nodeHashLookup(Rtree *pRtree, i64 iNode){
127441 for(p=pRtree->aHash[nodeHash(iNode)]; p && p->iNode!=iNode; p=p->pNext);
127448 static void nodeHashInsert(Rtree *pRtree, RtreeNode *pNode){
127452 pNode->pNext = pRtree->aHash[iHash];
127453 pRtree->aHash[iHash] = pNode;
127459 static void nodeHashDelete(Rtree *pRtree, RtreeNode *pNode){
127462 pp = &pRtree->aHash[nodeHash(pNode->iNode)];
127475 static RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent){
127477 pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode) + pRtree->iNodeSize);
127479 memset(pNode, 0, sizeof(RtreeNode) + pRtree->iNodeSize);
127494 Rtree *pRtree, /* R-tree structure */
127506 if( (pNode = nodeHashLookup(pRtree, iNode)) ){
127517 sqlite3_bind_int64(pRtree->pReadNode, 1, iNode);
127518 rc = sqlite3_step(pRtree->pReadNode);
127520 const u8 *zBlob = sqlite3_column_blob(pRtree->pReadNode, 0);
127521 if( pRtree->iNodeSize==sqlite3_column_bytes(pRtree->pReadNode, 0) ){
127522 pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode)+pRtree->iNodeSize);
127532 memcpy(pNode->zData, zBlob, pRtree->iNodeSize);
127537 rc = sqlite3_reset(pRtree->pReadNode);
127540 /* If the root node was just loaded, set pRtree->iDepth to the height
127547 pRtree->iDepth = readInt16(pNode->zData);
127548 if( pRtree->iDepth>RTREE_MAX_DEPTH ){
127558 if( NCELL(pNode)>((pRtree->iNodeSize-4)/pRtree->nBytesPerCell) ){
127565 nodeHashInsert(pRtree, pNode);
127582 Rtree *pRtree,
127588 u8 *p = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];
127590 for(ii=0; ii<(pRtree->nDim*2); ii++){
127599 static void nodeDeleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell){
127600 u8 *pDst = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];
127601 u8 *pSrc = &pDst[pRtree->nBytesPerCell];
127602 int nByte = (NCELL(pNode) - iCell - 1) * pRtree->nBytesPerCell;
127616 Rtree *pRtree,
127623 nMaxCell = (pRtree->iNodeSize-4)/pRtree->nBytesPerCell;
127628 nodeOverwriteCell(pRtree, pNode, pCell, nCell);
127640 nodeWrite(Rtree *pRtree, RtreeNode *pNode){
127643 sqlite3_stmt *p = pRtree->pWriteNode;
127649 sqlite3_bind_blob(p, 2, pNode->zData, pRtree->iNodeSize, SQLITE_STATIC);
127654 pNode->iNode = sqlite3_last_insert_rowid(pRtree->db);
127655 nodeHashInsert(pRtree, pNode);
127666 nodeRelease(Rtree *pRtree, RtreeNode *pNode){
127673 pRtree->iDepth = -1;
127676 rc = nodeRelease(pRtree, pNode->pParent);
127679 rc = nodeWrite(pRtree, pNode);
127681 nodeHashDelete(pRtree, pNode);
127694 Rtree *pRtree,
127699 return readInt64(&pNode->zData[4 + pRtree->nBytesPerCell*iCell]);
127706 Rtree *pRtree,
127712 readCoord(&pNode->zData[12 + pRtree->nBytesPerCell*iCell + 4*iCoord], pCoord);
127720 Rtree *pRtree,
127726 pCell->iRowid = nodeGetRowid(pRtree, pNode, iCell);
127727 for(ii=0; ii<pRtree->nDim*2; ii++){
127728 nodeGetCoord(pRtree, pNode, iCell, ii, &pCell->aCoord[ii]);
127769 static void rtreeReference(Rtree *pRtree){
127770 pRtree->nBusy++;
127777 static void rtreeRelease(Rtree *pRtree){
127778 pRtree->nBusy--;
127779 if( pRtree->nBusy==0 ){
127780 sqlite3_finalize(pRtree->pReadNode);
127781 sqlite3_finalize(pRtree->pWriteNode);
127782 sqlite3_finalize(pRtree->pDeleteNode);
127783 sqlite3_finalize(pRtree->pReadRowid);
127784 sqlite3_finalize(pRtree->pWriteRowid);
127785 sqlite3_finalize(pRtree->pDeleteRowid);
127786 sqlite3_finalize(pRtree->pReadParent);
127787 sqlite3_finalize(pRtree->pWriteParent);
127788 sqlite3_finalize(pRtree->pDeleteParent);
127789 sqlite3_free(pRtree);
127805 Rtree *pRtree = (Rtree *)pVtab;
127811 pRtree->zDb, pRtree->zName,
127812 pRtree->zDb, pRtree->zName,
127813 pRtree->zDb, pRtree->zName
127818 rc = sqlite3_exec(pRtree->db, zCreate, 0, 0, 0);
127822 rtreeRelease(pRtree);
127869 Rtree *pRtree = (Rtree *)(cur->pVtab);
127873 rc = nodeRelease(pRtree, pCsr->pNode);
127894 Rtree *pRtree, /* R-Tree object */
127901 int nCoord = pRtree->nDim*2;
127921 static int testRtreeCell(Rtree *pRtree, RtreeCursor *pCursor, int *pbEof){
127927 nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell);
127952 rc = testRtreeGeom(pRtree, p, &cell, &bRes);
127975 static int testRtreeEntry(Rtree *pRtree, RtreeCursor *pCursor, int *pbEof){
127980 nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell);
127997 rc = testRtreeGeom(pRtree, p, &cell, &res);
128021 Rtree *pRtree,
128038 rc = testRtreeEntry(pRtree, pCursor, &isEof);
128040 rc = testRtreeCell(pRtree, pCursor, &isEof);
128046 iRowid = nodeGetRowid(pRtree, pCursor->pNode, pCursor->iCell);
128047 rc = nodeAcquire(pRtree, iRowid, pCursor->pNode, &pChild);
128052 nodeRelease(pRtree, pCursor->pNode);
128057 rc = descendToCell(pRtree, pCursor, iHeight-1, &isEof);
128066 nodeRelease(pRtree, pChild);
128081 Rtree *pRtree,
128089 if( nodeGetRowid(pRtree, pNode, ii)==iRowid ){
128101 static int nodeParentIndex(Rtree *pRtree, RtreeNode *pNode, int *piIndex){
128104 return nodeRowidIndex(pRtree, pParent, pNode->iNode, piIndex);
128114 Rtree *pRtree = (Rtree *)(pVtabCursor->pVtab);
128126 nodeRelease(pRtree, pCsr->pNode);
128136 rc = descendToCell(pRtree, pCsr, iHeight, &isEof);
128142 rc = nodeParentIndex(pRtree, pNode, &pCsr->iCell);
128147 nodeRelease(pRtree, pNode);
128159 Rtree *pRtree = (Rtree *)pVtabCursor->pVtab;
128163 *pRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell);
128172 Rtree *pRtree = (Rtree *)cur->pVtab;
128176 i64 iRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell);
128180 nodeGetCoord(pRtree, pCsr->pNode, pCsr->iCell, i-1, &c);
128181 if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
128184 assert( pRtree->eCoordType==RTREE_COORD_INT32 );
128199 static int findLeafNode(Rtree *pRtree, i64 iRowid, RtreeNode **ppLeaf){
128202 sqlite3_bind_int64(pRtree->pReadRowid, 1, iRowid);
128203 if( sqlite3_step(pRtree->pReadRowid)==SQLITE_ROW ){
128204 i64 iNode = sqlite3_column_int64(pRtree->pReadRowid, 0);
128205 rc = nodeAcquire(pRtree, iNode, 0, ppLeaf);
128206 sqlite3_reset(pRtree->pReadRowid);
128208 rc = sqlite3_reset(pRtree->pReadRowid);
128267 Rtree *pRtree = (Rtree *)pVtabCursor->pVtab;
128274 rtreeReference(pRtree);
128283 rc = findLeafNode(pRtree, iRowid, &pLeaf);
128287 rc = nodeRowidIndex(pRtree, pLeaf, iRowid, &pCsr->iCell);
128323 rc = nodeAcquire(pRtree, 1, 0, &pRoot);
128331 rc = descendToCell(pRtree, pCsr, pRtree->iDepth, &isEof);
128338 nodeRelease(pRtree, pRoot);
128345 rtreeRelease(pRtree);
128449 static float cellArea(Rtree *pRtree, RtreeCell *p){
128452 for(ii=0; ii<(pRtree->nDim*2); ii+=2){
128462 static float cellMargin(Rtree *pRtree, RtreeCell *p){
128465 for(ii=0; ii<(pRtree->nDim*2); ii+=2){
128474 static void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){
128476 if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
128477 for(ii=0; ii<(pRtree->nDim*2); ii+=2){
128482 for(ii=0; ii<(pRtree->nDim*2); ii+=2){
128493 static int cellContains(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){
128495 int isInt = (pRtree->eCoordType==RTREE_COORD_INT32);
128496 for(ii=0; ii<(pRtree->nDim*2); ii+=2){
128511 static float cellGrowth(Rtree *pRtree, RtreeCell *p, RtreeCell *pCell){
128515 area = cellArea(pRtree, &cell);
128516 cellUnion(pRtree, &cell, pCell);
128517 return (cellArea(pRtree, &cell)-area);
128522 Rtree *pRtree,
128540 for(jj=0; jj<(pRtree->nDim*2); jj+=2){
128563 Rtree *pRtree,
128572 before = cellOverlap(pRtree, p, aCell, nCell, iExclude);
128573 cellUnion(pRtree, p, pInsert);
128574 after = cellOverlap(pRtree, p, aCell, nCell, iExclude);
128585 Rtree *pRtree, /* Rtree table */
128593 rc = nodeAcquire(pRtree, 1, 0, &pNode);
128595 for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){
128610 if( ii==(pRtree->iDepth-1) ){
128615 nodeRelease(pRtree, pNode);
128620 nodeGetCell(pRtree, pNode, jj, &aCell[jj]);
128634 nodeGetCell(pRtree, pNode, iCell, &cell);
128635 growth = cellGrowth(pRtree, &cell, pCell);
128636 area = cellArea(pRtree, &cell);
128639 if( ii==(pRtree->iDepth-1) ){
128640 overlap = cellOverlapEnlargement(pRtree,&cell,pCell,aCell,nCell,iCell);
128663 rc = nodeAcquire(pRtree, iBest, pNode, &pChild);
128664 nodeRelease(pRtree, pNode);
128678 Rtree *pRtree, /* Rtree table */
128688 if( nodeParentIndex(pRtree, p, &iCell) ){
128692 nodeGetCell(pRtree, pParent, iCell, &cell);
128693 if( !cellContains(pRtree, &cell, pCell) ){
128694 cellUnion(pRtree, &cell, pCell);
128695 nodeOverwriteCell(pRtree, pParent, &cell, iCell);
128706 static int rowidWrite(Rtree *pRtree, sqlite3_int64 iRowid, sqlite3_int64 iNode){
128707 sqlite3_bind_int64(pRtree->pWriteRowid, 1, iRowid);
128708 sqlite3_bind_int64(pRtree->pWriteRowid, 2, iNode);
128709 sqlite3_step(pRtree->pWriteRowid);
128710 return sqlite3_reset(pRtree->pWriteRowid);
128716 static int parentWrite(Rtree *pRtree, sqlite3_int64 iNode, sqlite3_int64 iPar){
128717 sqlite3_bind_int64(pRtree->pWriteParent, 1, iNode);
128718 sqlite3_bind_int64(pRtree->pWriteParent, 2, iPar);
128719 sqlite3_step(pRtree->pWriteParent);
128720 return sqlite3_reset(pRtree->pWriteParent);
128731 Rtree *pRtree,
128749 Rtree *pRtree,
128765 for(i=0; i<pRtree->nDim; i++){
128811 Rtree *pRtree,
128825 float left = cellGrowth(pRtree, pLeftBox, &aCell[ii]);
128826 float right = cellGrowth(pRtree, pLeftBox, &aCell[ii]);
128843 Rtree *pRtree,
128858 float right = cellArea(pRtree, &aCell[jj]);
128859 float growth = cellGrowth(pRtree, &aCell[ii], &aCell[jj]);
128959 Rtree *pRtree,
128976 SortByDimension(pRtree, aLeft, nLeft, iDim, aCell, aSpare);
128977 SortByDimension(pRtree, aRight, nRight, iDim, aCell, aSpare);
129019 Rtree *pRtree,
129035 int nByte = (pRtree->nDim+1)*(sizeof(int*)+nCell*sizeof(int));
129042 aSpare = &((int *)&aaSorted[pRtree->nDim])[pRtree->nDim*nCell];
129044 for(ii=0; ii<pRtree->nDim; ii++){
129046 aaSorted[ii] = &((int *)&aaSorted[pRtree->nDim])[ii*nCell];
129050 SortByDimension(pRtree, aaSorted[ii], nCell, ii, aCell, aSpare);
129053 for(ii=0; ii<pRtree->nDim; ii++){
129061 nLeft=RTREE_MINCELLS(pRtree);
129062 nLeft<=(nCell-RTREE_MINCELLS(pRtree));
129075 cellUnion(pRtree, &left, &aCell[aaSorted[ii][kk]]);
129077 cellUnion(pRtree, &right, &aCell[aaSorted[ii][kk]]);
129080 margin += cellMargin(pRtree, &left);
129081 margin += cellMargin(pRtree, &right);
129082 overlap = cellOverlap(pRtree, &left, &right, 1, -1);
129083 area = cellArea(pRtree, &left) + cellArea(pRtree, &right);
129084 if( (nLeft==RTREE_MINCELLS(pRtree))
129107 nodeInsertCell(pRtree, pTarget, pCell);
129108 cellUnion(pRtree, pBbox, pCell);
129121 Rtree *pRtree,
129140 PickSeeds(pRtree, aCell, nCell, &iLeftSeed, &iRightSeed);
129144 nodeInsertCell(pRtree, pLeft, &aCell[iLeftSeed]);
129145 nodeInsertCell(pRtree, pRight, &aCell[iRightSeed]);
129151 pNext = PickNext(pRtree, aCell, nCell, pBboxLeft, pBboxRight, aiUsed);
129153 cellGrowth(pRtree, pBboxLeft, pNext) -
129154 cellGrowth(pRtree, pBboxRight, pNext)
129156 if( (RTREE_MINCELLS(pRtree)-NCELL(pRight)==i)
129157 || (diff>0.0 && (RTREE_MINCELLS(pRtree)-NCELL(pLeft)!=i))
129159 nodeInsertCell(pRtree, pRight, pNext);
129160 cellUnion(pRtree, pBboxRight, pNext);
129162 nodeInsertCell(pRtree, pLeft, pNext);
129163 cellUnion(pRtree, pBboxLeft, pNext);
129173 Rtree *pRtree,
129181 RtreeNode *pChild = nodeHashLookup(pRtree, iRowid);
129183 nodeRelease(pRtree, pChild->pParent);
129188 return xSetMapping(pRtree, iRowid, pNode->iNode);
129192 Rtree *pRtree,
129222 nodeGetCell(pRtree, pNode, i, &aCell[i]);
129224 nodeZero(pRtree, pNode);
129229 pRight = nodeNew(pRtree, pNode);
129230 pLeft = nodeNew(pRtree, pNode);
129231 pRtree->iDepth++;
129233 writeInt16(pNode->zData, pRtree->iDepth);
129236 pRight = nodeNew(pRtree, pLeft->pParent);
129245 memset(pLeft->zData, 0, pRtree->iNodeSize);
129246 memset(pRight->zData, 0, pRtree->iNodeSize);
129248 rc = AssignCells(pRtree, aCell, nCell, pLeft, pRight, &leftbbox, &rightbbox);
129258 if( SQLITE_OK!=(rc = nodeWrite(pRtree, pRight))
129259 || (0==pLeft->iNode && SQLITE_OK!=(rc = nodeWrite(pRtree, pLeft)))
129268 rc = rtreeInsertCell(pRtree, pLeft->pParent, &leftbbox, iHeight+1);
129275 rc = nodeParentIndex(pRtree, pLeft, &iCell);
129277 nodeOverwriteCell(pRtree, pParent, &leftbbox, iCell);
129278 rc = AdjustTree(pRtree, pParent, &leftbbox);
129284 if( (rc = rtreeInsertCell(pRtree, pRight->pParent, &rightbbox, iHeight+1)) ){
129289 i64 iRowid = nodeGetRowid(pRtree, pRight, i);
129290 rc = updateMapping(pRtree, iRowid, pRight, iHeight);
129300 i64 iRowid = nodeGetRowid(pRtree, pLeft, i);
129301 rc = updateMapping(pRtree, iRowid, pLeft, iHeight);
129307 rc = updateMapping(pRtree, pCell->iRowid, pLeft, iHeight);
129311 rc = nodeRelease(pRtree, pRight);
129315 rc = nodeRelease(pRtree, pLeft);
129320 nodeRelease(pRtree, pRight);
129321 nodeRelease(pRtree, pLeft);
129337 static int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){
129342 sqlite3_bind_int64(pRtree->pReadParent, 1, pChild->iNode);
129343 rc = sqlite3_step(pRtree->pReadParent);
129353 iNode = sqlite3_column_int64(pRtree->pReadParent, 0);
129356 rc2 = nodeAcquire(pRtree, iNode, 0, &pChild->pParent);
129359 rc = sqlite3_reset(pRtree->pReadParent);
129369 static int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){
129378 rc = nodeParentIndex(pRtree, pNode, &iCell);
129382 rc = deleteCell(pRtree, pParent, iCell, iHeight+1);
129384 rc2 = nodeRelease(pRtree, pParent);
129393 sqlite3_bind_int64(pRtree->pDeleteNode, 1, pNode->iNode);
129394 sqlite3_step(pRtree->pDeleteNode);
129395 if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteNode)) ){
129400 sqlite3_bind_int64(pRtree->pDeleteParent, 1, pNode->iNode);
129401 sqlite3_step(pRtree->pDeleteParent);
129402 if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteParent)) ){
129409 nodeHashDelete(pRtree, pNode);
129411 pNode->pNext = pRtree->pDeleted;
129413 pRtree->pDeleted = pNode;
129418 static int fixBoundingBox(Rtree *pRtree, RtreeNode *pNode){
129425 nodeGetCell(pRtree, pNode, 0, &box);
129428 nodeGetCell(pRtree, pNode, ii, &cell);
129429 cellUnion(pRtree, &box, &cell);
129432 rc = nodeParentIndex(pRtree, pNode, &ii);
129434 nodeOverwriteCell(pRtree, pParent, &box, ii);
129435 rc = fixBoundingBox(pRtree, pParent);
129445 static int deleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell, int iHeight){
129449 if( SQLITE_OK!=(rc = fixLeafParent(pRtree, pNode)) ){
129456 nodeDeleteCell(pRtree, pNode, iCell);
129466 if( NCELL(pNode)<RTREE_MINCELLS(pRtree) ){
129467 rc = removeNode(pRtree, pNode, iHeight);
129469 rc = fixBoundingBox(pRtree, pNode);
129477 Rtree *pRtree,
129516 nodeGetCell(pRtree, pNode, ii, &aCell[ii]);
129519 for(iDim=0; iDim<pRtree->nDim; iDim++){
129524 for(iDim=0; iDim<pRtree->nDim; iDim++){
129530 for(iDim=0; iDim<pRtree->nDim; iDim++){
129538 nodeZero(pRtree, pNode);
129540 for(ii=0; rc==SQLITE_OK && ii<(nCell-(RTREE_MINCELLS(pRtree)+1)); ii++){
129542 nodeInsertCell(pRtree, pNode, p);
129545 rc = rowidWrite(pRtree, p->iRowid, pNode->iNode);
129547 rc = parentWrite(pRtree, p->iRowid, pNode->iNode);
129552 rc = fixBoundingBox(pRtree, pNode);
129560 rc = ChooseLeaf(pRtree, p, iHeight, &pInsert);
129563 rc = rtreeInsertCell(pRtree, pInsert, p, iHeight);
129564 rc2 = nodeRelease(pRtree, pInsert);
129580 Rtree *pRtree,
129587 RtreeNode *pChild = nodeHashLookup(pRtree, pCell->iRowid);
129589 nodeRelease(pRtree, pChild->pParent);
129594 if( nodeInsertCell(pRtree, pNode, pCell) ){
129596 if( iHeight<=pRtree->iReinsertHeight || pNode->iNode==1){
129597 rc = SplitNode(pRtree, pNode, pCell, iHeight);
129599 pRtree->iReinsertHeight = iHeight;
129600 rc = Reinsert(pRtree, pNode, pCell, iHeight);
129603 rc = SplitNode(pRtree, pNode, pCell, iHeight);
129606 rc = AdjustTree(pRtree, pNode, pCell);
129609 rc = rowidWrite(pRtree, pCell->iRowid, pNode->iNode);
129611 rc = parentWrite(pRtree, pCell->iRowid, pNode->iNode);
129618 static int reinsertNodeContent(Rtree *pRtree, RtreeNode *pNode){
129626 nodeGetCell(pRtree, pNode, ii, &cell);
129631 rc = ChooseLeaf(pRtree, &cell, (int)pNode->iNode, &pInsert);
129634 rc = rtreeInsertCell(pRtree, pInsert, &cell, (int)pNode->iNode);
129635 rc2 = nodeRelease(pRtree, pInsert);
129647 static int newRowid(Rtree *pRtree, i64 *piRowid){
129649 sqlite3_bind_null(pRtree->pWriteRowid, 1);
129650 sqlite3_bind_null(pRtree->pWriteRowid, 2);
129651 sqlite3_step(pRtree->pWriteRowid);
129652 rc = sqlite3_reset(pRtree->pWriteRowid);
129653 *piRowid = sqlite3_last_insert_rowid(pRtree->db);
129660 static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){
129668 rc = nodeAcquire(pRtree, 1, 0, &pRoot);
129674 rc = findLeafNode(pRtree, iDelete, &pLeaf);
129680 rc = nodeRowidIndex(pRtree, pLeaf, iDelete, &iCell);
129682 rc = deleteCell(pRtree, pLeaf, iCell, 0);
129684 rc2 = nodeRelease(pRtree, pLeaf);
129692 sqlite3_bind_int64(pRtree->pDeleteRowid, 1, iDelete);
129693 sqlite3_step(pRtree->pDeleteRowid);
129694 rc = sqlite3_reset(pRtree->pDeleteRowid);
129705 if( rc==SQLITE_OK && pRtree->iDepth>0 && NCELL(pRoot)==1 ){
129708 i64 iChild = nodeGetRowid(pRtree, pRoot, 0);
129709 rc = nodeAcquire(pRtree, iChild, pRoot, &pChild);
129711 rc = removeNode(pRtree, pChild, pRtree->iDepth-1);
129713 rc2 = nodeRelease(pRtree, pChild);
129716 pRtree->iDepth--;
129717 writeInt16(pRoot->zData, pRtree->iDepth);
129723 for(pLeaf=pRtree->pDeleted; pLeaf; pLeaf=pRtree->pDeleted){
129725 rc = reinsertNodeContent(pRtree, pLeaf);
129727 pRtree->pDeleted = pLeaf->pNext;
129733 rc = nodeRelease(pRtree, pRoot);
129735 nodeRelease(pRtree, pRoot);
129750 Rtree *pRtree = (Rtree *)pVtab;
129755 rtreeReference(pRtree);
129773 assert( nData==(pRtree->nDim*2 + 3) );
129774 if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
129775 for(ii=0; ii<(pRtree->nDim*2); ii+=2){
129784 for(ii=0; ii<(pRtree->nDim*2); ii+=2){
129802 sqlite3_bind_int64(pRtree->pReadRowid, 1, cell.iRowid);
129803 steprc = sqlite3_step(pRtree->pReadRowid);
129804 rc = sqlite3_reset(pRtree->pReadRowid);
129806 if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){
129807 rc = rtreeDeleteRowid(pRtree, cell.iRowid);
129823 rc = rtreeDeleteRowid(pRtree, sqlite3_value_int64(azData[0]));
129836 rc = newRowid(pRtree, &cell.iRowid);
129841 rc = ChooseLeaf(pRtree, &cell, 0, &pLeaf);
129845 pRtree->iReinsertHeight = -1;
129846 rc = rtreeInsertCell(pRtree, pLeaf, &cell, 0);
129847 rc2 = nodeRelease(pRtree, pLeaf);
129855 rtreeRelease(pRtree);
129863 Rtree *pRtree = (Rtree *)pVtab;
129869 , pRtree->zDb, pRtree->zName, zNewName
129870 , pRtree->zDb, pRtree->zName, zNewName
129871 , pRtree->zDb, pRtree->zName, zNewName
129874 rc = sqlite3_exec(pRtree->db, zSql, 0, 0, 0);
129907 Rtree *pRtree,
129935 pRtree->db = db;
129943 zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, pRtree->iNodeSize
129955 appStmt[0] = &pRtree->pReadNode;
129956 appStmt[1] = &pRtree->pWriteNode;
129957 appStmt[2] = &pRtree->pDeleteNode;
129958 appStmt[3] = &pRtree->pReadRowid;
129959 appStmt[4] = &pRtree->pWriteRowid;
129960 appStmt[5] = &pRtree->pDeleteRowid;
129961 appStmt[6] = &pRtree->pReadParent;
129962 appStmt[7] = &pRtree->pWriteParent;
129963 appStmt[8] = &pRtree->pDeleteParent;
130003 ** to. If successful, pRtree->iNodeSize is populated and SQLITE_OK returned.
130017 Rtree *pRtree, /* Rtree handle */
130024 zSql = sqlite3_mprintf("PRAGMA %Q.page_size", pRtree->zDb);
130027 pRtree->iNodeSize = iPageSize-64;
130028 if( (4+pRtree->nBytesPerCell*RTREE_MAXCELLS)<pRtree->iNodeSize ){
130029 pRtree->iNodeSize = 4+pRtree->nBytesPerCell*RTREE_MAXCELLS;
130035 pRtree->zDb, pRtree->zName
130037 rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
130062 Rtree *pRtree;
130085 pRtree = (Rtree *)sqlite3_malloc(sizeof(Rtree)+nDb+nName+2);
130086 if( !pRtree ){
130089 memset(pRtree, 0, sizeof(Rtree)+nDb+nName+2);
130090 pRtree->nBusy = 1;
130091 pRtree->base.pModule = &rtreeModule;
130092 pRtree->zDb = (char *)&pRtree[1];
130093 pRtree->zName = &pRtree->zDb[nDb+1];
130094 pRtree->nDim = (argc-4)/2;
130095 pRtree->nBytesPerCell = 8 + pRtree->nDim*4*2;
130096 pRtree->eCoordType = eCoordType;
130097 memcpy(pRtree->zDb, argv[1], nDb);
130098 memcpy(pRtree->zName, argv[2], nName);
130101 rc = getNodeSize(db, pRtree, isCreate);
130108 if( (rc = rtreeSqlInit(pRtree, db, argv[1], argv[2], isCreate)) ){
130134 *ppVtab = (sqlite3_vtab *)pRtree;
130136 rtreeRelease(pRtree);