]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add a temporary sqlite2BtreeKeyCompare() function to help get
authordanielk1977 <danielk1977@noemail.net>
Sun, 9 May 2004 23:23:56 +0000 (23:23 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sun, 9 May 2004 23:23:56 +0000 (23:23 +0000)
regression tests passing again. (CVS 1332)

FossilOrigin-Name: d8d1c91e55f24d17233414facaa03136b3b320d5

manifest
manifest.uuid
src/btree.h
src/vdbe.c
src/vdbeInt.h
src/vdbeaux.c

index e96cd96315aa066767537073d0ce8f8eee6a7786..7c7ec4f546f56af392e6daae54cca8e2fd68f07e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -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)
-D 2004-05-09T20:40:11
+C Add\sa\stemporary\ssqlite2BtreeKeyCompare()\sfunction\sto\shelp\sget\nregression\stests\spassing\sagain.\s(CVS\s1332)
+D 2004-05-09T23:23:57
 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -24,7 +24,7 @@ F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
 F src/attach.c fa9a58234406d84eeb900517d0c0adc4b2da051a
 F src/auth.c a2a46e3ed7799134cf3d2dd5ae6650115f26b653
 F src/btree.c b4c04b7867ccabaa1b04d5691a1bc6d0a27e6c6b
-F src/btree.h 825034a68947baf99507f04f318f417013dcd3a3
+F src/btree.h 7c3939a2e5f782c1ebac3bf43c02a16febad6df1
 F src/btree_rb.c 47e5b5ec90846af392b5668b34648198ba459561
 F src/build.c 21b6645c966970dac51bcccfa8650403a3f56210
 F src/copy.c 3c33157f6b4919d6851602b78008c67d466cdadd
@@ -63,10 +63,10 @@ F src/update.c 475465fc0582160dadf5455b05235cb13c9e21f9
 F src/utf.c fc799748d43fe1982d157b871e3e420a19c85d4f
 F src/util.c 0c31a53b848648271d0910c2604b4d8ae516ebb1
 F src/vacuum.c 91ba5a23eca2d9a8a11191cef577d417f9318976
-F src/vdbe.c 9b089e0b20e7ee4dea416eb86520dffa0c04f02a
+F src/vdbe.c bf7d4826cbf18c49b7ac1a5ddbc70db65ac35487
 F src/vdbe.h 2dc4d1161b64f5684faa6a2d292e318a185ecb2e
-F src/vdbeInt.h 4563dc1c9f05a842cbbc7759e4cc7f3779f53547
-F src/vdbeaux.c 81d95af2651777f7960c2cca18613aa3aa95403e
+F src/vdbeInt.h 19926d40956eea309f58bc569f9ae02f62350db2
+F src/vdbeaux.c 2789bdd1f9b510b35b0102174a5b73b8267c4f71
 F src/where.c 6db0291280f2c642bae2c69a70750325b53717a4
 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
 F test/attach.test ba8261d38da6b6a7d4f78ec543c548c4418582ef
@@ -187,7 +187,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 9f1caa530e69aaf202debac36b6a46d707f362d7
-R 18442ae74dd8b81b683a8a5bfb177026
-U drh
-Z 472c41ca52356c30cd6f2f2fdbf61b10
+P 9379c7c9cf8b0770a0c8d1feb5ffdba342173589
+R f3af99fed24e4ae37a57f15e0ab75548
+U danielk1977
+Z d8cf5004a19237d514fe82cdbc9ee318
index 18f81ce7de91cd27bef23e4feec2ee57768d362f..4cfea88a594b614f45a055df4e222918e02f34dc 100644 (file)
@@ -1 +1 @@
-9379c7c9cf8b0770a0c8d1feb5ffdba342173589
\ No newline at end of file
+d8d1c91e55f24d17233414facaa03136b3b320d5
\ No newline at end of file
index a51313446ef011c12ab59d79c7cd176d66755215..c0904c0a05a20502193c133df4f41a6772e9e77d 100644 (file)
@@ -13,7 +13,7 @@
 ** subsystem.  See comments in the source code for a detailed description
 ** 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_
 #define _BTREE_H_
@@ -87,7 +87,6 @@ int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
 void *sqlite3BtreeKeyFetch(BtCursor*);
 int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
 int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);
-int sqlite3BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
 
 char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot);
 struct Pager *sqlite3BtreePager(Btree*);
index 9b0f04bc6325317a9ce18d77f7f20e25785c3aa3..b47632c341cb846ad54a52603369062c74412218 100644 (file)
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** 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 "os.h"
@@ -2744,9 +2744,8 @@ case OP_IsUnique: {
         break;
       }
     }
-/******** FIX ME
-    rc = sqlite3BtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &res); 
-*/rc=SQLITE_INTERNAL;
+    /* FIX ME - the sqlite2BtreeKeyCompare() function is a temporary hack */
+    rc = sqlite2BtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &res); 
     if( rc!=SQLITE_OK ) goto abort_due_to_error;
     if( res>0 ){
       pc = pOp->p2 - 1;
@@ -3474,9 +3473,8 @@ case OP_IdxPut: {
         int c;
         /* TODO: sqlite3BtreeKeySize(pCrsr, &n); */
         if( n==nKey
-/***** FIX ME
-            && sqlite3BtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &c)==SQLITE_OK
-*/
+     /* FIX ME - the sqlite2BtreeKeyCompare() function is a temporary hack */
+            && sqlite2BtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &c)==SQLITE_OK
            && c==0
         ){
           rc = SQLITE_CONSTRAINT;
@@ -3597,9 +3595,8 @@ case OP_IdxGE: {
  
     Stringify(pTos);
     assert( p->aCsr[i].deferredMoveto==0 );
-/****** FIX ME
-    rc = sqlite3BtreeKeyCompare(pCrsr, pTos->z, pTos->n, 4, &res);
-*/rc=SQLITE_INTERNAL;
+    /* FIX ME - the sqlite2BtreeKeyCompare() function is a temporary hack */
+    rc = sqlite2BtreeKeyCompare(pCrsr, pTos->z, pTos->n, 4, &res);
     if( rc!=SQLITE_OK ){
       break;
     }
index fbbeb5130c9d42a71f13d0bb9b34368a24d14888..475a2c433038a91e5607426ed9364657546e645d 100644 (file)
@@ -302,5 +302,7 @@ int sqlite3VdbeByteSwap(int);
 void sqlite3VdbePrintOp(FILE*, int, Op*);
 #endif
 
+int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
+
 
 
index cdb3f0e3434443099c90d81d9bf2fd6f89ab6fbc..733885ae57bd7cbf81fcabc5b2849ceb0c76fb8b 100644 (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)