aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2004-08-31 13:45:11 +0000
committerdrh <drh@noemail.net>2004-08-31 13:45:11 +0000
commit855eb1cf021a4f9503acbb835b25695f2e9f3f86 (patch)
tree5bc9a91817f81b88ff2061d5637463bb2c575efc /src
parent4e5ffc5f8d727ef1bd8beca17476b529e584e7b1 (diff)
downloadsqlite-855eb1cf021a4f9503acbb835b25695f2e9f3f86.tar.gz
sqlite-855eb1cf021a4f9503acbb835b25695f2e9f3f86.zip
Simplifications and optimizations. Also: disable the corrupt.test for now. (CVS 1924)
FossilOrigin-Name: 8fd65e704888a8e2f4a712a94fd0e3f866c10ef3
Diffstat (limited to 'src')
-rw-r--r--src/btree.c4
-rw-r--r--src/build.c6
-rw-r--r--src/delete.c11
-rw-r--r--src/expr.c14
-rw-r--r--src/pragma.c8
-rw-r--r--src/trigger.c2
-rw-r--r--src/update.c4
-rw-r--r--src/vdbe.c40
8 files changed, 26 insertions, 63 deletions
diff --git a/src/btree.c b/src/btree.c
index 64e8aef25..0dfd89c46 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -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--;
diff --git a/src/build.c b/src/build.c
index ca536f764..1ff47aef6 100644
--- a/src/build.c
+++ b/src/build.c
@@ -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);
diff --git a/src/delete.c b/src/delete.c
index bfe1cbde5..918b597dd 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -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"
@@ -24,11 +24,10 @@
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;
}
diff --git a/src/expr.c b/src/expr.c
index 5377a2daa..e8dfc2baf 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -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: {
diff --git a/src/pragma.c b/src/pragma.c
index 172ace359..6fc43607c 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -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;
diff --git a/src/trigger.c b/src/trigger.c
index df8e5fb4d..3c07996d6 100644
--- a/src/trigger.c
+++ b/src/trigger.c
@@ -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 },
};
diff --git a/src/update.c b/src/update.c
index e57537d5b..97e9aff28 100644
--- a/src/update.c
+++ b/src/update.c
@@ -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;
diff --git a/src/vdbe.c b/src/vdbe.c
index b2618e0af..4151e43b1 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -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++){