| | @@ -1147,11 +1147,11 @@ |
| 1147 | 1147 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1148 | 1148 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1149 | 1149 | */ |
| 1150 | 1150 | #define SQLITE_VERSION "3.22.0" |
| 1151 | 1151 | #define SQLITE_VERSION_NUMBER 3022000 |
| 1152 | | -#define SQLITE_SOURCE_ID "2018-01-11 00:38:39 b8d92d8dc239597c6f01a6e572b047f98ce374a8f48257683fa839dde3ec993f" |
| 1152 | +#define SQLITE_SOURCE_ID "2018-01-12 14:34:45 30ed7a4b6408f0ca921abc4d8b7bb5404fc7708cedcd104b017b361054e7148c" |
| 1153 | 1153 | |
| 1154 | 1154 | /* |
| 1155 | 1155 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1156 | 1156 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1157 | 1157 | ** |
| | @@ -9319,10 +9319,22 @@ |
| 9319 | 9319 | ** of the SQL statement that triggered the call to the [xUpdate] method of the |
| 9320 | 9320 | ** [virtual table]. |
| 9321 | 9321 | */ |
| 9322 | 9322 | SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); |
| 9323 | 9323 | |
| 9324 | +/* |
| 9325 | +** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE |
| 9326 | +** |
| 9327 | +** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn] |
| 9328 | +** method of a [virtual table], then it returns true if and only if the |
| 9329 | +** column is being fetched as part of an UPDATE operation during which the |
| 9330 | +** column value will not change. Applications might use this to substitute |
| 9331 | +** a lighter-weight value to return that the corresponding [xUpdate] method |
| 9332 | +** understands as a "no-change" value. |
| 9333 | +*/ |
| 9334 | +SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); |
| 9335 | + |
| 9324 | 9336 | /* |
| 9325 | 9337 | ** CAPI3REF: Determine The Collation For a Virtual Table Constraint |
| 9326 | 9338 | ** |
| 9327 | 9339 | ** This function may only be called from within a call to the [xBestIndex] |
| 9328 | 9340 | ** method of a [virtual table]. |
| | @@ -18883,10 +18895,11 @@ |
| 18883 | 18895 | Vdbe *pVdbe; /* The VM that owns this context */ |
| 18884 | 18896 | int iOp; /* Instruction number of OP_Function */ |
| 18885 | 18897 | int isError; /* Error code returned by the function. */ |
| 18886 | 18898 | u8 skipFlag; /* Skip accumulator loading if true */ |
| 18887 | 18899 | u8 fErrorOrAux; /* isError!=0 or pVdbe->pAuxData modified */ |
| 18900 | + u8 bVtabNoChng; /* Fetching an unchanging column in a vtab UPDATE */ |
| 18888 | 18901 | u8 argc; /* Number of arguments */ |
| 18889 | 18902 | sqlite3_value *argv[1]; /* Argument set */ |
| 18890 | 18903 | }; |
| 18891 | 18904 | |
| 18892 | 18905 | /* A bitfield type for use inside of structures. Always follow with :N where |
| | @@ -78345,10 +78358,29 @@ |
| 78345 | 78358 | */ |
| 78346 | 78359 | SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){ |
| 78347 | 78360 | assert( p && p->pOut ); |
| 78348 | 78361 | return p->pOut->db; |
| 78349 | 78362 | } |
| 78363 | + |
| 78364 | +/* |
| 78365 | +** If this routine is invoked from within an xColumn method of a virtual |
| 78366 | +** table, then it returns true if and only if the the call is during an |
| 78367 | +** UPDATE operation and the value of the column will not be modified |
| 78368 | +** by the UPDATE. |
| 78369 | +** |
| 78370 | +** If this routine is called from any context other than within the |
| 78371 | +** xColumn method of a virtual table, then the return value is meaningless |
| 78372 | +** and arbitrary. |
| 78373 | +** |
| 78374 | +** Virtual table implements might use this routine to optimize their |
| 78375 | +** performance by substituting a NULL result, or some other light-weight |
| 78376 | +** value, as a signal to the xUpdate routine that the column is unchanged. |
| 78377 | +*/ |
| 78378 | +SQLITE_API int sqlite3_vtab_nochange(sqlite3_context *p){ |
| 78379 | + assert( p ); |
| 78380 | + return p->bVtabNoChng; |
| 78381 | +} |
| 78350 | 78382 | |
| 78351 | 78383 | /* |
| 78352 | 78384 | ** Return the current time for a statement. If the current time |
| 78353 | 78385 | ** is requested more than once within the same run of a single prepared |
| 78354 | 78386 | ** statement, the exact same time is returned for each invocation regardless |
| | @@ -86545,16 +86577,22 @@ |
| 86545 | 86577 | break; |
| 86546 | 86578 | } |
| 86547 | 86579 | #endif /* SQLITE_OMIT_VIRTUALTABLE */ |
| 86548 | 86580 | |
| 86549 | 86581 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 86550 | | -/* Opcode: VColumn P1 P2 P3 * * |
| 86582 | +/* Opcode: VColumn P1 P2 P3 P4 * |
| 86551 | 86583 | ** Synopsis: r[P3]=vcolumn(P2) |
| 86552 | 86584 | ** |
| 86553 | | -** Store the value of the P2-th column of |
| 86554 | | -** the row of the virtual-table that the |
| 86555 | | -** P1 cursor is pointing to into register P3. |
| 86585 | +** Store in register P3 the value of the P2-th column of |
| 86586 | +** the current row of the virtual-table of cursor P1. |
| 86587 | +** |
| 86588 | +** If the VColumn opcode is being used to fetch the value of |
| 86589 | +** an unchanging column during an UPDATE operation, then the P4 |
| 86590 | +** value is 1. Otherwise, P4 is 0. The P4 value is returned |
| 86591 | +** by sqlite3_vtab_nochange() routine can can be used |
| 86592 | +** by virtual table implementations to return special "no-change" |
| 86593 | +** marks which can be more efficient, depending on the virtual table. |
| 86556 | 86594 | */ |
| 86557 | 86595 | case OP_VColumn: { |
| 86558 | 86596 | sqlite3_vtab *pVtab; |
| 86559 | 86597 | const sqlite3_module *pModule; |
| 86560 | 86598 | Mem *pDest; |
| | @@ -86572,10 +86610,11 @@ |
| 86572 | 86610 | pVtab = pCur->uc.pVCur->pVtab; |
| 86573 | 86611 | pModule = pVtab->pModule; |
| 86574 | 86612 | assert( pModule->xColumn ); |
| 86575 | 86613 | memset(&sContext, 0, sizeof(sContext)); |
| 86576 | 86614 | sContext.pOut = pDest; |
| 86615 | + sContext.bVtabNoChng = pOp->p4.i!=0; |
| 86577 | 86616 | MemSetTypeFlag(pDest, MEM_Null); |
| 86578 | 86617 | rc = pModule->xColumn(pCur->uc.pVCur, &sContext, pOp->p2); |
| 86579 | 86618 | sqlite3VtabImportErrmsg(p, pVtab); |
| 86580 | 86619 | if( sContext.isError ){ |
| 86581 | 86620 | rc = sContext.isError; |
| | @@ -126691,11 +126730,11 @@ |
| 126691 | 126730 | int iCsr = pSrc->a[0].iCursor; /* Cursor used for virtual table scan */ |
| 126692 | 126731 | int aDummy[2]; /* Unused arg for sqlite3WhereOkOnePass() */ |
| 126693 | 126732 | int bOnePass; /* True to use onepass strategy */ |
| 126694 | 126733 | int addr; /* Address of OP_OpenEphemeral */ |
| 126695 | 126734 | |
| 126696 | | - /* Allocate nArg registers to martial the arguments to VUpdate. Then |
| 126735 | + /* Allocate nArg registers in which to gather the arguments for VUpdate. Then |
| 126697 | 126736 | ** create and open the ephemeral table in which the records created from |
| 126698 | 126737 | ** these arguments will be temporarily stored. */ |
| 126699 | 126738 | assert( v ); |
| 126700 | 126739 | ephemTab = pParse->nTab++; |
| 126701 | 126740 | addr= sqlite3VdbeAddOp2(v, OP_OpenEphemeral, ephemTab, nArg); |
| | @@ -126711,11 +126750,11 @@ |
| 126711 | 126750 | /* Populate the argument registers. */ |
| 126712 | 126751 | for(i=0; i<pTab->nCol; i++){ |
| 126713 | 126752 | if( aXRef[i]>=0 ){ |
| 126714 | 126753 | sqlite3ExprCode(pParse, pChanges->a[aXRef[i]].pExpr, regArg+2+i); |
| 126715 | 126754 | }else{ |
| 126716 | | - sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, i, regArg+2+i); |
| 126755 | + sqlite3VdbeAddOp4Int(v, OP_VColumn, iCsr, i, regArg+2+i, 1); |
| 126717 | 126756 | } |
| 126718 | 126757 | } |
| 126719 | 126758 | if( HasRowid(pTab) ){ |
| 126720 | 126759 | sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg); |
| 126721 | 126760 | if( pRowid ){ |
| | @@ -202949,11 +202988,11 @@ |
| 202949 | 202988 | int nArg, /* Number of args */ |
| 202950 | 202989 | sqlite3_value **apUnused /* Function arguments */ |
| 202951 | 202990 | ){ |
| 202952 | 202991 | assert( nArg==0 ); |
| 202953 | 202992 | UNUSED_PARAM2(nArg, apUnused); |
| 202954 | | - sqlite3_result_text(pCtx, "fts5: 2018-01-11 00:38:39 b8d92d8dc239597c6f01a6e572b047f98ce374a8f48257683fa839dde3ec993f", -1, SQLITE_TRANSIENT); |
| 202993 | + sqlite3_result_text(pCtx, "fts5: 2018-01-12 14:34:45 30ed7a4b6408f0ca921abc4d8b7bb5404fc7708cedcd104b017b361054e7148c", -1, SQLITE_TRANSIENT); |
| 202955 | 202994 | } |
| 202956 | 202995 | |
| 202957 | 202996 | static int fts5Init(sqlite3 *db){ |
| 202958 | 202997 | static const sqlite3_module fts5Mod = { |
| 202959 | 202998 | /* iVersion */ 2, |
| | @@ -207217,12 +207256,12 @@ |
| 207217 | 207256 | } |
| 207218 | 207257 | #endif /* SQLITE_CORE */ |
| 207219 | 207258 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 207220 | 207259 | |
| 207221 | 207260 | /************** End of stmt.c ************************************************/ |
| 207222 | | -#if __LINE__!=207222 |
| 207261 | +#if __LINE__!=207261 |
| 207223 | 207262 | #undef SQLITE_SOURCE_ID |
| 207224 | | -#define SQLITE_SOURCE_ID "2018-01-11 00:38:39 b8d92d8dc239597c6f01a6e572b047f98ce374a8f48257683fa839dde3ecalt2" |
| 207263 | +#define SQLITE_SOURCE_ID "2018-01-12 14:34:45 30ed7a4b6408f0ca921abc4d8b7bb5404fc7708cedcd104b017b361054e7alt2" |
| 207225 | 207264 | #endif |
| 207226 | 207265 | /* Return the source-id for this library */ |
| 207227 | 207266 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 207228 | 207267 | /************************** End of sqlite3.c ******************************/ |
| 207229 | 207268 | |