diff --git a/manifest b/manifest index 6e90a46c14..0f063a080e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\soutput\sof\svdbe_trace\setc.\sto\sinclude\soperands\sp3\sand\sp5.\s(CVS\s4665) -D 2008-01-03T08:18:31 +C Change\sthe\sOP_Insert\sopcode\sto\sread\sthe\skey\sand\sdata\sto\sinsert\sfrom\smemory\scells,\snot\sthe\sstack.\s(CVS\s4666) +D 2008-01-03T09:51:55 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in 30789bf70614bad659351660d76b8e533f3340e9 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -79,24 +79,24 @@ F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.def a96c1d0d39362b763d2ddba220a32da41a15c4b4 F sqlite3.pc.in abed4664817e1cd500f2276142c71958087c16bc F src/alter.c b58ed3becc77885e2aec6754c689255534f2734c -F src/analyze.c 1fb7ada6a10c252db873c0835fbd92caaaa65116 +F src/analyze.c d7b4dace3823b45d0a18568dd43067f78aa0f133 F src/attach.c 4b214b411237531491e1186211e005e4de73630d F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 F src/btmutex.c 5d39da37c9d1282f3c6f9967afae6a34ee36b7ff F src/btree.c 5164b32950cfd41f2c5c31e8ff82c4a499918aef F src/btree.h 19dcf5ad23c17b98855da548e9a8e3eb4429d5eb F src/btreeInt.h 1c5a9da165718ef7de81e35ce9ab5d9ba9283f76 -F src/build.c a34fc6b288115b36e7b32dc2da429cbb59c89098 +F src/build.c 11cd1e6a6425893662edcdf4b39abe02a1fb2ecb F src/callback.c 77b302b0d41468dcda78c70e706e5b84577f0fa0 F src/complete.c 4cf68fd75d60257524cbe74f87351b9848399131 F src/date.c 49c5a6d2de6c12000905b4d36868b07d3011bbf6 -F src/delete.c 0daad58124d0dfb334c8e5d3f6ceb76f093b8723 +F src/delete.c 16389863bf16fdbec6810d6b44b9236fdbf4e567 F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b F src/expr.c 24202e79a92c8b9b0b5a609d03051ff3d91e5bf4 F src/func.c 996071cf0af9d967e58b69fce1909555059ebc7d F src/hash.c 45a7005aac044b6c86bd7e49c44bc15d30006d6c F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53 -F src/insert.c c76fbbed6f3d3721dcc528653e45ff6c08a24c83 +F src/insert.c 195072a6bd6c7f31618d3e97c27166a6e71ea0e4 F src/journal.c 807bed7a158979ac8d63953e1774e8d85bff65e2 F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66 F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35 @@ -131,12 +131,12 @@ F src/pragma.c 61b9d171a6d53d36a77c66cb921d47a5c09a8441 F src/prepare.c f1bb8eb642082e618a359c08e3e107490eafe0e3 F src/printf.c eb27822ba2eec669161409ca31279a24c26ac910 F src/random.c 4a22746501bf36b0a088c66e38dde5daba6a35da -F src/select.c 1f8579efbb45c037d1b169d08ac9e4cab84e1d74 +F src/select.c 539a71c9b302ac003e5be72eee007d1f2e452e43 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c 5391e889384d2062249f668110d64ed16f601c4b F src/sqlite.h.in 2a7e3776534bbe6ff2cdc058f3abebe91e7e429f F src/sqlite3ext.h a93f59cdee3638dc0c9c086f80df743a4e68c3cb -F src/sqliteInt.h 2e30ff7e6ee65743d38447f00ef873ce058be7be +F src/sqliteInt.h 4cd2cec92641cf1c292ae5bc6b07a51ee4d0f34f F src/sqliteLimit.h ee4430f88f69bf63527967bb35ca52af7b0ccb1e F src/table.c 1aeb9eab57b4235db86fe15a35dec76fb445a9c4 F src/tclsqlite.c 9923abeffc9b3d7dad58e92b319661521f60debf @@ -163,16 +163,16 @@ F src/test_server.c a6ece6c835e7eae835054124e09e947e422b1ac5 F src/test_tclvar.c b2d1115e4d489179d3f029e765211b2ad527ba59 F src/test_thread.c e297dd41db0b249646e69f97d36ec13e56e8b730 F src/tokenize.c a4e04438c11fed2c67ec47fe3edbef9cca2d1b48 -F src/trigger.c e7642cf61056655905aaba8db1ca51d299a1003b -F src/update.c 587df2777e78a47d2c4399059cdd7a2cea5e0b19 +F src/trigger.c caa971c1a9bba37b6ad705e7990316dd1e8266c9 +F src/update.c 9b90a5d55cba28800a40ed5f443dcc44d71c3abc F src/utf.c ef4b7d83bae533b76c3e1bf635b113fdad86a736 F src/util.c 05f31144bbd3f1a24f4139ae029c42545cb72624 F src/vacuum.c 3f34f278809bf3eb0b62ec46ff779e9c385b28f0 -F src/vdbe.c 429493ced32e5bb3d17fabd4f893374ebe5ffdf2 -F src/vdbe.h ad5fd7aa694928e54efa84ac8f8133b77053c97d +F src/vdbe.c 5b1939189986ad44940f2a5b207f9c302b95e95a +F src/vdbe.h 433a955b0b7ef4be23564353481da998666c480b F src/vdbeInt.h 2985f1369273e635898cf5952237efcb3fdb21f3 F src/vdbeapi.c bf615ff2cf2b121f1609cbadd4f52720289733b5 -F src/vdbeaux.c 8c8901e4b5d5e8a89d6c149b9bcf91facb169f18 +F src/vdbeaux.c 077854f4bc5ed0fcfb42f0fab2727816c7cefcd7 F src/vdbeblob.c b90f7494c408d47ce6835000b01e40b371e27baf F src/vdbefifo.c 334c838c8f42d61a94813d136019ee566b5dc2f6 F src/vdbemem.c 123994fcd344993d2fb050a83b91b341bbbd08b4 @@ -603,7 +603,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P c30f8206353f32a08ef0b323c9fd0bdbeaa28b02 -R 771f6ceee9c4c383810617b5c88de655 +P 76f2040b051e1d4d8033e354dffe277b549f7962 +R bbd0651e2eb2956304714ff8df05e705 U danielk1977 -Z f7a1409cbe2afac4183b180783d9a997 +Z 658c0c7b02e0a563b671cd4ff1bc5c7c diff --git a/manifest.uuid b/manifest.uuid index 952b1b0fd9..fcd25b9847 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -76f2040b051e1d4d8033e354dffe277b549f7962 \ No newline at end of file +46501f490a5f5577ea31c758df749e02c7c65f39 \ No newline at end of file diff --git a/src/analyze.c b/src/analyze.c index ffcc6d6cf3..572fdb60fd 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code associated with the ANALYZE command. ** -** @(#) $Id: analyze.c,v 1.28 2008/01/03 07:54:24 danielk1977 Exp $ +** @(#) $Id: analyze.c,v 1.29 2008/01/03 09:51:55 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_ANALYZE #include "sqliteInt.h" @@ -212,7 +212,7 @@ static void analyzeOneTable( } } sqlite3VdbeAddOp4(v, OP_MakeRecord, 3, 0, 0, "aaa", 0); - sqlite3VdbeAddOp2(v, OP_Insert, iStatCur, OPFLAG_APPEND); + sqlite3CodeInsert(pParse, iStatCur, OPFLAG_APPEND); sqlite3VdbeJumpHere(v, addr); } } diff --git a/src/build.c b/src/build.c index 48ed5bd412..f6faeb7478 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.454 2008/01/03 07:54:24 danielk1977 Exp $ +** $Id: build.c,v 1.455 2008/01/03 09:51:55 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -883,7 +883,7 @@ void sqlite3StartTable( sqlite3VdbeAddOp0(v, OP_NewRowid); sqlite3VdbeAddOp0(v, OP_Dup); sqlite3VdbeAddOp0(v, OP_Null); - sqlite3VdbeAddOp2(v, OP_Insert, 0, OPFLAG_APPEND); + sqlite3CodeInsert(pParse, 0, OPFLAG_APPEND); sqlite3VdbeAddOp0(v, OP_Close); sqlite3VdbeAddOp1(v, OP_Pull, 1); } diff --git a/src/delete.c b/src/delete.c index 6214249b40..b97ce709b0 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 ** in order to generate code for DELETE FROM statements. ** -** $Id: delete.c,v 1.141 2008/01/03 07:54:24 danielk1977 Exp $ +** $Id: delete.c,v 1.142 2008/01/03 09:51:55 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -60,6 +60,20 @@ int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ return 0; } +/* +** This function is a temporary measure required because OP_Insert now +** reads the key and data to insert from memory cells. +*/ +void sqlite3CodeInsert(Parse *p, int iCur, u8 flags){ + int iData = p->nMem++; + int iKey = p->nMem++; + Vdbe *v = sqlite3GetVdbe(p); + sqlite3VdbeAddOp2(v, OP_MemStore, iData, 1); + sqlite3VdbeAddOp2(v, OP_MemStore, iKey, 1); + sqlite3VdbeAddOp3(v, OP_Insert, iCur, iData, iKey); + sqlite3VdbeChangeP5(v, sqlite3VdbeCurrentAddr(v)-1, flags); +} + /* ** Generate code that will open a table for reading. */ @@ -325,7 +339,7 @@ void sqlite3DeleteFrom( }else{ sqlite3VdbeAddOp0(v, OP_Null); } - sqlite3VdbeAddOp1(v, OP_Insert, oldIdx); + sqlite3CodeInsert(pParse, oldIdx, 0); /* Jump back and run the BEFORE triggers */ sqlite3VdbeAddOp2(v, OP_Goto, 0, iBeginBeforeTrigger); diff --git a/src/insert.c b/src/insert.c index e8e0a0f4ae..871cb70abd 100644 --- a/src/insert.c +++ b/src/insert.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** -** $Id: insert.c,v 1.203 2008/01/03 07:54:24 danielk1977 Exp $ +** $Id: insert.c,v 1.204 2008/01/03 09:51:55 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -221,7 +221,7 @@ static void autoIncEnd( sqlite3VdbeAddOp4(v, OP_String8, 0, 0, 0, pTab->zName, 0); sqlite3VdbeAddOp2(v, OP_MemLoad, memId, 0); sqlite3VdbeAddOp2(v, OP_MakeRecord, 2, 0); - sqlite3VdbeAddOp2(v, OP_Insert, iCur, OPFLAG_APPEND); + sqlite3CodeInsert(pParse, iCur, OPFLAG_APPEND); sqlite3VdbeAddOp2(v, OP_Close, iCur, 0); } } @@ -511,7 +511,7 @@ void sqlite3Insert( sqlite3VdbeAddOp2(v, OP_MakeRecord, nColumn, 0); sqlite3VdbeAddOp2(v, OP_NewRowid, srcTab, 0); sqlite3VdbeAddOp2(v, OP_Pull, 1, 0); - sqlite3VdbeAddOp2(v, OP_Insert, srcTab, OPFLAG_APPEND); + sqlite3CodeInsert(pParse, srcTab, OPFLAG_APPEND); sqlite3VdbeAddOp2(v, OP_Return, 0, 0); /* The following code runs first because the GOTO at the very top @@ -701,7 +701,7 @@ void sqlite3Insert( if( !isView ){ sqlite3TableAffinityStr(v, pTab); } - sqlite3VdbeAddOp2(v, OP_Insert, newIdx, 0); + sqlite3CodeInsert(pParse, newIdx, OPFLAG_APPEND); /* Fire BEFORE or INSTEAD OF triggers */ if( sqlite3CodeRowTrigger(pParse, TK_INSERT, 0, TRIGGER_BEFORE, pTab, @@ -1231,7 +1231,7 @@ void sqlite3CompleteInsertion( if( newIdx>=0 ){ sqlite3VdbeAddOp2(v, OP_Dup, 1, 0); sqlite3VdbeAddOp2(v, OP_Dup, 1, 0); - sqlite3VdbeAddOp2(v, OP_Insert, newIdx, 0); + sqlite3CodeInsert(pParse, newIdx, 0); } #endif if( pParse->nested ){ @@ -1243,7 +1243,7 @@ void sqlite3CompleteInsertion( if( appendBias ){ pik_flags |= OPFLAG_APPEND; } - sqlite3VdbeAddOp2(v, OP_Insert, base, pik_flags); + sqlite3CodeInsert(pParse, base, pik_flags); if( !pParse->nested ){ sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_STATIC); } @@ -1563,9 +1563,8 @@ static int xferOptimization( assert( pDest->autoInc==0 ); } sqlite3VdbeAddOp2(v, OP_RowData, iSrc, 0); - sqlite3VdbeAddOp4(v, OP_Insert, iDest, 0, - OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND, - pDest->zName, 0); + sqlite3CodeInsert(pParse,iDest,OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND); + sqlite3VdbeChangeP4(v, -1, pDest->zName, 0); sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); autoIncEnd(pParse, iDbDest, pDest, counterMem); for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){ diff --git a/src/select.c b/src/select.c index 38569fac74..bc2f0180dc 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.379 2008/01/03 07:54:24 danielk1977 Exp $ +** $Id: select.c,v 1.380 2008/01/03 09:51:55 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -613,7 +613,7 @@ static int selectInnerLoop( }else{ sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, 0); sqlite3VdbeAddOp2(v, OP_Pull, 1, 0); - sqlite3VdbeAddOp2(v, OP_Insert, iParm, OPFLAG_APPEND); + sqlite3CodeInsert(pParse, iParm, OPFLAG_APPEND); } break; } @@ -791,7 +791,7 @@ static void generateSortTail( case SRT_EphemTab: { sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, 0); sqlite3VdbeAddOp2(v, OP_Pull, 1, 0); - sqlite3VdbeAddOp2(v, OP_Insert, iParm, OPFLAG_APPEND); + sqlite3CodeInsert(pParse, iParm, OPFLAG_APPEND); break; } #ifndef SQLITE_OMIT_SUBQUERY @@ -814,7 +814,7 @@ static void generateSortTail( case SRT_Callback: case SRT_Subroutine: { int i; - sqlite3VdbeAddOp2(v, OP_Insert, pseudoTab, 0); + sqlite3CodeInsert(pParse, pseudoTab, 0); for(i=0; inMem++; + int iData = pParse->nMem++; /* Make an entry in the sqlite_master table */ v = sqlite3GetVdbe(pParse); @@ -254,6 +258,10 @@ void sqlite3FinishTrigger( sqlite3VdbeChangeP4(v, addr+5, "CREATE TRIGGER ", P4_STATIC); sqlite3VdbeChangeP4(v, addr+6, (char*)pAll->z, pAll->n); sqlite3VdbeChangeP4(v, addr+8, "aaada", P4_STATIC); + sqlite3VdbeChangeP1(v, addr+9, iData); + sqlite3VdbeChangeP2(v, addr+11, iData); + sqlite3VdbeChangeP1(v, addr+10, iKey); + sqlite3VdbeChangeP3(v, addr+11, iKey); sqlite3ChangeCookie(db, v, iDb); sqlite3VdbeAddOp2(v, OP_Close, 0, 0); sqlite3VdbeAddOp4(v, OP_ParseSchema, iDb, 0, 0, sqlite3MPrintf( diff --git a/src/update.c b/src/update.c index 3146a1d839..d7ae939e7f 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.151 2008/01/03 08:08:40 danielk1977 Exp $ +** $Id: update.c,v 1.152 2008/01/03 09:51:55 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -410,7 +410,7 @@ void sqlite3Update( }else{ sqlite3VdbeAddOp2(v, OP_RowData, iCur, 0); } - sqlite3VdbeAddOp2(v, OP_Insert, oldIdx, 0); + sqlite3CodeInsert(pParse, oldIdx, 0); /* Generate the NEW table */ @@ -441,7 +441,7 @@ void sqlite3Update( sqlite3TableAffinityStr(v, pTab); } if( pParse->nErr ) goto update_cleanup; - sqlite3VdbeAddOp2(v, OP_Insert, newIdx, 0); + sqlite3CodeInsert(pParse, newIdx, 0); sqlite3VdbeAddOp2(v, OP_Goto, 0, iBeginBeforeTrigger); sqlite3VdbeJumpHere(v, iEndBeforeTrigger); diff --git a/src/vdbe.c b/src/vdbe.c index 8320a76578..c748b70828 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.667 2008/01/03 08:08:40 danielk1977 Exp $ +** $Id: vdbe.c,v 1.668 2008/01/03 09:51:55 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -2043,12 +2043,9 @@ case OP_SetNumColumns: { /* no-push */ ** If the KeyAsData opcode has previously executed on this cursor, then the ** field might be extracted from the key rather than the data. ** -** If the column contains fewer than P2 fields, then extract a NULL. Or -** if the next instruction is OP_DfltValue then the P4 argument to the -** OP_DfltValue instruction will be a P4_MEM. Use the P4 argument of -** the OP_DfltValue instruction as the extracted value instead of NULL. -** The OP_DfltValue P4 value will be a default value for a column -** that has been added using the ALTER TABLE ADD COLUMN command. +** If the column contains fewer than P2 fields, then extract a NULL. Or, +** if the P4 argument is a P4_MEM use the value of the P4 argument as +** the result. */ case OP_Column: { u32 payloadSize; /* Number of bytes in the record */ @@ -3560,16 +3557,16 @@ case OP_NewRowid: { break; } -/* Opcode: Insert P1 P2 P4 +/* Opcode: Insert P1 P2 P3 P4 P5 ** ** Write an entry into the table of cursor P1. A new entry is ** created if it doesn't already exist or the data for an existing -** entry is overwritten. The data is the value on the top of the -** stack. The key is the next value down on the stack. The key must -** be an integer. The stack is popped twice by this instruction. +** entry is overwritten. The data is the value stored register +** number P2. The key is stored in register P3. The key must +** be an integer. ** -** If the OPFLAG_NCHANGE flag of P2 is set, then the row change count is -** incremented (otherwise not). If the OPFLAG_LASTROWID flag of P2 is set, +** If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is +** incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set, ** then rowid is stored for subsequent return by the ** sqlite3_last_insert_rowid() function (otherwise it is unmodified). ** @@ -3581,55 +3578,56 @@ case OP_NewRowid: { ** for indices is OP_IdxInsert. */ case OP_Insert: { /* no-push */ - Mem *pNos = &pTos[-1]; + Mem *pData = &p->aMem[pOp->p2]; + Mem *pKey = &p->aMem[pOp->p3]; + int i = pOp->p1; Cursor *pC; - assert( pNos>=p->aStack ); assert( i>=0 && inCursor ); assert( p->apCsr[i]!=0 ); if( ((pC = p->apCsr[i])->pCursor!=0 || pC->pseudoTable) ){ i64 iKey; /* The integer ROWID or key for the record to be inserted */ - assert( pNos->flags & MEM_Int ); + assert( pKey->flags & MEM_Int ); assert( pC->isTable ); - iKey = intToKey(pNos->u.i); + iKey = intToKey(pKey->u.i); - if( pOp->p2 & OPFLAG_NCHANGE ) p->nChange++; - if( pOp->p2 & OPFLAG_LASTROWID ) db->lastRowid = pNos->u.i; - if( pC->nextRowidValid && pNos->u.i>=pC->nextRowid ){ + if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++; + if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = pKey->u.i; + if( pC->nextRowidValid && pKey->u.i>=pC->nextRowid ){ pC->nextRowidValid = 0; } - if( pTos->flags & MEM_Null ){ - pTos->z = 0; - pTos->n = 0; + if( pData->flags & MEM_Null ){ + pData->z = 0; + pData->n = 0; }else{ - assert( pTos->flags & (MEM_Blob|MEM_Str) ); + assert( pData->flags & (MEM_Blob|MEM_Str) ); } if( pC->pseudoTable ){ sqlite3_free(pC->pData); pC->iKey = iKey; - pC->nData = pTos->n; - if( pTos->flags & MEM_Dyn ){ - pC->pData = pTos->z; - pTos->flags = MEM_Null; + pC->nData = pData->n; + if( pData->flags & MEM_Dyn ){ + pC->pData = pData->z; + pData->flags = MEM_Null; }else{ pC->pData = sqlite3_malloc( pC->nData+2 ); if( !pC->pData ) goto no_mem; - memcpy(pC->pData, pTos->z, pC->nData); + memcpy(pC->pData, pData->z, pC->nData); pC->pData[pC->nData] = 0; pC->pData[pC->nData+1] = 0; } pC->nullRow = 0; }else{ int nZero; - if( pTos->flags & MEM_Zero ){ - nZero = pTos->u.i; + if( pData->flags & MEM_Zero ){ + nZero = pData->u.i; }else{ nZero = 0; } rc = sqlite3BtreeInsert(pC->pCursor, 0, iKey, - pTos->z, pTos->n, nZero, - pOp->p2 & OPFLAG_APPEND); + pData->z, pData->n, nZero, + pOp->p5 & OPFLAG_APPEND); } pC->rowidIsValid = 0; @@ -3640,13 +3638,12 @@ case OP_Insert: { /* no-push */ if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.p ){ const char *zDb = db->aDb[pC->iDb].zName; const char *zTbl = pOp->p4.p; - int op = ((pOp->p2 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT); + int op = ((pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT); assert( pC->isTable ); db->xUpdateCallback(db->pUpdateArg, op, zDb, zTbl, iKey); assert( pC->iDb>=0 ); } } - popStack(&pTos, 2); break; } diff --git a/src/vdbe.h b/src/vdbe.h index 30538add2c..bf221ca5f9 100644 --- a/src/vdbe.h +++ b/src/vdbe.h @@ -15,7 +15,7 @@ ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. ** -** $Id: vdbe.h,v 1.120 2008/01/03 07:54:24 danielk1977 Exp $ +** $Id: vdbe.h,v 1.121 2008/01/03 09:51:55 danielk1977 Exp $ */ #ifndef _SQLITE_VDBE_H_ #define _SQLITE_VDBE_H_ @@ -133,7 +133,8 @@ int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp); void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1); void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2); -void sqlite3VdbeChangeP3(Vdbe*, int addr, int P2); +void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3); +void sqlite3VdbeChangeP5(Vdbe*, int addr, u8 P5); void sqlite3VdbeJumpHere(Vdbe*, int addr); void sqlite3VdbeChangeToNoop(Vdbe*, int addr, int N); void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N); diff --git a/src/vdbeaux.c b/src/vdbeaux.c index dd310c4f0a..c7c98f5453 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -438,8 +438,7 @@ void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){ } /* -** Change the value of the P2 operand for a specific instruction. -** This routine is useful for setting a jump destination. +** Change the value of the P3 operand for a specific instruction. */ void sqlite3VdbeChangeP3(Vdbe *p, int addr, int val){ assert( p==0 || p->magic==VDBE_MAGIC_INIT ); @@ -448,6 +447,16 @@ void sqlite3VdbeChangeP3(Vdbe *p, int addr, int val){ } } +/* +** Change the value of the P3 operand for a specific instruction. +*/ +void sqlite3VdbeChangeP5(Vdbe *p, int addr, u8 val){ + assert( p==0 || p->magic==VDBE_MAGIC_INIT ); + if( p && addr>=0 && p->nOp>addr && p->aOp ){ + p->aOp[addr].p5 = val; + } +} + /* ** Change the P2 operand of instruction addr so that it points to ** the address of the next instruction to be coded.