Fossil SCM
Update the built-in SQLite to 3.8.4 beta.
Commit
f0773f6370059a21e11d59e74abf785127489555
Parent
904ab4bbb844001…
2 files changed
+44
-68
+1
-1
+44
-68
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -189,11 +189,11 @@ | ||
| 189 | 189 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 190 | 190 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 191 | 191 | */ |
| 192 | 192 | #define SQLITE_VERSION "3.8.4" |
| 193 | 193 | #define SQLITE_VERSION_NUMBER 3008004 |
| 194 | -#define SQLITE_SOURCE_ID "2014-03-04 13:18:23 9830c343bc954b828f6ca752f8ae63e2c0a980c1" | |
| 194 | +#define SQLITE_SOURCE_ID "2014-03-05 19:04:46 0723effc9ccae7c660fb847b36ce9324e0cb5042" | |
| 195 | 195 | |
| 196 | 196 | /* |
| 197 | 197 | ** CAPI3REF: Run-Time Library Version Numbers |
| 198 | 198 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 199 | 199 | ** |
| @@ -11385,12 +11385,12 @@ | ||
| 11385 | 11385 | ** |
| 11386 | 11386 | ** In the colUsed field, the high-order bit (bit 63) is set if the table |
| 11387 | 11387 | ** contains more than 63 columns and the 64-th or later column is used. |
| 11388 | 11388 | */ |
| 11389 | 11389 | struct SrcList { |
| 11390 | - u8 nSrc; /* Number of tables or subqueries in the FROM clause */ | |
| 11391 | - u8 nAlloc; /* Number of entries allocated in a[] below */ | |
| 11390 | + int nSrc; /* Number of tables or subqueries in the FROM clause */ | |
| 11391 | + u32 nAlloc; /* Number of entries allocated in a[] below */ | |
| 11392 | 11392 | struct SrcList_item { |
| 11393 | 11393 | Schema *pSchema; /* Schema to which this item is fixed */ |
| 11394 | 11394 | char *zDatabase; /* Name of database holding this table */ |
| 11395 | 11395 | char *zName; /* Name of the table */ |
| 11396 | 11396 | char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */ |
| @@ -13418,10 +13418,13 @@ | ||
| 13418 | 13418 | #ifdef SQLITE_OMIT_COMPLETE |
| 13419 | 13419 | "OMIT_COMPLETE", |
| 13420 | 13420 | #endif |
| 13421 | 13421 | #ifdef SQLITE_OMIT_COMPOUND_SELECT |
| 13422 | 13422 | "OMIT_COMPOUND_SELECT", |
| 13423 | +#endif | |
| 13424 | +#ifdef SQLITE_OMIT_CTE | |
| 13425 | + "OMIT_CTE", | |
| 13423 | 13426 | #endif |
| 13424 | 13427 | #ifdef SQLITE_OMIT_DATETIME_FUNCS |
| 13425 | 13428 | "OMIT_DATETIME_FUNCS", |
| 13426 | 13429 | #endif |
| 13427 | 13430 | #ifdef SQLITE_OMIT_DECLTYPE |
| @@ -13803,11 +13806,10 @@ | ||
| 13803 | 13806 | RowSet *pRowSet; /* Used only when flags==MEM_RowSet */ |
| 13804 | 13807 | VdbeFrame *pFrame; /* Used when flags==MEM_Frame */ |
| 13805 | 13808 | } u; |
| 13806 | 13809 | int n; /* Number of characters in string value, excluding '\0' */ |
| 13807 | 13810 | u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */ |
| 13808 | - u8 memType; /* Lower 5 bits of flags */ | |
| 13809 | 13811 | u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */ |
| 13810 | 13812 | #ifdef SQLITE_DEBUG |
| 13811 | 13813 | Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ |
| 13812 | 13814 | void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */ |
| 13813 | 13815 | #endif |
| @@ -13830,10 +13832,11 @@ | ||
| 13830 | 13832 | #define MEM_Null 0x0001 /* Value is NULL */ |
| 13831 | 13833 | #define MEM_Str 0x0002 /* Value is a string */ |
| 13832 | 13834 | #define MEM_Int 0x0004 /* Value is an integer */ |
| 13833 | 13835 | #define MEM_Real 0x0008 /* Value is a real number */ |
| 13834 | 13836 | #define MEM_Blob 0x0010 /* Value is a BLOB */ |
| 13837 | +#define MEM_AffMask 0x001f /* Mask of affinity bits */ | |
| 13835 | 13838 | #define MEM_RowSet 0x0020 /* Value is a RowSet object */ |
| 13836 | 13839 | #define MEM_Frame 0x0040 /* Value is a VdbeFrame object */ |
| 13837 | 13840 | #define MEM_Undefined 0x0080 /* Value is undefined */ |
| 13838 | 13841 | #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */ |
| 13839 | 13842 | #define MEM_TypeMask 0x01ff /* Mask of type bits */ |
| @@ -14069,12 +14072,10 @@ | ||
| 14069 | 14072 | SQLITE_PRIVATE const char *sqlite3OpcodeName(int); |
| 14070 | 14073 | SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); |
| 14071 | 14074 | SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); |
| 14072 | 14075 | SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); |
| 14073 | 14076 | SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); |
| 14074 | -#define sqlite3VdbeMemStoreType(X) (X)->memType = (u8)((X)->flags&0x1f) | |
| 14075 | -/* void sqlite3VdbeMemStoreType(Mem *pMem); */ | |
| 14076 | 14077 | SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p); |
| 14077 | 14078 | |
| 14078 | 14079 | SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *); |
| 14079 | 14080 | SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *); |
| 14080 | 14081 | SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *); |
| @@ -55372,11 +55373,11 @@ | ||
| 55372 | 55373 | lwr = 0; |
| 55373 | 55374 | upr = pPage->nCell-1; |
| 55374 | 55375 | assert( biasRight==0 || biasRight==1 ); |
| 55375 | 55376 | idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */ |
| 55376 | 55377 | pCur->aiIdx[pCur->iPage] = (u16)idx; |
| 55377 | - if( pPage->intKey ){ | |
| 55378 | + if( xRecordCompare==0 ){ | |
| 55378 | 55379 | for(;;){ |
| 55379 | 55380 | i64 nCellKey; |
| 55380 | 55381 | pCell = findCell(pPage, idx) + pPage->childPtrSize; |
| 55381 | 55382 | if( pPage->hasData ){ |
| 55382 | 55383 | while( 0x80 <= *(pCell++) ){ |
| @@ -60120,10 +60121,11 @@ | ||
| 60120 | 60121 | sqlite3DbFree(pMem->db, pMem->zMalloc); |
| 60121 | 60122 | pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n); |
| 60122 | 60123 | } |
| 60123 | 60124 | if( pMem->zMalloc==0 ){ |
| 60124 | 60125 | VdbeMemRelease(pMem); |
| 60126 | + pMem->z = 0; | |
| 60125 | 60127 | pMem->flags = MEM_Null; |
| 60126 | 60128 | return SQLITE_NOMEM; |
| 60127 | 60129 | } |
| 60128 | 60130 | } |
| 60129 | 60131 | |
| @@ -60318,11 +60320,11 @@ | ||
| 60318 | 60320 | } |
| 60319 | 60321 | |
| 60320 | 60322 | /* |
| 60321 | 60323 | ** Release any memory held by the Mem. This may leave the Mem in an |
| 60322 | 60324 | ** inconsistent state, for example with (Mem.z==0) and |
| 60323 | -** (Mem.memType==MEM_Str). | |
| 60325 | +** (Mem.flags==MEM_Str). | |
| 60324 | 60326 | */ |
| 60325 | 60327 | SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){ |
| 60326 | 60328 | assert( sqlite3VdbeCheckMemInvariants(p) ); |
| 60327 | 60329 | VdbeMemRelease(p); |
| 60328 | 60330 | if( p->zMalloc ){ |
| @@ -60510,11 +60512,10 @@ | ||
| 60510 | 60512 | } |
| 60511 | 60513 | if( pMem->flags & MEM_RowSet ){ |
| 60512 | 60514 | sqlite3RowSetClear(pMem->u.pRowSet); |
| 60513 | 60515 | } |
| 60514 | 60516 | MemSetTypeFlag(pMem, MEM_Null); |
| 60515 | - pMem->memType = MEM_Null; | |
| 60516 | 60517 | } |
| 60517 | 60518 | SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){ |
| 60518 | 60519 | sqlite3VdbeMemSetNull((Mem*)p); |
| 60519 | 60520 | } |
| 60520 | 60521 | |
| @@ -60523,11 +60524,10 @@ | ||
| 60523 | 60524 | ** n containing all zeros. |
| 60524 | 60525 | */ |
| 60525 | 60526 | SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ |
| 60526 | 60527 | sqlite3VdbeMemRelease(pMem); |
| 60527 | 60528 | pMem->flags = MEM_Blob|MEM_Zero; |
| 60528 | - pMem->memType = MEM_Blob; | |
| 60529 | 60529 | pMem->n = 0; |
| 60530 | 60530 | if( n<0 ) n = 0; |
| 60531 | 60531 | pMem->u.nZero = n; |
| 60532 | 60532 | pMem->enc = SQLITE_UTF8; |
| 60533 | 60533 | |
| @@ -60546,11 +60546,10 @@ | ||
| 60546 | 60546 | */ |
| 60547 | 60547 | SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){ |
| 60548 | 60548 | sqlite3VdbeMemRelease(pMem); |
| 60549 | 60549 | pMem->u.i = val; |
| 60550 | 60550 | pMem->flags = MEM_Int; |
| 60551 | - pMem->memType = MEM_Int; | |
| 60552 | 60551 | } |
| 60553 | 60552 | |
| 60554 | 60553 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 60555 | 60554 | /* |
| 60556 | 60555 | ** Delete any previous value and set the value stored in *pMem to val, |
| @@ -60561,11 +60560,10 @@ | ||
| 60561 | 60560 | sqlite3VdbeMemSetNull(pMem); |
| 60562 | 60561 | }else{ |
| 60563 | 60562 | sqlite3VdbeMemRelease(pMem); |
| 60564 | 60563 | pMem->r = val; |
| 60565 | 60564 | pMem->flags = MEM_Real; |
| 60566 | - pMem->memType = MEM_Real; | |
| 60567 | 60565 | } |
| 60568 | 60566 | } |
| 60569 | 60567 | #endif |
| 60570 | 60568 | |
| 60571 | 60569 | /* |
| @@ -60770,11 +60768,10 @@ | ||
| 60770 | 60768 | } |
| 60771 | 60769 | |
| 60772 | 60770 | pMem->n = nByte; |
| 60773 | 60771 | pMem->flags = flags; |
| 60774 | 60772 | pMem->enc = (enc==0 ? SQLITE_UTF8 : enc); |
| 60775 | - pMem->memType = flags&0x1f; | |
| 60776 | 60773 | |
| 60777 | 60774 | #ifndef SQLITE_OMIT_UTF16 |
| 60778 | 60775 | if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){ |
| 60779 | 60776 | return SQLITE_NOMEM; |
| 60780 | 60777 | } |
| @@ -60836,11 +60833,10 @@ | ||
| 60836 | 60833 | } |
| 60837 | 60834 | if( rc==SQLITE_OK ){ |
| 60838 | 60835 | pMem->z[amt] = 0; |
| 60839 | 60836 | pMem->z[amt+1] = 0; |
| 60840 | 60837 | pMem->flags = MEM_Blob|MEM_Term; |
| 60841 | - pMem->memType = MEM_Blob; | |
| 60842 | 60838 | pMem->n = (int)amt; |
| 60843 | 60839 | }else{ |
| 60844 | 60840 | sqlite3VdbeMemRelease(pMem); |
| 60845 | 60841 | } |
| 60846 | 60842 | } |
| @@ -60899,11 +60895,10 @@ | ||
| 60899 | 60895 | */ |
| 60900 | 60896 | SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *db){ |
| 60901 | 60897 | Mem *p = sqlite3DbMallocZero(db, sizeof(*p)); |
| 60902 | 60898 | if( p ){ |
| 60903 | 60899 | p->flags = MEM_Null; |
| 60904 | - p->memType = MEM_Null; | |
| 60905 | 60900 | p->db = db; |
| 60906 | 60901 | } |
| 60907 | 60902 | return p; |
| 60908 | 60903 | } |
| 60909 | 60904 | |
| @@ -60948,11 +60943,10 @@ | ||
| 60948 | 60943 | assert( pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField==nCol ); |
| 60949 | 60944 | assert( pRec->pKeyInfo->enc==ENC(db) ); |
| 60950 | 60945 | pRec->aMem = (Mem *)((u8*)pRec + ROUND8(sizeof(UnpackedRecord))); |
| 60951 | 60946 | for(i=0; i<nCol; i++){ |
| 60952 | 60947 | pRec->aMem[i].flags = MEM_Null; |
| 60953 | - pRec->aMem[i].memType = MEM_Null; | |
| 60954 | 60948 | pRec->aMem[i].db = db; |
| 60955 | 60949 | } |
| 60956 | 60950 | }else{ |
| 60957 | 60951 | sqlite3DbFree(db, pRec); |
| 60958 | 60952 | pRec = 0; |
| @@ -61021,11 +61015,10 @@ | ||
| 61021 | 61015 | sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt); |
| 61022 | 61016 | }else{ |
| 61023 | 61017 | zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); |
| 61024 | 61018 | if( zVal==0 ) goto no_mem; |
| 61025 | 61019 | sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); |
| 61026 | - if( op==TK_FLOAT ) pVal->memType = MEM_Real; | |
| 61027 | 61020 | } |
| 61028 | 61021 | if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){ |
| 61029 | 61022 | sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); |
| 61030 | 61023 | }else{ |
| 61031 | 61024 | sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8); |
| @@ -61039,13 +61032,13 @@ | ||
| 61039 | 61032 | if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) |
| 61040 | 61033 | && pVal!=0 |
| 61041 | 61034 | ){ |
| 61042 | 61035 | sqlite3VdbeMemNumerify(pVal); |
| 61043 | 61036 | if( pVal->u.i==SMALLEST_INT64 ){ |
| 61044 | - pVal->flags &= MEM_Int; | |
| 61037 | + pVal->flags &= ~MEM_Int; | |
| 61045 | 61038 | pVal->flags |= MEM_Real; |
| 61046 | - pVal->r = (double)LARGEST_INT64; | |
| 61039 | + pVal->r = (double)SMALLEST_INT64; | |
| 61047 | 61040 | }else{ |
| 61048 | 61041 | pVal->u.i = -pVal->u.i; |
| 61049 | 61042 | } |
| 61050 | 61043 | pVal->r = -pVal->r; |
| 61051 | 61044 | sqlite3ValueApplyAffinity(pVal, affinity, enc); |
| @@ -61067,13 +61060,10 @@ | ||
| 61067 | 61060 | sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2, |
| 61068 | 61061 | 0, SQLITE_DYNAMIC); |
| 61069 | 61062 | } |
| 61070 | 61063 | #endif |
| 61071 | 61064 | |
| 61072 | - if( pVal ){ | |
| 61073 | - sqlite3VdbeMemStoreType(pVal); | |
| 61074 | - } | |
| 61075 | 61065 | *ppVal = pVal; |
| 61076 | 61066 | return rc; |
| 61077 | 61067 | |
| 61078 | 61068 | no_mem: |
| 61079 | 61069 | db->mallocFailed = 1; |
| @@ -61233,11 +61223,10 @@ | ||
| 61233 | 61223 | rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); |
| 61234 | 61224 | if( rc==SQLITE_OK ){ |
| 61235 | 61225 | sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); |
| 61236 | 61226 | } |
| 61237 | 61227 | pVal->db = pParse->db; |
| 61238 | - sqlite3VdbeMemStoreType((Mem*)pVal); | |
| 61239 | 61228 | } |
| 61240 | 61229 | } |
| 61241 | 61230 | }else{ |
| 61242 | 61231 | rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, &alloc); |
| 61243 | 61232 | } |
| @@ -62668,19 +62657,17 @@ | ||
| 62668 | 62657 | } |
| 62669 | 62658 | pOp = &apSub[j]->aOp[i]; |
| 62670 | 62659 | } |
| 62671 | 62660 | if( p->explain==1 ){ |
| 62672 | 62661 | pMem->flags = MEM_Int; |
| 62673 | - pMem->memType = MEM_Int; | |
| 62674 | 62662 | pMem->u.i = i; /* Program counter */ |
| 62675 | 62663 | pMem++; |
| 62676 | 62664 | |
| 62677 | 62665 | pMem->flags = MEM_Static|MEM_Str|MEM_Term; |
| 62678 | 62666 | pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */ |
| 62679 | 62667 | assert( pMem->z!=0 ); |
| 62680 | 62668 | pMem->n = sqlite3Strlen30(pMem->z); |
| 62681 | - pMem->memType = MEM_Str; | |
| 62682 | 62669 | pMem->enc = SQLITE_UTF8; |
| 62683 | 62670 | pMem++; |
| 62684 | 62671 | |
| 62685 | 62672 | /* When an OP_Program opcode is encounter (the only opcode that has |
| 62686 | 62673 | ** a P4_SUBPROGRAM argument), expand the size of the array of subprograms |
| @@ -62702,21 +62689,18 @@ | ||
| 62702 | 62689 | } |
| 62703 | 62690 | } |
| 62704 | 62691 | |
| 62705 | 62692 | pMem->flags = MEM_Int; |
| 62706 | 62693 | pMem->u.i = pOp->p1; /* P1 */ |
| 62707 | - pMem->memType = MEM_Int; | |
| 62708 | 62694 | pMem++; |
| 62709 | 62695 | |
| 62710 | 62696 | pMem->flags = MEM_Int; |
| 62711 | 62697 | pMem->u.i = pOp->p2; /* P2 */ |
| 62712 | - pMem->memType = MEM_Int; | |
| 62713 | 62698 | pMem++; |
| 62714 | 62699 | |
| 62715 | 62700 | pMem->flags = MEM_Int; |
| 62716 | 62701 | pMem->u.i = pOp->p3; /* P3 */ |
| 62717 | - pMem->memType = MEM_Int; | |
| 62718 | 62702 | pMem++; |
| 62719 | 62703 | |
| 62720 | 62704 | if( sqlite3VdbeMemGrow(pMem, 32, 0) ){ /* P4 */ |
| 62721 | 62705 | assert( p->db->mallocFailed ); |
| 62722 | 62706 | return SQLITE_ERROR; |
| @@ -62728,11 +62712,10 @@ | ||
| 62728 | 62712 | }else{ |
| 62729 | 62713 | assert( pMem->z!=0 ); |
| 62730 | 62714 | pMem->n = sqlite3Strlen30(pMem->z); |
| 62731 | 62715 | pMem->enc = SQLITE_UTF8; |
| 62732 | 62716 | } |
| 62733 | - pMem->memType = MEM_Str; | |
| 62734 | 62717 | pMem++; |
| 62735 | 62718 | |
| 62736 | 62719 | if( p->explain==1 ){ |
| 62737 | 62720 | if( sqlite3VdbeMemGrow(pMem, 4, 0) ){ |
| 62738 | 62721 | assert( p->db->mallocFailed ); |
| @@ -62739,11 +62722,10 @@ | ||
| 62739 | 62722 | return SQLITE_ERROR; |
| 62740 | 62723 | } |
| 62741 | 62724 | pMem->flags = MEM_Str|MEM_Term; |
| 62742 | 62725 | pMem->n = 2; |
| 62743 | 62726 | sqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5); /* P5 */ |
| 62744 | - pMem->memType = MEM_Str; | |
| 62745 | 62727 | pMem->enc = SQLITE_UTF8; |
| 62746 | 62728 | pMem++; |
| 62747 | 62729 | |
| 62748 | 62730 | #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
| 62749 | 62731 | if( sqlite3VdbeMemGrow(pMem, 500, 0) ){ |
| @@ -62750,15 +62732,13 @@ | ||
| 62750 | 62732 | assert( p->db->mallocFailed ); |
| 62751 | 62733 | return SQLITE_ERROR; |
| 62752 | 62734 | } |
| 62753 | 62735 | pMem->flags = MEM_Str|MEM_Term; |
| 62754 | 62736 | pMem->n = displayComment(pOp, zP4, pMem->z, 500); |
| 62755 | - pMem->memType = MEM_Str; | |
| 62756 | 62737 | pMem->enc = SQLITE_UTF8; |
| 62757 | 62738 | #else |
| 62758 | 62739 | pMem->flags = MEM_Null; /* Comment */ |
| 62759 | - pMem->memType = MEM_Null; | |
| 62760 | 62740 | #endif |
| 62761 | 62741 | } |
| 62762 | 62742 | |
| 62763 | 62743 | p->nResColumn = 8 - 4*(p->explain-1); |
| 62764 | 62744 | p->pResultSet = &p->aMem[1]; |
| @@ -64844,13 +64824,14 @@ | ||
| 64844 | 64824 | |
| 64845 | 64825 | if( rc!=0 ){ |
| 64846 | 64826 | if( pKeyInfo->aSortOrder[i] ){ |
| 64847 | 64827 | rc = -rc; |
| 64848 | 64828 | } |
| 64849 | - assert( CORRUPT_DB | |
| 64829 | + assert( CORRUPT_DB | |
| 64850 | 64830 | || (rc<0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)<0) |
| 64851 | 64831 | || (rc>0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)>0) |
| 64832 | + || pKeyInfo->db->mallocFailed | |
| 64852 | 64833 | ); |
| 64853 | 64834 | assert( mem1.zMalloc==0 ); /* See comment below */ |
| 64854 | 64835 | return rc; |
| 64855 | 64836 | } |
| 64856 | 64837 | |
| @@ -65241,11 +65222,10 @@ | ||
| 65241 | 65222 | if( 0==(pMem->flags & MEM_Null) ){ |
| 65242 | 65223 | sqlite3_value *pRet = sqlite3ValueNew(v->db); |
| 65243 | 65224 | if( pRet ){ |
| 65244 | 65225 | sqlite3VdbeMemCopy((Mem *)pRet, pMem); |
| 65245 | 65226 | sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8); |
| 65246 | - sqlite3VdbeMemStoreType((Mem *)pRet); | |
| 65247 | 65227 | } |
| 65248 | 65228 | return pRet; |
| 65249 | 65229 | } |
| 65250 | 65230 | } |
| 65251 | 65231 | return 0; |
| @@ -65415,11 +65395,10 @@ | ||
| 65415 | 65395 | */ |
| 65416 | 65396 | SQLITE_API const void *sqlite3_value_blob(sqlite3_value *pVal){ |
| 65417 | 65397 | Mem *p = (Mem*)pVal; |
| 65418 | 65398 | if( p->flags & (MEM_Blob|MEM_Str) ){ |
| 65419 | 65399 | sqlite3VdbeMemExpandBlob(p); |
| 65420 | - p->flags &= ~MEM_Str; | |
| 65421 | 65400 | p->flags |= MEM_Blob; |
| 65422 | 65401 | return p->n ? p->z : 0; |
| 65423 | 65402 | }else{ |
| 65424 | 65403 | return sqlite3_value_text(pVal); |
| 65425 | 65404 | } |
| @@ -65486,11 +65465,11 @@ | ||
| 65486 | 65465 | SQLITE_INTEGER, /* 0x1c */ |
| 65487 | 65466 | SQLITE_NULL, /* 0x1d */ |
| 65488 | 65467 | SQLITE_INTEGER, /* 0x1e */ |
| 65489 | 65468 | SQLITE_NULL, /* 0x1f */ |
| 65490 | 65469 | }; |
| 65491 | - return aType[pVal->memType&0x1f]; | |
| 65470 | + return aType[pVal->flags&MEM_AffMask]; | |
| 65492 | 65471 | } |
| 65493 | 65472 | |
| 65494 | 65473 | /**************************** sqlite3_result_ ******************************* |
| 65495 | 65474 | ** The following routines are used by user-defined functions to specify |
| 65496 | 65475 | ** the function result. |
| @@ -66007,10 +65986,34 @@ | ||
| 66007 | 65986 | Vdbe *pVm = (Vdbe *)pStmt; |
| 66008 | 65987 | if( pVm==0 || pVm->pResultSet==0 ) return 0; |
| 66009 | 65988 | return pVm->nResColumn; |
| 66010 | 65989 | } |
| 66011 | 65990 | |
| 65991 | +/* | |
| 65992 | +** Return a pointer to static memory containing an SQL NULL value. | |
| 65993 | +*/ | |
| 65994 | +static const Mem *columnNullValue(void){ | |
| 65995 | + /* Even though the Mem structure contains an element | |
| 65996 | + ** of type i64, on certain architectures (x86) with certain compiler | |
| 65997 | + ** switches (-Os), gcc may align this Mem object on a 4-byte boundary | |
| 65998 | + ** instead of an 8-byte one. This all works fine, except that when | |
| 65999 | + ** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s | |
| 66000 | + ** that a Mem structure is located on an 8-byte boundary. To prevent | |
| 66001 | + ** these assert()s from failing, when building with SQLITE_DEBUG defined | |
| 66002 | + ** using gcc, we force nullMem to be 8-byte aligned using the magical | |
| 66003 | + ** __attribute__((aligned(8))) macro. */ | |
| 66004 | + static const Mem nullMem | |
| 66005 | +#if defined(SQLITE_DEBUG) && defined(__GNUC__) | |
| 66006 | + __attribute__((aligned(8))) | |
| 66007 | +#endif | |
| 66008 | + = {0, "", (double)0, {0}, 0, MEM_Null, 0, | |
| 66009 | +#ifdef SQLITE_DEBUG | |
| 66010 | + 0, 0, /* pScopyFrom, pFiller */ | |
| 66011 | +#endif | |
| 66012 | + 0, 0 }; | |
| 66013 | + return &nullMem; | |
| 66014 | +} | |
| 66012 | 66015 | |
| 66013 | 66016 | /* |
| 66014 | 66017 | ** Check to see if column iCol of the given statement is valid. If |
| 66015 | 66018 | ** it is, return a pointer to the Mem for the value of that column. |
| 66016 | 66019 | ** If iCol is not valid, return a pointer to a Mem which has a value |
| @@ -66023,36 +66026,15 @@ | ||
| 66023 | 66026 | pVm = (Vdbe *)pStmt; |
| 66024 | 66027 | if( pVm && pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){ |
| 66025 | 66028 | sqlite3_mutex_enter(pVm->db->mutex); |
| 66026 | 66029 | pOut = &pVm->pResultSet[i]; |
| 66027 | 66030 | }else{ |
| 66028 | - /* If the value passed as the second argument is out of range, return | |
| 66029 | - ** a pointer to the following static Mem object which contains the | |
| 66030 | - ** value SQL NULL. Even though the Mem structure contains an element | |
| 66031 | - ** of type i64, on certain architectures (x86) with certain compiler | |
| 66032 | - ** switches (-Os), gcc may align this Mem object on a 4-byte boundary | |
| 66033 | - ** instead of an 8-byte one. This all works fine, except that when | |
| 66034 | - ** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s | |
| 66035 | - ** that a Mem structure is located on an 8-byte boundary. To prevent | |
| 66036 | - ** these assert()s from failing, when building with SQLITE_DEBUG defined | |
| 66037 | - ** using gcc, we force nullMem to be 8-byte aligned using the magical | |
| 66038 | - ** __attribute__((aligned(8))) macro. */ | |
| 66039 | - static const Mem nullMem | |
| 66040 | -#if defined(SQLITE_DEBUG) && defined(__GNUC__) | |
| 66041 | - __attribute__((aligned(8))) | |
| 66042 | -#endif | |
| 66043 | - = {0, "", (double)0, {0}, 0, MEM_Null, SQLITE_NULL, 0, | |
| 66044 | -#ifdef SQLITE_DEBUG | |
| 66045 | - 0, 0, /* pScopyFrom, pFiller */ | |
| 66046 | -#endif | |
| 66047 | - 0, 0 }; | |
| 66048 | - | |
| 66049 | 66031 | if( pVm && ALWAYS(pVm->db) ){ |
| 66050 | 66032 | sqlite3_mutex_enter(pVm->db->mutex); |
| 66051 | 66033 | sqlite3Error(pVm->db, SQLITE_RANGE, 0); |
| 66052 | 66034 | } |
| 66053 | - pOut = (Mem*)&nullMem; | |
| 66035 | + pOut = (Mem*)columnNullValue(); | |
| 66054 | 66036 | } |
| 66055 | 66037 | return pOut; |
| 66056 | 66038 | } |
| 66057 | 66039 | |
| 66058 | 66040 | /* |
| @@ -67228,11 +67210,10 @@ | ||
| 67228 | 67210 | SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){ |
| 67229 | 67211 | int eType = sqlite3_value_type(pVal); |
| 67230 | 67212 | if( eType==SQLITE_TEXT ){ |
| 67231 | 67213 | Mem *pMem = (Mem*)pVal; |
| 67232 | 67214 | applyNumericAffinity(pMem); |
| 67233 | - sqlite3VdbeMemStoreType(pMem); | |
| 67234 | 67215 | eType = sqlite3_value_type(pVal); |
| 67235 | 67216 | } |
| 67236 | 67217 | return eType; |
| 67237 | 67218 | } |
| 67238 | 67219 | |
| @@ -68267,11 +68248,10 @@ | ||
| 68267 | 68248 | assert( memIsValid(&pMem[i]) ); |
| 68268 | 68249 | Deephemeralize(&pMem[i]); |
| 68269 | 68250 | assert( (pMem[i].flags & MEM_Ephem)==0 |
| 68270 | 68251 | || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 ); |
| 68271 | 68252 | sqlite3VdbeMemNulTerminate(&pMem[i]); |
| 68272 | - sqlite3VdbeMemStoreType(&pMem[i]); | |
| 68273 | 68253 | REGISTER_TRACE(pOp->p1+i, &pMem[i]); |
| 68274 | 68254 | } |
| 68275 | 68255 | if( db->mallocFailed ) goto no_mem; |
| 68276 | 68256 | |
| 68277 | 68257 | /* Return SQLITE_ROW |
| @@ -68513,11 +68493,10 @@ | ||
| 68513 | 68493 | pArg = &aMem[pOp->p2]; |
| 68514 | 68494 | for(i=0; i<n; i++, pArg++){ |
| 68515 | 68495 | assert( memIsValid(pArg) ); |
| 68516 | 68496 | apVal[i] = pArg; |
| 68517 | 68497 | Deephemeralize(pArg); |
| 68518 | - sqlite3VdbeMemStoreType(pArg); | |
| 68519 | 68498 | REGISTER_TRACE(pOp->p2+i, pArg); |
| 68520 | 68499 | } |
| 68521 | 68500 | |
| 68522 | 68501 | assert( pOp->p4type==P4_FUNCDEF ); |
| 68523 | 68502 | ctx.pFunc = pOp->p4.pFunc; |
| @@ -72518,11 +72497,10 @@ | ||
| 72518 | 72497 | assert( apVal || n==0 ); |
| 72519 | 72498 | for(i=0; i<n; i++, pRec++){ |
| 72520 | 72499 | assert( memIsValid(pRec) ); |
| 72521 | 72500 | apVal[i] = pRec; |
| 72522 | 72501 | memAboutToChange(p, pRec); |
| 72523 | - sqlite3VdbeMemStoreType(pRec); | |
| 72524 | 72502 | } |
| 72525 | 72503 | ctx.pFunc = pOp->p4.pFunc; |
| 72526 | 72504 | assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) ); |
| 72527 | 72505 | ctx.pMem = pMem = &aMem[pOp->p3]; |
| 72528 | 72506 | pMem->n++; |
| @@ -72952,11 +72930,10 @@ | ||
| 72952 | 72930 | { |
| 72953 | 72931 | res = 0; |
| 72954 | 72932 | apArg = p->apArg; |
| 72955 | 72933 | for(i = 0; i<nArg; i++){ |
| 72956 | 72934 | apArg[i] = &pArgc[i+1]; |
| 72957 | - sqlite3VdbeMemStoreType(apArg[i]); | |
| 72958 | 72935 | } |
| 72959 | 72936 | |
| 72960 | 72937 | p->inVtabMethod = 1; |
| 72961 | 72938 | rc = pModule->xFilter(pVtabCursor, iQuery, pOp->p4.z, nArg, apArg); |
| 72962 | 72939 | p->inVtabMethod = 0; |
| @@ -73159,11 +73136,10 @@ | ||
| 73159 | 73136 | apArg = p->apArg; |
| 73160 | 73137 | pX = &aMem[pOp->p3]; |
| 73161 | 73138 | for(i=0; i<nArg; i++){ |
| 73162 | 73139 | assert( memIsValid(pX) ); |
| 73163 | 73140 | memAboutToChange(p, pX); |
| 73164 | - sqlite3VdbeMemStoreType(pX); | |
| 73165 | 73141 | apArg[i] = pX; |
| 73166 | 73142 | pX++; |
| 73167 | 73143 | } |
| 73168 | 73144 | db->vtabOnConflict = pOp->p5; |
| 73169 | 73145 | rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid); |
| @@ -88183,11 +88159,11 @@ | ||
| 88183 | 88159 | assert( nExtra>=1 ); |
| 88184 | 88160 | assert( pSrc!=0 ); |
| 88185 | 88161 | assert( iStart<=pSrc->nSrc ); |
| 88186 | 88162 | |
| 88187 | 88163 | /* Allocate additional space if needed */ |
| 88188 | - if( pSrc->nSrc+nExtra>pSrc->nAlloc ){ | |
| 88164 | + if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){ | |
| 88189 | 88165 | SrcList *pNew; |
| 88190 | 88166 | int nAlloc = pSrc->nSrc+nExtra; |
| 88191 | 88167 | int nGot; |
| 88192 | 88168 | pNew = sqlite3DbRealloc(db, pSrc, |
| 88193 | 88169 | sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) ); |
| @@ -88195,19 +88171,19 @@ | ||
| 88195 | 88171 | assert( db->mallocFailed ); |
| 88196 | 88172 | return pSrc; |
| 88197 | 88173 | } |
| 88198 | 88174 | pSrc = pNew; |
| 88199 | 88175 | nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1; |
| 88200 | - pSrc->nAlloc = (u8)nGot; | |
| 88176 | + pSrc->nAlloc = nGot; | |
| 88201 | 88177 | } |
| 88202 | 88178 | |
| 88203 | 88179 | /* Move existing slots that come after the newly inserted slots |
| 88204 | 88180 | ** out of the way */ |
| 88205 | 88181 | for(i=pSrc->nSrc-1; i>=iStart; i--){ |
| 88206 | 88182 | pSrc->a[i+nExtra] = pSrc->a[i]; |
| 88207 | 88183 | } |
| 88208 | - pSrc->nSrc += (i8)nExtra; | |
| 88184 | + pSrc->nSrc += nExtra; | |
| 88209 | 88185 | |
| 88210 | 88186 | /* Zero the newly allocated slots */ |
| 88211 | 88187 | memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra); |
| 88212 | 88188 | for(i=iStart; i<iStart+nExtra; i++){ |
| 88213 | 88189 | pSrc->a[i].iCursor = -1; |
| @@ -101494,11 +101470,11 @@ | ||
| 101494 | 101470 | for(j=cnt=0; j<i; j++){ |
| 101495 | 101471 | if( sqlite3StrICmp(aCol[j].zName, zName)==0 ){ |
| 101496 | 101472 | char *zNewName; |
| 101497 | 101473 | int k; |
| 101498 | 101474 | for(k=nName-1; k>1 && sqlite3Isdigit(zName[k]); k--){} |
| 101499 | - if( zName[k]==':' ) nName = k; | |
| 101475 | + if( k>=0 && zName[k]==':' ) nName = k; | |
| 101500 | 101476 | zName[nName] = 0; |
| 101501 | 101477 | zNewName = sqlite3MPrintf(db, "%s:%d", zName, ++cnt); |
| 101502 | 101478 | sqlite3DbFree(db, zName); |
| 101503 | 101479 | zName = zNewName; |
| 101504 | 101480 | j = -1; |
| 101505 | 101481 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -189,11 +189,11 @@ | |
| 189 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 190 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 191 | */ |
| 192 | #define SQLITE_VERSION "3.8.4" |
| 193 | #define SQLITE_VERSION_NUMBER 3008004 |
| 194 | #define SQLITE_SOURCE_ID "2014-03-04 13:18:23 9830c343bc954b828f6ca752f8ae63e2c0a980c1" |
| 195 | |
| 196 | /* |
| 197 | ** CAPI3REF: Run-Time Library Version Numbers |
| 198 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 199 | ** |
| @@ -11385,12 +11385,12 @@ | |
| 11385 | ** |
| 11386 | ** In the colUsed field, the high-order bit (bit 63) is set if the table |
| 11387 | ** contains more than 63 columns and the 64-th or later column is used. |
| 11388 | */ |
| 11389 | struct SrcList { |
| 11390 | u8 nSrc; /* Number of tables or subqueries in the FROM clause */ |
| 11391 | u8 nAlloc; /* Number of entries allocated in a[] below */ |
| 11392 | struct SrcList_item { |
| 11393 | Schema *pSchema; /* Schema to which this item is fixed */ |
| 11394 | char *zDatabase; /* Name of database holding this table */ |
| 11395 | char *zName; /* Name of the table */ |
| 11396 | char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */ |
| @@ -13418,10 +13418,13 @@ | |
| 13418 | #ifdef SQLITE_OMIT_COMPLETE |
| 13419 | "OMIT_COMPLETE", |
| 13420 | #endif |
| 13421 | #ifdef SQLITE_OMIT_COMPOUND_SELECT |
| 13422 | "OMIT_COMPOUND_SELECT", |
| 13423 | #endif |
| 13424 | #ifdef SQLITE_OMIT_DATETIME_FUNCS |
| 13425 | "OMIT_DATETIME_FUNCS", |
| 13426 | #endif |
| 13427 | #ifdef SQLITE_OMIT_DECLTYPE |
| @@ -13803,11 +13806,10 @@ | |
| 13803 | RowSet *pRowSet; /* Used only when flags==MEM_RowSet */ |
| 13804 | VdbeFrame *pFrame; /* Used when flags==MEM_Frame */ |
| 13805 | } u; |
| 13806 | int n; /* Number of characters in string value, excluding '\0' */ |
| 13807 | u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */ |
| 13808 | u8 memType; /* Lower 5 bits of flags */ |
| 13809 | u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */ |
| 13810 | #ifdef SQLITE_DEBUG |
| 13811 | Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ |
| 13812 | void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */ |
| 13813 | #endif |
| @@ -13830,10 +13832,11 @@ | |
| 13830 | #define MEM_Null 0x0001 /* Value is NULL */ |
| 13831 | #define MEM_Str 0x0002 /* Value is a string */ |
| 13832 | #define MEM_Int 0x0004 /* Value is an integer */ |
| 13833 | #define MEM_Real 0x0008 /* Value is a real number */ |
| 13834 | #define MEM_Blob 0x0010 /* Value is a BLOB */ |
| 13835 | #define MEM_RowSet 0x0020 /* Value is a RowSet object */ |
| 13836 | #define MEM_Frame 0x0040 /* Value is a VdbeFrame object */ |
| 13837 | #define MEM_Undefined 0x0080 /* Value is undefined */ |
| 13838 | #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */ |
| 13839 | #define MEM_TypeMask 0x01ff /* Mask of type bits */ |
| @@ -14069,12 +14072,10 @@ | |
| 14069 | SQLITE_PRIVATE const char *sqlite3OpcodeName(int); |
| 14070 | SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); |
| 14071 | SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); |
| 14072 | SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); |
| 14073 | SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); |
| 14074 | #define sqlite3VdbeMemStoreType(X) (X)->memType = (u8)((X)->flags&0x1f) |
| 14075 | /* void sqlite3VdbeMemStoreType(Mem *pMem); */ |
| 14076 | SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p); |
| 14077 | |
| 14078 | SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *); |
| 14079 | SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *); |
| 14080 | SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *); |
| @@ -55372,11 +55373,11 @@ | |
| 55372 | lwr = 0; |
| 55373 | upr = pPage->nCell-1; |
| 55374 | assert( biasRight==0 || biasRight==1 ); |
| 55375 | idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */ |
| 55376 | pCur->aiIdx[pCur->iPage] = (u16)idx; |
| 55377 | if( pPage->intKey ){ |
| 55378 | for(;;){ |
| 55379 | i64 nCellKey; |
| 55380 | pCell = findCell(pPage, idx) + pPage->childPtrSize; |
| 55381 | if( pPage->hasData ){ |
| 55382 | while( 0x80 <= *(pCell++) ){ |
| @@ -60120,10 +60121,11 @@ | |
| 60120 | sqlite3DbFree(pMem->db, pMem->zMalloc); |
| 60121 | pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n); |
| 60122 | } |
| 60123 | if( pMem->zMalloc==0 ){ |
| 60124 | VdbeMemRelease(pMem); |
| 60125 | pMem->flags = MEM_Null; |
| 60126 | return SQLITE_NOMEM; |
| 60127 | } |
| 60128 | } |
| 60129 | |
| @@ -60318,11 +60320,11 @@ | |
| 60318 | } |
| 60319 | |
| 60320 | /* |
| 60321 | ** Release any memory held by the Mem. This may leave the Mem in an |
| 60322 | ** inconsistent state, for example with (Mem.z==0) and |
| 60323 | ** (Mem.memType==MEM_Str). |
| 60324 | */ |
| 60325 | SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){ |
| 60326 | assert( sqlite3VdbeCheckMemInvariants(p) ); |
| 60327 | VdbeMemRelease(p); |
| 60328 | if( p->zMalloc ){ |
| @@ -60510,11 +60512,10 @@ | |
| 60510 | } |
| 60511 | if( pMem->flags & MEM_RowSet ){ |
| 60512 | sqlite3RowSetClear(pMem->u.pRowSet); |
| 60513 | } |
| 60514 | MemSetTypeFlag(pMem, MEM_Null); |
| 60515 | pMem->memType = MEM_Null; |
| 60516 | } |
| 60517 | SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){ |
| 60518 | sqlite3VdbeMemSetNull((Mem*)p); |
| 60519 | } |
| 60520 | |
| @@ -60523,11 +60524,10 @@ | |
| 60523 | ** n containing all zeros. |
| 60524 | */ |
| 60525 | SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ |
| 60526 | sqlite3VdbeMemRelease(pMem); |
| 60527 | pMem->flags = MEM_Blob|MEM_Zero; |
| 60528 | pMem->memType = MEM_Blob; |
| 60529 | pMem->n = 0; |
| 60530 | if( n<0 ) n = 0; |
| 60531 | pMem->u.nZero = n; |
| 60532 | pMem->enc = SQLITE_UTF8; |
| 60533 | |
| @@ -60546,11 +60546,10 @@ | |
| 60546 | */ |
| 60547 | SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){ |
| 60548 | sqlite3VdbeMemRelease(pMem); |
| 60549 | pMem->u.i = val; |
| 60550 | pMem->flags = MEM_Int; |
| 60551 | pMem->memType = MEM_Int; |
| 60552 | } |
| 60553 | |
| 60554 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 60555 | /* |
| 60556 | ** Delete any previous value and set the value stored in *pMem to val, |
| @@ -60561,11 +60560,10 @@ | |
| 60561 | sqlite3VdbeMemSetNull(pMem); |
| 60562 | }else{ |
| 60563 | sqlite3VdbeMemRelease(pMem); |
| 60564 | pMem->r = val; |
| 60565 | pMem->flags = MEM_Real; |
| 60566 | pMem->memType = MEM_Real; |
| 60567 | } |
| 60568 | } |
| 60569 | #endif |
| 60570 | |
| 60571 | /* |
| @@ -60770,11 +60768,10 @@ | |
| 60770 | } |
| 60771 | |
| 60772 | pMem->n = nByte; |
| 60773 | pMem->flags = flags; |
| 60774 | pMem->enc = (enc==0 ? SQLITE_UTF8 : enc); |
| 60775 | pMem->memType = flags&0x1f; |
| 60776 | |
| 60777 | #ifndef SQLITE_OMIT_UTF16 |
| 60778 | if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){ |
| 60779 | return SQLITE_NOMEM; |
| 60780 | } |
| @@ -60836,11 +60833,10 @@ | |
| 60836 | } |
| 60837 | if( rc==SQLITE_OK ){ |
| 60838 | pMem->z[amt] = 0; |
| 60839 | pMem->z[amt+1] = 0; |
| 60840 | pMem->flags = MEM_Blob|MEM_Term; |
| 60841 | pMem->memType = MEM_Blob; |
| 60842 | pMem->n = (int)amt; |
| 60843 | }else{ |
| 60844 | sqlite3VdbeMemRelease(pMem); |
| 60845 | } |
| 60846 | } |
| @@ -60899,11 +60895,10 @@ | |
| 60899 | */ |
| 60900 | SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *db){ |
| 60901 | Mem *p = sqlite3DbMallocZero(db, sizeof(*p)); |
| 60902 | if( p ){ |
| 60903 | p->flags = MEM_Null; |
| 60904 | p->memType = MEM_Null; |
| 60905 | p->db = db; |
| 60906 | } |
| 60907 | return p; |
| 60908 | } |
| 60909 | |
| @@ -60948,11 +60943,10 @@ | |
| 60948 | assert( pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField==nCol ); |
| 60949 | assert( pRec->pKeyInfo->enc==ENC(db) ); |
| 60950 | pRec->aMem = (Mem *)((u8*)pRec + ROUND8(sizeof(UnpackedRecord))); |
| 60951 | for(i=0; i<nCol; i++){ |
| 60952 | pRec->aMem[i].flags = MEM_Null; |
| 60953 | pRec->aMem[i].memType = MEM_Null; |
| 60954 | pRec->aMem[i].db = db; |
| 60955 | } |
| 60956 | }else{ |
| 60957 | sqlite3DbFree(db, pRec); |
| 60958 | pRec = 0; |
| @@ -61021,11 +61015,10 @@ | |
| 61021 | sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt); |
| 61022 | }else{ |
| 61023 | zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); |
| 61024 | if( zVal==0 ) goto no_mem; |
| 61025 | sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); |
| 61026 | if( op==TK_FLOAT ) pVal->memType = MEM_Real; |
| 61027 | } |
| 61028 | if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){ |
| 61029 | sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); |
| 61030 | }else{ |
| 61031 | sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8); |
| @@ -61039,13 +61032,13 @@ | |
| 61039 | if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) |
| 61040 | && pVal!=0 |
| 61041 | ){ |
| 61042 | sqlite3VdbeMemNumerify(pVal); |
| 61043 | if( pVal->u.i==SMALLEST_INT64 ){ |
| 61044 | pVal->flags &= MEM_Int; |
| 61045 | pVal->flags |= MEM_Real; |
| 61046 | pVal->r = (double)LARGEST_INT64; |
| 61047 | }else{ |
| 61048 | pVal->u.i = -pVal->u.i; |
| 61049 | } |
| 61050 | pVal->r = -pVal->r; |
| 61051 | sqlite3ValueApplyAffinity(pVal, affinity, enc); |
| @@ -61067,13 +61060,10 @@ | |
| 61067 | sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2, |
| 61068 | 0, SQLITE_DYNAMIC); |
| 61069 | } |
| 61070 | #endif |
| 61071 | |
| 61072 | if( pVal ){ |
| 61073 | sqlite3VdbeMemStoreType(pVal); |
| 61074 | } |
| 61075 | *ppVal = pVal; |
| 61076 | return rc; |
| 61077 | |
| 61078 | no_mem: |
| 61079 | db->mallocFailed = 1; |
| @@ -61233,11 +61223,10 @@ | |
| 61233 | rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); |
| 61234 | if( rc==SQLITE_OK ){ |
| 61235 | sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); |
| 61236 | } |
| 61237 | pVal->db = pParse->db; |
| 61238 | sqlite3VdbeMemStoreType((Mem*)pVal); |
| 61239 | } |
| 61240 | } |
| 61241 | }else{ |
| 61242 | rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, &alloc); |
| 61243 | } |
| @@ -62668,19 +62657,17 @@ | |
| 62668 | } |
| 62669 | pOp = &apSub[j]->aOp[i]; |
| 62670 | } |
| 62671 | if( p->explain==1 ){ |
| 62672 | pMem->flags = MEM_Int; |
| 62673 | pMem->memType = MEM_Int; |
| 62674 | pMem->u.i = i; /* Program counter */ |
| 62675 | pMem++; |
| 62676 | |
| 62677 | pMem->flags = MEM_Static|MEM_Str|MEM_Term; |
| 62678 | pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */ |
| 62679 | assert( pMem->z!=0 ); |
| 62680 | pMem->n = sqlite3Strlen30(pMem->z); |
| 62681 | pMem->memType = MEM_Str; |
| 62682 | pMem->enc = SQLITE_UTF8; |
| 62683 | pMem++; |
| 62684 | |
| 62685 | /* When an OP_Program opcode is encounter (the only opcode that has |
| 62686 | ** a P4_SUBPROGRAM argument), expand the size of the array of subprograms |
| @@ -62702,21 +62689,18 @@ | |
| 62702 | } |
| 62703 | } |
| 62704 | |
| 62705 | pMem->flags = MEM_Int; |
| 62706 | pMem->u.i = pOp->p1; /* P1 */ |
| 62707 | pMem->memType = MEM_Int; |
| 62708 | pMem++; |
| 62709 | |
| 62710 | pMem->flags = MEM_Int; |
| 62711 | pMem->u.i = pOp->p2; /* P2 */ |
| 62712 | pMem->memType = MEM_Int; |
| 62713 | pMem++; |
| 62714 | |
| 62715 | pMem->flags = MEM_Int; |
| 62716 | pMem->u.i = pOp->p3; /* P3 */ |
| 62717 | pMem->memType = MEM_Int; |
| 62718 | pMem++; |
| 62719 | |
| 62720 | if( sqlite3VdbeMemGrow(pMem, 32, 0) ){ /* P4 */ |
| 62721 | assert( p->db->mallocFailed ); |
| 62722 | return SQLITE_ERROR; |
| @@ -62728,11 +62712,10 @@ | |
| 62728 | }else{ |
| 62729 | assert( pMem->z!=0 ); |
| 62730 | pMem->n = sqlite3Strlen30(pMem->z); |
| 62731 | pMem->enc = SQLITE_UTF8; |
| 62732 | } |
| 62733 | pMem->memType = MEM_Str; |
| 62734 | pMem++; |
| 62735 | |
| 62736 | if( p->explain==1 ){ |
| 62737 | if( sqlite3VdbeMemGrow(pMem, 4, 0) ){ |
| 62738 | assert( p->db->mallocFailed ); |
| @@ -62739,11 +62722,10 @@ | |
| 62739 | return SQLITE_ERROR; |
| 62740 | } |
| 62741 | pMem->flags = MEM_Str|MEM_Term; |
| 62742 | pMem->n = 2; |
| 62743 | sqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5); /* P5 */ |
| 62744 | pMem->memType = MEM_Str; |
| 62745 | pMem->enc = SQLITE_UTF8; |
| 62746 | pMem++; |
| 62747 | |
| 62748 | #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
| 62749 | if( sqlite3VdbeMemGrow(pMem, 500, 0) ){ |
| @@ -62750,15 +62732,13 @@ | |
| 62750 | assert( p->db->mallocFailed ); |
| 62751 | return SQLITE_ERROR; |
| 62752 | } |
| 62753 | pMem->flags = MEM_Str|MEM_Term; |
| 62754 | pMem->n = displayComment(pOp, zP4, pMem->z, 500); |
| 62755 | pMem->memType = MEM_Str; |
| 62756 | pMem->enc = SQLITE_UTF8; |
| 62757 | #else |
| 62758 | pMem->flags = MEM_Null; /* Comment */ |
| 62759 | pMem->memType = MEM_Null; |
| 62760 | #endif |
| 62761 | } |
| 62762 | |
| 62763 | p->nResColumn = 8 - 4*(p->explain-1); |
| 62764 | p->pResultSet = &p->aMem[1]; |
| @@ -64844,13 +64824,14 @@ | |
| 64844 | |
| 64845 | if( rc!=0 ){ |
| 64846 | if( pKeyInfo->aSortOrder[i] ){ |
| 64847 | rc = -rc; |
| 64848 | } |
| 64849 | assert( CORRUPT_DB |
| 64850 | || (rc<0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)<0) |
| 64851 | || (rc>0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)>0) |
| 64852 | ); |
| 64853 | assert( mem1.zMalloc==0 ); /* See comment below */ |
| 64854 | return rc; |
| 64855 | } |
| 64856 | |
| @@ -65241,11 +65222,10 @@ | |
| 65241 | if( 0==(pMem->flags & MEM_Null) ){ |
| 65242 | sqlite3_value *pRet = sqlite3ValueNew(v->db); |
| 65243 | if( pRet ){ |
| 65244 | sqlite3VdbeMemCopy((Mem *)pRet, pMem); |
| 65245 | sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8); |
| 65246 | sqlite3VdbeMemStoreType((Mem *)pRet); |
| 65247 | } |
| 65248 | return pRet; |
| 65249 | } |
| 65250 | } |
| 65251 | return 0; |
| @@ -65415,11 +65395,10 @@ | |
| 65415 | */ |
| 65416 | SQLITE_API const void *sqlite3_value_blob(sqlite3_value *pVal){ |
| 65417 | Mem *p = (Mem*)pVal; |
| 65418 | if( p->flags & (MEM_Blob|MEM_Str) ){ |
| 65419 | sqlite3VdbeMemExpandBlob(p); |
| 65420 | p->flags &= ~MEM_Str; |
| 65421 | p->flags |= MEM_Blob; |
| 65422 | return p->n ? p->z : 0; |
| 65423 | }else{ |
| 65424 | return sqlite3_value_text(pVal); |
| 65425 | } |
| @@ -65486,11 +65465,11 @@ | |
| 65486 | SQLITE_INTEGER, /* 0x1c */ |
| 65487 | SQLITE_NULL, /* 0x1d */ |
| 65488 | SQLITE_INTEGER, /* 0x1e */ |
| 65489 | SQLITE_NULL, /* 0x1f */ |
| 65490 | }; |
| 65491 | return aType[pVal->memType&0x1f]; |
| 65492 | } |
| 65493 | |
| 65494 | /**************************** sqlite3_result_ ******************************* |
| 65495 | ** The following routines are used by user-defined functions to specify |
| 65496 | ** the function result. |
| @@ -66007,10 +65986,34 @@ | |
| 66007 | Vdbe *pVm = (Vdbe *)pStmt; |
| 66008 | if( pVm==0 || pVm->pResultSet==0 ) return 0; |
| 66009 | return pVm->nResColumn; |
| 66010 | } |
| 66011 | |
| 66012 | |
| 66013 | /* |
| 66014 | ** Check to see if column iCol of the given statement is valid. If |
| 66015 | ** it is, return a pointer to the Mem for the value of that column. |
| 66016 | ** If iCol is not valid, return a pointer to a Mem which has a value |
| @@ -66023,36 +66026,15 @@ | |
| 66023 | pVm = (Vdbe *)pStmt; |
| 66024 | if( pVm && pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){ |
| 66025 | sqlite3_mutex_enter(pVm->db->mutex); |
| 66026 | pOut = &pVm->pResultSet[i]; |
| 66027 | }else{ |
| 66028 | /* If the value passed as the second argument is out of range, return |
| 66029 | ** a pointer to the following static Mem object which contains the |
| 66030 | ** value SQL NULL. Even though the Mem structure contains an element |
| 66031 | ** of type i64, on certain architectures (x86) with certain compiler |
| 66032 | ** switches (-Os), gcc may align this Mem object on a 4-byte boundary |
| 66033 | ** instead of an 8-byte one. This all works fine, except that when |
| 66034 | ** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s |
| 66035 | ** that a Mem structure is located on an 8-byte boundary. To prevent |
| 66036 | ** these assert()s from failing, when building with SQLITE_DEBUG defined |
| 66037 | ** using gcc, we force nullMem to be 8-byte aligned using the magical |
| 66038 | ** __attribute__((aligned(8))) macro. */ |
| 66039 | static const Mem nullMem |
| 66040 | #if defined(SQLITE_DEBUG) && defined(__GNUC__) |
| 66041 | __attribute__((aligned(8))) |
| 66042 | #endif |
| 66043 | = {0, "", (double)0, {0}, 0, MEM_Null, SQLITE_NULL, 0, |
| 66044 | #ifdef SQLITE_DEBUG |
| 66045 | 0, 0, /* pScopyFrom, pFiller */ |
| 66046 | #endif |
| 66047 | 0, 0 }; |
| 66048 | |
| 66049 | if( pVm && ALWAYS(pVm->db) ){ |
| 66050 | sqlite3_mutex_enter(pVm->db->mutex); |
| 66051 | sqlite3Error(pVm->db, SQLITE_RANGE, 0); |
| 66052 | } |
| 66053 | pOut = (Mem*)&nullMem; |
| 66054 | } |
| 66055 | return pOut; |
| 66056 | } |
| 66057 | |
| 66058 | /* |
| @@ -67228,11 +67210,10 @@ | |
| 67228 | SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){ |
| 67229 | int eType = sqlite3_value_type(pVal); |
| 67230 | if( eType==SQLITE_TEXT ){ |
| 67231 | Mem *pMem = (Mem*)pVal; |
| 67232 | applyNumericAffinity(pMem); |
| 67233 | sqlite3VdbeMemStoreType(pMem); |
| 67234 | eType = sqlite3_value_type(pVal); |
| 67235 | } |
| 67236 | return eType; |
| 67237 | } |
| 67238 | |
| @@ -68267,11 +68248,10 @@ | |
| 68267 | assert( memIsValid(&pMem[i]) ); |
| 68268 | Deephemeralize(&pMem[i]); |
| 68269 | assert( (pMem[i].flags & MEM_Ephem)==0 |
| 68270 | || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 ); |
| 68271 | sqlite3VdbeMemNulTerminate(&pMem[i]); |
| 68272 | sqlite3VdbeMemStoreType(&pMem[i]); |
| 68273 | REGISTER_TRACE(pOp->p1+i, &pMem[i]); |
| 68274 | } |
| 68275 | if( db->mallocFailed ) goto no_mem; |
| 68276 | |
| 68277 | /* Return SQLITE_ROW |
| @@ -68513,11 +68493,10 @@ | |
| 68513 | pArg = &aMem[pOp->p2]; |
| 68514 | for(i=0; i<n; i++, pArg++){ |
| 68515 | assert( memIsValid(pArg) ); |
| 68516 | apVal[i] = pArg; |
| 68517 | Deephemeralize(pArg); |
| 68518 | sqlite3VdbeMemStoreType(pArg); |
| 68519 | REGISTER_TRACE(pOp->p2+i, pArg); |
| 68520 | } |
| 68521 | |
| 68522 | assert( pOp->p4type==P4_FUNCDEF ); |
| 68523 | ctx.pFunc = pOp->p4.pFunc; |
| @@ -72518,11 +72497,10 @@ | |
| 72518 | assert( apVal || n==0 ); |
| 72519 | for(i=0; i<n; i++, pRec++){ |
| 72520 | assert( memIsValid(pRec) ); |
| 72521 | apVal[i] = pRec; |
| 72522 | memAboutToChange(p, pRec); |
| 72523 | sqlite3VdbeMemStoreType(pRec); |
| 72524 | } |
| 72525 | ctx.pFunc = pOp->p4.pFunc; |
| 72526 | assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) ); |
| 72527 | ctx.pMem = pMem = &aMem[pOp->p3]; |
| 72528 | pMem->n++; |
| @@ -72952,11 +72930,10 @@ | |
| 72952 | { |
| 72953 | res = 0; |
| 72954 | apArg = p->apArg; |
| 72955 | for(i = 0; i<nArg; i++){ |
| 72956 | apArg[i] = &pArgc[i+1]; |
| 72957 | sqlite3VdbeMemStoreType(apArg[i]); |
| 72958 | } |
| 72959 | |
| 72960 | p->inVtabMethod = 1; |
| 72961 | rc = pModule->xFilter(pVtabCursor, iQuery, pOp->p4.z, nArg, apArg); |
| 72962 | p->inVtabMethod = 0; |
| @@ -73159,11 +73136,10 @@ | |
| 73159 | apArg = p->apArg; |
| 73160 | pX = &aMem[pOp->p3]; |
| 73161 | for(i=0; i<nArg; i++){ |
| 73162 | assert( memIsValid(pX) ); |
| 73163 | memAboutToChange(p, pX); |
| 73164 | sqlite3VdbeMemStoreType(pX); |
| 73165 | apArg[i] = pX; |
| 73166 | pX++; |
| 73167 | } |
| 73168 | db->vtabOnConflict = pOp->p5; |
| 73169 | rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid); |
| @@ -88183,11 +88159,11 @@ | |
| 88183 | assert( nExtra>=1 ); |
| 88184 | assert( pSrc!=0 ); |
| 88185 | assert( iStart<=pSrc->nSrc ); |
| 88186 | |
| 88187 | /* Allocate additional space if needed */ |
| 88188 | if( pSrc->nSrc+nExtra>pSrc->nAlloc ){ |
| 88189 | SrcList *pNew; |
| 88190 | int nAlloc = pSrc->nSrc+nExtra; |
| 88191 | int nGot; |
| 88192 | pNew = sqlite3DbRealloc(db, pSrc, |
| 88193 | sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) ); |
| @@ -88195,19 +88171,19 @@ | |
| 88195 | assert( db->mallocFailed ); |
| 88196 | return pSrc; |
| 88197 | } |
| 88198 | pSrc = pNew; |
| 88199 | nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1; |
| 88200 | pSrc->nAlloc = (u8)nGot; |
| 88201 | } |
| 88202 | |
| 88203 | /* Move existing slots that come after the newly inserted slots |
| 88204 | ** out of the way */ |
| 88205 | for(i=pSrc->nSrc-1; i>=iStart; i--){ |
| 88206 | pSrc->a[i+nExtra] = pSrc->a[i]; |
| 88207 | } |
| 88208 | pSrc->nSrc += (i8)nExtra; |
| 88209 | |
| 88210 | /* Zero the newly allocated slots */ |
| 88211 | memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra); |
| 88212 | for(i=iStart; i<iStart+nExtra; i++){ |
| 88213 | pSrc->a[i].iCursor = -1; |
| @@ -101494,11 +101470,11 @@ | |
| 101494 | for(j=cnt=0; j<i; j++){ |
| 101495 | if( sqlite3StrICmp(aCol[j].zName, zName)==0 ){ |
| 101496 | char *zNewName; |
| 101497 | int k; |
| 101498 | for(k=nName-1; k>1 && sqlite3Isdigit(zName[k]); k--){} |
| 101499 | if( zName[k]==':' ) nName = k; |
| 101500 | zName[nName] = 0; |
| 101501 | zNewName = sqlite3MPrintf(db, "%s:%d", zName, ++cnt); |
| 101502 | sqlite3DbFree(db, zName); |
| 101503 | zName = zNewName; |
| 101504 | j = -1; |
| 101505 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -189,11 +189,11 @@ | |
| 189 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 190 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 191 | */ |
| 192 | #define SQLITE_VERSION "3.8.4" |
| 193 | #define SQLITE_VERSION_NUMBER 3008004 |
| 194 | #define SQLITE_SOURCE_ID "2014-03-05 19:04:46 0723effc9ccae7c660fb847b36ce9324e0cb5042" |
| 195 | |
| 196 | /* |
| 197 | ** CAPI3REF: Run-Time Library Version Numbers |
| 198 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 199 | ** |
| @@ -11385,12 +11385,12 @@ | |
| 11385 | ** |
| 11386 | ** In the colUsed field, the high-order bit (bit 63) is set if the table |
| 11387 | ** contains more than 63 columns and the 64-th or later column is used. |
| 11388 | */ |
| 11389 | struct SrcList { |
| 11390 | int nSrc; /* Number of tables or subqueries in the FROM clause */ |
| 11391 | u32 nAlloc; /* Number of entries allocated in a[] below */ |
| 11392 | struct SrcList_item { |
| 11393 | Schema *pSchema; /* Schema to which this item is fixed */ |
| 11394 | char *zDatabase; /* Name of database holding this table */ |
| 11395 | char *zName; /* Name of the table */ |
| 11396 | char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */ |
| @@ -13418,10 +13418,13 @@ | |
| 13418 | #ifdef SQLITE_OMIT_COMPLETE |
| 13419 | "OMIT_COMPLETE", |
| 13420 | #endif |
| 13421 | #ifdef SQLITE_OMIT_COMPOUND_SELECT |
| 13422 | "OMIT_COMPOUND_SELECT", |
| 13423 | #endif |
| 13424 | #ifdef SQLITE_OMIT_CTE |
| 13425 | "OMIT_CTE", |
| 13426 | #endif |
| 13427 | #ifdef SQLITE_OMIT_DATETIME_FUNCS |
| 13428 | "OMIT_DATETIME_FUNCS", |
| 13429 | #endif |
| 13430 | #ifdef SQLITE_OMIT_DECLTYPE |
| @@ -13803,11 +13806,10 @@ | |
| 13806 | RowSet *pRowSet; /* Used only when flags==MEM_RowSet */ |
| 13807 | VdbeFrame *pFrame; /* Used when flags==MEM_Frame */ |
| 13808 | } u; |
| 13809 | int n; /* Number of characters in string value, excluding '\0' */ |
| 13810 | u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */ |
| 13811 | u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */ |
| 13812 | #ifdef SQLITE_DEBUG |
| 13813 | Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ |
| 13814 | void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */ |
| 13815 | #endif |
| @@ -13830,10 +13832,11 @@ | |
| 13832 | #define MEM_Null 0x0001 /* Value is NULL */ |
| 13833 | #define MEM_Str 0x0002 /* Value is a string */ |
| 13834 | #define MEM_Int 0x0004 /* Value is an integer */ |
| 13835 | #define MEM_Real 0x0008 /* Value is a real number */ |
| 13836 | #define MEM_Blob 0x0010 /* Value is a BLOB */ |
| 13837 | #define MEM_AffMask 0x001f /* Mask of affinity bits */ |
| 13838 | #define MEM_RowSet 0x0020 /* Value is a RowSet object */ |
| 13839 | #define MEM_Frame 0x0040 /* Value is a VdbeFrame object */ |
| 13840 | #define MEM_Undefined 0x0080 /* Value is undefined */ |
| 13841 | #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */ |
| 13842 | #define MEM_TypeMask 0x01ff /* Mask of type bits */ |
| @@ -14069,12 +14072,10 @@ | |
| 14072 | SQLITE_PRIVATE const char *sqlite3OpcodeName(int); |
| 14073 | SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); |
| 14074 | SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); |
| 14075 | SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); |
| 14076 | SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); |
| 14077 | SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p); |
| 14078 | |
| 14079 | SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *); |
| 14080 | SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *); |
| 14081 | SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *); |
| @@ -55372,11 +55373,11 @@ | |
| 55373 | lwr = 0; |
| 55374 | upr = pPage->nCell-1; |
| 55375 | assert( biasRight==0 || biasRight==1 ); |
| 55376 | idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */ |
| 55377 | pCur->aiIdx[pCur->iPage] = (u16)idx; |
| 55378 | if( xRecordCompare==0 ){ |
| 55379 | for(;;){ |
| 55380 | i64 nCellKey; |
| 55381 | pCell = findCell(pPage, idx) + pPage->childPtrSize; |
| 55382 | if( pPage->hasData ){ |
| 55383 | while( 0x80 <= *(pCell++) ){ |
| @@ -60120,10 +60121,11 @@ | |
| 60121 | sqlite3DbFree(pMem->db, pMem->zMalloc); |
| 60122 | pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n); |
| 60123 | } |
| 60124 | if( pMem->zMalloc==0 ){ |
| 60125 | VdbeMemRelease(pMem); |
| 60126 | pMem->z = 0; |
| 60127 | pMem->flags = MEM_Null; |
| 60128 | return SQLITE_NOMEM; |
| 60129 | } |
| 60130 | } |
| 60131 | |
| @@ -60318,11 +60320,11 @@ | |
| 60320 | } |
| 60321 | |
| 60322 | /* |
| 60323 | ** Release any memory held by the Mem. This may leave the Mem in an |
| 60324 | ** inconsistent state, for example with (Mem.z==0) and |
| 60325 | ** (Mem.flags==MEM_Str). |
| 60326 | */ |
| 60327 | SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){ |
| 60328 | assert( sqlite3VdbeCheckMemInvariants(p) ); |
| 60329 | VdbeMemRelease(p); |
| 60330 | if( p->zMalloc ){ |
| @@ -60510,11 +60512,10 @@ | |
| 60512 | } |
| 60513 | if( pMem->flags & MEM_RowSet ){ |
| 60514 | sqlite3RowSetClear(pMem->u.pRowSet); |
| 60515 | } |
| 60516 | MemSetTypeFlag(pMem, MEM_Null); |
| 60517 | } |
| 60518 | SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){ |
| 60519 | sqlite3VdbeMemSetNull((Mem*)p); |
| 60520 | } |
| 60521 | |
| @@ -60523,11 +60524,10 @@ | |
| 60524 | ** n containing all zeros. |
| 60525 | */ |
| 60526 | SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ |
| 60527 | sqlite3VdbeMemRelease(pMem); |
| 60528 | pMem->flags = MEM_Blob|MEM_Zero; |
| 60529 | pMem->n = 0; |
| 60530 | if( n<0 ) n = 0; |
| 60531 | pMem->u.nZero = n; |
| 60532 | pMem->enc = SQLITE_UTF8; |
| 60533 | |
| @@ -60546,11 +60546,10 @@ | |
| 60546 | */ |
| 60547 | SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){ |
| 60548 | sqlite3VdbeMemRelease(pMem); |
| 60549 | pMem->u.i = val; |
| 60550 | pMem->flags = MEM_Int; |
| 60551 | } |
| 60552 | |
| 60553 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 60554 | /* |
| 60555 | ** Delete any previous value and set the value stored in *pMem to val, |
| @@ -60561,11 +60560,10 @@ | |
| 60560 | sqlite3VdbeMemSetNull(pMem); |
| 60561 | }else{ |
| 60562 | sqlite3VdbeMemRelease(pMem); |
| 60563 | pMem->r = val; |
| 60564 | pMem->flags = MEM_Real; |
| 60565 | } |
| 60566 | } |
| 60567 | #endif |
| 60568 | |
| 60569 | /* |
| @@ -60770,11 +60768,10 @@ | |
| 60768 | } |
| 60769 | |
| 60770 | pMem->n = nByte; |
| 60771 | pMem->flags = flags; |
| 60772 | pMem->enc = (enc==0 ? SQLITE_UTF8 : enc); |
| 60773 | |
| 60774 | #ifndef SQLITE_OMIT_UTF16 |
| 60775 | if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){ |
| 60776 | return SQLITE_NOMEM; |
| 60777 | } |
| @@ -60836,11 +60833,10 @@ | |
| 60833 | } |
| 60834 | if( rc==SQLITE_OK ){ |
| 60835 | pMem->z[amt] = 0; |
| 60836 | pMem->z[amt+1] = 0; |
| 60837 | pMem->flags = MEM_Blob|MEM_Term; |
| 60838 | pMem->n = (int)amt; |
| 60839 | }else{ |
| 60840 | sqlite3VdbeMemRelease(pMem); |
| 60841 | } |
| 60842 | } |
| @@ -60899,11 +60895,10 @@ | |
| 60895 | */ |
| 60896 | SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *db){ |
| 60897 | Mem *p = sqlite3DbMallocZero(db, sizeof(*p)); |
| 60898 | if( p ){ |
| 60899 | p->flags = MEM_Null; |
| 60900 | p->db = db; |
| 60901 | } |
| 60902 | return p; |
| 60903 | } |
| 60904 | |
| @@ -60948,11 +60943,10 @@ | |
| 60943 | assert( pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField==nCol ); |
| 60944 | assert( pRec->pKeyInfo->enc==ENC(db) ); |
| 60945 | pRec->aMem = (Mem *)((u8*)pRec + ROUND8(sizeof(UnpackedRecord))); |
| 60946 | for(i=0; i<nCol; i++){ |
| 60947 | pRec->aMem[i].flags = MEM_Null; |
| 60948 | pRec->aMem[i].db = db; |
| 60949 | } |
| 60950 | }else{ |
| 60951 | sqlite3DbFree(db, pRec); |
| 60952 | pRec = 0; |
| @@ -61021,11 +61015,10 @@ | |
| 61015 | sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt); |
| 61016 | }else{ |
| 61017 | zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); |
| 61018 | if( zVal==0 ) goto no_mem; |
| 61019 | sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); |
| 61020 | } |
| 61021 | if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){ |
| 61022 | sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); |
| 61023 | }else{ |
| 61024 | sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8); |
| @@ -61039,13 +61032,13 @@ | |
| 61032 | if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) |
| 61033 | && pVal!=0 |
| 61034 | ){ |
| 61035 | sqlite3VdbeMemNumerify(pVal); |
| 61036 | if( pVal->u.i==SMALLEST_INT64 ){ |
| 61037 | pVal->flags &= ~MEM_Int; |
| 61038 | pVal->flags |= MEM_Real; |
| 61039 | pVal->r = (double)SMALLEST_INT64; |
| 61040 | }else{ |
| 61041 | pVal->u.i = -pVal->u.i; |
| 61042 | } |
| 61043 | pVal->r = -pVal->r; |
| 61044 | sqlite3ValueApplyAffinity(pVal, affinity, enc); |
| @@ -61067,13 +61060,10 @@ | |
| 61060 | sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2, |
| 61061 | 0, SQLITE_DYNAMIC); |
| 61062 | } |
| 61063 | #endif |
| 61064 | |
| 61065 | *ppVal = pVal; |
| 61066 | return rc; |
| 61067 | |
| 61068 | no_mem: |
| 61069 | db->mallocFailed = 1; |
| @@ -61233,11 +61223,10 @@ | |
| 61223 | rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); |
| 61224 | if( rc==SQLITE_OK ){ |
| 61225 | sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); |
| 61226 | } |
| 61227 | pVal->db = pParse->db; |
| 61228 | } |
| 61229 | } |
| 61230 | }else{ |
| 61231 | rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, &alloc); |
| 61232 | } |
| @@ -62668,19 +62657,17 @@ | |
| 62657 | } |
| 62658 | pOp = &apSub[j]->aOp[i]; |
| 62659 | } |
| 62660 | if( p->explain==1 ){ |
| 62661 | pMem->flags = MEM_Int; |
| 62662 | pMem->u.i = i; /* Program counter */ |
| 62663 | pMem++; |
| 62664 | |
| 62665 | pMem->flags = MEM_Static|MEM_Str|MEM_Term; |
| 62666 | pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */ |
| 62667 | assert( pMem->z!=0 ); |
| 62668 | pMem->n = sqlite3Strlen30(pMem->z); |
| 62669 | pMem->enc = SQLITE_UTF8; |
| 62670 | pMem++; |
| 62671 | |
| 62672 | /* When an OP_Program opcode is encounter (the only opcode that has |
| 62673 | ** a P4_SUBPROGRAM argument), expand the size of the array of subprograms |
| @@ -62702,21 +62689,18 @@ | |
| 62689 | } |
| 62690 | } |
| 62691 | |
| 62692 | pMem->flags = MEM_Int; |
| 62693 | pMem->u.i = pOp->p1; /* P1 */ |
| 62694 | pMem++; |
| 62695 | |
| 62696 | pMem->flags = MEM_Int; |
| 62697 | pMem->u.i = pOp->p2; /* P2 */ |
| 62698 | pMem++; |
| 62699 | |
| 62700 | pMem->flags = MEM_Int; |
| 62701 | pMem->u.i = pOp->p3; /* P3 */ |
| 62702 | pMem++; |
| 62703 | |
| 62704 | if( sqlite3VdbeMemGrow(pMem, 32, 0) ){ /* P4 */ |
| 62705 | assert( p->db->mallocFailed ); |
| 62706 | return SQLITE_ERROR; |
| @@ -62728,11 +62712,10 @@ | |
| 62712 | }else{ |
| 62713 | assert( pMem->z!=0 ); |
| 62714 | pMem->n = sqlite3Strlen30(pMem->z); |
| 62715 | pMem->enc = SQLITE_UTF8; |
| 62716 | } |
| 62717 | pMem++; |
| 62718 | |
| 62719 | if( p->explain==1 ){ |
| 62720 | if( sqlite3VdbeMemGrow(pMem, 4, 0) ){ |
| 62721 | assert( p->db->mallocFailed ); |
| @@ -62739,11 +62722,10 @@ | |
| 62722 | return SQLITE_ERROR; |
| 62723 | } |
| 62724 | pMem->flags = MEM_Str|MEM_Term; |
| 62725 | pMem->n = 2; |
| 62726 | sqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5); /* P5 */ |
| 62727 | pMem->enc = SQLITE_UTF8; |
| 62728 | pMem++; |
| 62729 | |
| 62730 | #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
| 62731 | if( sqlite3VdbeMemGrow(pMem, 500, 0) ){ |
| @@ -62750,15 +62732,13 @@ | |
| 62732 | assert( p->db->mallocFailed ); |
| 62733 | return SQLITE_ERROR; |
| 62734 | } |
| 62735 | pMem->flags = MEM_Str|MEM_Term; |
| 62736 | pMem->n = displayComment(pOp, zP4, pMem->z, 500); |
| 62737 | pMem->enc = SQLITE_UTF8; |
| 62738 | #else |
| 62739 | pMem->flags = MEM_Null; /* Comment */ |
| 62740 | #endif |
| 62741 | } |
| 62742 | |
| 62743 | p->nResColumn = 8 - 4*(p->explain-1); |
| 62744 | p->pResultSet = &p->aMem[1]; |
| @@ -64844,13 +64824,14 @@ | |
| 64824 | |
| 64825 | if( rc!=0 ){ |
| 64826 | if( pKeyInfo->aSortOrder[i] ){ |
| 64827 | rc = -rc; |
| 64828 | } |
| 64829 | assert( CORRUPT_DB |
| 64830 | || (rc<0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)<0) |
| 64831 | || (rc>0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)>0) |
| 64832 | || pKeyInfo->db->mallocFailed |
| 64833 | ); |
| 64834 | assert( mem1.zMalloc==0 ); /* See comment below */ |
| 64835 | return rc; |
| 64836 | } |
| 64837 | |
| @@ -65241,11 +65222,10 @@ | |
| 65222 | if( 0==(pMem->flags & MEM_Null) ){ |
| 65223 | sqlite3_value *pRet = sqlite3ValueNew(v->db); |
| 65224 | if( pRet ){ |
| 65225 | sqlite3VdbeMemCopy((Mem *)pRet, pMem); |
| 65226 | sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8); |
| 65227 | } |
| 65228 | return pRet; |
| 65229 | } |
| 65230 | } |
| 65231 | return 0; |
| @@ -65415,11 +65395,10 @@ | |
| 65395 | */ |
| 65396 | SQLITE_API const void *sqlite3_value_blob(sqlite3_value *pVal){ |
| 65397 | Mem *p = (Mem*)pVal; |
| 65398 | if( p->flags & (MEM_Blob|MEM_Str) ){ |
| 65399 | sqlite3VdbeMemExpandBlob(p); |
| 65400 | p->flags |= MEM_Blob; |
| 65401 | return p->n ? p->z : 0; |
| 65402 | }else{ |
| 65403 | return sqlite3_value_text(pVal); |
| 65404 | } |
| @@ -65486,11 +65465,11 @@ | |
| 65465 | SQLITE_INTEGER, /* 0x1c */ |
| 65466 | SQLITE_NULL, /* 0x1d */ |
| 65467 | SQLITE_INTEGER, /* 0x1e */ |
| 65468 | SQLITE_NULL, /* 0x1f */ |
| 65469 | }; |
| 65470 | return aType[pVal->flags&MEM_AffMask]; |
| 65471 | } |
| 65472 | |
| 65473 | /**************************** sqlite3_result_ ******************************* |
| 65474 | ** The following routines are used by user-defined functions to specify |
| 65475 | ** the function result. |
| @@ -66007,10 +65986,34 @@ | |
| 65986 | Vdbe *pVm = (Vdbe *)pStmt; |
| 65987 | if( pVm==0 || pVm->pResultSet==0 ) return 0; |
| 65988 | return pVm->nResColumn; |
| 65989 | } |
| 65990 | |
| 65991 | /* |
| 65992 | ** Return a pointer to static memory containing an SQL NULL value. |
| 65993 | */ |
| 65994 | static const Mem *columnNullValue(void){ |
| 65995 | /* Even though the Mem structure contains an element |
| 65996 | ** of type i64, on certain architectures (x86) with certain compiler |
| 65997 | ** switches (-Os), gcc may align this Mem object on a 4-byte boundary |
| 65998 | ** instead of an 8-byte one. This all works fine, except that when |
| 65999 | ** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s |
| 66000 | ** that a Mem structure is located on an 8-byte boundary. To prevent |
| 66001 | ** these assert()s from failing, when building with SQLITE_DEBUG defined |
| 66002 | ** using gcc, we force nullMem to be 8-byte aligned using the magical |
| 66003 | ** __attribute__((aligned(8))) macro. */ |
| 66004 | static const Mem nullMem |
| 66005 | #if defined(SQLITE_DEBUG) && defined(__GNUC__) |
| 66006 | __attribute__((aligned(8))) |
| 66007 | #endif |
| 66008 | = {0, "", (double)0, {0}, 0, MEM_Null, 0, |
| 66009 | #ifdef SQLITE_DEBUG |
| 66010 | 0, 0, /* pScopyFrom, pFiller */ |
| 66011 | #endif |
| 66012 | 0, 0 }; |
| 66013 | return &nullMem; |
| 66014 | } |
| 66015 | |
| 66016 | /* |
| 66017 | ** Check to see if column iCol of the given statement is valid. If |
| 66018 | ** it is, return a pointer to the Mem for the value of that column. |
| 66019 | ** If iCol is not valid, return a pointer to a Mem which has a value |
| @@ -66023,36 +66026,15 @@ | |
| 66026 | pVm = (Vdbe *)pStmt; |
| 66027 | if( pVm && pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){ |
| 66028 | sqlite3_mutex_enter(pVm->db->mutex); |
| 66029 | pOut = &pVm->pResultSet[i]; |
| 66030 | }else{ |
| 66031 | if( pVm && ALWAYS(pVm->db) ){ |
| 66032 | sqlite3_mutex_enter(pVm->db->mutex); |
| 66033 | sqlite3Error(pVm->db, SQLITE_RANGE, 0); |
| 66034 | } |
| 66035 | pOut = (Mem*)columnNullValue(); |
| 66036 | } |
| 66037 | return pOut; |
| 66038 | } |
| 66039 | |
| 66040 | /* |
| @@ -67228,11 +67210,10 @@ | |
| 67210 | SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){ |
| 67211 | int eType = sqlite3_value_type(pVal); |
| 67212 | if( eType==SQLITE_TEXT ){ |
| 67213 | Mem *pMem = (Mem*)pVal; |
| 67214 | applyNumericAffinity(pMem); |
| 67215 | eType = sqlite3_value_type(pVal); |
| 67216 | } |
| 67217 | return eType; |
| 67218 | } |
| 67219 | |
| @@ -68267,11 +68248,10 @@ | |
| 68248 | assert( memIsValid(&pMem[i]) ); |
| 68249 | Deephemeralize(&pMem[i]); |
| 68250 | assert( (pMem[i].flags & MEM_Ephem)==0 |
| 68251 | || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 ); |
| 68252 | sqlite3VdbeMemNulTerminate(&pMem[i]); |
| 68253 | REGISTER_TRACE(pOp->p1+i, &pMem[i]); |
| 68254 | } |
| 68255 | if( db->mallocFailed ) goto no_mem; |
| 68256 | |
| 68257 | /* Return SQLITE_ROW |
| @@ -68513,11 +68493,10 @@ | |
| 68493 | pArg = &aMem[pOp->p2]; |
| 68494 | for(i=0; i<n; i++, pArg++){ |
| 68495 | assert( memIsValid(pArg) ); |
| 68496 | apVal[i] = pArg; |
| 68497 | Deephemeralize(pArg); |
| 68498 | REGISTER_TRACE(pOp->p2+i, pArg); |
| 68499 | } |
| 68500 | |
| 68501 | assert( pOp->p4type==P4_FUNCDEF ); |
| 68502 | ctx.pFunc = pOp->p4.pFunc; |
| @@ -72518,11 +72497,10 @@ | |
| 72497 | assert( apVal || n==0 ); |
| 72498 | for(i=0; i<n; i++, pRec++){ |
| 72499 | assert( memIsValid(pRec) ); |
| 72500 | apVal[i] = pRec; |
| 72501 | memAboutToChange(p, pRec); |
| 72502 | } |
| 72503 | ctx.pFunc = pOp->p4.pFunc; |
| 72504 | assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) ); |
| 72505 | ctx.pMem = pMem = &aMem[pOp->p3]; |
| 72506 | pMem->n++; |
| @@ -72952,11 +72930,10 @@ | |
| 72930 | { |
| 72931 | res = 0; |
| 72932 | apArg = p->apArg; |
| 72933 | for(i = 0; i<nArg; i++){ |
| 72934 | apArg[i] = &pArgc[i+1]; |
| 72935 | } |
| 72936 | |
| 72937 | p->inVtabMethod = 1; |
| 72938 | rc = pModule->xFilter(pVtabCursor, iQuery, pOp->p4.z, nArg, apArg); |
| 72939 | p->inVtabMethod = 0; |
| @@ -73159,11 +73136,10 @@ | |
| 73136 | apArg = p->apArg; |
| 73137 | pX = &aMem[pOp->p3]; |
| 73138 | for(i=0; i<nArg; i++){ |
| 73139 | assert( memIsValid(pX) ); |
| 73140 | memAboutToChange(p, pX); |
| 73141 | apArg[i] = pX; |
| 73142 | pX++; |
| 73143 | } |
| 73144 | db->vtabOnConflict = pOp->p5; |
| 73145 | rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid); |
| @@ -88183,11 +88159,11 @@ | |
| 88159 | assert( nExtra>=1 ); |
| 88160 | assert( pSrc!=0 ); |
| 88161 | assert( iStart<=pSrc->nSrc ); |
| 88162 | |
| 88163 | /* Allocate additional space if needed */ |
| 88164 | if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){ |
| 88165 | SrcList *pNew; |
| 88166 | int nAlloc = pSrc->nSrc+nExtra; |
| 88167 | int nGot; |
| 88168 | pNew = sqlite3DbRealloc(db, pSrc, |
| 88169 | sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) ); |
| @@ -88195,19 +88171,19 @@ | |
| 88171 | assert( db->mallocFailed ); |
| 88172 | return pSrc; |
| 88173 | } |
| 88174 | pSrc = pNew; |
| 88175 | nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1; |
| 88176 | pSrc->nAlloc = nGot; |
| 88177 | } |
| 88178 | |
| 88179 | /* Move existing slots that come after the newly inserted slots |
| 88180 | ** out of the way */ |
| 88181 | for(i=pSrc->nSrc-1; i>=iStart; i--){ |
| 88182 | pSrc->a[i+nExtra] = pSrc->a[i]; |
| 88183 | } |
| 88184 | pSrc->nSrc += nExtra; |
| 88185 | |
| 88186 | /* Zero the newly allocated slots */ |
| 88187 | memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra); |
| 88188 | for(i=iStart; i<iStart+nExtra; i++){ |
| 88189 | pSrc->a[i].iCursor = -1; |
| @@ -101494,11 +101470,11 @@ | |
| 101470 | for(j=cnt=0; j<i; j++){ |
| 101471 | if( sqlite3StrICmp(aCol[j].zName, zName)==0 ){ |
| 101472 | char *zNewName; |
| 101473 | int k; |
| 101474 | for(k=nName-1; k>1 && sqlite3Isdigit(zName[k]); k--){} |
| 101475 | if( k>=0 && zName[k]==':' ) nName = k; |
| 101476 | zName[nName] = 0; |
| 101477 | zNewName = sqlite3MPrintf(db, "%s:%d", zName, ++cnt); |
| 101478 | sqlite3DbFree(db, zName); |
| 101479 | zName = zNewName; |
| 101480 | j = -1; |
| 101481 |
+1
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -107,11 +107,11 @@ | ||
| 107 | 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | 109 | */ |
| 110 | 110 | #define SQLITE_VERSION "3.8.4" |
| 111 | 111 | #define SQLITE_VERSION_NUMBER 3008004 |
| 112 | -#define SQLITE_SOURCE_ID "2014-03-04 13:18:23 9830c343bc954b828f6ca752f8ae63e2c0a980c1" | |
| 112 | +#define SQLITE_SOURCE_ID "2014-03-05 19:04:46 0723effc9ccae7c660fb847b36ce9324e0cb5042" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| 118 | 118 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.8.4" |
| 111 | #define SQLITE_VERSION_NUMBER 3008004 |
| 112 | #define SQLITE_SOURCE_ID "2014-03-04 13:18:23 9830c343bc954b828f6ca752f8ae63e2c0a980c1" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| 118 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.8.4" |
| 111 | #define SQLITE_VERSION_NUMBER 3008004 |
| 112 | #define SQLITE_SOURCE_ID "2014-03-05 19:04:46 0723effc9ccae7c660fb847b36ce9324e0cb5042" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| 118 |