/ Check-in [1122b410]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update comments in vdbe.c. No changes to code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1122b410de68a3c79b4c719a3a4cc4dc6a5bb39d
User & Date: drh 2014-02-07 02:29:45
Context
2014-02-07
03:28
More comment updates. No changes to code. check-in: be24fbc2 user: mistachkin tags: trunk
02:29
Update comments in vdbe.c. No changes to code. check-in: 1122b410 user: drh tags: trunk
2014-02-06
23:56
Delete the OP_VerifySchema opcode. Enhance OP_Transaction to do the schema version checks that OP_VerifySchema used to do. check-in: 2f3376eb user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** The code in this file implements execution method of the 
    13         -** Virtual Database Engine (VDBE).  A separate file ("vdbeaux.c")
    14         -** handles housekeeping details such as creating and deleting
    15         -** VDBE instances.  This file is solely interested in executing
    16         -** the VDBE program.
    17         -**
    18         -** In the external interface, an "sqlite3_stmt*" is an opaque pointer
    19         -** to a VDBE.
    20         -**
    21         -** The SQL parser generates a program which is then executed by
    22         -** the VDBE to do the work of the SQL statement.  VDBE programs are 
    23         -** similar in form to assembly language.  The program consists of
    24         -** a linear sequence of operations.  Each operation has an opcode 
    25         -** and 5 operands.  Operands P1, P2, and P3 are integers.  Operand P4 
    26         -** is a null-terminated string.  Operand P5 is an unsigned character.
    27         -** Few opcodes use all 5 operands.
    28         -**
    29         -** Computation results are stored on a set of registers numbered beginning
    30         -** with 1 and going up to Vdbe.nMem.  Each register can store
    31         -** either an integer, a null-terminated string, a floating point
    32         -** number, or the SQL "NULL" value.  An implicit conversion from one
    33         -** type to the other occurs as necessary.
    34         -** 
    35         -** Most of the code in this file is taken up by the sqlite3VdbeExec()
    36         -** function which does the work of interpreting a VDBE program.
    37         -** But other routines are also provided to help in building up
    38         -** a program instruction by instruction.
           12  +** The code in this file implements the function that runs the
           13  +** bytecode of a prepared statement.
    39     14   **
    40     15   ** Various scripts scan this source file in order to generate HTML
    41     16   ** documentation, headers files, or other derived files.  The formatting
    42     17   ** of the code in this file is, therefore, important.  See other comments
    43     18   ** in this file for details.  If in doubt, do not deviate from existing
    44     19   ** commenting and indentation practices when changing or adding code.
    45     20   */
    46     21   #include "sqliteInt.h"
    47     22   #include "vdbeInt.h"
    48     23   
    49     24   /*
    50     25   ** Invoke this macro on memory cells just prior to changing the
    51     26   ** value of the cell.  This macro verifies that shallow copies are
    52         -** not misused.
           27  +** not misused.  A shallow copy of a string or blob just copies a
           28  +** pointer to the string or blob, not the content.  If the original
           29  +** is changed while the copy is still in use, the string or blob might
           30  +** be changed out from under the copy.  This macro verifies that nothing
           31  +** like that every happens.
    53     32   */
    54     33   #ifdef SQLITE_DEBUG
    55     34   # define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M)
    56     35   #else
    57     36   # define memAboutToChange(P,M)
    58     37   #endif
    59     38   
................................................................................
   104     83     if( (p->flags & (MEM_Str|MEM_Blob))!=0 && p->n>sqlite3_max_blobsize ){
   105     84       sqlite3_max_blobsize = p->n;
   106     85     }
   107     86   }
   108     87   #endif
   109     88   
   110     89   /*
   111         -** The next global variable is incremented each type the OP_Found opcode
           90  +** The next global variable is incremented each time the OP_Found opcode
   112     91   ** is executed. This is used to test whether or not the foreign key
   113     92   ** operation implemented using OP_FkIsZero is working. This variable
   114     93   ** has no function other than to help verify the correct operation of the
   115     94   ** library.
   116     95   */
   117     96   #ifdef SQLITE_TEST
   118     97   int sqlite3_found_count = 0;
................................................................................
   148    127   ** converts an MEM_Ephem string into an MEM_Dyn string.
   149    128   */
   150    129   #define Deephemeralize(P) \
   151    130      if( ((P)->flags&MEM_Ephem)!=0 \
   152    131          && sqlite3VdbeMemMakeWriteable(P) ){ goto no_mem;}
   153    132   
   154    133   /* Return true if the cursor was opened using the OP_OpenSorter opcode. */
   155         -# define isSorter(x) ((x)->pSorter!=0)
          134  +#define isSorter(x) ((x)->pSorter!=0)
   156    135   
   157    136   /*
   158    137   ** Argument pMem points at a register that will be passed to a
   159    138   ** user-defined function or returned to the user as the result of a query.
   160    139   ** This routine sets the pMem->type variable used by the sqlite3_value_*() 
   161    140   ** routines.
   162    141   */
................................................................................
   453    432   /* 
   454    433   ** hwtime.h contains inline assembler code for implementing 
   455    434   ** high-performance timing routines.
   456    435   */
   457    436   #include "hwtime.h"
   458    437   
   459    438   #endif
   460         -
   461         -/*
   462         -** The CHECK_FOR_INTERRUPT macro defined here looks to see if the
   463         -** sqlite3_interrupt() routine has been called.  If it has been, then
   464         -** processing of the VDBE program is interrupted.
   465         -**
   466         -** This macro added to every instruction that does a jump in order to
   467         -** implement a loop.  This test used to be on every single instruction,
   468         -** but that meant we more testing than we needed.  By only testing the
   469         -** flag on jump instructions, we get a (small) speed improvement.
   470         -*/
   471         -#define CHECK_FOR_INTERRUPT \
   472         -   if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
   473         -
   474    439   
   475    440   #ifndef NDEBUG
   476    441   /*
   477    442   ** This function is only called from within an assert() expression. It
   478    443   ** checks that the sqlite3.nTransaction variable is correctly set to
   479    444   ** the number of non-transaction savepoints currently in the 
   480    445   ** linked list starting at sqlite3.pSavepoint.
................................................................................
   490    455     assert( n==(db->nSavepoint + db->isTransactionSavepoint) );
   491    456     return 1;
   492    457   }
   493    458   #endif
   494    459   
   495    460   
   496    461   /*
   497         -** Execute as much of a VDBE program as we can then return.
   498         -**
   499         -** sqlite3VdbeMakeReady() must be called before this routine in order to
   500         -** close the program with a final OP_Halt and to set up the callbacks
   501         -** and the error message pointer.
   502         -**
   503         -** Whenever a row or result data is available, this routine will either
   504         -** invoke the result callback (if there is one) or return with
   505         -** SQLITE_ROW.
   506         -**
   507         -** If an attempt is made to open a locked database, then this routine
   508         -** will either invoke the busy callback (if there is one) or it will
   509         -** return SQLITE_BUSY.
   510         -**
   511         -** If an error occurs, an error message is written to memory obtained
   512         -** from sqlite3_malloc() and p->zErrMsg is made to point to that memory.
   513         -** The error code is stored in p->rc and this routine returns SQLITE_ERROR.
   514         -**
   515         -** If the callback ever returns non-zero, then the program exits
   516         -** immediately.  There will be no error message but the p->rc field is
   517         -** set to SQLITE_ABORT and this routine will return SQLITE_ERROR.
   518         -**
   519         -** A memory allocation error causes p->rc to be set to SQLITE_NOMEM and this
   520         -** routine to return SQLITE_ERROR.
   521         -**
   522         -** Other fatal errors return SQLITE_ERROR.
   523         -**
   524         -** After this routine has finished, sqlite3VdbeFinalize() should be
   525         -** used to clean up the mess that was left behind.
          462  +** Execute as much of a VDBE program as we can.
          463  +** This is the core of sqlite3_step().  
   526    464   */
   527    465   int sqlite3VdbeExec(
   528    466     Vdbe *p                    /* The VDBE */
   529    467   ){
   530    468     int pc=0;                  /* The program counter */
   531    469     Op *aOp = p->aOp;          /* Copy of p->aOp */
   532    470     Op *pOp;                   /* Current operation */
................................................................................
   562    500     assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY );
   563    501     assert( p->bIsReader || p->readOnly!=0 );
   564    502     p->rc = SQLITE_OK;
   565    503     p->iCurrentTime = 0;
   566    504     assert( p->explain==0 );
   567    505     p->pResultSet = 0;
   568    506     db->busyHandler.nBusy = 0;
   569         -  CHECK_FOR_INTERRUPT;
          507  +  if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
   570    508     sqlite3VdbeIOTraceSql(p);
   571    509   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
   572    510     if( db->xProgress ){
   573    511       assert( 0 < db->nProgressOps );
   574    512       nProgressLimit = (unsigned)p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
   575    513       if( nProgressLimit==0 ){
   576    514         nProgressLimit = db->nProgressOps;
................................................................................
   738    676     **
   739    677     ** This code uses unstructured "goto" statements and does not look clean.
   740    678     ** But that is not due to sloppy coding habits. The code is written this
   741    679     ** way for performance, to avoid having to run the interrupt and progress
   742    680     ** checks on every opcode.  This helps sqlite3_step() to run about 1.5%
   743    681     ** faster according to "valgrind --tool=cachegrind" */
   744    682   check_for_interrupt:
   745         -  CHECK_FOR_INTERRUPT;
          683  +  if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
   746    684   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
   747    685     /* Call the progress callback if it is configured and the required number
   748    686     ** of VDBE ops have been executed (either since this invocation of
   749    687     ** sqlite3VdbeExec() or since last time the progress callback was called).
   750    688     ** If the progress callback returns non-zero, exit the virtual machine with
   751    689     ** a return code SQLITE_ABORT.
   752    690     */
................................................................................
   760    698     }
   761    699   #endif
   762    700     
   763    701     break;
   764    702   }
   765    703   
   766    704   /* Opcode:  Gosub P1 P2 * * *
          705  +** Synopsis:  r[P1]=pc; pc=P2
   767    706   **
   768    707   ** Write the current address onto register P1
   769    708   ** and then jump to address P2.
   770    709   */
   771    710   case OP_Gosub: {            /* jump */
   772    711     assert( pOp->p1>0 && pOp->p1<=(p->nMem-p->nCursor) );
   773    712     pIn1 = &aMem[pOp->p1];
................................................................................
   777    716     pIn1->u.i = pc;
   778    717     REGISTER_TRACE(pOp->p1, pIn1);
   779    718     pc = pOp->p2 - 1;
   780    719     break;
   781    720   }
   782    721   
   783    722   /* Opcode:  Return P1 * * * *
          723  +** Synopsis:  pc=r[P1]+1
   784    724   **
   785    725   ** Jump to the next instruction after the address in register P1.
   786    726   */
   787    727   case OP_Return: {           /* in1 */
   788    728     pIn1 = &aMem[pOp->p1];
   789    729     assert( pIn1->flags & MEM_Int );
   790    730     pc = (int)pIn1->u.i;
   791    731     break;
   792    732   }
   793    733   
   794    734   /* Opcode:  Yield P1 * * * *
          735  +** Synopsis: swap(pc,r[P1])
   795    736   **
   796    737   ** Swap the program counter with the value in register P1.
   797    738   */
   798    739   case OP_Yield: {            /* in1 */
   799    740     int pcDest;
   800    741     pIn1 = &aMem[pOp->p1];
   801    742     assert( (pIn1->flags & MEM_Dyn)==0 );
................................................................................
   804    745     pIn1->u.i = pc;
   805    746     REGISTER_TRACE(pOp->p1, pIn1);
   806    747     pc = pcDest;
   807    748     break;
   808    749   }
   809    750   
   810    751   /* Opcode:  HaltIfNull  P1 P2 P3 P4 P5
   811         -** Synopsis:  if r[P3] null then halt
          752  +** Synopsis:  if r[P3]=null halt
   812    753   **
   813    754   ** Check the value in register P3.  If it is NULL then Halt using
   814    755   ** parameter P1, P2, and P4 as if this were a Halt instruction.  If the
   815    756   ** value in register P3 is not NULL, then this routine is a no-op.
   816    757   ** The P5 parameter should be 1.
   817    758   */
   818    759   case OP_HaltIfNull: {      /* in3 */
................................................................................
   952    893   }
   953    894   #endif
   954    895   
   955    896   /* Opcode: String8 * P2 * P4 *
   956    897   ** Synopsis: r[P2]='P4'
   957    898   **
   958    899   ** P4 points to a nul terminated UTF-8 string. This opcode is transformed 
   959         -** into an OP_String before it is executed for the first time.
          900  +** into an OP_String before it is executed for the first time.  During
          901  +** this transformation, the length of string P4 is computed and stored
          902  +** as the P1 parameter.
   960    903   */
   961    904   case OP_String8: {         /* same as TK_STRING, out2-prerelease */
   962    905     assert( pOp->p4.z!=0 );
   963    906     pOp->opcode = OP_String;
   964    907     pOp->p1 = sqlite3Strlen30(pOp->p4.z);
   965    908   
   966    909   #ifndef SQLITE_OMIT_UTF16
................................................................................
  1046    989   }
  1047    990   
  1048    991   /* Opcode: Variable P1 P2 * P4 *
  1049    992   ** Synopsis: r[P2]=parameter(P1,P4)
  1050    993   **
  1051    994   ** Transfer the values of bound parameter P1 into register P2
  1052    995   **
  1053         -** If the parameter is named, then its name appears in P4 and P3==1.
          996  +** If the parameter is named, then its name appears in P4.
  1054    997   ** The P4 value is used by sqlite3_bind_parameter_name().
  1055    998   */
  1056    999   case OP_Variable: {            /* out2-prerelease */
  1057   1000     Mem *pVar;       /* Value being transferred */
  1058   1001   
  1059   1002     assert( pOp->p1>0 && pOp->p1<=p->nVar );
  1060   1003     assert( pOp->p4.z==0 || pOp->p4.z==p->azVar[pOp->p1-1] );
................................................................................
  1165   1108   
  1166   1109   /* Opcode: ResultRow P1 P2 * * *
  1167   1110   ** Synopsis:  output=r[P1@P2]
  1168   1111   **
  1169   1112   ** The registers P1 through P1+P2-1 contain a single row of
  1170   1113   ** results. This opcode causes the sqlite3_step() call to terminate
  1171   1114   ** with an SQLITE_ROW return code and it sets up the sqlite3_stmt
  1172         -** structure to provide access to the top P1 values as the result
  1173         -** row.
         1115  +** structure to provide access to the r[P1]..r[P1+P2-1] values as
         1116  +** the result row.
  1174   1117   */
  1175   1118   case OP_ResultRow: {
  1176   1119     Mem *pMem;
  1177   1120     int i;
  1178   1121     assert( p->nResColumn==pOp->p2 );
  1179   1122     assert( pOp->p1>0 );
  1180   1123     assert( pOp->p1+pOp->p2<=(p->nMem-p->nCursor)+1 );
................................................................................
  1694   1637   #endif
  1695   1638   
  1696   1639   #ifndef SQLITE_OMIT_CAST
  1697   1640   /* Opcode: ToText P1 * * * *
  1698   1641   **
  1699   1642   ** Force the value in register P1 to be text.
  1700   1643   ** If the value is numeric, convert it to a string using the
  1701         -** equivalent of printf().  Blob values are unchanged and
         1644  +** equivalent of sprintf().  Blob values are unchanged and
  1702   1645   ** are afterwards simply interpreted as text.
  1703   1646   **
  1704   1647   ** A NULL value is not changed by this routine.  It remains NULL.
  1705   1648   */
  1706   1649   case OP_ToText: {                  /* same as TK_TO_TEXT, in1 */
  1707   1650     pIn1 = &aMem[pOp->p1];
  1708   1651     memAboutToChange(p, pIn1);
................................................................................
  2149   2092     }
  2150   2093     break;
  2151   2094   }
  2152   2095   
  2153   2096   /* Opcode: Once P1 P2 * * *
  2154   2097   **
  2155   2098   ** Check if OP_Once flag P1 is set. If so, jump to instruction P2. Otherwise,
  2156         -** set the flag and fall through to the next instruction.
         2099  +** set the flag and fall through to the next instruction.  In other words,
         2100  +** this opcode causes all following up codes up through P2 (but not including
         2101  +** P2) to run just once and skipped on subsequent times through the loop.
  2157   2102   */
  2158   2103   case OP_Once: {             /* jump */
  2159   2104     assert( pOp->p1<p->nOnceFlag );
  2160   2105     if( p->aOnceFlag[pOp->p1] ){
  2161   2106       pc = pOp->p2-1;
  2162   2107     }else{
  2163   2108       p->aOnceFlag[pOp->p1] = 1;
................................................................................
  3342   3287         pCx->isTable = 1;
  3343   3288       }
  3344   3289     }
  3345   3290     pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
  3346   3291     break;
  3347   3292   }
  3348   3293   
  3349         -/* Opcode: SorterOpen P1 * * P4 *
         3294  +/* Opcode: SorterOpen P1 P2 * P4 *
  3350   3295   **
  3351   3296   ** This opcode works like OP_OpenEphemeral except that it opens
  3352   3297   ** a transient index that is specifically designed to sort large
  3353   3298   ** tables using an external merge-sort algorithm.
  3354   3299   */
  3355   3300   case OP_SorterOpen: {
  3356   3301     VdbeCursor *pCx;
................................................................................
  4209   4154   ** of a real table, not a pseudo-table.
  4210   4155   */
  4211   4156   /* Opcode: RowKey P1 P2 * * *
  4212   4157   ** Synopsis: r[P2]=key
  4213   4158   **
  4214   4159   ** Write into register P2 the complete row key for cursor P1.
  4215   4160   ** There is no interpretation of the data.  
  4216         -** The key is copied onto the P3 register exactly as 
         4161  +** The key is copied onto the P2 register exactly as 
  4217   4162   ** it is found in the database file.
  4218   4163   **
  4219   4164   ** If the P1 cursor must be pointing to a valid row (not a NULL row)
  4220   4165   ** of a real table, not a pseudo-table.
  4221   4166   */
  4222   4167   case OP_RowKey:
  4223   4168   case OP_RowData: {
................................................................................
  4435   4380     assert( pOp->p2>0 && pOp->p2<p->nOp );
  4436   4381     if( res ){
  4437   4382       pc = pOp->p2 - 1;
  4438   4383     }
  4439   4384     break;
  4440   4385   }
  4441   4386   
  4442         -/* Opcode: Next P1 P2 P3 * P5
         4387  +/* Opcode: Next P1 P2 P3 P4 P5
  4443   4388   **
  4444   4389   ** Advance cursor P1 so that it points to the next key/data pair in its
  4445   4390   ** table or index.  If there are no more key/value pairs then fall through
  4446   4391   ** to the following instruction.  But if the cursor advance was successful,
  4447   4392   ** jump immediately to P2.
  4448   4393   **
  4449   4394   ** The P1 cursor must be for a real table, not a pseudo-table.  P1 must have
................................................................................
  4458   4403   ** sqlite3BtreeNext().
  4459   4404   **
  4460   4405   ** If P5 is positive and the jump is taken, then event counter
  4461   4406   ** number P5-1 in the prepared statement is incremented.
  4462   4407   **
  4463   4408   ** See also: Prev, NextIfOpen
  4464   4409   */
  4465         -/* Opcode: NextIfOpen P1 P2 P3 * P5
         4410  +/* Opcode: NextIfOpen P1 P2 P3 P4 P5
  4466   4411   **
  4467   4412   ** This opcode works just like OP_Next except that if cursor P1 is not
  4468   4413   ** open it behaves a no-op.
  4469   4414   */
  4470         -/* Opcode: Prev P1 P2 P3 * P5
         4415  +/* Opcode: Prev P1 P2 P3 P4 P5
  4471   4416   **
  4472   4417   ** Back up cursor P1 so that it points to the previous key/data pair in its
  4473   4418   ** table or index.  If there is no previous key/value pairs then fall through
  4474   4419   ** to the following instruction.  But if the cursor backup was successful,
  4475   4420   ** jump immediately to P2.
  4476   4421   **
  4477   4422   ** The P1 cursor must be for a real table, not a pseudo-table.  If P1 is
................................................................................
  4484   4429   **
  4485   4430   ** P4 is always of type P4_ADVANCE. The function pointer points to
  4486   4431   ** sqlite3BtreePrevious().
  4487   4432   **
  4488   4433   ** If P5 is positive and the jump is taken, then event counter
  4489   4434   ** number P5-1 in the prepared statement is incremented.
  4490   4435   */
  4491         -/* Opcode: PrevIfOpen P1 P2 P3 * P5
         4436  +/* Opcode: PrevIfOpen P1 P2 P3 P4 P5
  4492   4437   **
  4493   4438   ** This opcode works just like OP_Prev except that if cursor P1 is not
  4494   4439   ** open it behaves a no-op.
  4495   4440   */
  4496   4441   case OP_SorterNext: {  /* jump */
  4497   4442     VdbeCursor *pC;
  4498   4443     int res;
................................................................................
  4542   4487   **
  4543   4488   ** Register P2 holds an SQL index key made using the
  4544   4489   ** MakeRecord instructions.  This opcode writes that key
  4545   4490   ** into the index P1.  Data for the entry is nil.
  4546   4491   **
  4547   4492   ** P3 is a flag that provides a hint to the b-tree layer that this
  4548   4493   ** insert is likely to be an append.
         4494  +**
         4495  +** If P5 contains bet OPFLAG_NCHANGE, then the change counter is
         4496  +** incremented by this instruction.  If OPFLAG_NCHANGE is clear, then
         4497  +** the change counter is unchanged.
         4498  +**
         4499  +** If P5 contains OPFLAG_USESEEKRESULT then the cursor must have just
         4500  +** done a seek to the spot where the new entry is to be inserted.  This
         4501  +** flag avoids doing an extra seek.
  4549   4502   **
  4550   4503   ** This instruction only works for indices.  The equivalent instruction
  4551   4504   ** for tables is OP_Insert.
  4552   4505   */
  4553   4506   case OP_SorterInsert:       /* in2 */
  4554   4507   case OP_IdxInsert: {        /* in2 */
  4555   4508     VdbeCursor *pC;
................................................................................
  5143   5096     }
  5144   5097     break;
  5145   5098   }
  5146   5099   
  5147   5100   
  5148   5101   #ifndef SQLITE_OMIT_TRIGGER
  5149   5102   
  5150         -/* Opcode: Program P1 P2 P3 P4 *
         5103  +/* Opcode: Program P1 P2 P3 P4 P5
  5151   5104   **
  5152   5105   ** Execute the trigger program passed as P4 (type P4_SUBPROGRAM). 
  5153   5106   **
  5154   5107   ** P1 contains the address of the memory cell that contains the first memory 
  5155   5108   ** cell in an array of values used as arguments to the sub-program. P2 
  5156   5109   ** contains the address to jump to if the sub-program throws an IGNORE 
  5157   5110   ** exception using the RAISE() function. Register P3 contains the address 
  5158   5111   ** of a memory cell in this (the parent) VM that is used to allocate the 
  5159   5112   ** memory required by the sub-vdbe at runtime.
  5160   5113   **
  5161   5114   ** P4 is a pointer to the VM containing the trigger program.
         5115  +**
         5116  +** If P5 is non-zero, then recursive program invocation is enabled.
  5162   5117   */
  5163   5118   case OP_Program: {        /* jump */
  5164   5119     int nMem;               /* Number of memory registers for sub-program */
  5165   5120     int nByte;              /* Bytes of runtime space required for sub-program */
  5166   5121     Mem *pRt;               /* Register to allocate runtime space */
  5167   5122     Mem *pMem;              /* Used to iterate through memory cells */
  5168   5123     Mem *pEnd;              /* Last memory cell in new array */
................................................................................
  5542   5497       sqlite3VdbeMemSetInt64(pMem, (i64)aRes[i]);
  5543   5498     }    
  5544   5499     break;
  5545   5500   };  
  5546   5501   #endif
  5547   5502   
  5548   5503   #ifndef SQLITE_OMIT_PRAGMA
  5549         -/* Opcode: JournalMode P1 P2 P3 * P5
         5504  +/* Opcode: JournalMode P1 P2 P3 * *
  5550   5505   **
  5551   5506   ** Change the journal mode of database P1 to P3. P3 must be one of the
  5552   5507   ** PAGER_JOURNALMODE_XXX values. If changing between the various rollback
  5553   5508   ** modes (delete, truncate, persist, off and memory), this is a simple
  5554   5509   ** operation. No IO is required.
  5555   5510   **
  5556   5511   ** If changing into or out of WAL mode the procedure is more complicated.
................................................................................
  6028   5983       p->expired = 0;
  6029   5984     }
  6030   5985     break;
  6031   5986   }
  6032   5987   #endif
  6033   5988   
  6034   5989   #ifndef SQLITE_OMIT_VIRTUALTABLE
  6035         -/* Opcode: VUpdate P1 P2 P3 P4 *
         5990  +/* Opcode: VUpdate P1 P2 P3 P4 P5
  6036   5991   ** Synopsis: data=r[P3@P2]
  6037   5992   **
  6038   5993   ** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
  6039   5994   ** This opcode invokes the corresponding xUpdate method. P2 values
  6040   5995   ** are contiguous memory cells starting at P3 to pass to the xUpdate 
  6041   5996   ** invocation. The value in register (P3+P2-1) corresponds to the 
  6042   5997   ** p2th element of the argv array passed to xUpdate.
................................................................................
  6051   6006   **
  6052   6007   ** If P2==1 then no insert is performed.  argv[0] is the rowid of
  6053   6008   ** a row to delete.
  6054   6009   **
  6055   6010   ** P1 is a boolean flag. If it is set to true and the xUpdate call
  6056   6011   ** is successful, then the value returned by sqlite3_last_insert_rowid() 
  6057   6012   ** is set to the value of the rowid for the row just inserted.
         6013  +**
         6014  +** P5 is the error actions (OE_Replace, OE_Fail, OE_Ignore, etc) to
         6015  +** apply in the case of a constraint failure on an insert or update.
  6058   6016   */
  6059   6017   case OP_VUpdate: {
  6060   6018     sqlite3_vtab *pVtab;
  6061   6019     sqlite3_module *pModule;
  6062   6020     int nArg;
  6063   6021     int i;
  6064   6022     sqlite_int64 rowid;