]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Simplifications and optimizations. Also: disable the corrupt.test for now. (CVS...
authordrh <drh@noemail.net>
Tue, 31 Aug 2004 13:45:11 +0000 (13:45 +0000)
committerdrh <drh@noemail.net>
Tue, 31 Aug 2004 13:45:11 +0000 (13:45 +0000)
FossilOrigin-Name: 8fd65e704888a8e2f4a712a94fd0e3f866c10ef3

manifest
manifest.uuid
src/btree.c
src/build.c
src/delete.c
src/expr.c
src/pragma.c
src/trigger.c
src/update.c
src/vdbe.c
test/all.test

index a43ef5f86e8c0abc6393e8497cec647ed7e82cb0..c10295f48fc43add6787437dfb67b99cf36dbeb4 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Combine\sthe\simplementation\sof\sLIKE\sand\sGLOB\sinto\sa\ssingle\sparameterized\nfunction.\s(CVS\s1923)
-D 2004-08-31T00:52:37
+C Simplifications\sand\soptimizations.\s\sAlso:\sdisable\sthe\scorrupt.test\sfor\snow.\s(CVS\s1924)
+D 2004-08-31T13:45:11
 F Makefile.in 65a7c43fcaf9a710d62f120b11b6e435eeb4a450
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -28,13 +28,13 @@ F sqlite3.def cf325d366f167029a971de7333f32b74bfe2e375
 F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
 F src/attach.c 0bd4f11da6999665da30625665a4096ba7898de6
 F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
-F src/btree.c 9cf41d26fb175b5d46051ed29c28a6e179094dda
+F src/btree.c 7437310f8add1709252c755f02bca37e957516a9
 F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
-F src/build.c 7d93b19d03bffd171f7c7873739688cab7e300c5
+F src/build.c 35275654d9c5ce6c1c0c78e391f85e6915a8a66b
 F src/date.c edff4aa851eeca8abbc737dc3933a2f0671156ce
-F src/delete.c 0ccc3424d72e5aaded165a8861b9d958c9d0afe6
+F src/delete.c cebfdde83e7bf68d8118e1c13e40c99787302fbf
 F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
-F src/expr.c 3694386726ca140dddb839837ba24b58563d10af
+F src/expr.c 3c3dd119fd7910dca40676a46c85785222cdf311
 F src/func.c ab1d6436edea1333f2a9398800a6404942661724
 F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
@@ -55,7 +55,7 @@ F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44
 F src/pager.c 616563dc510993ab67baa54fc6a2ddacc05175ca
 F src/pager.h 67739fe649f33be55dba522ca8a9cc4e42d14f71
 F src/parse.y 581a2ce014b843506805b2470c02b7865ad034d5
-F src/pragma.c a7cea75286fcff6666a5412b04478fcf0ecef5c4
+F src/pragma.c b39177b96bb5f7354511468c933357ce65a0dd4c
 F src/printf.c 17b28a1eedfe8129b05de981719306c18c3f1327
 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
 F src/select.c 400b2dcc8e05c0101a65a370f7ebb33c9c85f0b3
@@ -70,19 +70,19 @@ F src/test3.c 94d0a2a90bccd85802488cb42c69ec8afd2e4646
 F src/test4.c c38766914e924091516030b6a8b677d849c08bf0
 F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1
 F src/tokenize.c 32171c3d576c7ec6acd6cf15e55c00ac0b314769
-F src/trigger.c 8b147c6b8ae0bab3a13463a4ca9ab6ad61f1361d
-F src/update.c 151f1869ce532ed883f1ce26306f0b0fa7b2589a
+F src/trigger.c 40e10f4b219b55e56478bc17480ce77654300e8d
+F src/update.c bbe126c67529bd699016af2d72bc4ceb8fd41527
 F src/utf.c 328890099db492dda5620ee5f924e244c6e57ff7
 F src/util.c d5aaf211543fb6e285654fada50252c857ac78aa
 F src/vacuum.c 9978a5760c2c430bc5b5e66505a02dad76f25813
-F src/vdbe.c bc7717be599d23c463c029d13eb2eb46c94a5e6e
+F src/vdbe.c 28b0ea2a8c534fc39e15e41db0437fcc3b5f2e9b
 F src/vdbe.h e081c72cd0f7c19d49b1927460aeefcf0fbc85ac
 F src/vdbeInt.h aadadddc8cfad6aa5a5445c849f70d881276fe34
 F src/vdbeapi.c 854732720c2cfc6ff76b28eef6253ac84a5408bc
 F src/vdbeaux.c 022c484dba235d2dcbb1faca0f1943702f4232ed
 F src/vdbemem.c ef9ac7d32acfe4bce5c5b408b1294c8d9e0cdb56
 F src/where.c a84eee276cd072158224da6b5f30733df2d56027
-F test/all.test 3b692eb43583b52c99c344b2fa8934512d179016
+F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c
 F test/attach.test feb2ce54e78688df4c84553416d5aec3b2a0112e
 F test/attach2.test 9be9656bc1e929b224861960299920c76d45b14d
 F test/attach3.test 6d060986ff004ebb89e1876a331d96c6bb62269e
@@ -246,7 +246,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 8f5b199e845fa7ae3444ef69bd840716d305cf73
-R 616cb374fb9c8575e09ed1273dacb01d
+P 0a47c8f86d1649e9ae7edd4c49a6fe5f5272351e
+R 4e22239c77e5e5c0b57b87eb76489528
 U drh
-Z 33bccfa82a63e9342b9c97917948d9a3
+Z 972ff5a80d13e0bb73eb2d8433c24b81
index 7ccd0c432f611c099da33632cdd0f13947b16a67..564fa734d6a6a50fd90d36cd737a62df9c0ea853 100644 (file)
@@ -1 +1 @@
-0a47c8f86d1649e9ae7edd4c49a6fe5f5272351e
\ No newline at end of file
+8fd65e704888a8e2f4a712a94fd0e3f866c10ef3
\ No newline at end of file
index 64e8aef2528eddadc6c237231e1b09086e1e6fe7..0dfd89c46dea8e6d6d68f7154dc2aacced794dea 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.183 2004/08/30 16:52:18 drh Exp $
+** $Id: btree.c,v 1.184 2004/08/31 13:45:11 drh Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** For a detailed discussion of BTrees, refer to
@@ -4075,7 +4075,7 @@ static void checkList(
     }
     if( isFreeList ){
       int n = get4byte(&pOvfl[4]);
-      if( n>=pCheck->pBt->usableSize/4-8 ){
+      if( n>pCheck->pBt->usableSize/4-8 ){
         sprintf(zMsg, "freelist leaf count too big on page %d", iPage);
         checkAppendMsg(pCheck, zContext, zMsg);
         N--;
index ca536f76436ea0bf816111b0599b565f3182a60e..1ff47aef62eb16cff4ede64349a4bae8d5e194c0 100644 (file)
@@ -23,7 +23,7 @@
 **     ROLLBACK
 **     PRAGMA
 **
-** $Id: build.c,v 1.249 2004/08/21 17:54:45 drh Exp $
+** $Id: build.c,v 1.250 2004/08/31 13:45:11 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1374,7 +1374,7 @@ void sqlite3EndTable(Parse *pParse, Token *pEnd, Select *pSelect){
       n = Addr(pEnd->z) - Addr(pParse->sNameToken.z) + 1;
       sqlite3VdbeAddOp(v, OP_String8, 0, 0);
       sqlite3VdbeChangeP3(v, -1, pParse->sNameToken.z, n);
-      sqlite3VdbeAddOp(v, OP_Concat8, 2, 0);
+      sqlite3VdbeAddOp(v, OP_Concat, 0, 0);
     }
     sqlite3VdbeOp3(v, OP_MakeRecord, 5, 0, "tttit", P3_STATIC);
     sqlite3VdbeAddOp(v, OP_PutIntKey, 0, 0);
@@ -2116,7 +2116,7 @@ void sqlite3CreateIndex(
       sqlite3VdbeAddOp(v, OP_String8, 0, 0);
       n = Addr(pEnd->z) - Addr(pName->z) + 1;
       sqlite3VdbeChangeP3(v, -1, pName->z, n);
-      sqlite3VdbeAddOp(v, OP_Concat8, 2, 0);
+      sqlite3VdbeAddOp(v, OP_Concat, 0, 0);
     }
     sqlite3VdbeOp3(v, OP_MakeRecord, 5, 0, "tttit", P3_STATIC);
     sqlite3VdbeAddOp(v, OP_PutIntKey, 0, 0);
index bfe1cbde5b3477288598f6e75110357e8cec49d2..918b597dd1bca0158825ae8a9dbcd44156f8f01d 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle DELETE FROM statements.
 **
-** $Id: delete.c,v 1.78 2004/08/21 17:54:45 drh Exp $
+** $Id: delete.c,v 1.79 2004/08/31 13:45:12 drh Exp $
 */
 #include "sqliteInt.h"
 
 Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
   Table *pTab = 0;
   int i;
-  for(i=0; i<pSrc->nSrc; i++){
-    const char *zTab = pSrc->a[i].zName;
-    const char *zDb = pSrc->a[i].zDatabase;
-    pTab = sqlite3LocateTable(pParse, zTab, zDb);
-    pSrc->a[i].pTab = pTab;
+  struct SrcList_item *pItem;
+  for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
+    pTab = sqlite3LocateTable(pParse, pItem->zName, pItem->zDatabase);
+    pItem->pTab = pTab;
   }
   return pTab;
 }
index 5377a2daa5adaaf7ee09a695d8fdc9690778e151..e8dfc2baf40f1e52b99599212e50bf7532ae0f8c 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.157 2004/08/21 17:54:45 drh Exp $
+** $Id: expr.c,v 1.158 2004/08/31 13:45:12 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1147,8 +1147,9 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
     case TK_RSHIFT:   op = OP_ShiftRight; break;
     case TK_REM:      op = OP_Remainder;  break;
     case TK_FLOAT:    op = OP_Real;       break;
-    case TK_STRING:   op = OP_String8;     break;
+    case TK_STRING:   op = OP_String8;    break;
     case TK_BLOB:     op = OP_HexBlob;    break;
+    case TK_CONCAT:   op = OP_Concat;     break;
     default: op = 0; break;
   }
   switch( pExpr->op ){
@@ -1209,16 +1210,11 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
     case TK_BITOR:
     case TK_SLASH:
     case TK_LSHIFT:
-    case TK_RSHIFT: {
-      sqlite3ExprCode(pParse, pExpr->pLeft);
-      sqlite3ExprCode(pParse, pExpr->pRight);
-      sqlite3VdbeAddOp(v, op, 0, 0);
-      break;
-    }
+    case TK_RSHIFT: 
     case TK_CONCAT: {
       sqlite3ExprCode(pParse, pExpr->pLeft);
       sqlite3ExprCode(pParse, pExpr->pRight);
-      sqlite3VdbeAddOp(v, OP_Concat8, 2, 0);
+      sqlite3VdbeAddOp(v, op, 0, 0);
       break;
     }
     case TK_UMINUS: {
index 172ace35914a7037c0f80aefb9409f777d25fcb0..6fc43607c0898267c38a87b9f9a35e8a1e4d4ad8 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** This file contains code used to implement the PRAGMA command.
 **
-** $Id: pragma.c,v 1.60 2004/08/21 17:54:45 drh Exp $
+** $Id: pragma.c,v 1.61 2004/08/31 13:45:12 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -577,7 +577,7 @@ void sqlite3Pragma(
          sqlite3MPrintf("*** in database %s ***\n", db->aDb[i].zName),
          P3_DYNAMIC);
       sqlite3VdbeAddOp(v, OP_Pull, 1, 0);
-      sqlite3VdbeAddOp(v, OP_Concat8, 2, 1);
+      sqlite3VdbeAddOp(v, OP_Concat, 0, 1);
       sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
 
       /* Make sure all the indices are constructed correctly.
@@ -602,7 +602,7 @@ void sqlite3Pragma(
             { OP_Recno,       1,  0,  0},
             { OP_String8,     0,  0,  " missing from index "},
             { OP_String8,     0,  0,  0},    /* 4 */
-            { OP_Concat8,     4,  0,  0},
+            { OP_Concat,      2,  0,  0},
             { OP_Callback,    1,  0,  0},
           };
           sqlite3GenerateIndexKey(v, pIdx, 1);
@@ -626,7 +626,7 @@ void sqlite3Pragma(
              { OP_MemIncr,      0,  0,  0},
              { OP_String8,      0,  0,  "wrong # of entries in index "},
              { OP_String8,      0,  0,  0},  /* 10 */
-             { OP_Concat8,      2,  0,  0},
+             { OP_Concat,       0,  0,  0},
              { OP_Callback,     1,  0,  0},
           };
           if( pIdx->tnum==0 ) continue;
index df8e5fb4d7087496bcc3624b2982945f70dfd48a..3c07996d6644668fff50d80c6a5f38cdcb59b812 100644 (file)
@@ -219,7 +219,7 @@ void sqlite3FinishTrigger(
       { OP_Integer,    0, 0,  0          },
       { OP_String8,    0, 0,  "CREATE TRIGGER "},
       { OP_String8,    0, 0,  0          },  /* 6: SQL */
-      { OP_Concat8,    2, 0,  0          }, 
+      { OP_Concat,     0, 0,  0          }, 
       { OP_MakeRecord, 5, 0,  "tttit"    },
       { OP_PutIntKey,  0, 0,  0          },
     };
index e57537d5b2bbefe94d73bd1461785ce5a2b17485..97e9aff2853ad4396f2f629552e012abc46dbb88 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle UPDATE statements.
 **
-** $Id: update.c,v 1.86 2004/08/21 17:54:45 drh Exp $
+** $Id: update.c,v 1.87 2004/08/31 13:45:12 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -272,7 +272,7 @@ void sqlite3Update(
     }else{
       sqlite3VdbeAddOp(v, OP_Recno, iCur, 0);
     }
-    for(i=0; i<pTab->nCol; i++){
+    for(i=0; i<pTab->nCol; i++){ /* TODO: Factor out this loop as common code */
       if( i==pTab->iPKey ){
         sqlite3VdbeAddOp(v, OP_String8, 0, 0);
         continue;
index b2618e0af8b4fca64f391df582b17555aaff104b..4151e43b105b7e8ab19ce1ecbdf81e14690a75b6 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.411 2004/08/29 17:30:50 drh Exp $
+** $Id: vdbe.c,v 1.412 2004/08/31 13:45:12 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -908,42 +908,10 @@ case OP_Callback: {
   return SQLITE_ROW;
 }
 
-/* Opcode: Concat8 P1 P2 P3
-**
-** P3 points to a nul terminated UTF-8 string. When it is executed for
-** the first time, P3 is converted to the native database encoding and
-** the opcode replaced with Concat (see Concat for details of processing).
-*/
-case OP_Concat8: {
-  pOp->opcode = OP_Concat;
-
-  if( db->enc!=SQLITE_UTF8 && pOp->p3 ){
-    Mem tmp;
-    tmp.flags = MEM_Null;
-    sqlite3VdbeMemSetStr(&tmp, pOp->p3, -1, SQLITE_UTF8, SQLITE_STATIC);
-    if( SQLITE_OK!=sqlite3VdbeChangeEncoding(&tmp, db->enc) ||
-        SQLITE_OK!=sqlite3VdbeMemDynamicify(&tmp) 
-    ){
-      goto no_mem;
-    }
-    assert( tmp.flags|MEM_Dyn );
-    assert( !tmp.xDel );
-    pOp->p3type = P3_DYNAMIC;
-    pOp->p3 = tmp.z;
-    /* Don't call sqlite3VdbeMemRelease() on &tmp, the dynamic allocation
-    ** is cleaned up when the vdbe is deleted. 
-    */
-  }
-
-  /* If it wasn't already, P3 has been converted to the database text
-  ** encoding. Fall through to OP_Concat to process this instruction.
-  */
-}
-
 /* Opcode: Concat P1 P2 *
 **
-** Look at the first P1 elements of the stack.  Append them all 
-** together with the lowest element first.  The original P1 elements
+** Look at the first P1+2 elements of the stack.  Append them all 
+** together with the lowest element first.  The original P1+2 elements
 ** are popped from the stack if P2==0 and retained if P2==1.  If
 ** any element of the stack is NULL, then the result is NULL.
 **
@@ -958,7 +926,7 @@ case OP_Concat: {
   Mem *pTerm;
 
   /* Loop through the stack elements to see how long the result will be. */
-  nField = pOp->p1;
+  nField = pOp->p1 + 2;
   pTerm = &pTos[1-nField];
   nByte = 0;
   for(i=0; i<nField; i++, pTerm++){
index a1a00648c5d992cc500f8b9b2c8479d8f9192866..001f9e8fc977a4c52e6e1431c1130563fbed34c3 100644 (file)
@@ -10,7 +10,7 @@
 #***********************************************************************
 # This file runs all tests.
 #
-# $Id: all.test,v 1.21 2004/06/30 08:20:16 danielk1977 Exp $
+# $Id: all.test,v 1.22 2004/08/31 13:45:12 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -54,6 +54,7 @@ set EXCLUDE {
   malloc.test
   misuse.test
   memleak.test
+  corrupt.test
 }
 #  btree2.test