1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Style fixes to triggers code in various *.c files (partial fix to ticket #39) (CVS 571)

FossilOrigin-Name: 8a4195c7466962291a296e8f53034ea8cb25005f
This commit is contained in:
danielk1977
2002-05-19 23:43:12 +00:00
parent 633ed08d95
commit f29ce55958
11 changed files with 175 additions and 150 deletions

View File

@@ -1,5 +1,5 @@
C Stylistic\schanges\sto\ssrc/trigger.c\s(partial\sfix\sto\sticket\s#39).\sAlso\smore\scomments.\s(CVS\s570) C Style\sfixes\sto\striggers\scode\sin\svarious\s*.c\sfiles\s(partial\sfix\sto\sticket\s#39)\s(CVS\s571)
D 2002-05-17T00:05:59 D 2002-05-19T23:43:13
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495 F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0 F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
@@ -20,15 +20,15 @@ F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6 F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
F src/btree.c c01b404b9373ae1c0daf7d1f9211c72ead67638e F src/btree.c c01b404b9373ae1c0daf7d1f9211c72ead67638e
F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3 F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
F src/build.c 705ebd993ac708bb3d04f4b9019d42dc205408cc F src/build.c f6d2f428801e636c802fa63e951772569fa133a5
F src/delete.c 48e4c533b39d6edfcfca23fb500129b80b7cad30 F src/delete.c f9ab9738c5a6fed434ec9e7721a178f58f65f57a
F src/encode.c 346b12b46148506c32038524b95c4631ab46d760 F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
F src/expr.c 6888e37e4eecdc20567aedd442328df752465723 F src/expr.c 2c7535ba013b731ed73f12b6cc1cd5b466efb3e2
F src/func.c a31dcba85bc2ecb9b752980289cf7e6cd0cafbce F src/func.c a31dcba85bc2ecb9b752980289cf7e6cd0cafbce
F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892 F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892
F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9 F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9
F src/insert.c 26ca700fb4055c34970ebac1d9a9a067bebef3b0 F src/insert.c 5233701a402cf5f4329525a654928c5de8d9a4e8
F src/main.c de486c893c0a34a91aa5660c3ab5ce3d08746eaf F src/main.c 3f0db74a3e8385322a3b69f51bea6ce19caeff19
F src/md5.c 0ae1f3e2cac92d06fc6246d1b4b8f61a2fe66d3b F src/md5.c 0ae1f3e2cac92d06fc6246d1b4b8f61a2fe66d3b
F src/os.c 5ab8b6b4590d0c1ab8e96c67996c170e4462e0fc F src/os.c 5ab8b6b4590d0c1ab8e96c67996c170e4462e0fc
F src/os.h 4a361fccfbc4e7609b3e1557f604f94c1e96ad10 F src/os.h 4a361fccfbc4e7609b3e1557f604f94c1e96ad10
@@ -49,12 +49,12 @@ F src/test2.c 669cc22781c6461a273416ec1a7414d25c081730
F src/test3.c 4e52fff8b01f08bd202f7633feda5639b7ba2b5e F src/test3.c 4e52fff8b01f08bd202f7633feda5639b7ba2b5e
F src/threadtest.c 81f0598e0f031c1bd506af337fdc1b7e8dff263f F src/threadtest.c 81f0598e0f031c1bd506af337fdc1b7e8dff263f
F src/tokenize.c f12f78c58b2a79ea4eee880efad63a328e103c62 F src/tokenize.c f12f78c58b2a79ea4eee880efad63a328e103c62
F src/trigger.c e61b4a9ecdfdef8e5d7d074e720dacf7abe5f361 F src/trigger.c 43dbeb68ba379049a78d270db0db27fa01deec12
F src/update.c f9b53d46cc651b9630fc53342b9e792031f6fc5c F src/update.c 6b1d80b5058e686c2e3197d72c567ea27d35f42e
F src/util.c 707c30f8c13cddace7c08556ac450c0b786660b3 F src/util.c 707c30f8c13cddace7c08556ac450c0b786660b3
F src/vdbe.c 42281b4e0e0c4a089018a14d6840ada5a1896e51 F src/vdbe.c 5fd717e6a42e98e4f244a2149267004f71f23679
F src/vdbe.h 126a651ba26f05de075dcc6da5466244a31af6b8 F src/vdbe.h 126a651ba26f05de075dcc6da5466244a31af6b8
F src/where.c d1c05aca90d2a9d7000c40db5a4b1ac9d6d1169d F src/where.c 7e482af684197f5137380aa5c9ae0693f7fe7be4
F test/all.test e4d3821eeba751829b419cd47814bd20af4286d1 F test/all.test e4d3821eeba751829b419cd47814bd20af4286d1
F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578 F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
F test/btree.test bf326f546a666617367a7033fa2c07451bd4f8e1 F test/btree.test bf326f546a666617367a7033fa2c07451bd4f8e1
@@ -134,7 +134,7 @@ F www/speed.tcl da8afcc1d3ccc5696cfb388a68982bc3d9f7f00f
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279 F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
P 9ec8a2b139ce38312284d7b4eb61221b1e1e3052 P b1d72cb5847a9f5f08e40b36ad117b5493232ea7
R 6c59ff9d8d542bc14ae8632c3c69e144 R 6a41d52fabcd64a48785213ecafaf488
U danielk1977 U danielk1977
Z d967dbf67c63f0da8b2c7467d5b0888a Z f416062573015e51faa69ab13000e10e

View File

@@ -1 +1 @@
b1d72cb5847a9f5f08e40b36ad117b5493232ea7 8a4195c7466962291a296e8f53034ea8cb25005f

View File

@@ -25,7 +25,7 @@
** ROLLBACK ** ROLLBACK
** PRAGMA ** PRAGMA
** **
** $Id: build.c,v 1.90 2002/05/15 12:45:43 drh Exp $ ** $Id: build.c,v 1.91 2002/05/19 23:43:14 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -353,11 +353,11 @@ void sqliteRollbackInternalChanges(sqlite *db){
for(pElem = sqliteHashFirst(&db->trigDrop); pElem; for(pElem = sqliteHashFirst(&db->trigDrop); pElem;
pElem = sqliteHashNext(pElem)){ pElem = sqliteHashNext(pElem)){
Trigger *pTrigger = sqliteHashData(pElem); Trigger *pTrigger = sqliteHashData(pElem);
Table * tab = sqliteFindTable(db, pTrigger->table); Table *pTbl = sqliteFindTable(db, pTrigger->table);
sqliteHashInsert(&db->trigHash, pTrigger->name, sqliteHashInsert(&db->trigHash, pTrigger->name,
strlen(pTrigger->name) + 1, pTrigger); strlen(pTrigger->name) + 1, pTrigger);
pTrigger->pNext = tab->pTrigger; pTrigger->pNext = pTbl->pTrigger;
tab->pTrigger = pTrigger; pTbl->pTrigger = pTrigger;
} }
sqliteHashClear(&db->trigDrop); sqliteHashClear(&db->trigDrop);

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle DELETE FROM statements. ** to handle DELETE FROM statements.
** **
** $Id: delete.c,v 1.32 2002/05/15 11:44:14 drh Exp $ ** $Id: delete.c,v 1.33 2002/05/19 23:43:14 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -94,7 +94,7 @@ void sqliteDeleteFrom(
db = pParse->db; db = pParse->db;
/* Check for the special case of a VIEW with one or more ON DELETE triggers /* Check for the special case of a VIEW with one or more ON DELETE triggers
* defined ** defined
*/ */
{ {
Table *pTab; Table *pTab;
@@ -129,8 +129,9 @@ void sqliteDeleteFrom(
pTab = pTabList->a[0].pTab; pTab = pTabList->a[0].pTab;
assert( pTab->pSelect==0 ); /* This table is not a view */ assert( pTab->pSelect==0 ); /* This table is not a view */
if (row_triggers_exist) if( row_triggers_exist ){
oldIdx = pParse->nTab++; oldIdx = pParse->nTab++;
}
/* Resolve the column names in all the expressions. /* Resolve the column names in all the expressions.
*/ */
@@ -147,11 +148,14 @@ void sqliteDeleteFrom(
/* Begin generating code. /* Begin generating code.
*/ */
v = sqliteGetVdbe(pParse); v = sqliteGetVdbe(pParse);
if( v==0 ) goto delete_from_cleanup; if( v==0 ){
if (row_triggers_exist) goto delete_from_cleanup;
}
if( row_triggers_exist ){
sqliteBeginMultiWriteOperation(pParse); sqliteBeginMultiWriteOperation(pParse);
else } else {
sqliteBeginWriteOperation(pParse); sqliteBeginWriteOperation(pParse);
}
/* Initialize the counter of the number of rows deleted, if /* Initialize the counter of the number of rows deleted, if
** we are counting rows. ** we are counting rows.
@@ -223,11 +227,12 @@ void sqliteDeleteFrom(
sqliteVdbeAddOp(v, OP_Integer, 13, 0); sqliteVdbeAddOp(v, OP_Integer, 13, 0);
for(ii = 0; ii<pTab->nCol; ii++){ for(ii = 0; ii<pTab->nCol; ii++){
if (ii == pTab->iPKey) if( ii==pTab->iPKey ){
sqliteVdbeAddOp(v, OP_Recno, base, 0); sqliteVdbeAddOp(v, OP_Recno, base, 0);
else } else {
sqliteVdbeAddOp(v, OP_Column, base, ii); sqliteVdbeAddOp(v, OP_Column, base, ii);
} }
}
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0); sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0); sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0);
sqliteVdbeAddOp(v, OP_Close, base, 0); sqliteVdbeAddOp(v, OP_Close, base, 0);
@@ -244,8 +249,9 @@ void sqliteDeleteFrom(
sqliteVdbeAddOp(v, openOp, pParse->nTab++, pIdx->tnum); sqliteVdbeAddOp(v, openOp, pParse->nTab++, pIdx->tnum);
} }
if (!row_triggers_exist) if( !row_triggers_exist ){
addr = sqliteVdbeAddOp(v, OP_ListRead, 0, end); addr = sqliteVdbeAddOp(v, OP_ListRead, 0, end);
}
sqliteGenerateRowDelete(v, pTab, base, pParse->trigStack?0:1); sqliteGenerateRowDelete(v, pTab, base, pParse->trigStack?0:1);

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and ** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite. ** for generating VDBE code that evaluates expressions in SQLite.
** **
** $Id: expr.c,v 1.59 2002/05/15 08:30:13 danielk1977 Exp $ ** $Id: expr.c,v 1.60 2002/05/19 23:43:14 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -485,28 +485,29 @@ int sqliteExprResolveIds(
/* If we have not already resolved this *.* expression, then maybe /* If we have not already resolved this *.* expression, then maybe
* it is a new.* or old.* trigger argument reference */ * it is a new.* or old.* trigger argument reference */
if( cnt == 0 && pParse->trigStack != 0 ){ if( cnt == 0 && pParse->trigStack != 0 ){
TriggerStack * tt = pParse->trigStack; TriggerStack *pTriggerStack = pParse->trigStack;
int j;
int t = 0; int t = 0;
if (tt->newIdx != -1 && sqliteStrICmp("new", zLeft) == 0) { if( pTriggerStack->newIdx != -1 && sqliteStrICmp("new", zLeft) == 0 ){
pExpr->iTable = tt->newIdx; pExpr->iTable = pTriggerStack->newIdx;
cntTab++; cntTab++;
t = 1; t = 1;
} }
if (tt->oldIdx != -1 && sqliteStrICmp("old", zLeft) == 0) { if( pTriggerStack->oldIdx != -1 && sqliteStrICmp("old", zLeft) == 0 ){
pExpr->iTable = tt->oldIdx; pExpr->iTable = pTriggerStack->oldIdx;
cntTab++; cntTab++;
t = 1; t = 1;
} }
if (t) if( t ){
for(j=0; j<tt->pTab->nCol; j++) { int j;
if( sqliteStrICmp(tt->pTab->aCol[j].zName, zRight)==0 ){ for(j=0; j < pTriggerStack->pTab->nCol; j++) {
if( sqliteStrICmp(pTriggerStack->pTab->aCol[j].zName, zRight)==0 ){
cnt++; cnt++;
pExpr->iColumn = j; pExpr->iColumn = j;
} }
} }
} }
}
if( cnt==0 && cntTab==1 && sqliteIsRowid(zRight) ){ if( cnt==0 && cntTab==1 && sqliteIsRowid(zRight) ){
cnt = 1; cnt = 1;

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite. ** to handle INSERT statements in SQLite.
** **
** $Id: insert.c,v 1.54 2002/05/15 11:44:14 drh Exp $ ** $Id: insert.c,v 1.55 2002/05/19 23:43:14 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -102,8 +102,9 @@ void sqliteInsert(
} }
/* if there are row triggers, allocate a temp table for new.* references. */ /* if there are row triggers, allocate a temp table for new.* references. */
if (row_triggers_exist) if( row_triggers_exist ){
newIdx = pParse->nTab++; newIdx = pParse->nTab++;
}
/* Figure out how many columns of data are supplied. If the data /* Figure out how many columns of data are supplied. If the data
** is coming from a SELECT statement, then this step has to generate ** is coming from a SELECT statement, then this step has to generate
@@ -204,8 +205,9 @@ void sqliteInsert(
} }
/* Open the temp table for FOR EACH ROW triggers */ /* Open the temp table for FOR EACH ROW triggers */
if (row_triggers_exist) if( row_triggers_exist ){
sqliteVdbeAddOp(v, OP_OpenTemp, newIdx, 0); sqliteVdbeAddOp(v, OP_OpenTemp, newIdx, 0);
}
/* Initialize the count of rows to be inserted /* Initialize the count of rows to be inserted
*/ */
@@ -263,10 +265,10 @@ void sqliteInsert(
sqliteVdbeAddOp(v, OP_Rewind, newIdx, 0); sqliteVdbeAddOp(v, OP_Rewind, newIdx, 0);
/* Fire BEFORE triggers */ /* Fire BEFORE triggers */
if ( if( sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_BEFORE, pTab, newIdx, -1,
sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_BEFORE, pTab, newIdx, -1, onError) ){
onError) goto insert_cleanup;
) goto insert_cleanup; }
/* Open the tables and indices for the INSERT */ /* Open the tables and indices for the INSERT */
if( !pTab->pSelect ){ if( !pTab->pSelect ){
@@ -361,10 +363,10 @@ void sqliteInsert(
} }
/* Code AFTER triggers */ /* Code AFTER triggers */
if ( if( sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_AFTER, pTab, newIdx, -1,
sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_AFTER, pTab, newIdx, -1, onError) ){
onError) goto insert_cleanup;
) goto insert_cleanup; }
} }
/* The bottom of the loop, if the data source is a SELECT statement /* The bottom of the loop, if the data source is a SELECT statement

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** accessed by users of the library.
** **
** $Id: main.c,v 1.74 2002/05/15 14:17:45 drh Exp $ ** $Id: main.c,v 1.75 2002/05/19 23:43:14 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -434,7 +434,6 @@ static void clearHashTable(sqlite *db, int preserveTemps){
} }
} }
sqliteHashClear(&temp1); sqliteHashClear(&temp1);
db->flags &= ~SQLITE_Initialized; db->flags &= ~SQLITE_Initialized;
} }

View File

@@ -82,7 +82,9 @@ void sqliteCreateTrigger(
ss = nt->step_list; ss = nt->step_list;
while( ss ){ while( ss ){
sqliteSelectMoveStrings(ss->pSelect, offset); sqliteSelectMoveStrings(ss->pSelect, offset);
if (ss->target.z) ss->target.z += offset; if( ss->target.z ){
ss->target.z += offset;
}
sqliteExprMoveStrings(ss->pWhere, offset); sqliteExprMoveStrings(ss->pWhere, offset);
sqliteExprListMoveStrings(ss->pExprList, offset); sqliteExprListMoveStrings(ss->pExprList, offset);
@@ -349,10 +351,13 @@ static int checkColumnOverLap(IdList * pIdList, ExprList * pEList)
if( !pIdList )return 1; if( !pIdList )return 1;
if( !pEList )return 1; if( !pEList )return 1;
for (i = 0; i < pIdList->nId; i++) for(i = 0; i < pIdList->nId; i++){
for (e = 0; e < pEList->nExpr; e++) for(e = 0; e < pEList->nExpr; e++){
if (!sqliteStrICmp(pIdList->a[i].zName, pEList->a[e].zName)) if( !sqliteStrICmp(pIdList->a[i].zName, pEList->a[e].zName) ){
return 1; return 1;
}
}
}
return 0; return 0;
} }
@@ -394,7 +399,9 @@ int sqliteTriggersExist(
checkColumnOverLap(pTriggerCursor->pColumns, pChanges) ){ checkColumnOverLap(pTriggerCursor->pColumns, pChanges) ){
TriggerStack * ss; TriggerStack * ss;
ss = pParse->trigStack; ss = pParse->trigStack;
while (ss && ss->pTrigger != pTrigger) ss = ss->pNext; while( ss && ss->pTrigger != pTrigger ){
ss = ss->pNext;
}
if( !ss )return 1; if( !ss )return 1;
} }
pTriggerCursor = pTriggerCursor->pNext; pTriggerCursor = pTriggerCursor->pNext;
@@ -502,13 +509,16 @@ int sqliteCodeRowTrigger(
fire_this = 1; fire_this = 1;
pTriggerStack = pParse->trigStack; pTriggerStack = pParse->trigStack;
while( pTriggerStack ){ while( pTriggerStack ){
if (pTriggerStack->pTrigger == pTrigger) fire_this = 0; if( pTriggerStack->pTrigger == pTrigger ){
fire_this = 0;
}
pTriggerStack = pTriggerStack->pNext; pTriggerStack = pTriggerStack->pNext;
} }
if( op == TK_UPDATE && pTrigger->pColumns && if( op == TK_UPDATE && pTrigger->pColumns &&
!checkColumnOverLap(pTrigger->pColumns, pChanges)) !checkColumnOverLap(pTrigger->pColumns, pChanges) ){
fire_this = 0; fire_this = 0;
} }
}
if( fire_this ){ if( fire_this ){
int endTrigger; int endTrigger;
@@ -636,8 +646,9 @@ void sqliteViewTriggers(
for(ii=0; ii<pChanges->nExpr; ii++){ for(ii=0; ii<pChanges->nExpr; ii++){
int jj; int jj;
if( sqliteExprResolveIds(pParse, oldIdx, theSelect.pSrc , 0, if( sqliteExprResolveIds(pParse, oldIdx, theSelect.pSrc , 0,
pChanges->a[ii].pExpr) ) pChanges->a[ii].pExpr) ){
goto trigger_cleanup; goto trigger_cleanup;
}
if( sqliteExprCheck(pParse, pChanges->a[ii].pExpr, 0, 0) ) if( sqliteExprCheck(pParse, pChanges->a[ii].pExpr, 0, 0) )
goto trigger_cleanup; goto trigger_cleanup;

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle UPDATE statements. ** to handle UPDATE statements.
** **
** $Id: update.c,v 1.38 2002/05/15 11:44:15 drh Exp $ ** $Id: update.c,v 1.39 2002/05/19 23:43:14 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -92,6 +92,7 @@ void sqliteUpdate(
if( aXRef==0 ) goto update_cleanup; if( aXRef==0 ) goto update_cleanup;
for(i=0; i<pTab->nCol; i++) aXRef[i] = -1; for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;
/* If there are FOR EACH ROW triggers, allocate temp tables */
if( row_triggers_exist ){ if( row_triggers_exist ){
newIdx = pParse->nTab++; newIdx = pParse->nTab++;
oldIdx = pParse->nTab++; oldIdx = pParse->nTab++;
@@ -213,21 +214,23 @@ void sqliteUpdate(
sqliteVdbeAddOp(v, OP_Integer, 13, 0); sqliteVdbeAddOp(v, OP_Integer, 13, 0);
for(ii = 0; ii < pTab->nCol; ii++){ for(ii = 0; ii < pTab->nCol; ii++){
if (ii == pTab->iPKey) if( ii == pTab->iPKey ){
sqliteVdbeAddOp(v, OP_Recno, base, 0); sqliteVdbeAddOp(v, OP_Recno, base, 0);
else }else{
sqliteVdbeAddOp(v, OP_Column, base, ii); sqliteVdbeAddOp(v, OP_Column, base, ii);
} }
}
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0); sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0); sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0);
sqliteVdbeAddOp(v, OP_Integer, 13, 0); sqliteVdbeAddOp(v, OP_Integer, 13, 0);
for(ii = 0; ii < pTab->nCol; ii++){ for(ii = 0; ii < pTab->nCol; ii++){
if( aXRef[ii] < 0 ){ if( aXRef[ii] < 0 ){
if (ii == pTab->iPKey) if( ii == pTab->iPKey ){
sqliteVdbeAddOp(v, OP_Recno, base, 0); sqliteVdbeAddOp(v, OP_Recno, base, 0);
else }else{
sqliteVdbeAddOp(v, OP_Column, base, ii); sqliteVdbeAddOp(v, OP_Column, base, ii);
}
}else{ }else{
sqliteExprCode(pParse, pChanges->a[aXRef[ii]].pExpr); sqliteExprCode(pParse, pChanges->a[aXRef[ii]].pExpr);
} }
@@ -240,7 +243,9 @@ void sqliteUpdate(
sqliteVdbeAddOp(v, OP_Rewind, newIdx, 0); sqliteVdbeAddOp(v, OP_Rewind, newIdx, 0);
if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_BEFORE, pTab, if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_BEFORE, pTab,
newIdx, oldIdx, onError)) goto update_cleanup; newIdx, oldIdx, onError) ){
goto update_cleanup;
}
} }
/* Rewind the list of records that need to be updated and /* Rewind the list of records that need to be updated and
@@ -346,7 +351,9 @@ void sqliteUpdate(
pParse->nTab = base; pParse->nTab = base;
if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_AFTER, pTab, if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_AFTER, pTab,
newIdx, oldIdx, onError)) goto update_cleanup; newIdx, oldIdx, onError) ){
goto update_cleanup;
}
} }
/* Repeat the above with the next record to be updated, until /* Repeat the above with the next record to be updated, until

View File

@@ -30,7 +30,7 @@
** But other routines are also provided to help in building up ** But other routines are also provided to help in building up
** a program instruction by instruction. ** a program instruction by instruction.
** **
** $Id: vdbe.c,v 1.143 2002/05/15 11:44:15 drh Exp $ ** $Id: vdbe.c,v 1.144 2002/05/19 23:43:14 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -249,9 +249,8 @@ struct Vdbe {
int nCallback; /* Number of callbacks invoked so far */ int nCallback; /* Number of callbacks invoked so far */
int iLimit; /* Limit on the number of callbacks remaining */ int iLimit; /* Limit on the number of callbacks remaining */
int iOffset; /* Offset before beginning to do callbacks */ int iOffset; /* Offset before beginning to do callbacks */
int keylistStackDepth; /* The size of the "keylist" stack */
int keylistStackDepth; Keylist **keylistStack; /* The stack used by opcodes PushList & PopList */
Keylist ** keylistStack;
}; };
/* /*

View File

@@ -13,7 +13,7 @@
** the WHERE clause of SQL statements. Also found here are subroutines ** the WHERE clause of SQL statements. Also found here are subroutines
** to generate VDBE code to evaluate expressions. ** to generate VDBE code to evaluate expressions.
** **
** $Id: where.c,v 1.43 2002/05/15 11:44:15 drh Exp $ ** $Id: where.c,v 1.44 2002/05/19 23:43:14 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"