1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-03 16:53:36 +03:00

Add a temporary sqlite2BtreeKeyCompare() function to help get

regression tests passing again. (CVS 1332)

FossilOrigin-Name: d8d1c91e55f24d17233414facaa03136b3b320d5
This commit is contained in:
danielk1977
2004-05-09 23:23:56 +00:00
parent 3a4c141357
commit 189621d81f
6 changed files with 60 additions and 23 deletions

View File

@@ -1060,6 +1060,45 @@ int sqlite3VdbeCursorMoveto(Cursor *p){
return SQLITE_OK;
}
/*
** FIX ME
**
** This function is included temporarily so that regression tests have
** a chance of passing. It always uses memcmp().
*/
int sqlite2BtreeKeyCompare(
BtCursor *pCur, /* Pointer to entry to compare against */
const void *pKey, /* Key to compare against entry that pCur points to */
int nKey, /* Number of bytes in pKey */
int nIgnore, /* Ignore this many bytes at the end of pCur */
int *pResult /* Write the result here */
){
void *pCellKey;
u64 nCellKey;
int rc;
sqlite3BtreeKeySize(pCur, &nCellKey);
nCellKey = nCellKey - nIgnore;
if( nCellKey<=0 ){
*pResult = 0;
return SQLITE_OK;
}
pCellKey = sqlite3BtreeKeyFetch(pCur);
if( pCellKey ){
*pResult = memcmp(pCellKey, pKey, nKey>nCellKey?nCellKey:nKey);
return SQLITE_OK;
}
pCellKey = sqliteMalloc( nCellKey );
if( pCellKey==0 ) return SQLITE_NOMEM;
rc = sqlite3BtreeKey(pCur, 0, nCellKey, pCellKey);
*pResult = memcmp(pCellKey, pKey, nKey>nCellKey?nCellKey:nKey);
sqliteFree(pCellKey);
return rc;
}
/*
** The following is the comparison function for (non-integer)