mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 14:19:10 -04:00
updated SQLite to 3.9.2
This commit is contained in:
parent
5b1ad44ef1
commit
05901205d8
2 changed files with 61 additions and 41 deletions
96
sqlite3.c
96
sqlite3.c
|
@ -1,6 +1,6 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
** This file is an amalgamation of many separate C source files from SQLite
|
** This file is an amalgamation of many separate C source files from SQLite
|
||||||
** version 3.9.1. By combining all the individual C code files into this
|
** version 3.9.2. By combining all the individual C code files into this
|
||||||
** single large file, the entire code can be compiled as a single translation
|
** single large file, the entire code can be compiled as a single translation
|
||||||
** unit. This allows many compilers to do optimizations that would not be
|
** unit. This allows many compilers to do optimizations that would not be
|
||||||
** possible if the files were compiled separately. Performance improvements
|
** possible if the files were compiled separately. Performance improvements
|
||||||
|
@ -325,9 +325,9 @@ extern "C" {
|
||||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||||
** [sqlite_version()] and [sqlite_source_id()].
|
** [sqlite_version()] and [sqlite_source_id()].
|
||||||
*/
|
*/
|
||||||
#define SQLITE_VERSION "3.9.1"
|
#define SQLITE_VERSION "3.9.2"
|
||||||
#define SQLITE_VERSION_NUMBER 3009001
|
#define SQLITE_VERSION_NUMBER 3009002
|
||||||
#define SQLITE_SOURCE_ID "2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02"
|
#define SQLITE_SOURCE_ID "2015-11-02 18:31:45 bda77dda9697c463c3d0704014d51627fceee328"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Run-Time Library Version Numbers
|
** CAPI3REF: Run-Time Library Version Numbers
|
||||||
|
@ -94035,6 +94035,30 @@ SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse *pParse, ExprSpan *pSpan){
|
||||||
sqlite3ExprDelete(db, pSpan->pExpr);
|
sqlite3ExprDelete(db, pSpan->pExpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Backwards Compatibility Hack:
|
||||||
|
**
|
||||||
|
** Historical versions of SQLite accepted strings as column names in
|
||||||
|
** indexes and PRIMARY KEY constraints and in UNIQUE constraints. Example:
|
||||||
|
**
|
||||||
|
** CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim)
|
||||||
|
** CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC);
|
||||||
|
**
|
||||||
|
** This is goofy. But to preserve backwards compatibility we continue to
|
||||||
|
** accept it. This routine does the necessary conversion. It converts
|
||||||
|
** the expression given in its argument from a TK_STRING into a TK_ID
|
||||||
|
** if the expression is just a TK_STRING with an optional COLLATE clause.
|
||||||
|
** If the epxression is anything other than TK_STRING, the expression is
|
||||||
|
** unchanged.
|
||||||
|
*/
|
||||||
|
static void sqlite3StringToId(Expr *p){
|
||||||
|
if( p->op==TK_STRING ){
|
||||||
|
p->op = TK_ID;
|
||||||
|
}else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){
|
||||||
|
p->pLeft->op = TK_ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Designate the PRIMARY KEY for the table. pList is a list of names
|
** Designate the PRIMARY KEY for the table. pList is a list of names
|
||||||
** of columns that form the primary key. If pList is NULL, then the
|
** of columns that form the primary key. If pList is NULL, then the
|
||||||
|
@ -94081,6 +94105,7 @@ SQLITE_PRIVATE void sqlite3AddPrimaryKey(
|
||||||
for(i=0; i<nTerm; i++){
|
for(i=0; i<nTerm; i++){
|
||||||
Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr);
|
Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr);
|
||||||
assert( pCExpr!=0 );
|
assert( pCExpr!=0 );
|
||||||
|
sqlite3StringToId(pCExpr);
|
||||||
if( pCExpr->op==TK_ID ){
|
if( pCExpr->op==TK_ID ){
|
||||||
const char *zCName = pCExpr->u.zToken;
|
const char *zCName = pCExpr->u.zToken;
|
||||||
for(iCol=0; iCol<pTab->nCol; iCol++){
|
for(iCol=0; iCol<pTab->nCol; iCol++){
|
||||||
|
@ -95619,30 +95644,6 @@ SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
** Backwards Compatibility Hack:
|
|
||||||
**
|
|
||||||
** Historical versions of SQLite accepted strings as column names in
|
|
||||||
** indexes and PRIMARY KEY constraints and in UNIQUE constraints. Example:
|
|
||||||
**
|
|
||||||
** CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim)
|
|
||||||
** CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC);
|
|
||||||
**
|
|
||||||
** This is goofy. But to preserve backwards compatibility we continue to
|
|
||||||
** accept it. This routine does the necessary conversion. It converts
|
|
||||||
** the expression given in its argument from a TK_STRING into a TK_ID
|
|
||||||
** if the expression is just a TK_STRING with an optional COLLATE clause.
|
|
||||||
** If the epxression is anything other than TK_STRING, the expression is
|
|
||||||
** unchanged.
|
|
||||||
*/
|
|
||||||
static void sqlite3StringToId(Expr *p){
|
|
||||||
if( p->op==TK_STRING ){
|
|
||||||
p->op = TK_ID;
|
|
||||||
}else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){
|
|
||||||
p->pLeft->op = TK_ID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Create a new index for an SQL table. pName1.pName2 is the name of the index
|
** Create a new index for an SQL table. pName1.pName2 is the name of the index
|
||||||
** and pTblList is the name of the table that is to be indexed. Both will
|
** and pTblList is the name of the table that is to be indexed. Both will
|
||||||
|
@ -121858,14 +121859,20 @@ static LogEst estLog(LogEst N){
|
||||||
** Convert OP_Column opcodes to OP_Copy in previously generated code.
|
** Convert OP_Column opcodes to OP_Copy in previously generated code.
|
||||||
**
|
**
|
||||||
** This routine runs over generated VDBE code and translates OP_Column
|
** This routine runs over generated VDBE code and translates OP_Column
|
||||||
** opcodes into OP_Copy, and OP_Rowid into OP_Null, when the table is being
|
** opcodes into OP_Copy when the table is being accessed via co-routine
|
||||||
** accessed via co-routine instead of via table lookup.
|
** instead of via table lookup.
|
||||||
|
**
|
||||||
|
** If the bIncrRowid parameter is 0, then any OP_Rowid instructions on
|
||||||
|
** cursor iTabCur are transformed into OP_Null. Or, if bIncrRowid is non-zero,
|
||||||
|
** then each OP_Rowid is transformed into an instruction to increment the
|
||||||
|
** value stored in its output register.
|
||||||
*/
|
*/
|
||||||
static void translateColumnToCopy(
|
static void translateColumnToCopy(
|
||||||
Vdbe *v, /* The VDBE containing code to translate */
|
Vdbe *v, /* The VDBE containing code to translate */
|
||||||
int iStart, /* Translate from this opcode to the end */
|
int iStart, /* Translate from this opcode to the end */
|
||||||
int iTabCur, /* OP_Column/OP_Rowid references to this table */
|
int iTabCur, /* OP_Column/OP_Rowid references to this table */
|
||||||
int iRegister /* The first column is in this register */
|
int iRegister, /* The first column is in this register */
|
||||||
|
int bIncrRowid /* If non-zero, transform OP_rowid to OP_AddImm(1) */
|
||||||
){
|
){
|
||||||
VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart);
|
VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart);
|
||||||
int iEnd = sqlite3VdbeCurrentAddr(v);
|
int iEnd = sqlite3VdbeCurrentAddr(v);
|
||||||
|
@ -121877,9 +121884,16 @@ static void translateColumnToCopy(
|
||||||
pOp->p2 = pOp->p3;
|
pOp->p2 = pOp->p3;
|
||||||
pOp->p3 = 0;
|
pOp->p3 = 0;
|
||||||
}else if( pOp->opcode==OP_Rowid ){
|
}else if( pOp->opcode==OP_Rowid ){
|
||||||
pOp->opcode = OP_Null;
|
if( bIncrRowid ){
|
||||||
pOp->p1 = 0;
|
/* Increment the value stored in the P2 operand of the OP_Rowid. */
|
||||||
pOp->p3 = 0;
|
pOp->opcode = OP_AddImm;
|
||||||
|
pOp->p1 = pOp->p2;
|
||||||
|
pOp->p2 = 1;
|
||||||
|
}else{
|
||||||
|
pOp->opcode = OP_Null;
|
||||||
|
pOp->p1 = 0;
|
||||||
|
pOp->p3 = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121987,6 +122001,8 @@ static void constructAutomaticIndex(
|
||||||
Expr *pPartial = 0; /* Partial Index Expression */
|
Expr *pPartial = 0; /* Partial Index Expression */
|
||||||
int iContinue = 0; /* Jump here to skip excluded rows */
|
int iContinue = 0; /* Jump here to skip excluded rows */
|
||||||
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
|
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
|
||||||
|
int addrCounter; /* Address where integer counter is initialized */
|
||||||
|
int regBase; /* Array of registers where record is assembled */
|
||||||
|
|
||||||
/* Generate code to skip over the creation and initialization of the
|
/* Generate code to skip over the creation and initialization of the
|
||||||
** transient index on 2nd and subsequent iterations of the loop. */
|
** transient index on 2nd and subsequent iterations of the loop. */
|
||||||
|
@ -122115,6 +122131,7 @@ static void constructAutomaticIndex(
|
||||||
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
|
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
|
||||||
if( pTabItem->fg.viaCoroutine ){
|
if( pTabItem->fg.viaCoroutine ){
|
||||||
int regYield = pTabItem->regReturn;
|
int regYield = pTabItem->regReturn;
|
||||||
|
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
|
||||||
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
|
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
|
||||||
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
|
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
|
||||||
VdbeCoverage(v);
|
VdbeCoverage(v);
|
||||||
|
@ -122128,12 +122145,15 @@ static void constructAutomaticIndex(
|
||||||
pLoop->wsFlags |= WHERE_PARTIALIDX;
|
pLoop->wsFlags |= WHERE_PARTIALIDX;
|
||||||
}
|
}
|
||||||
regRecord = sqlite3GetTempReg(pParse);
|
regRecord = sqlite3GetTempReg(pParse);
|
||||||
sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0);
|
regBase = sqlite3GenerateIndexKey(
|
||||||
|
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
|
||||||
|
);
|
||||||
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
|
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
|
||||||
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
|
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
|
||||||
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
|
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
|
||||||
if( pTabItem->fg.viaCoroutine ){
|
if( pTabItem->fg.viaCoroutine ){
|
||||||
translateColumnToCopy(v, addrTop, pLevel->iTabCur, pTabItem->regResult);
|
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
|
||||||
|
translateColumnToCopy(v, addrTop, pLevel->iTabCur, pTabItem->regResult, 1);
|
||||||
sqlite3VdbeGoto(v, addrTop);
|
sqlite3VdbeGoto(v, addrTop);
|
||||||
pTabItem->fg.viaCoroutine = 0;
|
pTabItem->fg.viaCoroutine = 0;
|
||||||
}else{
|
}else{
|
||||||
|
@ -125882,7 +125902,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
|
||||||
*/
|
*/
|
||||||
if( pTabItem->fg.viaCoroutine && !db->mallocFailed ){
|
if( pTabItem->fg.viaCoroutine && !db->mallocFailed ){
|
||||||
translateColumnToCopy(v, pLevel->addrBody, pLevel->iTabCur,
|
translateColumnToCopy(v, pLevel->addrBody, pLevel->iTabCur,
|
||||||
pTabItem->regResult);
|
pTabItem->regResult, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180582,7 +180602,7 @@ static void fts5SourceIdFunc(
|
||||||
sqlite3_value **apVal /* Function arguments */
|
sqlite3_value **apVal /* Function arguments */
|
||||||
){
|
){
|
||||||
assert( nArg==0 );
|
assert( nArg==0 );
|
||||||
sqlite3_result_text(pCtx, "fts5: 2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02", -1, SQLITE_TRANSIENT);
|
sqlite3_result_text(pCtx, "fts5: 2015-11-02 18:31:45 bda77dda9697c463c3d0704014d51627fceee328", -1, SQLITE_TRANSIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fts5Init(sqlite3 *db){
|
static int fts5Init(sqlite3 *db){
|
||||||
|
|
|
@ -111,9 +111,9 @@ extern "C" {
|
||||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||||
** [sqlite_version()] and [sqlite_source_id()].
|
** [sqlite_version()] and [sqlite_source_id()].
|
||||||
*/
|
*/
|
||||||
#define SQLITE_VERSION "3.9.1"
|
#define SQLITE_VERSION "3.9.2"
|
||||||
#define SQLITE_VERSION_NUMBER 3009001
|
#define SQLITE_VERSION_NUMBER 3009002
|
||||||
#define SQLITE_SOURCE_ID "2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02"
|
#define SQLITE_SOURCE_ID "2015-11-02 18:31:45 bda77dda9697c463c3d0704014d51627fceee328"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Run-Time Library Version Numbers
|
** CAPI3REF: Run-Time Library Version Numbers
|
||||||
|
|
Loading…
Add table
Reference in a new issue