|
@@ -327,7 +327,7 @@ extern "C" {
|
|
|
*/
|
|
*/
|
|
|
#define SQLITE_VERSION "3.10.0"
|
|
#define SQLITE_VERSION "3.10.0"
|
|
|
#define SQLITE_VERSION_NUMBER 3010000
|
|
#define SQLITE_VERSION_NUMBER 3010000
|
|
|
-#define SQLITE_SOURCE_ID "2015-12-30 01:07:02 7f386a9332237100a345035ca213327e21d95855"
|
|
|
|
|
|
|
+#define SQLITE_SOURCE_ID "2016-01-04 04:44:31 22abe08038cc7b66cbc25e733246d210197c9215"
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -12376,7 +12376,7 @@ struct Column {
|
|
|
char *zColl; /* Collating sequence. If NULL, use the default */
|
|
char *zColl; /* Collating sequence. If NULL, use the default */
|
|
|
u8 notNull; /* An OE_ code for handling a NOT NULL constraint */
|
|
u8 notNull; /* An OE_ code for handling a NOT NULL constraint */
|
|
|
char affinity; /* One of the SQLITE_AFF_... values */
|
|
char affinity; /* One of the SQLITE_AFF_... values */
|
|
|
- u8 szEst; /* Estimated size of this column. INT==1 */
|
|
|
|
|
|
|
+ u8 szEst; /* Estimated size of value in this column. sizeof(INT)==1 */
|
|
|
u8 colFlags; /* Boolean properties. See COLFLAG_ defines below */
|
|
u8 colFlags; /* Boolean properties. See COLFLAG_ defines below */
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -12786,7 +12786,7 @@ struct Index {
|
|
|
Index *pNext; /* The next index associated with the same table */
|
|
Index *pNext; /* The next index associated with the same table */
|
|
|
Schema *pSchema; /* Schema containing this index */
|
|
Schema *pSchema; /* Schema containing this index */
|
|
|
u8 *aSortOrder; /* for each column: True==DESC, False==ASC */
|
|
u8 *aSortOrder; /* for each column: True==DESC, False==ASC */
|
|
|
- char **azColl; /* Array of collation sequence names for index */
|
|
|
|
|
|
|
+ const char **azColl; /* Array of collation sequence names for index */
|
|
|
Expr *pPartIdxWhere; /* WHERE clause for partial indices */
|
|
Expr *pPartIdxWhere; /* WHERE clause for partial indices */
|
|
|
ExprList *aColExpr; /* Column expressions */
|
|
ExprList *aColExpr; /* Column expressions */
|
|
|
int tnum; /* DB Page containing root of this index */
|
|
int tnum; /* DB Page containing root of this index */
|
|
@@ -13586,6 +13586,7 @@ struct Parse {
|
|
|
int nSet; /* Number of sets used so far */
|
|
int nSet; /* Number of sets used so far */
|
|
|
int nOnce; /* Number of OP_Once instructions so far */
|
|
int nOnce; /* Number of OP_Once instructions so far */
|
|
|
int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
|
|
int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
|
|
|
|
|
+ int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
|
|
|
int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */
|
|
int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */
|
|
|
int ckBase; /* Base register of data during check constraints */
|
|
int ckBase; /* Base register of data during check constraints */
|
|
|
int iSelfTab; /* Table of an index whose exprs are being coded */
|
|
int iSelfTab; /* Table of an index whose exprs are being coded */
|
|
@@ -14202,7 +14203,11 @@ SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *, int);
|
|
|
SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table*);
|
|
SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table*);
|
|
|
SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index*, i16);
|
|
SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index*, i16);
|
|
|
SQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
|
|
SQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
|
|
|
-SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table*, Column*);
|
|
|
|
|
|
|
+#if SQLITE_ENABLE_HIDDEN_COLUMNS
|
|
|
|
|
+SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table*, Column*);
|
|
|
|
|
+#else
|
|
|
|
|
+# define sqlite3ColumnPropertiesFromName(T,C) /* no-op */
|
|
|
|
|
+#endif
|
|
|
SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*);
|
|
SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*);
|
|
|
SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int);
|
|
SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int);
|
|
|
SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
|
|
SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
|
|
@@ -14554,6 +14559,7 @@ SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value
|
|
|
SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
|
|
SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
|
|
|
#ifndef SQLITE_AMALGAMATION
|
|
#ifndef SQLITE_AMALGAMATION
|
|
|
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];
|
|
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];
|
|
|
|
|
+SQLITE_PRIVATE const char sqlite3StrBINARY[];
|
|
|
SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];
|
|
SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];
|
|
|
SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];
|
|
SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];
|
|
|
SQLITE_PRIVATE const Token sqlite3IntTokens[];
|
|
SQLITE_PRIVATE const Token sqlite3IntTokens[];
|
|
@@ -15158,6 +15164,11 @@ SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
|
|
|
*/
|
|
*/
|
|
|
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
|
|
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
|
|
|
|
|
|
|
|
|
|
+/*
|
|
|
|
|
+** Name of the default collating sequence
|
|
|
|
|
+*/
|
|
|
|
|
+SQLITE_PRIVATE const char sqlite3StrBINARY[] = "BINARY";
|
|
|
|
|
+
|
|
|
/************** End of global.c **********************************************/
|
|
/************** End of global.c **********************************************/
|
|
|
/************** Begin file ctime.c *******************************************/
|
|
/************** Begin file ctime.c *******************************************/
|
|
|
/*
|
|
/*
|
|
@@ -23481,7 +23492,12 @@ SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char *zFormat, va_list ap
|
|
|
#ifndef SQLITE_OMIT_AUTOINIT
|
|
#ifndef SQLITE_OMIT_AUTOINIT
|
|
|
if( sqlite3_initialize() ) return 0;
|
|
if( sqlite3_initialize() ) return 0;
|
|
|
#endif
|
|
#endif
|
|
|
|
|
+#if SQLITE_MAX_LENGTH<0x40000000
|
|
|
sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);
|
|
sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);
|
|
|
|
|
+#else
|
|
|
|
|
+ sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), 0x3fffffff);
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
sqlite3VXPrintf(&acc, 0, zFormat, ap);
|
|
sqlite3VXPrintf(&acc, 0, zFormat, ap);
|
|
|
z = sqlite3StrAccumFinish(&acc);
|
|
z = sqlite3StrAccumFinish(&acc);
|
|
|
return z;
|
|
return z;
|
|
@@ -54756,7 +54772,6 @@ struct CellInfo {
|
|
|
u8 *pPayload; /* Pointer to the start of payload */
|
|
u8 *pPayload; /* Pointer to the start of payload */
|
|
|
u32 nPayload; /* Bytes of payload */
|
|
u32 nPayload; /* Bytes of payload */
|
|
|
u16 nLocal; /* Amount of payload held locally, not on overflow */
|
|
u16 nLocal; /* Amount of payload held locally, not on overflow */
|
|
|
- u16 iOverflow; /* Offset to overflow page number. Zero if no overflow */
|
|
|
|
|
u16 nSize; /* Size of the cell content on the main b-tree page */
|
|
u16 nSize; /* Size of the cell content on the main b-tree page */
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -56337,8 +56352,7 @@ static SQLITE_NOINLINE void btreeParseCellAdjustSizeForOverflow(
|
|
|
}else{
|
|
}else{
|
|
|
pInfo->nLocal = (u16)minLocal;
|
|
pInfo->nLocal = (u16)minLocal;
|
|
|
}
|
|
}
|
|
|
- pInfo->iOverflow = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell);
|
|
|
|
|
- pInfo->nSize = pInfo->iOverflow + 4;
|
|
|
|
|
|
|
+ pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -56370,7 +56384,6 @@ static void btreeParseCellPtrNoPayload(
|
|
|
pInfo->nSize = 4 + getVarint(&pCell[4], (u64*)&pInfo->nKey);
|
|
pInfo->nSize = 4 + getVarint(&pCell[4], (u64*)&pInfo->nKey);
|
|
|
pInfo->nPayload = 0;
|
|
pInfo->nPayload = 0;
|
|
|
pInfo->nLocal = 0;
|
|
pInfo->nLocal = 0;
|
|
|
- pInfo->iOverflow = 0;
|
|
|
|
|
pInfo->pPayload = 0;
|
|
pInfo->pPayload = 0;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -56440,7 +56453,6 @@ static void btreeParseCellPtr(
|
|
|
pInfo->nSize = nPayload + (u16)(pIter - pCell);
|
|
pInfo->nSize = nPayload + (u16)(pIter - pCell);
|
|
|
if( pInfo->nSize<4 ) pInfo->nSize = 4;
|
|
if( pInfo->nSize<4 ) pInfo->nSize = 4;
|
|
|
pInfo->nLocal = (u16)nPayload;
|
|
pInfo->nLocal = (u16)nPayload;
|
|
|
- pInfo->iOverflow = 0;
|
|
|
|
|
}else{
|
|
}else{
|
|
|
btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
|
|
btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
|
|
|
}
|
|
}
|
|
@@ -56479,7 +56491,6 @@ static void btreeParseCellPtrIndex(
|
|
|
pInfo->nSize = nPayload + (u16)(pIter - pCell);
|
|
pInfo->nSize = nPayload + (u16)(pIter - pCell);
|
|
|
if( pInfo->nSize<4 ) pInfo->nSize = 4;
|
|
if( pInfo->nSize<4 ) pInfo->nSize = 4;
|
|
|
pInfo->nLocal = (u16)nPayload;
|
|
pInfo->nLocal = (u16)nPayload;
|
|
|
- pInfo->iOverflow = 0;
|
|
|
|
|
}else{
|
|
}else{
|
|
|
btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
|
|
btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
|
|
|
}
|
|
}
|
|
@@ -56595,8 +56606,8 @@ static void ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell, int *pRC){
|
|
|
if( *pRC ) return;
|
|
if( *pRC ) return;
|
|
|
assert( pCell!=0 );
|
|
assert( pCell!=0 );
|
|
|
pPage->xParseCell(pPage, pCell, &info);
|
|
pPage->xParseCell(pPage, pCell, &info);
|
|
|
- if( info.iOverflow ){
|
|
|
|
|
- Pgno ovfl = get4byte(&pCell[info.iOverflow]);
|
|
|
|
|
|
|
+ if( info.nLocal<info.nPayload ){
|
|
|
|
|
+ Pgno ovfl = get4byte(&pCell[info.nSize-4]);
|
|
|
ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);
|
|
ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -58634,11 +58645,11 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
|
|
|
if( eType==PTRMAP_OVERFLOW1 ){
|
|
if( eType==PTRMAP_OVERFLOW1 ){
|
|
|
CellInfo info;
|
|
CellInfo info;
|
|
|
pPage->xParseCell(pPage, pCell, &info);
|
|
pPage->xParseCell(pPage, pCell, &info);
|
|
|
- if( info.iOverflow
|
|
|
|
|
- && pCell+info.iOverflow+3<=pPage->aData+pPage->maskPage
|
|
|
|
|
- && iFrom==get4byte(&pCell[info.iOverflow])
|
|
|
|
|
|
|
+ if( info.nLocal<info.nPayload
|
|
|
|
|
+ && pCell+info.nSize-1<=pPage->aData+pPage->maskPage
|
|
|
|
|
+ && iFrom==get4byte(pCell+info.nSize-4)
|
|
|
){
|
|
){
|
|
|
- put4byte(&pCell[info.iOverflow], iTo);
|
|
|
|
|
|
|
+ put4byte(pCell+info.nSize-4, iTo);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
@@ -61280,13 +61291,13 @@ static int clearCell(
|
|
|
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
|
|
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
|
|
|
pPage->xParseCell(pPage, pCell, &info);
|
|
pPage->xParseCell(pPage, pCell, &info);
|
|
|
*pnSize = info.nSize;
|
|
*pnSize = info.nSize;
|
|
|
- if( info.iOverflow==0 ){
|
|
|
|
|
|
|
+ if( info.nLocal==info.nPayload ){
|
|
|
return SQLITE_OK; /* No overflow pages. Return without doing anything */
|
|
return SQLITE_OK; /* No overflow pages. Return without doing anything */
|
|
|
}
|
|
}
|
|
|
- if( pCell+info.iOverflow+3 > pPage->aData+pPage->maskPage ){
|
|
|
|
|
|
|
+ if( pCell+info.nSize-1 > pPage->aData+pPage->maskPage ){
|
|
|
return SQLITE_CORRUPT_BKPT; /* Cell extends past end of page */
|
|
return SQLITE_CORRUPT_BKPT; /* Cell extends past end of page */
|
|
|
}
|
|
}
|
|
|
- ovflPgno = get4byte(&pCell[info.iOverflow]);
|
|
|
|
|
|
|
+ ovflPgno = get4byte(pCell + info.nSize - 4);
|
|
|
assert( pBt->usableSize > 4 );
|
|
assert( pBt->usableSize > 4 );
|
|
|
ovflPageSize = pBt->usableSize - 4;
|
|
ovflPageSize = pBt->usableSize - 4;
|
|
|
nOvfl = (info.nPayload - info.nLocal + ovflPageSize - 1)/ovflPageSize;
|
|
nOvfl = (info.nPayload - info.nLocal + ovflPageSize - 1)/ovflPageSize;
|
|
@@ -61435,7 +61446,6 @@ static int fillInCell(
|
|
|
assert( info.nKey==nKey );
|
|
assert( info.nKey==nKey );
|
|
|
assert( *pnSize == info.nSize );
|
|
assert( *pnSize == info.nSize );
|
|
|
assert( spaceLeft == info.nLocal );
|
|
assert( spaceLeft == info.nLocal );
|
|
|
- assert( pPrior == &pCell[info.iOverflow] );
|
|
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
@@ -62145,8 +62155,8 @@ static int ptrmapCheckPages(MemPage **apPage, int nPage){
|
|
|
|
|
|
|
|
z = findCell(pPage, j);
|
|
z = findCell(pPage, j);
|
|
|
pPage->xParseCell(pPage, z, &info);
|
|
pPage->xParseCell(pPage, z, &info);
|
|
|
- if( info.iOverflow ){
|
|
|
|
|
- Pgno ovfl = get4byte(&z[info.iOverflow]);
|
|
|
|
|
|
|
+ if( info.nLocal<info.nPayload ){
|
|
|
|
|
+ Pgno ovfl = get4byte(&z[info.nSize-4]);
|
|
|
ptrmapGet(pBt, ovfl, &e, &n);
|
|
ptrmapGet(pBt, ovfl, &e, &n);
|
|
|
assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 );
|
|
assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 );
|
|
|
}
|
|
}
|
|
@@ -63512,7 +63522,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, int bPreserve){
|
|
|
|
|
|
|
|
if( rc==SQLITE_OK ){
|
|
if( rc==SQLITE_OK ){
|
|
|
if( bSkipnext ){
|
|
if( bSkipnext ){
|
|
|
- assert( bPreserve && pCur->iPage==iCellDepth );
|
|
|
|
|
|
|
+ assert( bPreserve && (pCur->iPage==iCellDepth || CORRUPT_DB) );
|
|
|
assert( pPage==pCur->apPage[pCur->iPage] );
|
|
assert( pPage==pCur->apPage[pCur->iPage] );
|
|
|
assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );
|
|
assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );
|
|
|
pCur->eState = CURSOR_SKIPNEXT;
|
|
pCur->eState = CURSOR_SKIPNEXT;
|
|
@@ -64452,9 +64462,9 @@ static int checkTreePage(
|
|
|
if( info.nPayload>info.nLocal ){
|
|
if( info.nPayload>info.nLocal ){
|
|
|
int nPage; /* Number of pages on the overflow chain */
|
|
int nPage; /* Number of pages on the overflow chain */
|
|
|
Pgno pgnoOvfl; /* First page of the overflow chain */
|
|
Pgno pgnoOvfl; /* First page of the overflow chain */
|
|
|
- assert( pc + info.iOverflow <= usableSize );
|
|
|
|
|
|
|
+ assert( pc + info.nSize - 4 <= usableSize );
|
|
|
nPage = (info.nPayload - info.nLocal + usableSize - 5)/(usableSize - 4);
|
|
nPage = (info.nPayload - info.nLocal + usableSize - 5)/(usableSize - 4);
|
|
|
- pgnoOvfl = get4byte(&pCell[info.iOverflow]);
|
|
|
|
|
|
|
+ pgnoOvfl = get4byte(&pCell[info.nSize - 4]);
|
|
|
#ifndef SQLITE_OMIT_AUTOVACUUM
|
|
#ifndef SQLITE_OMIT_AUTOVACUUM
|
|
|
if( pBt->autoVacuum ){
|
|
if( pBt->autoVacuum ){
|
|
|
checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage);
|
|
checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage);
|
|
@@ -67523,6 +67533,7 @@ SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
|
|
|
assert( pParse->aLabel==0 );
|
|
assert( pParse->aLabel==0 );
|
|
|
assert( pParse->nLabel==0 );
|
|
assert( pParse->nLabel==0 );
|
|
|
assert( pParse->nOpAlloc==0 );
|
|
assert( pParse->nOpAlloc==0 );
|
|
|
|
|
+ assert( pParse->szOpAlloc==0 );
|
|
|
return p;
|
|
return p;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -67612,7 +67623,8 @@ static int growOpArray(Vdbe *v, int nOp){
|
|
|
assert( nNew>=(p->nOpAlloc+nOp) );
|
|
assert( nNew>=(p->nOpAlloc+nOp) );
|
|
|
pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));
|
|
pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));
|
|
|
if( pNew ){
|
|
if( pNew ){
|
|
|
- p->nOpAlloc = sqlite3DbMallocSize(p->db, pNew)/sizeof(Op);
|
|
|
|
|
|
|
+ p->szOpAlloc = sqlite3DbMallocSize(p->db, pNew);
|
|
|
|
|
+ p->nOpAlloc = p->szOpAlloc/sizeof(Op);
|
|
|
v->aOp = pNew;
|
|
v->aOp = pNew;
|
|
|
}
|
|
}
|
|
|
return (pNew ? SQLITE_OK : SQLITE_NOMEM);
|
|
return (pNew ? SQLITE_OK : SQLITE_NOMEM);
|
|
@@ -69337,9 +69349,8 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady(
|
|
|
/* Allocate space for memory registers, SQL variables, VDBE cursors and
|
|
/* Allocate space for memory registers, SQL variables, VDBE cursors and
|
|
|
** an array to marshal SQL function arguments in.
|
|
** an array to marshal SQL function arguments in.
|
|
|
*/
|
|
*/
|
|
|
- zCsr = (u8*)&p->aOp[p->nOp]; /* Memory avaliable for allocation */
|
|
|
|
|
- assert( pParse->nOpAlloc*sizeof(Op) <= 0x7fffff00 );
|
|
|
|
|
- nFree = (pParse->nOpAlloc - p->nOp)*sizeof(p->aOp[0]); /* Available space */
|
|
|
|
|
|
|
+ zCsr = ((u8*)p->aOp) + ROUND8(sizeof(Op)*p->nOp); /* Available space */
|
|
|
|
|
+ nFree = pParse->szOpAlloc - ROUND8(sizeof(Op)*p->nOp); /* Size of zCsr */
|
|
|
|
|
|
|
|
resolveP2Values(p, &nArg);
|
|
resolveP2Values(p, &nArg);
|
|
|
p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
|
|
p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
|
|
@@ -71237,7 +71248,7 @@ SQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const C
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- assert( pMem1->enc==pMem2->enc );
|
|
|
|
|
|
|
+ assert( pMem1->enc==pMem2->enc || pMem1->db->mallocFailed );
|
|
|
assert( pMem1->enc==SQLITE_UTF8 ||
|
|
assert( pMem1->enc==SQLITE_UTF8 ||
|
|
|
pMem1->enc==SQLITE_UTF16LE || pMem1->enc==SQLITE_UTF16BE );
|
|
pMem1->enc==SQLITE_UTF16LE || pMem1->enc==SQLITE_UTF16BE );
|
|
|
|
|
|
|
@@ -75876,21 +75887,21 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
|
|
/* Neither operand is NULL. Do a comparison. */
|
|
/* Neither operand is NULL. Do a comparison. */
|
|
|
affinity = pOp->p5 & SQLITE_AFF_MASK;
|
|
affinity = pOp->p5 & SQLITE_AFF_MASK;
|
|
|
if( affinity>=SQLITE_AFF_NUMERIC ){
|
|
if( affinity>=SQLITE_AFF_NUMERIC ){
|
|
|
- if( (pIn1->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
|
|
|
|
|
|
|
+ if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
|
|
|
applyNumericAffinity(pIn1,0);
|
|
applyNumericAffinity(pIn1,0);
|
|
|
}
|
|
}
|
|
|
- if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
|
|
|
|
|
|
|
+ if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
|
|
|
applyNumericAffinity(pIn3,0);
|
|
applyNumericAffinity(pIn3,0);
|
|
|
}
|
|
}
|
|
|
}else if( affinity==SQLITE_AFF_TEXT ){
|
|
}else if( affinity==SQLITE_AFF_TEXT ){
|
|
|
- if( (pIn1->flags & MEM_Str)==0 && (pIn1->flags & (MEM_Int|MEM_Real))!=0 ){
|
|
|
|
|
|
|
+ if( (flags1 & MEM_Str)==0 && (flags1 & (MEM_Int|MEM_Real))!=0 ){
|
|
|
testcase( pIn1->flags & MEM_Int );
|
|
testcase( pIn1->flags & MEM_Int );
|
|
|
testcase( pIn1->flags & MEM_Real );
|
|
testcase( pIn1->flags & MEM_Real );
|
|
|
sqlite3VdbeMemStringify(pIn1, encoding, 1);
|
|
sqlite3VdbeMemStringify(pIn1, encoding, 1);
|
|
|
testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );
|
|
testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );
|
|
|
flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
|
|
flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
|
|
|
}
|
|
}
|
|
|
- if( (pIn3->flags & MEM_Str)==0 && (pIn3->flags & (MEM_Int|MEM_Real))!=0 ){
|
|
|
|
|
|
|
+ if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
|
|
|
testcase( pIn3->flags & MEM_Int );
|
|
testcase( pIn3->flags & MEM_Int );
|
|
|
testcase( pIn3->flags & MEM_Real );
|
|
testcase( pIn3->flags & MEM_Real );
|
|
|
sqlite3VdbeMemStringify(pIn3, encoding, 1);
|
|
sqlite3VdbeMemStringify(pIn3, encoding, 1);
|
|
@@ -75899,15 +75910,14 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );
|
|
assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );
|
|
|
- if( pIn1->flags & MEM_Zero ){
|
|
|
|
|
|
|
+ if( flags1 & MEM_Zero ){
|
|
|
sqlite3VdbeMemExpandBlob(pIn1);
|
|
sqlite3VdbeMemExpandBlob(pIn1);
|
|
|
flags1 &= ~MEM_Zero;
|
|
flags1 &= ~MEM_Zero;
|
|
|
}
|
|
}
|
|
|
- if( pIn3->flags & MEM_Zero ){
|
|
|
|
|
|
|
+ if( flags3 & MEM_Zero ){
|
|
|
sqlite3VdbeMemExpandBlob(pIn3);
|
|
sqlite3VdbeMemExpandBlob(pIn3);
|
|
|
flags3 &= ~MEM_Zero;
|
|
flags3 &= ~MEM_Zero;
|
|
|
}
|
|
}
|
|
|
- if( db->mallocFailed ) goto no_mem;
|
|
|
|
|
res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);
|
|
res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);
|
|
|
}
|
|
}
|
|
|
switch( pOp->opcode ){
|
|
switch( pOp->opcode ){
|
|
@@ -76405,7 +76415,7 @@ case OP_Column: {
|
|
|
goto op_column_error;
|
|
goto op_column_error;
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
- VVA_ONLY( t = 0; ) /* Only needed by assert() statements */
|
|
|
|
|
|
|
+ t = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* If after trying to extract new entries from the header, nHdrParsed is
|
|
/* If after trying to extract new entries from the header, nHdrParsed is
|
|
@@ -77283,7 +77293,7 @@ open_cursor_set_hints:
|
|
|
assert( OPFLAG_BULKCSR==BTREE_BULKLOAD );
|
|
assert( OPFLAG_BULKCSR==BTREE_BULKLOAD );
|
|
|
assert( OPFLAG_SEEKEQ==BTREE_SEEK_EQ );
|
|
assert( OPFLAG_SEEKEQ==BTREE_SEEK_EQ );
|
|
|
testcase( pOp->p5 & OPFLAG_BULKCSR );
|
|
testcase( pOp->p5 & OPFLAG_BULKCSR );
|
|
|
-#ifdef SQLITE_ENABLE_CURSOR_HINT
|
|
|
|
|
|
|
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
|
|
|
testcase( pOp->p2 & OPFLAG_SEEKEQ );
|
|
testcase( pOp->p2 & OPFLAG_SEEKEQ );
|
|
|
#endif
|
|
#endif
|
|
|
sqlite3BtreeCursorHintFlags(pCur->uc.pCursor,
|
|
sqlite3BtreeCursorHintFlags(pCur->uc.pCursor,
|
|
@@ -94340,7 +94350,7 @@ static void freeIndex(sqlite3 *db, Index *p){
|
|
|
sqlite3ExprDelete(db, p->pPartIdxWhere);
|
|
sqlite3ExprDelete(db, p->pPartIdxWhere);
|
|
|
sqlite3ExprListDelete(db, p->aColExpr);
|
|
sqlite3ExprListDelete(db, p->aColExpr);
|
|
|
sqlite3DbFree(db, p->zColAff);
|
|
sqlite3DbFree(db, p->zColAff);
|
|
|
- if( p->isResized ) sqlite3DbFree(db, p->azColl);
|
|
|
|
|
|
|
+ if( p->isResized ) sqlite3DbFree(db, (void *)p->azColl);
|
|
|
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
|
|
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
|
|
|
sqlite3_free(p->aiRowEst);
|
|
sqlite3_free(p->aiRowEst);
|
|
|
#endif
|
|
#endif
|
|
@@ -94943,15 +94953,15 @@ begin_table_error:
|
|
|
/* Set properties of a table column based on the (magical)
|
|
/* Set properties of a table column based on the (magical)
|
|
|
** name of the column.
|
|
** name of the column.
|
|
|
*/
|
|
*/
|
|
|
-SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
|
|
|
|
|
#if SQLITE_ENABLE_HIDDEN_COLUMNS
|
|
#if SQLITE_ENABLE_HIDDEN_COLUMNS
|
|
|
|
|
+SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
|
|
|
if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){
|
|
if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){
|
|
|
pCol->colFlags |= COLFLAG_HIDDEN;
|
|
pCol->colFlags |= COLFLAG_HIDDEN;
|
|
|
}else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){
|
|
}else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){
|
|
|
pTab->tabFlags |= TF_OOOHidden;
|
|
pTab->tabFlags |= TF_OOOHidden;
|
|
|
}
|
|
}
|
|
|
-#endif
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -95531,7 +95541,7 @@ static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
|
|
|
zExtra = sqlite3DbMallocZero(db, nByte);
|
|
zExtra = sqlite3DbMallocZero(db, nByte);
|
|
|
if( zExtra==0 ) return SQLITE_NOMEM;
|
|
if( zExtra==0 ) return SQLITE_NOMEM;
|
|
|
memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
|
|
memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
|
|
|
- pIdx->azColl = (char**)zExtra;
|
|
|
|
|
|
|
+ pIdx->azColl = (const char**)zExtra;
|
|
|
zExtra += sizeof(char*)*N;
|
|
zExtra += sizeof(char*)*N;
|
|
|
memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn);
|
|
memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn);
|
|
|
pIdx->aiColumn = (i16*)zExtra;
|
|
pIdx->aiColumn = (i16*)zExtra;
|
|
@@ -95670,7 +95680,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
|
|
|
** do not enforce this for imposter tables.) */
|
|
** do not enforce this for imposter tables.) */
|
|
|
if( !db->init.imposterTable ){
|
|
if( !db->init.imposterTable ){
|
|
|
for(i=0; i<nPk; i++){
|
|
for(i=0; i<nPk; i++){
|
|
|
- pTab->aCol[pPk->aiColumn[i]].notNull = 1;
|
|
|
|
|
|
|
+ pTab->aCol[pPk->aiColumn[i]].notNull = OE_Abort;
|
|
|
}
|
|
}
|
|
|
pPk->uniqNotNull = 1;
|
|
pPk->uniqNotNull = 1;
|
|
|
}
|
|
}
|
|
@@ -95712,7 +95722,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
|
|
|
if( !hasColumn(pPk->aiColumn, j, i) ){
|
|
if( !hasColumn(pPk->aiColumn, j, i) ){
|
|
|
assert( j<pPk->nColumn );
|
|
assert( j<pPk->nColumn );
|
|
|
pPk->aiColumn[j] = i;
|
|
pPk->aiColumn[j] = i;
|
|
|
- pPk->azColl[j] = "BINARY";
|
|
|
|
|
|
|
+ pPk->azColl[j] = sqlite3StrBINARY;
|
|
|
j++;
|
|
j++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -96786,7 +96796,7 @@ SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(
|
|
|
p = sqlite3DbMallocZero(db, nByte + nExtra);
|
|
p = sqlite3DbMallocZero(db, nByte + nExtra);
|
|
|
if( p ){
|
|
if( p ){
|
|
|
char *pExtra = ((char*)p)+ROUND8(sizeof(Index));
|
|
char *pExtra = ((char*)p)+ROUND8(sizeof(Index));
|
|
|
- p->azColl = (char**)pExtra; pExtra += ROUND8(sizeof(char*)*nCol);
|
|
|
|
|
|
|
+ p->azColl = (const char**)pExtra; pExtra += ROUND8(sizeof(char*)*nCol);
|
|
|
p->aiRowLogEst = (LogEst*)pExtra; pExtra += sizeof(LogEst)*(nCol+1);
|
|
p->aiRowLogEst = (LogEst*)pExtra; pExtra += sizeof(LogEst)*(nCol+1);
|
|
|
p->aiColumn = (i16*)pExtra; pExtra += sizeof(i16)*nCol;
|
|
p->aiColumn = (i16*)pExtra; pExtra += sizeof(i16)*nCol;
|
|
|
p->aSortOrder = (u8*)pExtra;
|
|
p->aSortOrder = (u8*)pExtra;
|
|
@@ -97063,7 +97073,7 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex(
|
|
|
for(i=0, pListItem=pList->a; i<pList->nExpr; i++, pListItem++){
|
|
for(i=0, pListItem=pList->a; i<pList->nExpr; i++, pListItem++){
|
|
|
Expr *pCExpr; /* The i-th index expression */
|
|
Expr *pCExpr; /* The i-th index expression */
|
|
|
int requestedSortOrder; /* ASC or DESC on the i-th expression */
|
|
int requestedSortOrder; /* ASC or DESC on the i-th expression */
|
|
|
- char *zColl; /* Collation sequence name */
|
|
|
|
|
|
|
+ const char *zColl; /* Collation sequence name */
|
|
|
|
|
|
|
|
sqlite3StringToId(pListItem->pExpr);
|
|
sqlite3StringToId(pListItem->pExpr);
|
|
|
sqlite3ResolveSelfReference(pParse, pTab, NC_IdxExpr, pListItem->pExpr, 0);
|
|
sqlite3ResolveSelfReference(pParse, pTab, NC_IdxExpr, pListItem->pExpr, 0);
|
|
@@ -97109,7 +97119,7 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex(
|
|
|
}else if( j>=0 ){
|
|
}else if( j>=0 ){
|
|
|
zColl = pTab->aCol[j].zColl;
|
|
zColl = pTab->aCol[j].zColl;
|
|
|
}
|
|
}
|
|
|
- if( !zColl ) zColl = "BINARY";
|
|
|
|
|
|
|
+ if( !zColl ) zColl = sqlite3StrBINARY;
|
|
|
if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){
|
|
if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){
|
|
|
goto exit_create_index;
|
|
goto exit_create_index;
|
|
|
}
|
|
}
|
|
@@ -97138,7 +97148,7 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex(
|
|
|
assert( i==pIndex->nColumn );
|
|
assert( i==pIndex->nColumn );
|
|
|
}else{
|
|
}else{
|
|
|
pIndex->aiColumn[i] = XN_ROWID;
|
|
pIndex->aiColumn[i] = XN_ROWID;
|
|
|
- pIndex->azColl[i] = "BINARY";
|
|
|
|
|
|
|
+ pIndex->azColl[i] = sqlite3StrBINARY;
|
|
|
}
|
|
}
|
|
|
sqlite3DefaultRowEst(pIndex);
|
|
sqlite3DefaultRowEst(pIndex);
|
|
|
if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);
|
|
if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);
|
|
@@ -98262,9 +98272,8 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){
|
|
|
if( pKey ){
|
|
if( pKey ){
|
|
|
assert( sqlite3KeyInfoIsWriteable(pKey) );
|
|
assert( sqlite3KeyInfoIsWriteable(pKey) );
|
|
|
for(i=0; i<nCol; i++){
|
|
for(i=0; i<nCol; i++){
|
|
|
- char *zColl = pIdx->azColl[i];
|
|
|
|
|
- assert( zColl!=0 );
|
|
|
|
|
- pKey->aColl[i] = strcmp(zColl,"BINARY")==0 ? 0 :
|
|
|
|
|
|
|
+ const char *zColl = pIdx->azColl[i];
|
|
|
|
|
+ pKey->aColl[i] = zColl==sqlite3StrBINARY ? 0 :
|
|
|
sqlite3LocateCollSeq(pParse, zColl);
|
|
sqlite3LocateCollSeq(pParse, zColl);
|
|
|
pKey->aSortOrder[i] = pIdx->aSortOrder[i];
|
|
pKey->aSortOrder[i] = pIdx->aSortOrder[i];
|
|
|
}
|
|
}
|
|
@@ -100519,7 +100528,7 @@ static int patternCompare(
|
|
|
}
|
|
}
|
|
|
c2 = Utf8Read(zString);
|
|
c2 = Utf8Read(zString);
|
|
|
if( c==c2 ) continue;
|
|
if( c==c2 ) continue;
|
|
|
- if( noCase && c<0x80 && c2<0x80 && sqlite3Tolower(c)==sqlite3Tolower(c2) ){
|
|
|
|
|
|
|
+ if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) ){
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue;
|
|
if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue;
|
|
@@ -101840,7 +101849,7 @@ SQLITE_PRIVATE int sqlite3FkLocateIndex(
|
|
|
int i, j;
|
|
int i, j;
|
|
|
for(i=0; i<nCol; i++){
|
|
for(i=0; i<nCol; i++){
|
|
|
i16 iCol = pIdx->aiColumn[i]; /* Index of column in parent tbl */
|
|
i16 iCol = pIdx->aiColumn[i]; /* Index of column in parent tbl */
|
|
|
- char *zDfltColl; /* Def. collation for column */
|
|
|
|
|
|
|
+ const char *zDfltColl; /* Def. collation for column */
|
|
|
char *zIdxCol; /* Name of indexed column */
|
|
char *zIdxCol; /* Name of indexed column */
|
|
|
|
|
|
|
|
if( iCol<0 ) break; /* No foreign keys against expression indexes */
|
|
if( iCol<0 ) break; /* No foreign keys against expression indexes */
|
|
@@ -101849,9 +101858,7 @@ SQLITE_PRIVATE int sqlite3FkLocateIndex(
|
|
|
** the default collation sequence for the column, this index is
|
|
** the default collation sequence for the column, this index is
|
|
|
** unusable. Bail out early in this case. */
|
|
** unusable. Bail out early in this case. */
|
|
|
zDfltColl = pParent->aCol[iCol].zColl;
|
|
zDfltColl = pParent->aCol[iCol].zColl;
|
|
|
- if( !zDfltColl ){
|
|
|
|
|
- zDfltColl = "BINARY";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if( !zDfltColl ) zDfltColl = sqlite3StrBINARY;
|
|
|
if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break;
|
|
if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break;
|
|
|
|
|
|
|
|
zIdxCol = pParent->aCol[iCol].zName;
|
|
zIdxCol = pParent->aCol[iCol].zName;
|
|
@@ -104713,20 +104720,6 @@ SQLITE_API int sqlite3_xferopt_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SQLITE_OMIT_XFER_OPT
|
|
#ifndef SQLITE_OMIT_XFER_OPT
|
|
|
-/*
|
|
|
|
|
-** Check to collation names to see if they are compatible.
|
|
|
|
|
-*/
|
|
|
|
|
-static int xferCompatibleCollation(const char *z1, const char *z2){
|
|
|
|
|
- if( z1==0 ){
|
|
|
|
|
- return z2==0;
|
|
|
|
|
- }
|
|
|
|
|
- if( z2==0 ){
|
|
|
|
|
- return 0;
|
|
|
|
|
- }
|
|
|
|
|
- return sqlite3StrICmp(z1, z2)==0;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/*
|
|
/*
|
|
|
** Check to see if index pSrc is compatible as a source of data
|
|
** Check to see if index pSrc is compatible as a source of data
|
|
|
** for index pDest in an insert transfer optimization. The rules
|
|
** for index pDest in an insert transfer optimization. The rules
|
|
@@ -104762,7 +104755,7 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){
|
|
|
if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){
|
|
if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){
|
|
|
return 0; /* Different sort orders */
|
|
return 0; /* Different sort orders */
|
|
|
}
|
|
}
|
|
|
- if( !xferCompatibleCollation(pSrc->azColl[i],pDest->azColl[i]) ){
|
|
|
|
|
|
|
+ if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){
|
|
|
return 0; /* Different collating sequences */
|
|
return 0; /* Different collating sequences */
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -104923,7 +104916,7 @@ static int xferOptimization(
|
|
|
if( pDestCol->affinity!=pSrcCol->affinity ){
|
|
if( pDestCol->affinity!=pSrcCol->affinity ){
|
|
|
return 0; /* Affinity must be the same on all columns */
|
|
return 0; /* Affinity must be the same on all columns */
|
|
|
}
|
|
}
|
|
|
- if( !xferCompatibleCollation(pDestCol->zColl, pSrcCol->zColl) ){
|
|
|
|
|
|
|
+ if( sqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){
|
|
|
return 0; /* Collating sequence must be the same on all columns */
|
|
return 0; /* Collating sequence must be the same on all columns */
|
|
|
}
|
|
}
|
|
|
if( pDestCol->notNull && !pSrcCol->notNull ){
|
|
if( pDestCol->notNull && !pSrcCol->notNull ){
|
|
@@ -105070,9 +105063,10 @@ static int xferOptimization(
|
|
|
** a VACUUM command. In that case keys may not be written in strictly
|
|
** a VACUUM command. In that case keys may not be written in strictly
|
|
|
** sorted order. */
|
|
** sorted order. */
|
|
|
for(i=0; i<pSrcIdx->nColumn; i++){
|
|
for(i=0; i<pSrcIdx->nColumn; i++){
|
|
|
- char *zColl = pSrcIdx->azColl[i];
|
|
|
|
|
- assert( zColl!=0 );
|
|
|
|
|
- if( sqlite3_stricmp("BINARY", zColl) ) break;
|
|
|
|
|
|
|
+ const char *zColl = pSrcIdx->azColl[i];
|
|
|
|
|
+ assert( sqlite3_stricmp(sqlite3StrBINARY, zColl)!=0
|
|
|
|
|
+ || sqlite3StrBINARY==zColl );
|
|
|
|
|
+ if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
|
|
|
}
|
|
}
|
|
|
if( i==pSrcIdx->nColumn ){
|
|
if( i==pSrcIdx->nColumn ){
|
|
|
idxInsFlags = OPFLAG_USESEEKRESULT;
|
|
idxInsFlags = OPFLAG_USESEEKRESULT;
|
|
@@ -119578,7 +119572,7 @@ struct WhereTerm {
|
|
|
struct WhereScan {
|
|
struct WhereScan {
|
|
|
WhereClause *pOrigWC; /* Original, innermost WhereClause */
|
|
WhereClause *pOrigWC; /* Original, innermost WhereClause */
|
|
|
WhereClause *pWC; /* WhereClause currently being scanned */
|
|
WhereClause *pWC; /* WhereClause currently being scanned */
|
|
|
- char *zCollName; /* Required collating sequence, if not NULL */
|
|
|
|
|
|
|
+ const char *zCollName; /* Required collating sequence, if not NULL */
|
|
|
Expr *pIdxExpr; /* Search for this index expression */
|
|
Expr *pIdxExpr; /* Search for this index expression */
|
|
|
char idxaff; /* Must match this affinity, if zCollName!=NULL */
|
|
char idxaff; /* Must match this affinity, if zCollName!=NULL */
|
|
|
unsigned char nEquiv; /* Number of entries in aEquiv[] */
|
|
unsigned char nEquiv; /* Number of entries in aEquiv[] */
|
|
@@ -123564,7 +123558,7 @@ static void constructAutomaticIndex(
|
|
|
idxCols |= cMask;
|
|
idxCols |= cMask;
|
|
|
pIdx->aiColumn[n] = pTerm->u.leftColumn;
|
|
pIdx->aiColumn[n] = pTerm->u.leftColumn;
|
|
|
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
|
|
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
|
|
|
- pIdx->azColl[n] = pColl ? pColl->zName : "BINARY";
|
|
|
|
|
|
|
+ pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
|
|
|
n++;
|
|
n++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -123576,20 +123570,20 @@ static void constructAutomaticIndex(
|
|
|
for(i=0; i<mxBitCol; i++){
|
|
for(i=0; i<mxBitCol; i++){
|
|
|
if( extraCols & MASKBIT(i) ){
|
|
if( extraCols & MASKBIT(i) ){
|
|
|
pIdx->aiColumn[n] = i;
|
|
pIdx->aiColumn[n] = i;
|
|
|
- pIdx->azColl[n] = "BINARY";
|
|
|
|
|
|
|
+ pIdx->azColl[n] = sqlite3StrBINARY;
|
|
|
n++;
|
|
n++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if( pSrc->colUsed & MASKBIT(BMS-1) ){
|
|
if( pSrc->colUsed & MASKBIT(BMS-1) ){
|
|
|
for(i=BMS-1; i<pTable->nCol; i++){
|
|
for(i=BMS-1; i<pTable->nCol; i++){
|
|
|
pIdx->aiColumn[n] = i;
|
|
pIdx->aiColumn[n] = i;
|
|
|
- pIdx->azColl[n] = "BINARY";
|
|
|
|
|
|
|
+ pIdx->azColl[n] = sqlite3StrBINARY;
|
|
|
n++;
|
|
n++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
assert( n==nKeyCol );
|
|
assert( n==nKeyCol );
|
|
|
pIdx->aiColumn[n] = XN_ROWID;
|
|
pIdx->aiColumn[n] = XN_ROWID;
|
|
|
- pIdx->azColl[n] = "BINARY";
|
|
|
|
|
|
|
+ pIdx->azColl[n] = sqlite3StrBINARY;
|
|
|
|
|
|
|
|
/* Create the automatic index */
|
|
/* Create the automatic index */
|
|
|
assert( pLevel->iIdxCur>=0 );
|
|
assert( pLevel->iIdxCur>=0 );
|
|
@@ -135377,9 +135371,9 @@ static int openDatabase(
|
|
|
** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating
|
|
** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating
|
|
|
** functions:
|
|
** functions:
|
|
|
*/
|
|
*/
|
|
|
- createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc, 0);
|
|
|
|
|
- createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc, 0);
|
|
|
|
|
- createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0);
|
|
|
|
|
|
|
+ createCollation(db, sqlite3StrBINARY, SQLITE_UTF8, 0, binCollFunc, 0);
|
|
|
|
|
+ createCollation(db, sqlite3StrBINARY, SQLITE_UTF16BE, 0, binCollFunc, 0);
|
|
|
|
|
+ createCollation(db, sqlite3StrBINARY, SQLITE_UTF16LE, 0, binCollFunc, 0);
|
|
|
createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
|
|
createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
|
|
|
createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
|
|
createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
|
|
|
if( db->mallocFailed ){
|
|
if( db->mallocFailed ){
|
|
@@ -135388,7 +135382,7 @@ static int openDatabase(
|
|
|
/* EVIDENCE-OF: R-08308-17224 The default collating function for all
|
|
/* EVIDENCE-OF: R-08308-17224 The default collating function for all
|
|
|
** strings is BINARY.
|
|
** strings is BINARY.
|
|
|
*/
|
|
*/
|
|
|
- db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 0);
|
|
|
|
|
|
|
+ db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);
|
|
|
assert( db->pDfltColl!=0 );
|
|
assert( db->pDfltColl!=0 );
|
|
|
|
|
|
|
|
/* Also add a UTF-8 case-insensitive collation sequence. */
|
|
/* Also add a UTF-8 case-insensitive collation sequence. */
|
|
@@ -135930,7 +135924,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
|
|
|
primarykey = 1;
|
|
primarykey = 1;
|
|
|
}
|
|
}
|
|
|
if( !zCollSeq ){
|
|
if( !zCollSeq ){
|
|
|
- zCollSeq = "BINARY";
|
|
|
|
|
|
|
+ zCollSeq = sqlite3StrBINARY;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
error_out:
|
|
error_out:
|
|
@@ -136539,7 +136533,6 @@ SQLITE_API void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot
|
|
|
}
|
|
}
|
|
|
#endif /* SQLITE_ENABLE_SNAPSHOT */
|
|
#endif /* SQLITE_ENABLE_SNAPSHOT */
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/************** End of main.c ************************************************/
|
|
/************** End of main.c ************************************************/
|
|
|
/************** Begin file notify.c ******************************************/
|
|
/************** Begin file notify.c ******************************************/
|
|
|
/*
|
|
/*
|
|
@@ -168706,7 +168699,7 @@ static void jsonArrayFinal(sqlite3_context *ctx){
|
|
|
jsonAppendChar(pStr, ']');
|
|
jsonAppendChar(pStr, ']');
|
|
|
if( pStr->bErr ){
|
|
if( pStr->bErr ){
|
|
|
sqlite3_result_error_nomem(ctx);
|
|
sqlite3_result_error_nomem(ctx);
|
|
|
- if( !pStr->bStatic ) sqlite3_free(pStr->zBuf);
|
|
|
|
|
|
|
+ assert( pStr->bStatic );
|
|
|
}else{
|
|
}else{
|
|
|
sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
|
|
sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
|
|
|
pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
|
|
pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
|
|
@@ -168754,7 +168747,7 @@ static void jsonObjectFinal(sqlite3_context *ctx){
|
|
|
jsonAppendChar(pStr, '}');
|
|
jsonAppendChar(pStr, '}');
|
|
|
if( pStr->bErr ){
|
|
if( pStr->bErr ){
|
|
|
sqlite3_result_error_nomem(ctx);
|
|
sqlite3_result_error_nomem(ctx);
|
|
|
- if( !pStr->bStatic ) sqlite3_free(pStr->zBuf);
|
|
|
|
|
|
|
+ assert( pStr->bStatic );
|
|
|
}else{
|
|
}else{
|
|
|
sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
|
|
sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
|
|
|
pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
|
|
pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
|