Lines Matching refs:pNode

104   BtRbNode *pNode;
158 ** out the pNode field of all other cursors.
169 p->pNode = 0;
282 static char *append_node(char * orig, BtRbNode *pNode, int indent)
291 sprintf(buf, "%p", pNode);
294 if( pNode ){
296 if( pNode->isBlack ){
301 orig = append_node( orig, pNode->pLeft, indent );
302 orig = append_node( orig, pNode->pRight, indent );
314 static void print_node(BtRbNode *pNode)
316 char * str = append_node(0, pNode, 0);
333 BtRbNode *pNode;
340 pNode = tree->pHead;
341 while( pNode ){
344 if( pNode->pLeft ){
345 pNode = pNode->pLeft;
351 if( pNode->pRight ){
352 pNode = pNode->pRight;
360 if( !pNode->isBlack &&
361 ( (pNode->pLeft && !pNode->pLeft->isBlack) ||
362 (pNode->pRight && !pNode->pRight->isBlack) )
365 sprintf(buf, "Red node with red child at %p\n", pNode);
375 if( pNode->pLeft ){
376 leftHeight += pNode->pLeft->nBlackHeight;
377 leftHeight += (pNode->pLeft->isBlack?1:0);
379 if( pNode->pRight ){
380 rightHeight += pNode->pRight->nBlackHeight;
381 rightHeight += (pNode->pRight->isBlack?1:0);
385 sprintf(buf, "Different black-heights at %p\n", pNode);
390 pNode->nBlackHeight = leftHeight;
393 if( pNode->pParent ){
394 if( pNode == pNode->pParent->pLeft ) prev_step = 1;
397 pNode = pNode->pParent;
698 if( !pCur->pNode ) {
701 if( (pCur->pNode->nKey - nIgnore) < 0 ){
704 *pRes = key_compare(pCur->pNode->pKey, pCur->pNode->nKey-nIgnore,
715 * Note that RbtCursor.eSkip and RbtCursor.pNode both initialize to 0.
786 BtRbNode *pNode = sqliteMalloc(sizeof(BtRbNode));
787 if( pNode==0 ) return SQLITE_NOMEM;
788 pNode->nKey = nKey;
789 pNode->pKey = sqliteMallocRaw(nKey);
791 memcpy(pNode->pKey, pKey, nKey);
792 pNode->nData = nData;
793 pNode->pData = pData;
794 if( pCur->pNode ){
797 assert( !pCur->pNode->pRight );
798 pNode->pParent = pCur->pNode;
799 pCur->pNode->pRight = pNode;
802 assert( !pCur->pNode->pLeft );
803 pNode->pParent = pCur->pNode;
804 pCur->pNode->pLeft = pNode;
810 pCur->pTree->pHead = pNode;
814 pCur->pNode = pNode;
817 do_insert_balancing(pCur->pTree, pNode);
825 pOp->nKey = pNode->nKey;
828 memcpy( pOp->pKey, pNode->pKey, pOp->nKey );
841 pOp->nKey = pCur->pNode->nKey;
844 memcpy( pOp->pKey, pCur->pNode->pKey, pOp->nKey );
845 pOp->nData = pCur->pNode->nData;
846 pOp->pData = pCur->pNode->pData;
850 sqliteFree( pCur->pNode->pData );
854 pCur->pNode->pData = pData;
855 pCur->pNode->nData = nData;
882 pCur->pNode = pCur->pTree->pHead;
884 while( pCur->pNode && *pRes ) {
885 *pRes = key_compare(pCur->pNode->pKey, pCur->pNode->nKey, pKey, nKey);
886 pTmp = pCur->pNode;
889 pCur->pNode = pCur->pNode->pLeft;
892 pCur->pNode = pCur->pNode->pRight;
897 /* If (pCur->pNode == NULL), then we have failed to find a match. Set
898 * pCur->pNode to pTmp, which is either NULL (if the tree is empty) or the
902 if( !pCur->pNode ) pCur->pNode = pTmp;
937 pZ = pCur->pNode;
972 pZ->pData = pCur->pNode->pData;
973 pZ->nData = pCur->pNode->nData;
974 pZ->pKey = pCur->pNode->pKey;
975 pZ->nKey = pCur->pNode->nKey;
977 pZ = pCur->pNode;
978 pCur->pNode = pTmp;
1032 BtRbNode *pNode;
1037 pNode = pTree->pHead;
1038 while( pNode ){
1039 if( pNode->pLeft ){
1040 pNode = pNode->pLeft;
1042 else if( pNode->pRight ){
1043 pNode = pNode->pRight;
1046 BtRbNode *pTmp = pNode->pParent;
1048 sqliteFree( pNode->pKey );
1049 sqliteFree( pNode->pData );
1055 pRollbackOp->nKey = pNode->nKey;
1056 pRollbackOp->pKey = pNode->pKey;
1057 pRollbackOp->nData = pNode->nData;
1058 pRollbackOp->pData = pNode->pData;
1061 sqliteFree( pNode );
1063 if( pTmp->pLeft == pNode ) pTmp->pLeft = 0;
1064 else if( pTmp->pRight == pNode ) pTmp->pRight = 0;
1066 pNode = pTmp;
1077 pCur->pNode = pCur->pTree->pHead;
1078 while( pCur->pNode->pLeft ){
1079 pCur->pNode = pCur->pNode->pLeft;
1082 if( pCur->pNode ){
1094 pCur->pNode = pCur->pTree->pHead;
1095 while( pCur->pNode->pRight ){
1096 pCur->pNode = pCur->pNode->pRight;
1099 if( pCur->pNode ){
1116 if( pCur->pNode && pCur->eSkip != SKIP_NEXT ){
1117 if( pCur->pNode->pRight ){
1118 pCur->pNode = pCur->pNode->pRight;
1119 while( pCur->pNode->pLeft )
1120 pCur->pNode = pCur->pNode->pLeft;
1122 BtRbNode * pX = pCur->pNode;
1123 pCur->pNode = pX->pParent;
1124 while( pCur->pNode && (pCur->pNode->pRight == pX) ){
1125 pX = pCur->pNode;
1126 pCur->pNode = pX->pParent;
1132 if( !pCur->pNode ){
1143 if( pCur->pNode && pCur->eSkip != SKIP_PREV ){
1144 if( pCur->pNode->pLeft ){
1145 pCur->pNode = pCur->pNode->pLeft;
1146 while( pCur->pNode->pRight )
1147 pCur->pNode = pCur->pNode->pRight;
1149 BtRbNode * pX = pCur->pNode;
1150 pCur->pNode = pX->pParent;
1151 while( pCur->pNode && (pCur->pNode->pLeft == pX) ){
1152 pX = pCur->pNode;
1153 pCur->pNode = pX->pParent;
1159 if( !pCur->pNode ){
1170 if( pCur->pNode ){
1171 *pSize = pCur->pNode->nKey;
1180 if( !pCur->pNode ) return 0;
1181 if( !pCur->pNode->pKey || ((amt + offset) <= pCur->pNode->nKey) ){
1182 memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, amt);
1184 memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, pCur->pNode->nKey-offset);
1185 amt = pCur->pNode->nKey-offset;
1192 if( pCur->pNode ){
1193 *pSize = pCur->pNode->nData;
1202 if( !pCur->pNode ) return 0;
1203 if( (amt + offset) <= pCur->pNode->nData ){
1204 memcpy(zBuf, ((char*)pCur->pNode->pData)+offset, amt);
1206 memcpy(zBuf, ((char*)pCur->pNode->pData)+offset ,pCur->pNode->nData-offset);
1207 amt = pCur->pNode->nData-offset;