1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +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

@@ -1,5 +1,5 @@
C More\sbtree.c\sbug\sfixing.\s\sIt's\sgetting\scloser\sbut\sstill\snot\sthere\syet.\nMove\sobsolete\stest\sscripts\sinto\sthe\sattic.\s(CVS\s1331) C Add\sa\stemporary\ssqlite2BtreeKeyCompare()\sfunction\sto\shelp\sget\nregression\stests\spassing\sagain.\s(CVS\s1332)
D 2004-05-09T20:40:11 D 2004-05-09T23:23:57
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -24,7 +24,7 @@ F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
F src/attach.c fa9a58234406d84eeb900517d0c0adc4b2da051a F src/attach.c fa9a58234406d84eeb900517d0c0adc4b2da051a
F src/auth.c a2a46e3ed7799134cf3d2dd5ae6650115f26b653 F src/auth.c a2a46e3ed7799134cf3d2dd5ae6650115f26b653
F src/btree.c b4c04b7867ccabaa1b04d5691a1bc6d0a27e6c6b F src/btree.c b4c04b7867ccabaa1b04d5691a1bc6d0a27e6c6b
F src/btree.h 825034a68947baf99507f04f318f417013dcd3a3 F src/btree.h 7c3939a2e5f782c1ebac3bf43c02a16febad6df1
F src/btree_rb.c 47e5b5ec90846af392b5668b34648198ba459561 F src/btree_rb.c 47e5b5ec90846af392b5668b34648198ba459561
F src/build.c 21b6645c966970dac51bcccfa8650403a3f56210 F src/build.c 21b6645c966970dac51bcccfa8650403a3f56210
F src/copy.c 3c33157f6b4919d6851602b78008c67d466cdadd F src/copy.c 3c33157f6b4919d6851602b78008c67d466cdadd
@@ -63,10 +63,10 @@ F src/update.c 475465fc0582160dadf5455b05235cb13c9e21f9
F src/utf.c fc799748d43fe1982d157b871e3e420a19c85d4f F src/utf.c fc799748d43fe1982d157b871e3e420a19c85d4f
F src/util.c 0c31a53b848648271d0910c2604b4d8ae516ebb1 F src/util.c 0c31a53b848648271d0910c2604b4d8ae516ebb1
F src/vacuum.c 91ba5a23eca2d9a8a11191cef577d417f9318976 F src/vacuum.c 91ba5a23eca2d9a8a11191cef577d417f9318976
F src/vdbe.c 9b089e0b20e7ee4dea416eb86520dffa0c04f02a F src/vdbe.c bf7d4826cbf18c49b7ac1a5ddbc70db65ac35487
F src/vdbe.h 2dc4d1161b64f5684faa6a2d292e318a185ecb2e F src/vdbe.h 2dc4d1161b64f5684faa6a2d292e318a185ecb2e
F src/vdbeInt.h 4563dc1c9f05a842cbbc7759e4cc7f3779f53547 F src/vdbeInt.h 19926d40956eea309f58bc569f9ae02f62350db2
F src/vdbeaux.c 81d95af2651777f7960c2cca18613aa3aa95403e F src/vdbeaux.c 2789bdd1f9b510b35b0102174a5b73b8267c4f71
F src/where.c 6db0291280f2c642bae2c69a70750325b53717a4 F src/where.c 6db0291280f2c642bae2c69a70750325b53717a4
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test ba8261d38da6b6a7d4f78ec543c548c4418582ef F test/attach.test ba8261d38da6b6a7d4f78ec543c548c4418582ef
@@ -187,7 +187,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P 9f1caa530e69aaf202debac36b6a46d707f362d7 P 9379c7c9cf8b0770a0c8d1feb5ffdba342173589
R 18442ae74dd8b81b683a8a5bfb177026 R f3af99fed24e4ae37a57f15e0ab75548
U drh U danielk1977
Z 472c41ca52356c30cd6f2f2fdbf61b10 Z d8cf5004a19237d514fe82cdbc9ee318

View File

@@ -1 +1 @@
9379c7c9cf8b0770a0c8d1feb5ffdba342173589 d8d1c91e55f24d17233414facaa03136b3b320d5

View File

@@ -13,7 +13,7 @@
** subsystem. See comments in the source code for a detailed description ** subsystem. See comments in the source code for a detailed description
** of what each interface routine does. ** of what each interface routine does.
** **
** @(#) $Id: btree.h,v 1.42 2004/05/09 00:40:52 drh Exp $ ** @(#) $Id: btree.h,v 1.43 2004/05/09 23:23:57 danielk1977 Exp $
*/ */
#ifndef _BTREE_H_ #ifndef _BTREE_H_
#define _BTREE_H_ #define _BTREE_H_
@@ -87,7 +87,6 @@ int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
void *sqlite3BtreeKeyFetch(BtCursor*); void *sqlite3BtreeKeyFetch(BtCursor*);
int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*); int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);
int sqlite3BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot); char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot);
struct Pager *sqlite3BtreePager(Btree*); struct Pager *sqlite3BtreePager(Btree*);

View File

@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing ** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code. ** commenting and indentation practices when changing or adding code.
** **
** $Id: vdbe.c,v 1.270 2004/05/08 10:56:12 drh Exp $ ** $Id: vdbe.c,v 1.271 2004/05/09 23:23:58 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -2744,9 +2744,8 @@ case OP_IsUnique: {
break; break;
} }
} }
/******** FIX ME /* FIX ME - the sqlite2BtreeKeyCompare() function is a temporary hack */
rc = sqlite3BtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &res); rc = sqlite2BtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &res);
*/rc=SQLITE_INTERNAL;
if( rc!=SQLITE_OK ) goto abort_due_to_error; if( rc!=SQLITE_OK ) goto abort_due_to_error;
if( res>0 ){ if( res>0 ){
pc = pOp->p2 - 1; pc = pOp->p2 - 1;
@@ -3474,9 +3473,8 @@ case OP_IdxPut: {
int c; int c;
/* TODO: sqlite3BtreeKeySize(pCrsr, &n); */ /* TODO: sqlite3BtreeKeySize(pCrsr, &n); */
if( n==nKey if( n==nKey
/***** FIX ME /* FIX ME - the sqlite2BtreeKeyCompare() function is a temporary hack */
&& sqlite3BtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &c)==SQLITE_OK && sqlite2BtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &c)==SQLITE_OK
*/
&& c==0 && c==0
){ ){
rc = SQLITE_CONSTRAINT; rc = SQLITE_CONSTRAINT;
@@ -3597,9 +3595,8 @@ case OP_IdxGE: {
Stringify(pTos); Stringify(pTos);
assert( p->aCsr[i].deferredMoveto==0 ); assert( p->aCsr[i].deferredMoveto==0 );
/****** FIX ME /* FIX ME - the sqlite2BtreeKeyCompare() function is a temporary hack */
rc = sqlite3BtreeKeyCompare(pCrsr, pTos->z, pTos->n, 4, &res); rc = sqlite2BtreeKeyCompare(pCrsr, pTos->z, pTos->n, 4, &res);
*/rc=SQLITE_INTERNAL;
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
break; break;
} }

View File

@@ -302,5 +302,7 @@ int sqlite3VdbeByteSwap(int);
void sqlite3VdbePrintOp(FILE*, int, Op*); void sqlite3VdbePrintOp(FILE*, int, Op*);
#endif #endif
int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);

View File

@@ -1060,6 +1060,45 @@ int sqlite3VdbeCursorMoveto(Cursor *p){
return SQLITE_OK; 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) ** The following is the comparison function for (non-integer)