mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Further changes to sqlite3VdbeRecordCompare().
FossilOrigin-Name: 570893740067a7caa952f259fa078cdf67017d71
This commit is contained in:
13
src/btree.c
13
src/btree.c
@@ -4547,7 +4547,7 @@ int sqlite3BtreeMovetoUnpacked(
|
||||
int *pRes /* Write search results here */
|
||||
){
|
||||
int rc;
|
||||
int (*xRecordCompare)(int, const void*, UnpackedRecord*);
|
||||
RecordCompare xRecordCompare;
|
||||
|
||||
assert( cursorHoldsMutex(pCur) );
|
||||
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
|
||||
@@ -4571,7 +4571,10 @@ int sqlite3BtreeMovetoUnpacked(
|
||||
|
||||
if( pIdxKey ){
|
||||
xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
|
||||
assert( pIdxKey->default_rc==1 || pIdxKey->default_rc==0 || pIdxKey->default_rc==-1);
|
||||
assert( pIdxKey->default_rc==1
|
||||
|| pIdxKey->default_rc==0
|
||||
|| pIdxKey->default_rc==-1
|
||||
);
|
||||
}
|
||||
|
||||
rc = moveToRoot(pCur);
|
||||
@@ -4658,14 +4661,14 @@ int sqlite3BtreeMovetoUnpacked(
|
||||
** single byte varint and the record fits entirely on the main
|
||||
** b-tree page. */
|
||||
testcase( pCell+nCell+1==pPage->aDataEnd );
|
||||
c = xRecordCompare(nCell, (void*)&pCell[1], pIdxKey);
|
||||
c = xRecordCompare(nCell, (void*)&pCell[1], pCell[1], 1, pIdxKey);
|
||||
}else if( !(pCell[1] & 0x80)
|
||||
&& (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal
|
||||
){
|
||||
/* The record-size field is a 2 byte varint and the record
|
||||
** fits entirely on the main b-tree page. */
|
||||
testcase( pCell+nCell+2==pPage->aDataEnd );
|
||||
c = xRecordCompare(nCell, (void*)&pCell[2], pIdxKey);
|
||||
c = xRecordCompare(nCell, (void*)&pCell[2], pCell[2], 1, pIdxKey);
|
||||
}else{
|
||||
/* The record flows over onto one or more overflow pages. In
|
||||
** this case the whole cell needs to be parsed, a buffer allocated
|
||||
@@ -4686,7 +4689,7 @@ int sqlite3BtreeMovetoUnpacked(
|
||||
sqlite3_free(pCellKey);
|
||||
goto moveto_finish;
|
||||
}
|
||||
c = xRecordCompare(nCell, pCellKey, pIdxKey);
|
||||
c = xRecordCompare(nCell, pCellKey, ((u8*)pCellKey)[0], 1, pIdxKey);
|
||||
sqlite3_free(pCellKey);
|
||||
}
|
||||
if( c<0 ){
|
||||
|
Reference in New Issue
Block a user