summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/sqlite
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-09-26 19:31:41 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-09-26 19:31:41 +0000
commit94d1e563607f8aa9dee4e362d02e90b24db96aca (patch)
tree9bddb0952503e6baef4d0d6631cbfe6e3bfc032f /ext/pdo_sqlite/sqlite
parent74c7eb772384faf2e0c78e62f24f78fd875bf757 (diff)
downloadphp-git-94d1e563607f8aa9dee4e362d02e90b24db96aca.tar.gz
Update bundled libsqlite3 to version 3.2.7
Diffstat (limited to 'ext/pdo_sqlite/sqlite')
-rw-r--r--ext/pdo_sqlite/sqlite/VERSION2
-rw-r--r--ext/pdo_sqlite/sqlite/src/analyze.c14
-rw-r--r--ext/pdo_sqlite/sqlite/src/btree.c58
-rw-r--r--ext/pdo_sqlite/sqlite/src/build.c90
-rw-r--r--ext/pdo_sqlite/sqlite/src/delete.c8
-rw-r--r--ext/pdo_sqlite/sqlite/src/expr.c244
-rw-r--r--ext/pdo_sqlite/sqlite/src/func.c51
-rw-r--r--ext/pdo_sqlite/sqlite/src/insert.c20
-rw-r--r--ext/pdo_sqlite/sqlite/src/main.c45
-rw-r--r--ext/pdo_sqlite/sqlite/src/opcodes.h275
-rw-r--r--ext/pdo_sqlite/sqlite/src/os.h9
-rw-r--r--ext/pdo_sqlite/sqlite/src/os_common.h20
-rw-r--r--ext/pdo_sqlite/sqlite/src/os_test.c4
-rw-r--r--ext/pdo_sqlite/sqlite/src/os_unix.c42
-rw-r--r--ext/pdo_sqlite/sqlite/src/os_win.c301
-rw-r--r--ext/pdo_sqlite/sqlite/src/pager.c91
-rw-r--r--ext/pdo_sqlite/sqlite/src/pager.h2
-rw-r--r--ext/pdo_sqlite/sqlite/src/parse.c4074
-rw-r--r--ext/pdo_sqlite/sqlite/src/parse.h271
-rw-r--r--ext/pdo_sqlite/sqlite/src/parse.y47
-rw-r--r--ext/pdo_sqlite/sqlite/src/pragma.c48
-rw-r--r--ext/pdo_sqlite/sqlite/src/prepare.c19
-rw-r--r--ext/pdo_sqlite/sqlite/src/printf.c31
-rw-r--r--ext/pdo_sqlite/sqlite/src/select.c1086
-rw-r--r--ext/pdo_sqlite/sqlite/src/shell.c23
-rw-r--r--ext/pdo_sqlite/sqlite/src/sqlite.h.in18
-rw-r--r--ext/pdo_sqlite/sqlite/src/sqliteInt.h194
-rw-r--r--ext/pdo_sqlite/sqlite/src/tclsqlite.c587
-rw-r--r--ext/pdo_sqlite/sqlite/src/test1.c116
-rw-r--r--ext/pdo_sqlite/sqlite/src/test2.c5
-rw-r--r--ext/pdo_sqlite/sqlite/src/trigger.c1
-rw-r--r--ext/pdo_sqlite/sqlite/src/update.c8
-rw-r--r--ext/pdo_sqlite/sqlite/src/util.c13
-rw-r--r--ext/pdo_sqlite/sqlite/src/vdbe.c576
-rw-r--r--ext/pdo_sqlite/sqlite/src/vdbe.h3
-rw-r--r--ext/pdo_sqlite/sqlite/src/vdbeInt.h77
-rw-r--r--ext/pdo_sqlite/sqlite/src/vdbeapi.c53
-rw-r--r--ext/pdo_sqlite/sqlite/src/vdbeaux.c289
-rw-r--r--ext/pdo_sqlite/sqlite/src/vdbemem.c37
-rw-r--r--ext/pdo_sqlite/sqlite/src/where.c139
40 files changed, 4834 insertions, 4157 deletions
diff --git a/ext/pdo_sqlite/sqlite/VERSION b/ext/pdo_sqlite/sqlite/VERSION
index 5ae69bd5f0..406ebcbd95 100644
--- a/ext/pdo_sqlite/sqlite/VERSION
+++ b/ext/pdo_sqlite/sqlite/VERSION
@@ -1 +1 @@
-3.2.5
+3.2.7
diff --git a/ext/pdo_sqlite/sqlite/src/analyze.c b/ext/pdo_sqlite/sqlite/src/analyze.c
index 7f0f00a349..a6c92e9f6f 100644
--- a/ext/pdo_sqlite/sqlite/src/analyze.c
+++ b/ext/pdo_sqlite/sqlite/src/analyze.c
@@ -88,8 +88,8 @@ static void analyzeOneTable(
int addr; /* The address of an instruction */
v = sqlite3GetVdbe(pParse);
- if( pTab==0 || pTab->pIndex==0 || pTab->pIndex->pNext==0 ){
- /* Do no analysis for tables with fewer than 2 indices */
+ if( pTab==0 || pTab->pIndex==0 ){
+ /* Do no analysis for tables that have no indices */
return;
}
@@ -127,13 +127,11 @@ static void analyzeOneTable(
** Cells iMem through iMem+nCol are initialized to 0. The others
** are initialized to NULL.
*/
- sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
for(i=0; i<=nCol; i++){
- sqlite3VdbeAddOp(v, OP_MemStore, iMem+i, i==nCol);
+ sqlite3VdbeAddOp(v, OP_MemInt, 0, iMem+i);
}
- sqlite3VdbeAddOp(v, OP_Null, 0, 0);
for(i=0; i<nCol; i++){
- sqlite3VdbeAddOp(v, OP_MemStore, iMem+nCol+i+1, i==nCol-1);
+ sqlite3VdbeAddOp(v, OP_MemNull, iMem+nCol+i+1, 0);
}
/* Do the analysis.
@@ -198,7 +196,7 @@ static void analyzeOneTable(
}
sqlite3VdbeOp3(v, OP_MakeRecord, 3, 0, "ttt", 0);
sqlite3VdbeAddOp(v, OP_Insert, iStatCur, 0);
- sqlite3VdbeChangeP2(v, addr, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, addr);
}
}
@@ -333,7 +331,7 @@ static int analysisLoader(void *pData, int argc, char **argv, char **azNotUsed){
const char *z;
assert( argc==2 );
- if( argv[0]==0 || argv[1]==0 ){
+ if( argv==0 || argv[0]==0 || argv[1]==0 ){
return 0;
}
pIndex = sqlite3FindIndex(pInfo->db, argv[0], pInfo->zDatabase);
diff --git a/ext/pdo_sqlite/sqlite/src/btree.c b/ext/pdo_sqlite/sqlite/src/btree.c
index 3f1dfa92c7..f1ef6a2a4c 100644
--- a/ext/pdo_sqlite/sqlite/src/btree.c
+++ b/ext/pdo_sqlite/sqlite/src/btree.c
@@ -494,7 +494,7 @@ static int ptrmapPut(Btree *pBt, Pgno key, u8 eType, Pgno parent){
assert( pBt->autoVacuum );
if( key==0 ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
iPtrmap = PTRMAP_PAGENO(pBt->usableSize, key);
rc = sqlite3pager_get(pBt->pPager, iPtrmap, (void **)&pPtrmap);
@@ -540,7 +540,7 @@ static int ptrmapGet(Btree *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);
sqlite3pager_unref(pPtrmap);
- if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT;
+ if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT;
return SQLITE_OK;
}
@@ -1030,7 +1030,7 @@ static int initPage(
assert( pPage->aData == &((unsigned char*)pPage)[-pBt->pageSize] );
if( pPage->pParent!=pParent && (pPage->pParent!=0 || pPage->isInit) ){
/* The parent page should never change unless the file is corrupt */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
if( pPage->isInit ) return SQLITE_OK;
if( pPage->pParent==0 && pParent!=0 ){
@@ -1048,11 +1048,11 @@ static int initPage(
pPage->nCell = get2byte(&data[hdr+3]);
if( pPage->nCell>MX_CELL(pBt) ){
/* To many cells for a single page. The page must be corrupt */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
if( pPage->nCell==0 && pParent!=0 && pParent->pgno!=1 ){
/* All pages must have at least one cell, except for root pages */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
/* Compute the total free space on the page */
@@ -1062,13 +1062,13 @@ static int initPage(
int next, size;
if( pc>usableSize-4 ){
/* Free block is off the page */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
next = get2byte(&data[pc]);
size = get2byte(&data[pc+2]);
if( next>0 && next<=pc+size+3 ){
/* Free blocks must be in accending order */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
nFree += size;
pc = next;
@@ -1076,7 +1076,7 @@ static int initPage(
pPage->nFree = nFree;
if( nFree>=usableSize ){
/* Free space cannot exceed total page size */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
pPage->isInit = 1;
@@ -1146,7 +1146,7 @@ static int getAndInitPage(
){
int rc;
if( pgno==0 ){
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
rc = getPage(pBt, pgno, ppPage);
if( rc==SQLITE_OK && (*ppPage)->isInit==0 ){
@@ -1714,7 +1714,7 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
if( eType==PTRMAP_OVERFLOW2 ){
/* The pointer is always the first 4 bytes of the page in this case. */
if( get4byte(pPage->aData)!=iFrom ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
put4byte(pPage->aData, iTo);
}else{
@@ -1747,7 +1747,7 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
if( i==nCell ){
if( eType!=PTRMAP_BTREE ||
get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);
}
@@ -1860,7 +1860,7 @@ static int autoVacuumCommit(Btree *pBt, Pgno *nTrunc){
assert( pBt->autoVacuum );
if( PTRMAP_ISPAGE(pgsz, sqlite3pager_pagecount(pPager)) ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
/* Figure out how many free-pages are in the database. If there are no
@@ -1875,7 +1875,7 @@ static int autoVacuumCommit(Btree *pBt, Pgno *nTrunc){
origSize = sqlite3pager_pagecount(pPager);
nPtrMap = (nFreeList-origSize+PTRMAP_PAGENO(pgsz, origSize)+pgsz/5)/(pgsz/5);
finSize = origSize - nFreeList - nPtrMap;
- if( origSize>PENDING_BYTE_PAGE(pBt) && finSize<=PENDING_BYTE_PAGE(pBt) ){
+ if( origSize>=PENDING_BYTE_PAGE(pBt) && finSize<=PENDING_BYTE_PAGE(pBt) ){
finSize--;
if( PTRMAP_ISPAGE(pBt->usableSize, finSize) ){
finSize--;
@@ -1898,7 +1898,7 @@ static int autoVacuumCommit(Btree *pBt, Pgno *nTrunc){
rc = ptrmapGet(pBt, iDbPage, &eType, &iPtrPage);
if( rc!=SQLITE_OK ) goto autovacuum_out;
if( eType==PTRMAP_ROOTPAGE ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto autovacuum_out;
}
@@ -2414,7 +2414,7 @@ static int getPayload(
}
if( amt>0 ){
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
return SQLITE_OK;
}
@@ -2432,7 +2432,7 @@ int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
assert( pCur->isValid );
assert( pCur->pPage!=0 );
if( pCur->pPage->intKey ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
assert( pCur->pPage->intKey==0 );
assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
@@ -2481,13 +2481,11 @@ static const unsigned char *fetchPayload(
){
unsigned char *aPayload;
MemPage *pPage;
- Btree *pBt;
u32 nKey;
int nLocal;
assert( pCur!=0 && pCur->pPage!=0 );
assert( pCur->isValid );
- pBt = pCur->pBt;
pPage = pCur->pPage;
pageIntegrity(pPage);
assert( pCur->idx>=0 && pCur->idx<pPage->nCell );
@@ -2554,7 +2552,7 @@ static int moveToChild(BtCursor *pCur, u32 newPgno){
pCur->idx = 0;
pCur->info.nSize = 0;
if( pNewPage->nCell<1 ){
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
return SQLITE_OK;
}
@@ -2585,7 +2583,6 @@ static int isRootPage(MemPage *pPage){
** the largest cell index.
*/
static void moveToParent(BtCursor *pCur){
- Pgno oldPgno;
MemPage *pParent;
MemPage *pPage;
int idxParent;
@@ -2600,7 +2597,6 @@ static void moveToParent(BtCursor *pCur){
pageIntegrity(pParent);
idxParent = pPage->idxParent;
sqlite3pager_ref(pParent->aData);
- oldPgno = pPage->pgno;
releasePage(pPage);
pCur->pPage = pParent;
pCur->info.nSize = 0;
@@ -2765,7 +2761,7 @@ int sqlite3BtreeMoveto(BtCursor *pCur, const void *pKey, i64 nKey, int *pRes){
lwr = 0;
upr = pPage->nCell-1;
if( !pPage->intKey && pKey==0 ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
pageIntegrity(pPage);
while( lwr<=upr ){
@@ -3050,7 +3046,7 @@ static int allocatePage(
TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
}else if( k>pBt->usableSize/4 - 8 ){
/* Value of k is out of range. Database corruption */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
#ifndef SQLITE_OMIT_AUTOVACUUM
}else if( searchList && nearby==iTrunk ){
/* The list is being searched and this trunk page is the page
@@ -3125,7 +3121,7 @@ static int allocatePage(
*pPgno = iPage;
if( *pPgno>sqlite3pager_pagecount(pBt->pPager) ){
/* Free page off the end of the file */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
": %d more free pages\n",
@@ -3266,7 +3262,7 @@ static int clearCell(MemPage *pPage, unsigned char *pCell){
while( ovflPgno!=0 ){
MemPage *pOvfl;
if( ovflPgno>sqlite3pager_pagecount(pBt->pPager) ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
rc = getPage(pBt, ovflPgno, &pOvfl);
if( rc ) return rc;
@@ -4672,7 +4668,7 @@ int sqlite3BtreeDelete(BtCursor *pCur){
rc = sqlite3BtreeNext(&leafCur, &notUsed);
if( rc!=SQLITE_OK ){
if( rc!=SQLITE_NOMEM ){
- rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ rc = SQLITE_CORRUPT_BKPT;
}
}
if( rc==SQLITE_OK ){
@@ -4858,7 +4854,7 @@ static int clearDatabasePage(
int i;
if( pgno>sqlite3pager_pagecount(pBt->pPager) ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
rc = getAndInitPage(pBt, pgno, &pPage, pParent);
@@ -5480,7 +5476,7 @@ static int checkTreePage(
u8 *data;
BtCursor cur;
Btree *pBt;
- int maxLocal, usableSize;
+ int usableSize;
char zContext[100];
char *hit;
@@ -5497,7 +5493,6 @@ static int checkTreePage(
"unable to get the page. error code=%d", rc);
return 0;
}
- maxLocal = pPage->leafData ? pBt->maxLeaf : pBt->maxLocal;
if( (rc = initPage(pPage, pParent))!=0 ){
checkAppendMsg(pCheck, zContext, "initPage() returns error code %d", rc);
releasePage(pPage);
@@ -5744,7 +5739,7 @@ const char *sqlite3BtreeGetJournalname(Btree *pBt){
*/
int sqlite3BtreeCopyFile(Btree *pBtTo, Btree *pBtFrom){
int rc = SQLITE_OK;
- Pgno i, nPage, nToPage;
+ Pgno i, nPage, nToPage, iSkip;
if( pBtTo->inTrans!=TRANS_WRITE || pBtFrom->inTrans!=TRANS_WRITE ){
return SQLITE_ERROR;
@@ -5752,8 +5747,10 @@ int sqlite3BtreeCopyFile(Btree *pBtTo, Btree *pBtFrom){
if( pBtTo->pCursor ) return SQLITE_BUSY;
nToPage = sqlite3pager_pagecount(pBtTo->pPager);
nPage = sqlite3pager_pagecount(pBtFrom->pPager);
+ iSkip = PENDING_BYTE_PAGE(pBtTo);
for(i=1; rc==SQLITE_OK && i<=nPage; i++){
void *pPage;
+ if( i==iSkip ) continue;
rc = sqlite3pager_get(pBtFrom->pPager, i, &pPage);
if( rc ) break;
rc = sqlite3pager_overwrite(pBtTo->pPager, i, pPage);
@@ -5762,6 +5759,7 @@ int sqlite3BtreeCopyFile(Btree *pBtTo, Btree *pBtFrom){
}
for(i=nPage+1; rc==SQLITE_OK && i<=nToPage; i++){
void *pPage;
+ if( i==iSkip ) continue;
rc = sqlite3pager_get(pBtTo->pPager, i, &pPage);
if( rc ) break;
rc = sqlite3pager_write(pPage);
diff --git a/ext/pdo_sqlite/sqlite/src/build.c b/ext/pdo_sqlite/sqlite/src/build.c
index 67e83e970b..537eede8c0 100644
--- a/ext/pdo_sqlite/sqlite/src/build.c
+++ b/ext/pdo_sqlite/sqlite/src/build.c
@@ -76,7 +76,7 @@ void sqlite3FinishCoding(Parse *pParse){
if( pParse->cookieGoto>0 ){
u32 mask;
int iDb;
- sqlite3VdbeChangeP2(v, pParse->cookieGoto-1, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, pParse->cookieGoto-1);
for(iDb=0, mask=1; iDb<db->nDb; mask<<=1, iDb++){
if( (mask & pParse->cookieMask)==0 ) continue;
sqlite3VdbeAddOp(v, OP_Transaction, iDb, (mask & pParse->writeMask)!=0);
@@ -85,6 +85,7 @@ void sqlite3FinishCoding(Parse *pParse){
sqlite3VdbeAddOp(v, OP_Goto, 0, pParse->cookieGoto);
}
+#ifndef SQLITE_OMIT_TRACE
/* Add a No-op that contains the complete text of the compiled SQL
** statement as its P3 argument. This does not change the functionality
** of the program.
@@ -92,6 +93,7 @@ void sqlite3FinishCoding(Parse *pParse){
** This is used to implement sqlite3_trace().
*/
sqlite3VdbeOp3(v, OP_Noop, 0, 0, pParse->zSql, pParse->zTail-pParse->zSql);
+#endif /* SQLITE_OMIT_TRACE */
}
@@ -101,7 +103,7 @@ void sqlite3FinishCoding(Parse *pParse){
FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0;
sqlite3VdbeTrace(v, trace);
sqlite3VdbeMakeReady(v, pParse->nVar, pParse->nMem+3,
- pParse->nTab+3, pParse->nMaxDepth+1, pParse->explain);
+ pParse->nTab+3, pParse->explain);
pParse->rc = SQLITE_DONE;
pParse->colNamesSet = 0;
}else if( pParse->rc==SQLITE_OK ){
@@ -130,7 +132,6 @@ void sqlite3FinishCoding(Parse *pParse){
void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
va_list ap;
char *zSql;
- int rc;
# define SAVE_SZ (sizeof(Parse) - offsetof(Parse,nVar))
char saveBuf[SAVE_SZ];
@@ -145,7 +146,7 @@ void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
pParse->nested++;
memcpy(saveBuf, &pParse->nVar, SAVE_SZ);
memset(&pParse->nVar, 0, SAVE_SZ);
- rc = sqlite3RunParser(pParse, zSql, 0);
+ sqlite3RunParser(pParse, zSql, 0);
sqliteFree(zSql);
memcpy(&pParse->nVar, saveBuf, SAVE_SZ);
pParse->nested--;
@@ -634,7 +635,6 @@ void sqlite3StartTable(
int isView /* True if this is a VIEW */
){
Table *pTable;
- Index *pIdx;
char *zName = 0; /* The name of the new table */
sqlite3 *db = pParse->db;
Vdbe *v;
@@ -713,8 +713,7 @@ void sqlite3StartTable(
sqlite3ErrorMsg(pParse, "table %T already exists", pName);
goto begin_table_error;
}
- if( (pIdx = sqlite3FindIndex(db, zName, 0))!=0 &&
- ( iDb==0 || !db->init.busy) ){
+ if( sqlite3FindIndex(db, zName, 0)!=0 && (iDb==0 || !db->init.busy) ){
sqlite3ErrorMsg(pParse, "there is already an index named %s", zName);
goto begin_table_error;
}
@@ -941,7 +940,7 @@ void sqlite3AddColumnType(Parse *pParse, Token *pType){
i = p->nCol-1;
if( i<0 ) return;
pCol = &p->aCol[i];
- assert( pCol->zType==0 );
+ sqliteFree(pCol->zType);
pCol->zType = sqlite3NameFromToken(pType);
pCol->affinity = sqlite3AffinityType(pType);
}
@@ -1016,7 +1015,9 @@ void sqlite3AddPrimaryKey(
break;
}
}
- if( iCol<pTab->nCol ) pTab->aCol[iCol].isPrimKey = 1;
+ if( iCol<pTab->nCol ){
+ pTab->aCol[iCol].isPrimKey = 1;
+ }
}
if( pList->nExpr>1 ) iCol = -1;
}
@@ -2001,7 +2002,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
}
sqlite3VdbeAddOp(v, OP_IdxInsert, iIdx, 0);
sqlite3VdbeAddOp(v, OP_Next, iTab, addr1+1);
- sqlite3VdbeChangeP2(v, addr1, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, addr1);
sqlite3VdbeAddOp(v, OP_Close, iTab, 0);
sqlite3VdbeAddOp(v, OP_Close, iIdx, 0);
}
@@ -2114,14 +2115,12 @@ void sqlite3CreateIndex(
goto exit_create_index;
}
if( !db->init.busy ){
- Index *pISameName; /* Another index with the same name */
- Table *pTSameName; /* A table with same name as the index */
if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto exit_create_index;
- if( (pISameName = sqlite3FindIndex(db, zName, db->aDb[iDb].zName))!=0 ){
+ if( sqlite3FindIndex(db, zName, db->aDb[iDb].zName)!=0 ){
sqlite3ErrorMsg(pParse, "index %s already exists", zName);
goto exit_create_index;
}
- if( (pTSameName = sqlite3FindTable(db, zName, 0))!=0 ){
+ if( sqlite3FindTable(db, zName, 0)!=0 ){
sqlite3ErrorMsg(pParse, "there is already a table named %s", zName);
goto exit_create_index;
}
@@ -2171,7 +2170,7 @@ void sqlite3CreateIndex(
(sizeof(int)*2 + sizeof(CollSeq*))*pList->nExpr );
if( sqlite3_malloc_failed ) goto exit_create_index;
pIndex->aiColumn = (int*)&pIndex->keyInfo.aColl[pList->nExpr];
- pIndex->aiRowEst = &pIndex->aiColumn[pList->nExpr];
+ pIndex->aiRowEst = (unsigned*)&pIndex->aiColumn[pList->nExpr];
pIndex->zName = (char*)&pIndex->aiRowEst[pList->nExpr+1];
strcpy(pIndex->zName, zName);
pIndex->pTable = pTab;
@@ -2394,7 +2393,7 @@ exit_create_index:
** are based on typical values found in actual indices.
*/
void sqlite3DefaultRowEst(Index *pIdx){
- int *a = pIdx->aiRowEst;
+ unsigned *a = pIdx->aiRowEst;
int i;
assert( a!=0 );
a[0] = 1000000;
@@ -2468,30 +2467,65 @@ exit_drop_index:
}
/*
+** ppArray points into a structure where there is an array pointer
+** followed by two integers. The first integer is the
+** number of elements in the structure array. The second integer
+** is the number of allocated slots in the array.
+**
+** In other words, the structure looks something like this:
+**
+** struct Example1 {
+** struct subElem *aEntry;
+** int nEntry;
+** int nAlloc;
+** }
+**
+** The pnEntry parameter points to the equivalent of Example1.nEntry.
+**
+** This routine allocates a new slot in the array, zeros it out,
+** and returns its index. If malloc fails a negative number is returned.
+**
+** szEntry is the sizeof of a single array entry. initSize is the
+** number of array entries allocated on the initial allocation.
+*/
+int sqlite3ArrayAllocate(void **ppArray, int szEntry, int initSize){
+ char *p;
+ int *an = (int*)&ppArray[1];
+ if( an[0]>=an[1] ){
+ void *pNew;
+ int newSize;
+ newSize = an[1]*2 + initSize;
+ pNew = sqliteRealloc(*ppArray, newSize*szEntry);
+ if( pNew==0 ){
+ return -1;
+ }
+ an[1] = newSize;
+ *ppArray = pNew;
+ }
+ p = *ppArray;
+ memset(&p[an[0]*szEntry], 0, szEntry);
+ return an[0]++;
+}
+
+/*
** Append a new element to the given IdList. Create a new IdList if
** need be.
**
** A new IdList is returned, or NULL if malloc() fails.
*/
IdList *sqlite3IdListAppend(IdList *pList, Token *pToken){
+ int i;
if( pList==0 ){
pList = sqliteMalloc( sizeof(IdList) );
if( pList==0 ) return 0;
pList->nAlloc = 0;
}
- if( pList->nId>=pList->nAlloc ){
- struct IdList_item *a;
- pList->nAlloc = pList->nAlloc*2 + 5;
- a = sqliteRealloc(pList->a, pList->nAlloc*sizeof(pList->a[0]) );
- if( a==0 ){
- sqlite3IdListDelete(pList);
- return 0;
- }
- pList->a = a;
+ i = sqlite3ArrayAllocate((void**)&pList->a, sizeof(pList->a[0]), 5);
+ if( i<0 ){
+ sqlite3IdListDelete(pList);
+ return 0;
}
- memset(&pList->a[pList->nId], 0, sizeof(pList->a[0]));
- pList->a[pList->nId].zName = sqlite3NameFromToken(pToken);
- pList->nId++;
+ pList->a[i].zName = sqlite3NameFromToken(pToken);
return pList;
}
diff --git a/ext/pdo_sqlite/sqlite/src/delete.c b/ext/pdo_sqlite/sqlite/src/delete.c
index f9bb49e577..7eb618b78f 100644
--- a/ext/pdo_sqlite/sqlite/src/delete.c
+++ b/ext/pdo_sqlite/sqlite/src/delete.c
@@ -178,12 +178,12 @@ void sqlite3DeleteFrom(
if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
sqlite3BeginWriteOperation(pParse, triggers_exist, pTab->iDb);
- /* If we are trying to delete from a view, construct that view into
- ** a temporary table.
+ /* If we are trying to delete from a view, realize that view into
+ ** a ephemeral table.
*/
if( isView ){
Select *pView = sqlite3SelectDup(pTab->pSelect);
- sqlite3Select(pParse, pView, SRT_TempTable, iCur, 0, 0, 0, 0);
+ sqlite3Select(pParse, pView, SRT_VirtualTab, iCur, 0, 0, 0, 0);
sqlite3SelectDelete(pView);
}
@@ -380,7 +380,7 @@ void sqlite3GenerateRowDelete(
addr = sqlite3VdbeAddOp(v, OP_NotExists, iCur, 0);
sqlite3GenerateRowIndexDelete(db, v, pTab, iCur, 0);
sqlite3VdbeAddOp(v, OP_Delete, iCur, (count?OPFLAG_NCHANGE:0));
- sqlite3VdbeChangeP2(v, addr, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, addr);
}
/*
diff --git a/ext/pdo_sqlite/sqlite/src/expr.c b/ext/pdo_sqlite/sqlite/src/expr.c
index a83b9d78cf..1276fe9f6a 100644
--- a/ext/pdo_sqlite/sqlite/src/expr.c
+++ b/ext/pdo_sqlite/sqlite/src/expr.c
@@ -355,7 +355,7 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
pExpr->iTable = ++pParse->nVar;
if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){
pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10;
- pParse->apVarExpr = sqliteRealloc(pParse->apVarExpr,
+ sqlite3ReallocOrFree((void**)&pParse->apVarExpr,
pParse->nVarExprAlloc*sizeof(pParse->apVarExpr[0]) );
}
if( !sqlite3_malloc_failed ){
@@ -546,9 +546,14 @@ Select *sqlite3SelectDup(Select *p){
pNew->pOffset = sqlite3ExprDup(p->pOffset);
pNew->iLimit = -1;
pNew->iOffset = -1;
- pNew->ppOpenVirtual = 0;
pNew->isResolved = p->isResolved;
pNew->isAgg = p->isAgg;
+ pNew->usesVirt = 0;
+ pNew->disallowOrderBy = 0;
+ pNew->pRightmost = 0;
+ pNew->addrOpenVirt[0] = -1;
+ pNew->addrOpenVirt[1] = -1;
+ pNew->addrOpenVirt[2] = -1;
return pNew;
}
#else
@@ -692,6 +697,7 @@ static int exprNodeIsConstant(void *pArg, Expr *pExpr){
case TK_COLUMN:
case TK_DOT:
case TK_AGG_FUNCTION:
+ case TK_AGG_COLUMN:
#ifndef SQLITE_OMIT_SUBQUERY
case TK_SELECT:
case TK_EXISTS:
@@ -1227,11 +1233,19 @@ int sqlite3ExprResolveNames(
NameContext *pNC, /* Namespace to resolve expressions in. */
Expr *pExpr /* The expression to be analyzed. */
){
+ int savedHasAgg;
if( pExpr==0 ) return 0;
+ savedHasAgg = pNC->hasAgg;
+ pNC->hasAgg = 0;
walkExprTree(pExpr, nameResolverStep, pNC);
if( pNC->nErr>0 ){
ExprSetProperty(pExpr, EP_Error);
}
+ if( pNC->hasAgg ){
+ ExprSetProperty(pExpr, EP_Agg);
+ }else if( savedHasAgg ){
+ pNC->hasAgg = 1;
+ }
return ExprHasProperty(pExpr, EP_Error);
}
@@ -1279,13 +1293,8 @@ void sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
int mem = pParse->nMem++;
sqlite3VdbeAddOp(v, OP_MemLoad, mem, 0);
testAddr = sqlite3VdbeAddOp(v, OP_If, 0, 0);
- assert( testAddr>0 );
- sqlite3VdbeAddOp(v, OP_Integer, 1, 0);
- sqlite3VdbeAddOp(v, OP_MemStore, mem, 1);
- }
-
- if( pExpr->pSelect ){
- sqlite3VdbeAddOp(v, OP_AggContextPush, 0, 0);
+ assert( testAddr>0 || sqlite3_malloc_failed );
+ sqlite3VdbeAddOp(v, OP_MemInt, 1, mem);
}
switch( pExpr->op ){
@@ -1359,7 +1368,7 @@ void sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
if( testAddr>0 && !sqlite3ExprIsConstant(pE2) ){
VdbeOp *aOp = sqlite3VdbeGetOp(v, testAddr-1);
int i;
- for(i=0; i<4; i++){
+ for(i=0; i<3; i++){
aOp[i].opcode = OP_Noop;
}
testAddr = 0;
@@ -1400,11 +1409,8 @@ void sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
}
}
- if( pExpr->pSelect ){
- sqlite3VdbeAddOp(v, OP_AggContextPop, 0, 0);
- }
if( testAddr ){
- sqlite3VdbeChangeP2(v, testAddr, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, testAddr);
}
return;
}
@@ -1445,10 +1451,21 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
}
op = pExpr->op;
switch( op ){
+ case TK_AGG_COLUMN: {
+ AggInfo *pAggInfo = pExpr->pAggInfo;
+ struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg];
+ if( !pAggInfo->directMode ){
+ sqlite3VdbeAddOp(v, OP_MemLoad, pCol->iMem, 0);
+ break;
+ }else if( pAggInfo->useSortingIdx ){
+ sqlite3VdbeAddOp(v, OP_Column, pAggInfo->sortingIdx,
+ pCol->iSorterColumn);
+ break;
+ }
+ /* Otherwise, fall thru into the TK_COLUMN case */
+ }
case TK_COLUMN: {
- if( !pParse->fillAgg && pExpr->iAgg>=0 ){
- sqlite3VdbeAddOp(v, OP_AggGet, pExpr->iAggCtx, pExpr->iAgg);
- }else if( pExpr->iColumn>=0 ){
+ if( pExpr->iColumn>=0 ){
sqlite3VdbeAddOp(v, OP_Column, pExpr->iTable, pExpr->iColumn);
sqlite3ColumnDefault(v, pExpr->pTab, pExpr->iColumn);
}else{
@@ -1597,7 +1614,8 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
break;
}
case TK_AGG_FUNCTION: {
- sqlite3VdbeAddOp(v, OP_AggGet, 0, pExpr->iAgg);
+ AggInfo *pInfo = pExpr->pAggInfo;
+ sqlite3VdbeAddOp(v, OP_MemLoad, pInfo->aFunc[pExpr->iAgg].iMem, 0);
break;
}
case TK_CONST_FUNC:
@@ -1607,7 +1625,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
FuncDef *pDef;
int nId;
const char *zId;
- int p2 = 0;
+ int constMask = 0;
int i;
u8 enc = pParse->db->enc;
CollSeq *pColl = 0;
@@ -1618,7 +1636,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
nExpr = sqlite3ExprCodeExprList(pParse, pList);
for(i=0; i<nExpr && i<32; i++){
if( sqlite3ExprIsConstant(pList->a[i].pExpr) ){
- p2 |= (1<<i);
+ constMask |= (1<<i);
}
if( pDef->needCollSeq && !pColl ){
pColl = sqlite3ExprCollSeq(pParse, pList->a[i].pExpr);
@@ -1628,7 +1646,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
if( !pColl ) pColl = pParse->db->pDfltColl;
sqlite3VdbeOp3(v, OP_CollSeq, 0, 0, (char *)pColl, P3_COLLSEQ);
}
- sqlite3VdbeOp3(v, OP_Function, nExpr, p2, (char*)pDef, P3_FUNCDEF);
+ sqlite3VdbeOp3(v, OP_Function, constMask, nExpr, (char*)pDef, P3_FUNCDEF);
break;
}
#ifndef SQLITE_OMIT_SUBQUERY
@@ -1692,7 +1710,6 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
case TK_CASE: {
int expr_end_label;
int jumpInst;
- int addr;
int nExpr;
int i;
ExprList *pEList;
@@ -1720,8 +1737,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
}
sqlite3ExprCode(pParse, aListelem[i+1].pExpr);
sqlite3VdbeAddOp(v, OP_Goto, 0, expr_end_label);
- addr = sqlite3VdbeCurrentAddr(v);
- sqlite3VdbeChangeP2(v, jumpInst, addr);
+ sqlite3VdbeJumpHere(v, jumpInst);
}
if( pExpr->pLeft ){
sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
@@ -1888,7 +1904,7 @@ void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
codeCompare(pParse, pLeft, pRight, OP_Le, dest, jumpIfNull);
sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
- sqlite3VdbeChangeP2(v, addr, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, addr);
sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
break;
}
@@ -2021,6 +2037,7 @@ int sqlite3ExprCompare(Expr *pA, Expr *pB){
return 0;
}
if( pA->op!=pB->op ) return 0;
+ if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 0;
if( !sqlite3ExprCompare(pA->pLeft, pB->pLeft) ) return 0;
if( !sqlite3ExprCompare(pA->pRight, pB->pRight) ) return 0;
if( pA->pList ){
@@ -2044,23 +2061,32 @@ int sqlite3ExprCompare(Expr *pA, Expr *pB){
return 1;
}
+
/*
-** Add a new element to the pParse->aAgg[] array and return its index.
-** The new element is initialized to zero. The calling function is
-** expected to fill it in.
+** Add a new element to the pAggInfo->aCol[] array. Return the index of
+** the new element. Return a negative number if malloc fails.
*/
-static int appendAggInfo(Parse *pParse){
- if( (pParse->nAgg & 0x7)==0 ){
- int amt = pParse->nAgg + 8;
- AggExpr *aAgg = sqliteRealloc(pParse->aAgg, amt*sizeof(pParse->aAgg[0]));
- if( aAgg==0 ){
- return -1;
- }
- pParse->aAgg = aAgg;
+static int addAggInfoColumn(AggInfo *pInfo){
+ int i;
+ i = sqlite3ArrayAllocate((void**)&pInfo->aCol, sizeof(pInfo->aCol[0]), 3);
+ if( i<0 ){
+ return -1;
}
- memset(&pParse->aAgg[pParse->nAgg], 0, sizeof(pParse->aAgg[0]));
- return pParse->nAgg++;
-}
+ return i;
+}
+
+/*
+** Add a new element to the pAggInfo->aFunc[] array. Return the index of
+** the new element. Return a negative number if malloc fails.
+*/
+static int addAggInfoFunc(AggInfo *pInfo){
+ int i;
+ i = sqlite3ArrayAllocate((void**)&pInfo->aFunc, sizeof(pInfo->aFunc[0]), 2);
+ if( i<0 ){
+ return -1;
+ }
+ return i;
+}
/*
** This is an xFunc for walkExprTree() used to implement
@@ -2071,60 +2097,118 @@ static int appendAggInfo(Parse *pParse){
*/
static int analyzeAggregate(void *pArg, Expr *pExpr){
int i;
- AggExpr *aAgg;
NameContext *pNC = (NameContext *)pArg;
Parse *pParse = pNC->pParse;
SrcList *pSrcList = pNC->pSrcList;
+ AggInfo *pAggInfo = pNC->pAggInfo;
+
switch( pExpr->op ){
case TK_COLUMN: {
- for(i=0; pSrcList && i<pSrcList->nSrc; i++){
- if( pExpr->iTable==pSrcList->a[i].iCursor ){
- aAgg = pParse->aAgg;
- for(i=0; i<pParse->nAgg; i++){
- if( aAgg[i].isAgg ) continue;
- if( aAgg[i].pExpr->iTable==pExpr->iTable
- && aAgg[i].pExpr->iColumn==pExpr->iColumn ){
- break;
+ /* Check to see if the column is in one of the tables in the FROM
+ ** clause of the aggregate query */
+ if( pSrcList ){
+ struct SrcList_item *pItem = pSrcList->a;
+ for(i=0; i<pSrcList->nSrc; i++, pItem++){
+ struct AggInfo_col *pCol;
+ if( pExpr->iTable==pItem->iCursor ){
+ /* If we reach this point, it means that pExpr refers to a table
+ ** that is in the FROM clause of the aggregate query.
+ **
+ ** Make an entry for the column in pAggInfo->aCol[] if there
+ ** is not an entry there already.
+ */
+ pCol = pAggInfo->aCol;
+ for(i=0; i<pAggInfo->nColumn; i++, pCol++){
+ if( pCol->iTable==pExpr->iTable &&
+ pCol->iColumn==pExpr->iColumn ){
+ break;
+ }
}
- }
- if( i>=pParse->nAgg ){
- i = appendAggInfo(pParse);
- if( i<0 ) return 1;
- pParse->aAgg[i].isAgg = 0;
- pParse->aAgg[i].pExpr = pExpr;
- }
- pExpr->iAgg = i;
- pExpr->iAggCtx = pNC->nDepth;
- return 1;
- }
+ if( i>=pAggInfo->nColumn && (i = addAggInfoColumn(pAggInfo))>=0 ){
+ pCol = &pAggInfo->aCol[i];
+ pCol->iTable = pExpr->iTable;
+ pCol->iColumn = pExpr->iColumn;
+ pCol->iMem = pParse->nMem++;
+ pCol->iSorterColumn = -1;
+ pCol->pExpr = pExpr;
+ if( pAggInfo->pGroupBy ){
+ int j, n;
+ ExprList *pGB = pAggInfo->pGroupBy;
+ struct ExprList_item *pTerm = pGB->a;
+ n = pGB->nExpr;
+ for(j=0; j<n; j++, pTerm++){
+ Expr *pE = pTerm->pExpr;
+ if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable &&
+ pE->iColumn==pExpr->iColumn ){
+ pCol->iSorterColumn = j;
+ break;
+ }
+ }
+ }
+ if( pCol->iSorterColumn<0 ){
+ pCol->iSorterColumn = pAggInfo->nSortingColumn++;
+ }
+ }
+ /* There is now an entry for pExpr in pAggInfo->aCol[] (either
+ ** because it was there before or because we just created it).
+ ** Convert the pExpr to be a TK_AGG_COLUMN referring to that
+ ** pAggInfo->aCol[] entry.
+ */
+ pExpr->pAggInfo = pAggInfo;
+ pExpr->op = TK_AGG_COLUMN;
+ pExpr->iAgg = i;
+ break;
+ } /* endif pExpr->iTable==pItem->iCursor */
+ } /* end loop over pSrcList */
}
return 1;
}
case TK_AGG_FUNCTION: {
+ /* The pNC->nDepth==0 test causes aggregate functions in subqueries
+ ** to be ignored */
if( pNC->nDepth==0 ){
- aAgg = pParse->aAgg;
- for(i=0; i<pParse->nAgg; i++){
- if( !aAgg[i].isAgg ) continue;
- if( sqlite3ExprCompare(aAgg[i].pExpr, pExpr) ){
+ /* Check to see if pExpr is a duplicate of another aggregate
+ ** function that is already in the pAggInfo structure
+ */
+ struct AggInfo_func *pItem = pAggInfo->aFunc;
+ for(i=0; i<pAggInfo->nFunc; i++, pItem++){
+ if( sqlite3ExprCompare(pItem->pExpr, pExpr) ){
break;
}
}
- if( i>=pParse->nAgg ){
+ if( i>=pAggInfo->nFunc ){
+ /* pExpr is original. Make a new entry in pAggInfo->aFunc[]
+ */
u8 enc = pParse->db->enc;
- i = appendAggInfo(pParse);
- if( i<0 ) return 1;
- pParse->aAgg[i].isAgg = 1;
- pParse->aAgg[i].pExpr = pExpr;
- pParse->aAgg[i].pFunc = sqlite3FindFunction(pParse->db,
- pExpr->token.z, pExpr->token.n,
- pExpr->pList ? pExpr->pList->nExpr : 0, enc, 0);
+ i = addAggInfoFunc(pAggInfo);
+ if( i>=0 ){
+ pItem = &pAggInfo->aFunc[i];
+ pItem->pExpr = pExpr;
+ pItem->iMem = pParse->nMem++;
+ pItem->pFunc = sqlite3FindFunction(pParse->db,
+ pExpr->token.z, pExpr->token.n,
+ pExpr->pList ? pExpr->pList->nExpr : 0, enc, 0);
+ if( pExpr->flags & EP_Distinct ){
+ pItem->iDistinct = pParse->nTab++;
+ }else{
+ pItem->iDistinct = -1;
+ }
+ }
}
+ /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry
+ */
pExpr->iAgg = i;
+ pExpr->pAggInfo = pAggInfo;
return 1;
}
}
}
+
+ /* Recursively walk subqueries looking for TK_COLUMN nodes that need
+ ** to be changed to TK_AGG_COLUMN. But increment nDepth so that
+ ** TK_AGG_FUNCTION nodes in subqueries will be unchanged.
+ */
if( pExpr->pSelect ){
pNC->nDepth++;
walkSelectExpr(pExpr->pSelect, analyzeAggregate, pNC);
@@ -2149,3 +2233,21 @@ int sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){
walkExprTree(pExpr, analyzeAggregate, pNC);
return pNC->pParse->nErr - nErr;
}
+
+/*
+** Call sqlite3ExprAnalyzeAggregates() for every expression in an
+** expression list. Return the number of errors.
+**
+** If an error is found, the analysis is cut short.
+*/
+int sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList){
+ struct ExprList_item *pItem;
+ int i;
+ int nErr = 0;
+ if( pList ){
+ for(pItem=pList->a, i=0; nErr==0 && i<pList->nExpr; i++, pItem++){
+ nErr += sqlite3ExprAnalyzeAggregates(pNC, pItem->pExpr);
+ }
+ }
+ return nErr;
+}
diff --git a/ext/pdo_sqlite/sqlite/src/func.c b/ext/pdo_sqlite/sqlite/src/func.c
index 326d98eef6..cdb674fa28 100644
--- a/ext/pdo_sqlite/sqlite/src/func.c
+++ b/ext/pdo_sqlite/sqlite/src/func.c
@@ -819,6 +819,7 @@ typedef struct SumCtx SumCtx;
struct SumCtx {
double sum; /* Sum of terms */
int cnt; /* Number of elements summed */
+ u8 seenFloat; /* True if there has been any floating point value */
};
/*
@@ -826,21 +827,32 @@ struct SumCtx {
*/
static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){
SumCtx *p;
- if( argc<1 ) return;
+ int type;
+ assert( argc==1 );
p = sqlite3_aggregate_context(context, sizeof(*p));
- if( p && SQLITE_NULL!=sqlite3_value_type(argv[0]) ){
+ type = sqlite3_value_type(argv[0]);
+ if( p && type!=SQLITE_NULL ){
p->sum += sqlite3_value_double(argv[0]);
p->cnt++;
+ if( type==SQLITE_FLOAT ){
+ p->seenFloat = 1;
+ }
}
}
static void sumFinalize(sqlite3_context *context){
SumCtx *p;
- p = sqlite3_aggregate_context(context, sizeof(*p));
- sqlite3_result_double(context, p ? p->sum : 0.0);
+ p = sqlite3_aggregate_context(context, 0);
+ if( p && p->cnt>0 ){
+ if( p->seenFloat ){
+ sqlite3_result_double(context, p->sum);
+ }else{
+ sqlite3_result_int64(context, (i64)p->sum);
+ }
+ }
}
static void avgFinalize(sqlite3_context *context){
SumCtx *p;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_aggregate_context(context, 0);
if( p && p->cnt>0 ){
sqlite3_result_double(context, p->sum/(double)p->cnt);
}
@@ -878,7 +890,7 @@ static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){
}
static void countFinalize(sqlite3_context *context){
CountCtx *p;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_aggregate_context(context, 0);
sqlite3_result_int(context, p ? p->n : 0);
}
@@ -916,11 +928,13 @@ static void minmaxStep(sqlite3_context *context, int argc, sqlite3_value **argv)
}
static void minMaxFinalize(sqlite3_context *context){
sqlite3_value *pRes;
- pRes = (sqlite3_value *)sqlite3_aggregate_context(context, sizeof(Mem));
- if( pRes->flags ){
- sqlite3_result_value(context, pRes);
+ pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0);
+ if( pRes ){
+ if( pRes->flags ){
+ sqlite3_result_value(context, pRes);
+ }
+ sqlite3VdbeMemRelease(pRes);
}
- sqlite3VdbeMemRelease(pRes);
}
@@ -1041,11 +1055,11 @@ void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
/*
** Set the LIKEOPT flag on the 2-argument function with the given name.
*/
-static void setLikeOptFlag(sqlite3 *db, const char *zName){
+static void setLikeOptFlag(sqlite3 *db, const char *zName, int flagVal){
FuncDef *pDef;
pDef = sqlite3FindFunction(db, zName, strlen(zName), 2, SQLITE_UTF8, 0);
if( pDef ){
- pDef->flags = SQLITE_FUNC_LIKEOPT;
+ pDef->flags = flagVal;
}
}
@@ -1065,10 +1079,9 @@ void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){
sqlite3_create_function(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0);
sqlite3_create_function(db, "glob", 2, SQLITE_UTF8,
(struct compareInfo*)&globInfo, likeFunc, 0,0);
- setLikeOptFlag(db, "glob");
- if( caseSensitive ){
- setLikeOptFlag(db, "like");
- }
+ setLikeOptFlag(db, "glob", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE);
+ setLikeOptFlag(db, "like",
+ caseSensitive ? (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE);
}
/*
@@ -1078,7 +1091,7 @@ void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){
** return TRUE. If the function is not a LIKE-style function then
** return FALSE.
*/
-int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, char *aWc){
+int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){
FuncDef *pDef;
if( pExpr->op!=TK_FUNCTION ){
return 0;
@@ -1088,7 +1101,7 @@ int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, char *aWc){
}
pDef = sqlite3FindFunction(db, pExpr->token.z, pExpr->token.n, 2,
SQLITE_UTF8, 0);
- if( pDef==0 || (pDef->flags & SQLITE_FUNC_LIKEOPT)==0 ){
+ if( pDef==0 || (pDef->flags & SQLITE_FUNC_LIKE)==0 ){
return 0;
}
@@ -1100,6 +1113,6 @@ int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, char *aWc){
assert( (char*)&likeInfoAlt == (char*)&likeInfoAlt.matchAll );
assert( &((char*)&likeInfoAlt)[1] == (char*)&likeInfoAlt.matchOne );
assert( &((char*)&likeInfoAlt)[2] == (char*)&likeInfoAlt.matchSet );
-
+ *pIsNocase = (pDef->flags & SQLITE_FUNC_CASE)==0;
return 1;
}
diff --git a/ext/pdo_sqlite/sqlite/src/insert.c b/ext/pdo_sqlite/sqlite/src/insert.c
index 52ac2e55ca..37f9f4ee57 100644
--- a/ext/pdo_sqlite/sqlite/src/insert.c
+++ b/ext/pdo_sqlite/sqlite/src/insert.c
@@ -372,13 +372,13 @@ void sqlite3Insert(
** of the program jumps to it. Create the temporary table, then jump
** back up and execute the SELECT code above.
*/
- sqlite3VdbeChangeP2(v, iInitCode, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, iInitCode);
sqlite3VdbeAddOp(v, OP_OpenVirtual, srcTab, 0);
sqlite3VdbeAddOp(v, OP_SetNumColumns, srcTab, nColumn);
sqlite3VdbeAddOp(v, OP_Goto, 0, iSelectLoop);
sqlite3VdbeResolveLabel(v, iCleanup);
}else{
- sqlite3VdbeChangeP2(v, iInitCode, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, iInitCode);
}
}else{
/* This is the case if the data for the INSERT is coming from a VALUES
@@ -470,8 +470,7 @@ void sqlite3Insert(
*/
if( db->flags & SQLITE_CountRows ){
iCntMem = pParse->nMem++;
- sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
- sqlite3VdbeAddOp(v, OP_MemStore, iCntMem, 1);
+ sqlite3VdbeAddOp(v, OP_MemInt, 0, iCntMem);
}
/* Open tables and indices if there are no row triggers */
@@ -817,7 +816,6 @@ void sqlite3GenerateConstraintChecks(
Index *pIdx;
int seenReplace = 0;
int jumpInst1=0, jumpInst2;
- int contAddr;
int hasTwoRowids = (isUpdate && rowidChng);
v = sqlite3GetVdbe(pParse);
@@ -867,7 +865,7 @@ void sqlite3GenerateConstraintChecks(
break;
}
}
- sqlite3VdbeChangeP2(v, addr, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, addr);
}
/* Test all CHECK constraints
@@ -921,10 +919,9 @@ void sqlite3GenerateConstraintChecks(
break;
}
}
- contAddr = sqlite3VdbeCurrentAddr(v);
- sqlite3VdbeChangeP2(v, jumpInst2, contAddr);
+ sqlite3VdbeJumpHere(v, jumpInst2);
if( isUpdate ){
- sqlite3VdbeChangeP2(v, jumpInst1, contAddr);
+ sqlite3VdbeJumpHere(v, jumpInst1);
sqlite3VdbeAddOp(v, OP_Dup, nCol+1, 1);
sqlite3VdbeAddOp(v, OP_MoveGe, base, 0);
}
@@ -1018,11 +1015,10 @@ void sqlite3GenerateConstraintChecks(
break;
}
}
- contAddr = sqlite3VdbeCurrentAddr(v);
#if NULL_DISTINCT_FOR_UNIQUE
- sqlite3VdbeChangeP2(v, jumpInst1, contAddr);
+ sqlite3VdbeJumpHere(v, jumpInst1);
#endif
- sqlite3VdbeChangeP2(v, jumpInst2, contAddr);
+ sqlite3VdbeJumpHere(v, jumpInst2);
}
}
diff --git a/ext/pdo_sqlite/sqlite/src/main.c b/ext/pdo_sqlite/sqlite/src/main.c
index d0ecd4fe52..c42df158e4 100644
--- a/ext/pdo_sqlite/sqlite/src/main.c
+++ b/ext/pdo_sqlite/sqlite/src/main.c
@@ -509,13 +509,14 @@ int sqlite3_create_function16(
}
#endif
+#ifndef SQLITE_OMIT_TRACE
/*
** Register a trace function. The pArg from the previously registered trace
** is returned.
**
** A NULL trace function means that no tracing is executes. A non-NULL
** trace is a pointer to a function that is invoked at the start of each
-** sqlite3_exec().
+** SQL statement.
*/
void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){
void *pOld = db->pTraceArg;
@@ -523,6 +524,25 @@ void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){
db->pTraceArg = pArg;
return pOld;
}
+/*
+** Register a profile function. The pArg from the previously registered
+** profile function is returned.
+**
+** A NULL profile function means that no profiling is executes. A non-NULL
+** profile is a pointer to a function that is invoked at the conclusion of
+** each SQL statement that is run.
+*/
+void *sqlite3_profile(
+ sqlite3 *db,
+ void (*xProfile)(void*,const char*,sqlite_uint64),
+ void *pArg
+){
+ void *pOld = db->pProfileArg;
+ db->xProfile = xProfile;
+ db->pProfileArg = pArg;
+ return pOld;
+}
+#endif /* SQLITE_OMIT_TRACE */
/*** EXPERIMENTAL ***
**
@@ -694,6 +714,7 @@ static int openDatabase(
){
sqlite3 *db;
int rc, i;
+ CollSeq *pColl;
/* Allocate the sqlite data structure */
db = sqliteMalloc( sizeof(sqlite3) );
@@ -730,6 +751,13 @@ static int openDatabase(
/* Also add a UTF-8 case-insensitive collation sequence. */
sqlite3_create_collation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc);
+ /* Set flags on the built-in collating sequences */
+ db->pDfltColl->type = SQLITE_COLL_BINARY;
+ pColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "NOCASE", 6, 0);
+ if( pColl ){
+ pColl->type = SQLITE_COLL_NOCASE;
+ }
+
/* Open the backend database driver */
rc = sqlite3BtreeFactory(db, zFilename, 0, MAX_PAGES, &db->aDb[0].pBt);
if( rc!=SQLITE_OK ){
@@ -847,7 +875,7 @@ int sqlite3_reset(sqlite3_stmt *pStmt){
rc = SQLITE_OK;
}else{
rc = sqlite3VdbeReset((Vdbe*)pStmt);
- sqlite3VdbeMakeReady((Vdbe*)pStmt, -1, 0, 0, 0, 0);
+ sqlite3VdbeMakeReady((Vdbe*)pStmt, -1, 0, 0, 0);
}
return rc;
}
@@ -901,7 +929,7 @@ int sqlite3_create_collation(
pColl = sqlite3FindCollSeq(db, (u8)enc, zName, strlen(zName), 1);
if( 0==pColl ){
- rc = SQLITE_NOMEM;
+ rc = SQLITE_NOMEM;
}else{
pColl->xCmp = xCompare;
pColl->pUser = pCtx;
@@ -1019,3 +1047,14 @@ recover_out:
int sqlite3_get_autocommit(sqlite3 *db){
return db->autoCommit;
}
+
+#ifdef SQLITE_DEBUG
+/*
+** The following routine is subtituted for constant SQLITE_CORRUPT in
+** debugging builds. This provides a way to set a breakpoint for when
+** corruption is first detected.
+*/
+int sqlite3Corrupt(void){
+ return SQLITE_CORRUPT;
+}
+#endif
diff --git a/ext/pdo_sqlite/sqlite/src/opcodes.h b/ext/pdo_sqlite/sqlite/src/opcodes.h
index dd8823c277..4db3ec1639 100644
--- a/ext/pdo_sqlite/sqlite/src/opcodes.h
+++ b/ext/pdo_sqlite/sqlite/src/opcodes.h
@@ -1,144 +1,149 @@
/* Automatically generated. Do not edit */
/* See the mkopcodeh.awk script for details */
#define OP_MemLoad 1
-#define OP_HexBlob 131 /* same as TK_BLOB */
+#define OP_HexBlob 134 /* same as TK_BLOB */
#define OP_Column 2
#define OP_SetCookie 3
#define OP_IfMemPos 4
-#define OP_Real 130 /* same as TK_FLOAT */
-#define OP_MoveGt 5
-#define OP_Ge 77 /* same as TK_GE */
-#define OP_AggFocus 6
+#define OP_Real 133 /* same as TK_FLOAT */
+#define OP_Sequence 5
+#define OP_MoveGt 6
+#define OP_Ge 80 /* same as TK_GE */
#define OP_RowKey 7
-#define OP_AggNext 8
-#define OP_Eq 73 /* same as TK_EQ */
-#define OP_OpenWrite 9
-#define OP_NotNull 71 /* same as TK_NOTNULL */
-#define OP_If 10
-#define OP_ToInt 11
-#define OP_String8 92 /* same as TK_STRING */
-#define OP_Pop 12
-#define OP_AggContextPush 13
-#define OP_CollSeq 14
-#define OP_OpenRead 15
-#define OP_Expire 16
-#define OP_SortReset 17
-#define OP_AutoCommit 18
-#define OP_Gt 74 /* same as TK_GT */
-#define OP_Sort 19
-#define OP_IntegrityCk 20
-#define OP_SortInsert 21
-#define OP_Function 22
-#define OP_And 65 /* same as TK_AND */
-#define OP_Subtract 84 /* same as TK_MINUS */
-#define OP_Noop 23
-#define OP_Return 24
-#define OP_Remainder 87 /* same as TK_REM */
-#define OP_NewRowid 25
-#define OP_Multiply 85 /* same as TK_STAR */
-#define OP_Variable 26
-#define OP_String 27
-#define OP_ParseSchema 28
-#define OP_AggFunc 29
-#define OP_Close 30
-#define OP_CreateIndex 31
-#define OP_IsUnique 32
-#define OP_IdxIsNull 33
-#define OP_NotFound 34
-#define OP_Int64 35
-#define OP_MustBeInt 36
-#define OP_Halt 37
-#define OP_Rowid 38
-#define OP_IdxLT 39
-#define OP_AddImm 40
-#define OP_Statement 41
-#define OP_RowData 42
-#define OP_MemMax 43
-#define OP_Push 44
-#define OP_Or 64 /* same as TK_OR */
-#define OP_NotExists 45
-#define OP_MemIncr 46
-#define OP_Gosub 47
-#define OP_Divide 86 /* same as TK_SLASH */
-#define OP_AggSet 48
-#define OP_Integer 49
-#define OP_ToNumeric 50
-#define OP_SortNext 51
-#define OP_Prev 52
-#define OP_Concat 88 /* same as TK_CONCAT */
-#define OP_BitAnd 79 /* same as TK_BITAND */
-#define OP_CreateTable 53
-#define OP_Last 54
-#define OP_IsNull 70 /* same as TK_ISNULL */
-#define OP_IdxRowid 55
-#define OP_MakeIdxRec 56
-#define OP_ShiftRight 82 /* same as TK_RSHIFT */
-#define OP_ResetCount 57
-#define OP_FifoWrite 58
-#define OP_Callback 59
-#define OP_ContextPush 60
-#define OP_DropTrigger 61
-#define OP_DropIndex 62
-#define OP_IdxGE 63
-#define OP_IdxDelete 67
-#define OP_Vacuum 68
-#define OP_MoveLe 69
-#define OP_IfNot 78
-#define OP_DropTable 90
-#define OP_MakeRecord 93
-#define OP_ToBlob 94
-#define OP_Delete 95
-#define OP_AggContextPop 96
-#define OP_ShiftLeft 81 /* same as TK_LSHIFT */
-#define OP_Dup 97
-#define OP_Goto 98
-#define OP_FifoRead 99
-#define OP_Clear 100
-#define OP_IdxGT 101
-#define OP_MoveLt 102
-#define OP_Le 75 /* same as TK_LE */
-#define OP_VerifyCookie 103
-#define OP_Pull 104
-#define OP_ToText 105
-#define OP_Not 66 /* same as TK_NOT */
-#define OP_SetNumColumns 106
-#define OP_AbsValue 107
-#define OP_Transaction 108
-#define OP_Negative 89 /* same as TK_UMINUS */
-#define OP_Ne 72 /* same as TK_NE */
-#define OP_AggGet 109
-#define OP_ContextPop 110
-#define OP_BitOr 80 /* same as TK_BITOR */
-#define OP_Next 111
-#define OP_AggInit 112
-#define OP_IdxInsert 113
-#define OP_Distinct 114
-#define OP_Lt 76 /* same as TK_LT */
-#define OP_AggReset 115
-#define OP_Insert 116
-#define OP_Destroy 117
-#define OP_ReadCookie 118
-#define OP_ForceInt 119
-#define OP_LoadAnalysis 120
-#define OP_OpenVirtual 121
-#define OP_OpenPseudo 122
-#define OP_Null 123
-#define OP_Blob 124
-#define OP_Add 83 /* same as TK_PLUS */
-#define OP_MemStore 125
-#define OP_Rewind 126
-#define OP_MoveGe 127
-#define OP_BitNot 91 /* same as TK_BITNOT */
-#define OP_Found 128
-#define OP_NullRow 129
+#define OP_Eq 76 /* same as TK_EQ */
+#define OP_OpenWrite 8
+#define OP_NotNull 74 /* same as TK_NOTNULL */
+#define OP_If 9
+#define OP_ToInt 10
+#define OP_String8 95 /* same as TK_STRING */
+#define OP_Pop 11
+#define OP_CollSeq 12
+#define OP_OpenRead 13
+#define OP_Expire 14
+#define OP_AutoCommit 15
+#define OP_Gt 77 /* same as TK_GT */
+#define OP_IntegrityCk 16
+#define OP_Sort 17
+#define OP_Function 18
+#define OP_And 68 /* same as TK_AND */
+#define OP_Subtract 87 /* same as TK_MINUS */
+#define OP_Noop 19
+#define OP_Return 20
+#define OP_Remainder 90 /* same as TK_REM */
+#define OP_NewRowid 21
+#define OP_Multiply 88 /* same as TK_STAR */
+#define OP_Variable 22
+#define OP_String 23
+#define OP_ParseSchema 24
+#define OP_Close 25
+#define OP_CreateIndex 26
+#define OP_IsUnique 27
+#define OP_IdxIsNull 28
+#define OP_NotFound 29
+#define OP_Int64 30
+#define OP_MustBeInt 31
+#define OP_Halt 32
+#define OP_Rowid 33
+#define OP_IdxLT 34
+#define OP_AddImm 35
+#define OP_Statement 36
+#define OP_RowData 37
+#define OP_MemMax 38
+#define OP_Push 39
+#define OP_Or 67 /* same as TK_OR */
+#define OP_NotExists 40
+#define OP_MemIncr 41
+#define OP_Gosub 42
+#define OP_Divide 89 /* same as TK_SLASH */
+#define OP_Integer 43
+#define OP_ToNumeric 44
+#define OP_MemInt 45
+#define OP_Prev 46
+#define OP_Concat 91 /* same as TK_CONCAT */
+#define OP_BitAnd 82 /* same as TK_BITAND */
+#define OP_CreateTable 47
+#define OP_Last 48
+#define OP_IsNull 73 /* same as TK_ISNULL */
+#define OP_IdxRowid 49
+#define OP_MakeIdxRec 50
+#define OP_ShiftRight 85 /* same as TK_RSHIFT */
+#define OP_ResetCount 51
+#define OP_FifoWrite 52
+#define OP_Callback 53
+#define OP_ContextPush 54
+#define OP_DropTrigger 55
+#define OP_DropIndex 56
+#define OP_IdxGE 57
+#define OP_IdxDelete 58
+#define OP_Vacuum 59
+#define OP_MoveLe 60
+#define OP_IfNot 61
+#define OP_DropTable 62
+#define OP_MakeRecord 63
+#define OP_ToBlob 64
+#define OP_Delete 65
+#define OP_AggFinal 66
+#define OP_ShiftLeft 84 /* same as TK_LSHIFT */
+#define OP_Dup 70
+#define OP_Goto 71
+#define OP_FifoRead 72
+#define OP_Clear 81
+#define OP_IdxGT 93
+#define OP_MoveLt 96
+#define OP_Le 78 /* same as TK_LE */
+#define OP_VerifyCookie 97
+#define OP_AggStep 98
+#define OP_Pull 99
+#define OP_ToText 100
+#define OP_Not 69 /* same as TK_NOT */
+#define OP_SetNumColumns 101
+#define OP_AbsValue 102
+#define OP_Transaction 103
+#define OP_Negative 92 /* same as TK_UMINUS */
+#define OP_Ne 75 /* same as TK_NE */
+#define OP_ContextPop 104
+#define OP_BitOr 83 /* same as TK_BITOR */
+#define OP_Next 105
+#define OP_IdxInsert 106
+#define OP_Distinct 107
+#define OP_Lt 79 /* same as TK_LT */
+#define OP_Insert 108
+#define OP_Destroy 109
+#define OP_ReadCookie 110
+#define OP_ForceInt 111
+#define OP_LoadAnalysis 112
+#define OP_OpenVirtual 113
+#define OP_Explain 114
+#define OP_OpenPseudo 115
+#define OP_Null 116
+#define OP_Blob 117
+#define OP_Add 86 /* same as TK_PLUS */
+#define OP_MemStore 118
+#define OP_Rewind 119
+#define OP_MoveGe 120
+#define OP_BitNot 94 /* same as TK_BITNOT */
+#define OP_MemMove 121
+#define OP_MemNull 122
+#define OP_Found 123
+#define OP_NullRow 124
-#define NOPUSH_MASK_0 65400
-#define NOPUSH_MASK_1 29103
-#define NOPUSH_MASK_2 64439
-#define NOPUSH_MASK_3 65109
-#define NOPUSH_MASK_4 65535
-#define NOPUSH_MASK_5 52991
-#define NOPUSH_MASK_6 55285
-#define NOPUSH_MASK_7 59295
-#define NOPUSH_MASK_8 3
+/* The following opcode values are never used */
+#define OP_NotUsed_125 125
+#define OP_NotUsed_126 126
+#define OP_NotUsed_127 127
+#define OP_NotUsed_128 128
+#define OP_NotUsed_129 129
+#define OP_NotUsed_130 130
+#define OP_NotUsed_131 131
+#define OP_NotUsed_132 132
+
+#define NOPUSH_MASK_0 65368
+#define NOPUSH_MASK_1 47898
+#define NOPUSH_MASK_2 22493
+#define NOPUSH_MASK_3 32761
+#define NOPUSH_MASK_4 65215
+#define NOPUSH_MASK_5 30719
+#define NOPUSH_MASK_6 40895
+#define NOPUSH_MASK_7 6603
+#define NOPUSH_MASK_8 0
#define NOPUSH_MASK_9 0
diff --git a/ext/pdo_sqlite/sqlite/src/os.h b/ext/pdo_sqlite/sqlite/src/os.h
index 4854964fbe..a161d134a6 100644
--- a/ext/pdo_sqlite/sqlite/src/os.h
+++ b/ext/pdo_sqlite/sqlite/src/os.h
@@ -161,8 +161,13 @@
** 1GB boundary.
**
*/
+#ifndef SQLITE_TEST
#define PENDING_BYTE 0x40000000 /* First byte past the 1GB boundary */
-/* #define PENDING_BYTE 0x5400 // Page 22 - for testing */
+#else
+extern unsigned int sqlite3_pending_byte;
+#define PENDING_BYTE sqlite3_pending_byte
+#endif
+
#define RESERVED_BYTE (PENDING_BYTE+1)
#define SHARED_FIRST (PENDING_BYTE+2)
#define SHARED_SIZE 510
@@ -181,7 +186,7 @@ int sqlite3OsClose(OsFile*);
int sqlite3OsRead(OsFile*, void*, int amt);
int sqlite3OsWrite(OsFile*, const void*, int amt);
int sqlite3OsSeek(OsFile*, i64 offset);
-int sqlite3OsSync(OsFile*);
+int sqlite3OsSync(OsFile*, int);
int sqlite3OsTruncate(OsFile*, i64 size);
int sqlite3OsFileSize(OsFile*, i64 *pSize);
char *sqlite3OsFullPathname(const char*);
diff --git a/ext/pdo_sqlite/sqlite/src/os_common.h b/ext/pdo_sqlite/sqlite/src/os_common.h
index 94311b9604..b19ff05906 100644
--- a/ext/pdo_sqlite/sqlite/src/os_common.h
+++ b/ext/pdo_sqlite/sqlite/src/os_common.h
@@ -28,6 +28,14 @@
#endif
+/*
+ * When testing, this global variable stores the location of the
+ * pending-byte in the database file.
+ */
+#ifdef SQLITE_TEST
+unsigned int sqlite3_pending_byte = 0x40000000;
+#endif
+
int sqlite3_os_trace = 0;
#ifdef SQLITE_DEBUG
static int last_page = 0;
@@ -82,6 +90,7 @@ static unsigned int elapse;
#ifdef SQLITE_TEST
int sqlite3_io_error_pending = 0;
int sqlite3_diskfull_pending = 0;
+int sqlite3_diskfull = 0;
#define SimulateIOError(A) \
if( sqlite3_io_error_pending ) \
if( sqlite3_io_error_pending-- == 1 ){ local_ioerr(); return A; }
@@ -89,8 +98,15 @@ static void local_ioerr(){
sqlite3_io_error_pending = 0; /* Really just a place to set a breakpoint */
}
#define SimulateDiskfullError \
- if( sqlite3_diskfull_pending ) \
- if( sqlite3_diskfull_pending-- == 1 ){ local_ioerr(); return SQLITE_FULL; }
+ if( sqlite3_diskfull_pending ){ \
+ if( sqlite3_diskfull_pending == 1 ){ \
+ local_ioerr(); \
+ sqlite3_diskfull = 1; \
+ return SQLITE_FULL; \
+ }else{ \
+ sqlite3_diskfull_pending--; \
+ } \
+ }
#else
#define SimulateIOError(A)
#define SimulateDiskfullError
diff --git a/ext/pdo_sqlite/sqlite/src/os_test.c b/ext/pdo_sqlite/sqlite/src/os_test.c
index 8199f5b183..9b1c0e206f 100644
--- a/ext/pdo_sqlite/sqlite/src/os_test.c
+++ b/ext/pdo_sqlite/sqlite/src/os_test.c
@@ -391,12 +391,12 @@ int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
** Sync the file. First flush the write-cache to disk, then call the
** real sync() function.
*/
-int sqlite3OsSync(OsFile *id){
+int sqlite3OsSync(OsFile *id, int dataOnly){
int rc;
/* printf("SYNC %s (%d blocks)\n", (*id)->zName, (*id)->nBlk); */
rc = writeCache(*id);
if( rc!=SQLITE_OK ) return rc;
- rc = sqlite3RealSync(&(*id)->fd);
+ rc = sqlite3RealSync(&(*id)->fd, dataOnly);
return rc;
}
diff --git a/ext/pdo_sqlite/sqlite/src/os_unix.c b/ext/pdo_sqlite/sqlite/src/os_unix.c
index 2ea9aa8e35..f4e09b5364 100644
--- a/ext/pdo_sqlite/sqlite/src/os_unix.c
+++ b/ext/pdo_sqlite/sqlite/src/os_unix.c
@@ -18,6 +18,7 @@
#include <time.h>
+#include <sys/time.h>
#include <errno.h>
#include <unistd.h>
@@ -771,6 +772,9 @@ int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
int sqlite3OsSeek(OsFile *id, i64 offset){
assert( id->isOpen );
SEEK(offset/1024 + 1);
+#ifdef SQLITE_TEST
+ if( offset ) SimulateDiskfullError
+#endif
lseek(id->h, offset, SEEK_SET);
return SQLITE_OK;
}
@@ -796,7 +800,7 @@ int sqlite3_fullsync_count = 0;
** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash
** or power failure will likely corrupt the database file.
*/
-static int full_fsync(int fd, int fullSync){
+static int full_fsync(int fd, int fullSync, int dataOnly){
int rc;
/* Record the number of times that we do a normal fsync() and
@@ -824,8 +828,15 @@ static int full_fsync(int fd, int fullSync){
/* If the FULLSYNC failed, try to do a normal fsync() */
if( rc ) rc = fsync(fd);
-#else
- rc = fsync(fd);
+#else /* if !defined(F_FULLSYNC) */
+#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO>0
+ if( dataOnly ){
+ rc = fdatasync(fd);
+ }else
+#endif /* _POSIX_SYNCHRONIZED_IO > 0 */
+ {
+ rc = fsync(fd);
+ }
#endif /* defined(F_FULLFSYNC) */
#endif /* defined(SQLITE_NO_SYNC) */
@@ -835,6 +846,10 @@ static int full_fsync(int fd, int fullSync){
/*
** Make sure all writes to a particular file are committed to disk.
**
+** If dataOnly==0 then both the file itself and its metadata (file
+** size, access time, etc) are synced. If dataOnly!=0 then only the
+** file data is synced.
+**
** Under Unix, also make sure that the directory entry for the file
** has been created by fsync-ing the directory that contains the file.
** If we do not do this and we encounter a power failure, the directory
@@ -843,16 +858,16 @@ static int full_fsync(int fd, int fullSync){
** the directory entry for the journal was never created) and the transaction
** will not roll back - possibly leading to database corruption.
*/
-int sqlite3OsSync(OsFile *id){
+int sqlite3OsSync(OsFile *id, int dataOnly){
assert( id->isOpen );
SimulateIOError(SQLITE_IOERR);
TRACE2("SYNC %-3d\n", id->h);
- if( full_fsync(id->h, id->fullSync) ){
+ if( full_fsync(id->h, id->fullSync, dataOnly) ){
return SQLITE_IOERR;
}
if( id->dirfd>=0 ){
TRACE2("DIRSYNC %-3d\n", id->dirfd);
- full_fsync(id->dirfd, id->fullSync);
+ full_fsync(id->dirfd, id->fullSync, 0);
close(id->dirfd); /* Only need to sync once, so close the directory */
id->dirfd = -1; /* when we are done. */
}
@@ -1310,10 +1325,14 @@ char *sqlite3OsFullPathname(const char *zRelative){
if( zRelative[0]=='/' ){
sqlite3SetString(&zFull, zRelative, (char*)0);
}else{
- char zBuf[5000];
+ char *zBuf = sqliteMalloc(5000);
+ if( zBuf==0 ){
+ return 0;
+ }
zBuf[0] = 0;
- sqlite3SetString(&zFull, getcwd(zBuf, sizeof(zBuf)), "/", zRelative,
+ sqlite3SetString(&zFull, getcwd(zBuf, 5000), "/", zRelative,
(char*)0);
+ sqliteFree(zBuf);
}
return zFull;
}
@@ -1420,9 +1439,16 @@ int sqlite3_current_time = 0;
** return 0. Return 1 if the time and date cannot be found.
*/
int sqlite3OsCurrentTime(double *prNow){
+#ifdef NO_GETTOD
time_t t;
time(&t);
*prNow = t/86400.0 + 2440587.5;
+#else
+ struct timeval sNow;
+ struct timezone sTz; /* Not used */
+ gettimeofday(&sNow, &sTz);
+ *prNow = 2440587.5 + sNow.tv_sec/86400.0 + sNow.tv_usec/86400000000.0;
+#endif
#ifdef SQLITE_TEST
if( sqlite3_current_time ){
*prNow = sqlite3_current_time/86400.0 + 2440587.5;
diff --git a/ext/pdo_sqlite/sqlite/src/os_win.c b/ext/pdo_sqlite/sqlite/src/os_win.c
index ea2ca26089..ad874ae633 100644
--- a/ext/pdo_sqlite/sqlite/src/os_win.c
+++ b/ext/pdo_sqlite/sqlite/src/os_win.c
@@ -42,10 +42,98 @@
#ifndef SQLITE_OMIT_DISKIO
/*
+** The following variable is (normally) set once and never changes
+** thereafter. It records whether the operating system is Win95
+** or WinNT.
+**
+** 0: Operating system unknown.
+** 1: Operating system is Win95.
+** 2: Operating system is WinNT.
+**
+** In order to facilitate testing on a WinNT system, the test fixture
+** can manually set this value to 1 to emulate Win98 behavior.
+*/
+int sqlite3_os_type = 0;
+
+/*
+** Return true (non-zero) if we are running under WinNT, Win2K or WinXP.
+** Return false (zero) for Win95, Win98, or WinME.
+**
+** Here is an interesting observation: Win95, Win98, and WinME lack
+** the LockFileEx() API. But we can still statically link against that
+** API as long as we don't call it win running Win95/98/ME. A call to
+** this routine is used to determine if the host is Win95/98/ME or
+** WinNT/2K/XP so that we will know whether or not we can safely call
+** the LockFileEx() API.
+*/
+static int isNT(void){
+ if( sqlite3_os_type==0 ){
+ OSVERSIONINFO sInfo;
+ sInfo.dwOSVersionInfoSize = sizeof(sInfo);
+ GetVersionEx(&sInfo);
+ sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;
+ }
+ return sqlite3_os_type==2;
+}
+
+/*
+** Convert a UTF-8 string to UTF-32. Space to hold the returned string
+** is obtained from sqliteMalloc.
+*/
+static WCHAR *utf8ToUnicode(const char *zFilename){
+ int nByte;
+ WCHAR *zWideFilename;
+
+ if( !isNT() ){
+ return 0;
+ }
+ nByte = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0)*sizeof(WCHAR);
+ zWideFilename = sqliteMalloc( nByte*sizeof(zWideFilename[0]) );
+ if( zWideFilename==0 ){
+ return 0;
+ }
+ nByte = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename, nByte);
+ if( nByte==0 ){
+ sqliteFree(zWideFilename);
+ zWideFilename = 0;
+ }
+ return zWideFilename;
+}
+
+/*
+** Convert UTF-32 to UTF-8. Space to hold the returned string is
+** obtained from sqliteMalloc().
+*/
+static char *unicodeToUtf8(const WCHAR *zWideFilename){
+ int nByte;
+ char *zFilename;
+
+ nByte = WideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, 0, 0, 0, 0);
+ zFilename = sqliteMalloc( nByte );
+ if( zFilename==0 ){
+ return 0;
+ }
+ nByte = WideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, zFilename, nByte,
+ 0, 0);
+ if( nByte == 0 ){
+ sqliteFree(zFilename);
+ zFilename = 0;
+ }
+ return zFilename;
+}
+
+
+/*
** Delete the named file
*/
int sqlite3OsDelete(const char *zFilename){
- DeleteFileA(zFilename);
+ WCHAR *zWide = utf8ToUnicode(zFilename);
+ if( zWide ){
+ DeleteFileW(zWide);
+ sqliteFree(zWide);
+ }else{
+ DeleteFileA(zFilename);
+ }
TRACE2("DELETE \"%s\"\n", zFilename);
return SQLITE_OK;
}
@@ -54,7 +142,15 @@ int sqlite3OsDelete(const char *zFilename){
** Return TRUE if the named file exists.
*/
int sqlite3OsFileExists(const char *zFilename){
- return GetFileAttributesA(zFilename) != 0xffffffff;
+ int exists = 0;
+ WCHAR *zWide = utf8ToUnicode(zFilename);
+ if( zWide ){
+ exists = GetFileAttributesW(zWide) != 0xffffffff;
+ sqliteFree(zWide);
+ }else{
+ exists = GetFileAttributesA(zFilename) != 0xffffffff;
+ }
+ return exists;
}
/*
@@ -76,30 +172,60 @@ int sqlite3OsOpenReadWrite(
int *pReadonly
){
HANDLE h;
+ WCHAR *zWide = utf8ToUnicode(zFilename);
assert( !id->isOpen );
- h = CreateFileA(zFilename,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_ALWAYS,
- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
- NULL
- );
- if( h==INVALID_HANDLE_VALUE ){
- h = CreateFileA(zFilename,
- GENERIC_READ,
- FILE_SHARE_READ,
+ if( zWide ){
+ h = CreateFileW(zWide,
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
NULL
);
if( h==INVALID_HANDLE_VALUE ){
- return SQLITE_CANTOPEN;
+ h = CreateFileW(zWide,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
+ NULL
+ );
+ if( h==INVALID_HANDLE_VALUE ){
+ sqliteFree(zWide);
+ return SQLITE_CANTOPEN;
+ }
+ *pReadonly = 1;
+ }else{
+ *pReadonly = 0;
}
- *pReadonly = 1;
+ sqliteFree(zWide);
}else{
- *pReadonly = 0;
+ h = CreateFileA(zFilename,
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL,
+ OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
+ NULL
+ );
+ if( h==INVALID_HANDLE_VALUE ){
+ h = CreateFileA(zFilename,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
+ NULL
+ );
+ if( h==INVALID_HANDLE_VALUE ){
+ return SQLITE_CANTOPEN;
+ }
+ *pReadonly = 1;
+ }else{
+ *pReadonly = 0;
+ }
}
id->h = h;
id->locktype = NO_LOCK;
@@ -128,6 +254,7 @@ int sqlite3OsOpenReadWrite(
int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
HANDLE h;
int fileflags;
+ WCHAR *zWide = utf8ToUnicode(zFilename);
assert( !id->isOpen );
if( delFlag ){
fileflags = FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_RANDOM_ACCESS
@@ -135,14 +262,26 @@ int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
}else{
fileflags = FILE_FLAG_RANDOM_ACCESS;
}
- h = CreateFileA(zFilename,
- GENERIC_READ | GENERIC_WRITE,
- 0,
- NULL,
- CREATE_ALWAYS,
- fileflags,
- NULL
- );
+ if( zWide ){
+ h = CreateFileW(zWide,
+ GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ CREATE_ALWAYS,
+ fileflags,
+ NULL
+ );
+ sqliteFree(zWide);
+ }else{
+ h = CreateFileA(zFilename,
+ GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ CREATE_ALWAYS,
+ fileflags,
+ NULL
+ );
+ }
if( h==INVALID_HANDLE_VALUE ){
return SQLITE_CANTOPEN;
}
@@ -164,15 +303,28 @@ int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
*/
int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){
HANDLE h;
+ WCHAR *zWide = utf8ToUnicode(zFilename);
assert( !id->isOpen );
- h = CreateFileA(zFilename,
- GENERIC_READ,
- 0,
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
- NULL
- );
+ if( zWide ){
+ h = CreateFileW(zWide,
+ GENERIC_READ,
+ 0,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
+ NULL
+ );
+ sqliteFree(zWide);
+ }else{
+ h = CreateFileA(zFilename,
+ GENERIC_READ,
+ 0,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
+ NULL
+ );
+ }
if( h==INVALID_HANDLE_VALUE ){
return SQLITE_CANTOPEN;
}
@@ -229,6 +381,16 @@ int sqlite3OsTempFileName(char *zBuf){
if( sqlite3_temp_directory ){
strncpy(zTempPath, sqlite3_temp_directory, SQLITE_TEMPNAME_SIZE-30);
zTempPath[SQLITE_TEMPNAME_SIZE-30] = 0;
+ }else if( isNT() ){
+ char *zMulti;
+ WCHAR zWidePath[SQLITE_TEMPNAME_SIZE];
+ GetTempPathW(SQLITE_TEMPNAME_SIZE-30, zWidePath);
+ zMulti = unicodeToUtf8(zWidePath);
+ if( zMulti ){
+ strncpy(zTempPath, zMulti, SQLITE_TEMPNAME_SIZE-30);
+ zTempPath[SQLITE_TEMPNAME_SIZE-30] = 0;
+ sqliteFree(zMulti);
+ }
}else{
GetTempPathA(SQLITE_TEMPNAME_SIZE-30, zTempPath);
}
@@ -304,6 +466,13 @@ int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
}
/*
+** Some microsoft compilers lack this definition.
+*/
+#ifndef INVALID_SET_FILE_POINTER
+# define INVALID_SET_FILE_POINTER ((DWORD)-1)
+#endif
+
+/*
** Move the read/write pointer in a file.
*/
int sqlite3OsSeek(OsFile *id, i64 offset){
@@ -311,16 +480,22 @@ int sqlite3OsSeek(OsFile *id, i64 offset){
LONG lowerBits = offset & 0xffffffff;
DWORD rc;
assert( id->isOpen );
+#ifdef SQLITE_TEST
+ if( offset ) SimulateDiskfullError
+#endif
SEEK(offset/1024 + 1);
rc = SetFilePointer(id->h, lowerBits, &upperBits, FILE_BEGIN);
TRACE3("SEEK %d %lld\n", id->h, offset);
+ if( rc==INVALID_SET_FILE_POINTER && GetLastError()!=NO_ERROR ){
+ return SQLITE_FULL;
+ }
return SQLITE_OK;
}
/*
** Make sure all writes to a particular file are committed to disk.
*/
-int sqlite3OsSync(OsFile *id){
+int sqlite3OsSync(OsFile *id, int dataOnly){
assert( id->isOpen );
TRACE3("SYNC %d lock=%d\n", id->h, id->locktype);
if( FlushFileBuffers(id->h) ){
@@ -365,28 +540,6 @@ int sqlite3OsFileSize(OsFile *id, i64 *pSize){
}
/*
-** Return true (non-zero) if we are running under WinNT, Win2K or WinXP.
-** Return false (zero) for Win95, Win98, or WinME.
-**
-** Here is an interesting observation: Win95, Win98, and WinME lack
-** the LockFileEx() API. But we can still statically link against that
-** API as long as we don't call it win running Win95/98/ME. A call to
-** this routine is used to determine if the host is Win95/98/ME or
-** WinNT/2K/XP so that we will know whether or not we can safely call
-** the LockFileEx() API.
-*/
-static int isNT(void){
- static int osType = 0; /* 0=unknown 1=win95 2=winNT */
- if( osType==0 ){
- OSVERSIONINFO sInfo;
- sInfo.dwOSVersionInfoSize = sizeof(sInfo);
- GetVersionEx(&sInfo);
- osType = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;
- }
- return osType==2;
-}
-
-/*
** Acquire a reader lock.
** Different API routines are called depending on whether or not this
** is Win95 or WinNT.
@@ -426,11 +579,18 @@ static int unlockReadLock(OsFile *id){
** Check that a given pathname is a directory and is writable
**
*/
-int sqlite3OsIsDirWritable(char *zBuf){
+int sqlite3OsIsDirWritable(char *zDirname){
int fileAttr;
- if(! zBuf ) return 0;
- if(! isNT() && strlen(zBuf) > MAX_PATH ) return 0;
- fileAttr = GetFileAttributesA(zBuf);
+ WCHAR *zWide;
+ if( zDirname==0 ) return 0;
+ if( !isNT() && strlen(zDirname)>MAX_PATH ) return 0;
+ zWide = utf8ToUnicode(zDirname);
+ if( zWide ){
+ fileAttr = GetFileAttributesW(zWide);
+ sqliteFree(zWide);
+ }else{
+ fileAttr = GetFileAttributesA(zDirname);
+ }
if( fileAttr == 0xffffffff ) return 0;
if( (fileAttr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY ){
return 0;
@@ -641,6 +801,7 @@ int sqlite3OsUnlock(OsFile *id, int locktype){
char *sqlite3OsFullPathname(const char *zRelative){
char *zNotUsed;
char *zFull;
+ WCHAR *zWide;
int nByte;
#ifdef __CYGWIN__
nByte = strlen(zRelative) + MAX_PATH + 1001;
@@ -648,10 +809,22 @@ char *sqlite3OsFullPathname(const char *zRelative){
if( zFull==0 ) return 0;
if( cygwin_conv_to_full_win32_path(zRelative, zFull) ) return 0;
#else
- nByte = GetFullPathNameA(zRelative, 0, 0, &zNotUsed) + 1;
- zFull = sqliteMalloc( nByte );
- if( zFull==0 ) return 0;
- GetFullPathNameA(zRelative, nByte, zFull, &zNotUsed);
+ zWide = utf8ToUnicode(zRelative);
+ if( zWide ){
+ WCHAR *zTemp, *zNotUsedW;
+ nByte = GetFullPathNameW(zWide, 0, 0, &zNotUsedW) + 1;
+ zTemp = sqliteMalloc( nByte*sizeof(zTemp[0]) );
+ if( zTemp==0 ) return 0;
+ GetFullPathNameW(zWide, nByte, zTemp, &zNotUsedW);
+ sqliteFree(zWide);
+ zFull = unicodeToUtf8(zTemp);
+ sqliteFree(zTemp);
+ }else{
+ nByte = GetFullPathNameA(zRelative, 0, 0, &zNotUsed) + 1;
+ zFull = sqliteMalloc( nByte*sizeof(zFull[0]) );
+ if( zFull==0 ) return 0;
+ GetFullPathNameA(zRelative, nByte, zFull, &zNotUsed);
+ }
#endif
return zFull;
}
diff --git a/ext/pdo_sqlite/sqlite/src/pager.c b/ext/pdo_sqlite/sqlite/src/pager.c
index 8fd65ba88e..1edfbb4e7e 100644
--- a/ext/pdo_sqlite/sqlite/src/pager.c
+++ b/ext/pdo_sqlite/sqlite/src/pager.c
@@ -657,8 +657,10 @@ static int writeJournalHdr(Pager *pPager){
** file descriptor to the end of the journal header sector.
*/
if( rc==SQLITE_OK ){
- sqlite3OsSeek(&pPager->jfd, pPager->journalOff-1);
- rc = sqlite3OsWrite(&pPager->jfd, "\000", 1);
+ rc = sqlite3OsSeek(&pPager->jfd, pPager->journalOff-1);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsWrite(&pPager->jfd, "\000", 1);
+ }
}
return rc;
}
@@ -1038,8 +1040,10 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
assert( pPager->state>=PAGER_EXCLUSIVE || pPg!=0 );
TRACE3("PLAYBACK %d page %d\n", PAGERID(pPager), pgno);
if( pPager->state>=PAGER_EXCLUSIVE && (pPg==0 || pPg->needSync==0) ){
- sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize);
- rc = sqlite3OsWrite(&pPager->fd, aData, pPager->pageSize);
+ rc = sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsWrite(&pPager->fd, aData, pPager->pageSize);
+ }
if( pPg ) pPg->dirty = 0;
}
if( pPg ){
@@ -1168,8 +1172,10 @@ static int pager_reload_cache(Pager *pPager){
char zBuf[SQLITE_MAX_PAGE_SIZE];
if( !pPg->dirty ) continue;
if( (int)pPg->pgno <= pPager->origDbSize ){
- sqlite3OsSeek(&pPager->fd, pPager->pageSize*(i64)(pPg->pgno-1));
- rc = sqlite3OsRead(&pPager->fd, zBuf, pPager->pageSize);
+ rc = sqlite3OsSeek(&pPager->fd, pPager->pageSize*(i64)(pPg->pgno-1));
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsRead(&pPager->fd, zBuf, pPager->pageSize);
+ }
TRACE3("REFETCH %d page %d\n", PAGERID(pPager), pPg->pgno);
if( rc ) break;
CODEC(pPager, zBuf, pPg->pgno, 2);
@@ -1485,7 +1491,7 @@ static int pager_stmt_playback(Pager *pPager){
end_stmt_playback:
if( rc!=SQLITE_OK ){
pPager->errMask |= PAGER_ERR_CORRUPT;
- rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ rc = SQLITE_CORRUPT;
}else{
pPager->journalOff = szJ;
/* pager_reload_cache(pPager); */
@@ -1746,29 +1752,35 @@ void sqlite3pager_read_fileheader(Pager *pPager, int N, unsigned char *pDest){
/*
** Return the total number of pages in the disk file associated with
-** pPager.
+** pPager.
+**
+** If the PENDING_BYTE lies on the page directly after the end of the
+** file, then consider this page part of the file too. For example, if
+** PENDING_BYTE is byte 4096 (the first byte of page 5) and the size of the
+** file is 4096 bytes, 5 is returned instead of 4.
*/
int sqlite3pager_pagecount(Pager *pPager){
i64 n;
assert( pPager!=0 );
if( pPager->dbSize>=0 ){
- return pPager->dbSize;
- }
- if( sqlite3OsFileSize(&pPager->fd, &n)!=SQLITE_OK ){
- pPager->errMask |= PAGER_ERR_DISK;
- return 0;
- }
- if( n>0 && n<pPager->pageSize ){
- n = 1;
- }else{
- n /= pPager->pageSize;
+ n = pPager->dbSize;
+ } else {
+ if( sqlite3OsFileSize(&pPager->fd, &n)!=SQLITE_OK ){
+ pPager->errMask |= PAGER_ERR_DISK;
+ return 0;
+ }
+ if( n>0 && n<pPager->pageSize ){
+ n = 1;
+ }else{
+ n /= pPager->pageSize;
+ }
+ if( pPager->state!=PAGER_UNLOCK ){
+ pPager->dbSize = n;
+ }
}
- if( !MEMDB && n==PENDING_BYTE/pPager->pageSize ){
+ if( n==(PENDING_BYTE/pPager->pageSize) ){
n++;
}
- if( pPager->state!=PAGER_UNLOCK ){
- pPager->dbSize = n;
- }
return n;
}
@@ -2121,17 +2133,20 @@ static int syncJournal(Pager *pPager){
*/
if( pPager->fullSync ){
TRACE2("SYNC journal of %d\n", PAGERID(pPager));
- rc = sqlite3OsSync(&pPager->jfd);
+ rc = sqlite3OsSync(&pPager->jfd, 0);
if( rc!=0 ) return rc;
}
- sqlite3OsSeek(&pPager->jfd, pPager->journalHdr + sizeof(aJournalMagic));
+ rc = sqlite3OsSeek(&pPager->jfd,
+ pPager->journalHdr + sizeof(aJournalMagic));
+ if( rc ) return rc;
rc = write32bits(&pPager->jfd, pPager->nRec);
if( rc ) return rc;
- sqlite3OsSeek(&pPager->jfd, pPager->journalOff);
+ rc = sqlite3OsSeek(&pPager->jfd, pPager->journalOff);
+ if( rc ) return rc;
}
TRACE2("SYNC journal of %d\n", PAGERID(pPager));
- rc = sqlite3OsSync(&pPager->jfd);
+ rc = sqlite3OsSync(&pPager->jfd, pPager->fullSync);
if( rc!=0 ) return rc;
pPager->journalStarted = 1;
}
@@ -2196,7 +2211,8 @@ static int pager_write_pagelist(PgHdr *pList){
while( pList ){
assert( pList->dirty );
- sqlite3OsSeek(&pPager->fd, (pList->pgno-1)*(i64)pPager->pageSize);
+ rc = sqlite3OsSeek(&pPager->fd, (pList->pgno-1)*(i64)pPager->pageSize);
+ if( rc ) return rc;
/* If there are dirty pages in the page cache with page numbers greater
** than Pager.dbSize, this means sqlite3pager_truncate() was called to
** make the file smaller (presumably by auto-vacuum code). Do not write
@@ -2291,8 +2307,8 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
/* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page
** number greater than this, or zero, is requested.
*/
- if( pgno>PAGER_MAX_PGNO || pgno==0 ){
- return SQLITE_CORRUPT;
+ if( pgno>PAGER_MAX_PGNO || pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
+ return SQLITE_CORRUPT_BKPT;
}
/* Make sure we have not hit any critical errors.
@@ -2506,8 +2522,10 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
}else{
int rc;
assert( MEMDB==0 );
- sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize);
- rc = sqlite3OsRead(&pPager->fd, PGHDR_TO_DATA(pPg), pPager->pageSize);
+ rc = sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsRead(&pPager->fd, PGHDR_TO_DATA(pPg), pPager->pageSize);
+ }
TRACE3("FETCH %d page %d\n", PAGERID(pPager), pPg->pgno);
CODEC(pPager, PGHDR_TO_DATA(pPg), pPg->pgno, 3);
if( rc!=SQLITE_OK ){
@@ -2815,6 +2833,10 @@ int sqlite3pager_write(void *pData){
}
}else{
u32 cksum;
+ /* We should never write to the journal file the page that
+ ** contains the database locks. The following assert verifies
+ ** that we do not. */
+ assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
CODEC(pPager, pData, pPg->pgno, 7);
cksum = pager_cksum(pPager, pPg->pgno, pData);
saved = *(u32*)PGHDR_TO_EXTRA(pPg, pPager);
@@ -3171,7 +3193,7 @@ int sqlite3pager_rollback(Pager *pPager){
rc = pager_playback(pPager);
}
if( rc!=SQLITE_OK ){
- rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ rc = SQLITE_CORRUPT_BKPT;
pPager->errMask |= PAGER_ERR_CORRUPT;
}
pPager->dbSize = -1;
@@ -3441,8 +3463,9 @@ int sqlite3pager_sync(Pager *pPager, const char *zMaster, Pgno nTrunc){
*/
Pgno i;
void *pPage;
+ int iSkip = PAGER_MJ_PGNO(pPager);
for( i=nTrunc+1; i<=pPager->origDbSize; i++ ){
- if( !(pPager->aInJournal[i/8] & (1<<(i&7))) ){
+ if( !(pPager->aInJournal[i/8] & (1<<(i&7))) && i!=iSkip ){
rc = sqlite3pager_get(pPager, i, &pPage);
if( rc!=SQLITE_OK ) goto sync_exit;
rc = sqlite3pager_write(pPage);
@@ -3472,7 +3495,7 @@ int sqlite3pager_sync(Pager *pPager, const char *zMaster, Pgno nTrunc){
/* Sync the database file. */
if( !pPager->noSync ){
- rc = sqlite3OsSync(&pPager->fd);
+ rc = sqlite3OsSync(&pPager->fd, 0);
}
pPager->state = PAGER_SYNCED;
diff --git a/ext/pdo_sqlite/sqlite/src/pager.h b/ext/pdo_sqlite/sqlite/src/pager.h
index c3311c824b..feba78a7ad 100644
--- a/ext/pdo_sqlite/sqlite/src/pager.h
+++ b/ext/pdo_sqlite/sqlite/src/pager.h
@@ -34,7 +34,7 @@
** reasonable, like 1024.
*/
#ifndef SQLITE_MAX_PAGE_SIZE
-# define SQLITE_MAX_PAGE_SIZE 8192
+# define SQLITE_MAX_PAGE_SIZE 32768
#endif
/*
diff --git a/ext/pdo_sqlite/sqlite/src/parse.c b/ext/pdo_sqlite/sqlite/src/parse.c
index 1e382b4280..953b80f4dd 100644
--- a/ext/pdo_sqlite/sqlite/src/parse.c
+++ b/ext/pdo_sqlite/sqlite/src/parse.c
@@ -1,10 +1,10 @@
/* Driver template for the LEMON parser generator.
-** The author disclaims copyright to this source code.
+** The author disclaims copyright to this source code.
*/
/* First off, code is include which follows the "include" declaration
** in the input file. */
#include <stdio.h>
-#line 51 "parse.y"
+#line 51 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
#include "sqliteInt.h"
#include "parse.h"
@@ -43,7 +43,7 @@ struct TrigEvent { int a; IdList * b; };
*/
struct AttachKey { int type; Token key; };
-#line 48 "parse.c"
+#line 48 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
/* Next is all token values, in a form suitable for use by makeheaders.
** This section will be null unless lemon is run with the -m switch.
*/
@@ -93,35 +93,35 @@ struct AttachKey { int type; Token key; };
** defined, then do no error processing.
*/
#define YYCODETYPE unsigned char
-#define YYNOCODE 244
+#define YYNOCODE 247
#define YYACTIONTYPE unsigned short int
#define sqlite3ParserTOKENTYPE Token
typedef union {
sqlite3ParserTOKENTYPE yy0;
- struct {int value; int mask;} yy35;
- Expr* yy44;
- int yy58;
- Select* yy99;
- struct LimitVal yy112;
- Token yy144;
- TriggerStep* yy203;
- struct TrigEvent yy234;
- IdList* yy258;
- struct AttachKey yy300;
- SrcList* yy367;
- ExprList* yy412;
- struct LikeOp yy432;
- int yy487;
+ struct TrigEvent yy30;
+ Expr* yy62;
+ SrcList* yy151;
+ Token yy198;
+ struct LimitVal yy220;
+ struct LikeOp yy222;
+ IdList* yy240;
+ int yy280;
+ struct {int value; int mask;} yy359;
+ TriggerStep* yy360;
+ struct AttachKey yy361;
+ Select* yy375;
+ ExprList* yy418;
+ int yy493;
} YYMINORTYPE;
#define YYSTACKDEPTH 100
#define sqlite3ParserARG_SDECL Parse *pParse;
#define sqlite3ParserARG_PDECL ,Parse *pParse
#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
#define sqlite3ParserARG_STORE yypParser->pParse = pParse
-#define YYNSTATE 578
-#define YYNRULE 310
-#define YYERRORSYMBOL 143
-#define YYERRSYMDT yy487
+#define YYNSTATE 581
+#define YYNRULE 311
+#define YYERRORSYMBOL 146
+#define YYERRSYMDT yy493
#define YYFALLBACK 1
#define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
@@ -175,486 +175,485 @@ typedef union {
** yy_default[] Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 283, 581, 110, 137, 139, 135, 141, 268, 147, 149,
- /* 10 */ 151, 153, 155, 157, 159, 161, 163, 165, 114, 119,
- /* 20 */ 120, 167, 175, 147, 149, 151, 153, 155, 157, 159,
- /* 30 */ 161, 163, 165, 155, 157, 159, 161, 163, 165, 132,
- /* 40 */ 94, 168, 178, 183, 188, 177, 182, 143, 145, 137,
- /* 50 */ 139, 135, 141, 72, 147, 149, 151, 153, 155, 157,
- /* 60 */ 159, 161, 163, 165, 44, 45, 245, 111, 147, 149,
- /* 70 */ 151, 153, 155, 157, 159, 161, 163, 165, 13, 427,
- /* 80 */ 121, 578, 657, 639, 375, 347, 167, 39, 6, 5,
- /* 90 */ 92, 3, 576, 363, 25, 355, 299, 255, 34, 269,
- /* 100 */ 513, 129, 372, 112, 132, 94, 168, 178, 183, 188,
- /* 110 */ 177, 182, 143, 145, 137, 139, 135, 141, 567, 147,
- /* 120 */ 149, 151, 153, 155, 157, 159, 161, 163, 165, 77,
- /* 130 */ 109, 373, 133, 77, 117, 119, 120, 7, 13, 32,
- /* 140 */ 33, 300, 280, 14, 15, 377, 301, 610, 379, 386,
- /* 150 */ 391, 167, 377, 366, 369, 379, 386, 391, 524, 330,
- /* 160 */ 394, 64, 368, 374, 407, 705, 95, 394, 571, 132,
- /* 170 */ 94, 168, 178, 183, 188, 177, 182, 143, 145, 137,
- /* 180 */ 139, 135, 141, 9, 147, 149, 151, 153, 155, 157,
- /* 190 */ 159, 161, 163, 165, 127, 125, 121, 373, 167, 101,
- /* 200 */ 102, 103, 28, 14, 15, 408, 33, 860, 889, 1,
- /* 210 */ 577, 3, 576, 4, 540, 332, 132, 94, 168, 178,
- /* 220 */ 183, 188, 177, 182, 143, 145, 137, 139, 135, 141,
- /* 230 */ 295, 147, 149, 151, 153, 155, 157, 159, 161, 163,
- /* 240 */ 165, 2, 466, 377, 4, 167, 379, 386, 391, 16,
- /* 250 */ 17, 18, 285, 159, 161, 163, 165, 240, 394, 173,
- /* 260 */ 243, 184, 189, 132, 94, 168, 178, 183, 188, 177,
- /* 270 */ 182, 143, 145, 137, 139, 135, 141, 96, 147, 149,
- /* 280 */ 151, 153, 155, 157, 159, 161, 163, 165, 815, 291,
- /* 290 */ 308, 813, 51, 500, 472, 462, 588, 539, 75, 322,
- /* 300 */ 27, 133, 409, 704, 81, 272, 10, 173, 96, 184,
- /* 310 */ 189, 96, 190, 13, 541, 542, 13, 393, 78, 167,
- /* 320 */ 37, 361, 40, 59, 67, 69, 325, 356, 586, 75,
- /* 330 */ 197, 368, 75, 316, 358, 95, 218, 132, 94, 168,
- /* 340 */ 178, 183, 188, 177, 182, 143, 145, 137, 139, 135,
- /* 350 */ 141, 77, 147, 149, 151, 153, 155, 157, 159, 161,
- /* 360 */ 163, 165, 173, 113, 184, 189, 167, 110, 101, 102,
- /* 370 */ 103, 318, 274, 405, 329, 121, 12, 461, 14, 15,
- /* 380 */ 404, 14, 15, 238, 132, 94, 168, 178, 183, 188,
- /* 390 */ 177, 182, 143, 145, 137, 139, 135, 141, 273, 147,
- /* 400 */ 149, 151, 153, 155, 157, 159, 161, 163, 165, 96,
- /* 410 */ 77, 51, 315, 427, 48, 36, 360, 196, 317, 129,
- /* 420 */ 130, 112, 314, 49, 355, 209, 313, 13, 96, 110,
- /* 430 */ 75, 197, 111, 96, 814, 485, 50, 589, 46, 461,
- /* 440 */ 167, 40, 59, 67, 69, 325, 356, 482, 47, 75,
- /* 450 */ 257, 467, 429, 358, 75, 197, 469, 232, 132, 94,
- /* 460 */ 168, 178, 183, 188, 177, 182, 143, 145, 137, 139,
- /* 470 */ 135, 141, 77, 147, 149, 151, 153, 155, 157, 159,
- /* 480 */ 161, 163, 165, 323, 237, 13, 830, 169, 249, 258,
- /* 490 */ 13, 703, 14, 15, 111, 96, 265, 485, 96, 192,
- /* 500 */ 96, 194, 195, 13, 192, 167, 194, 195, 238, 171,
- /* 510 */ 172, 476, 192, 471, 194, 195, 75, 211, 469, 75,
- /* 520 */ 257, 75, 91, 132, 94, 168, 178, 183, 188, 177,
- /* 530 */ 182, 143, 145, 137, 139, 135, 141, 170, 147, 149,
- /* 540 */ 151, 153, 155, 157, 159, 161, 163, 165, 365, 48,
- /* 550 */ 14, 15, 216, 65, 228, 14, 15, 298, 49, 251,
- /* 560 */ 66, 13, 602, 13, 330, 96, 676, 212, 14, 15,
- /* 570 */ 167, 50, 865, 222, 57, 58, 678, 275, 192, 20,
- /* 580 */ 194, 195, 277, 403, 26, 351, 75, 499, 132, 94,
- /* 590 */ 168, 178, 183, 188, 177, 182, 143, 145, 137, 139,
- /* 600 */ 135, 141, 96, 147, 149, 151, 153, 155, 157, 159,
- /* 610 */ 161, 163, 165, 587, 863, 83, 11, 167, 742, 345,
- /* 620 */ 332, 312, 306, 75, 93, 358, 14, 15, 14, 15,
- /* 630 */ 858, 173, 495, 184, 189, 132, 94, 168, 178, 183,
- /* 640 */ 188, 177, 182, 143, 145, 137, 139, 135, 141, 594,
- /* 650 */ 147, 149, 151, 153, 155, 157, 159, 161, 163, 165,
- /* 660 */ 22, 272, 352, 192, 167, 194, 195, 192, 295, 194,
- /* 670 */ 195, 285, 505, 192, 42, 194, 195, 192, 351, 194,
- /* 680 */ 195, 595, 132, 94, 168, 178, 183, 188, 177, 182,
- /* 690 */ 143, 145, 137, 139, 135, 141, 338, 147, 149, 151,
- /* 700 */ 153, 155, 157, 159, 161, 163, 165, 837, 511, 286,
- /* 710 */ 507, 167, 382, 127, 125, 192, 339, 194, 195, 192,
- /* 720 */ 543, 194, 195, 333, 340, 342, 351, 442, 274, 132,
- /* 730 */ 94, 168, 178, 183, 188, 177, 182, 143, 145, 137,
- /* 740 */ 139, 135, 141, 96, 147, 149, 151, 153, 155, 157,
- /* 750 */ 159, 161, 163, 165, 273, 352, 110, 371, 167, 373,
- /* 760 */ 388, 438, 440, 439, 75, 499, 362, 574, 33, 335,
- /* 770 */ 538, 668, 656, 351, 31, 413, 132, 186, 168, 178,
- /* 780 */ 183, 188, 177, 182, 143, 145, 137, 139, 135, 141,
- /* 790 */ 509, 147, 149, 151, 153, 155, 157, 159, 161, 163,
- /* 800 */ 165, 96, 736, 352, 283, 167, 110, 397, 123, 124,
- /* 810 */ 531, 421, 193, 416, 115, 681, 116, 235, 477, 236,
- /* 820 */ 351, 111, 75, 244, 94, 168, 178, 183, 188, 177,
- /* 830 */ 182, 143, 145, 137, 139, 135, 141, 96, 147, 149,
- /* 840 */ 151, 153, 155, 157, 159, 161, 163, 165, 96, 879,
- /* 850 */ 352, 881, 167, 292, 455, 293, 270, 280, 75, 108,
- /* 860 */ 554, 319, 857, 236, 42, 447, 13, 351, 13, 75,
- /* 870 */ 134, 111, 168, 178, 183, 188, 177, 182, 143, 145,
- /* 880 */ 137, 139, 135, 141, 96, 147, 149, 151, 153, 155,
- /* 890 */ 157, 159, 161, 163, 165, 96, 76, 352, 444, 96,
- /* 900 */ 71, 96, 443, 52, 208, 75, 136, 76, 106, 24,
- /* 910 */ 412, 71, 180, 596, 445, 54, 75, 138, 266, 106,
- /* 920 */ 75, 140, 75, 142, 441, 220, 96, 337, 336, 29,
- /* 930 */ 96, 14, 15, 14, 15, 133, 220, 77, 96, 198,
- /* 940 */ 96, 458, 179, 346, 348, 347, 133, 75, 433, 96,
- /* 950 */ 198, 75, 144, 389, 285, 347, 204, 202, 320, 75,
- /* 960 */ 146, 75, 148, 410, 200, 73, 74, 204, 202, 95,
- /* 970 */ 75, 150, 398, 96, 347, 200, 73, 74, 852, 96,
- /* 980 */ 95, 76, 823, 448, 597, 71, 432, 459, 293, 420,
- /* 990 */ 96, 705, 303, 106, 75, 480, 77, 436, 437, 81,
- /* 1000 */ 75, 152, 101, 102, 103, 104, 105, 206, 210, 705,
- /* 1010 */ 220, 75, 154, 101, 102, 103, 104, 105, 206, 210,
- /* 1020 */ 133, 30, 77, 240, 198, 456, 96, 347, 35, 464,
- /* 1030 */ 45, 490, 463, 293, 96, 873, 498, 96, 496, 96,
- /* 1040 */ 76, 204, 202, 736, 71, 96, 601, 75, 156, 200,
- /* 1050 */ 73, 74, 106, 96, 95, 75, 158, 295, 75, 160,
- /* 1060 */ 75, 162, 38, 492, 96, 853, 75, 164, 76, 220,
- /* 1070 */ 41, 191, 71, 552, 75, 166, 482, 43, 427, 133,
- /* 1080 */ 106, 528, 568, 198, 96, 75, 197, 101, 102, 103,
- /* 1090 */ 104, 105, 206, 210, 816, 670, 77, 220, 240, 81,
- /* 1100 */ 204, 202, 309, 96, 77, 75, 174, 133, 200, 73,
- /* 1110 */ 74, 198, 493, 95, 77, 8, 489, 506, 427, 427,
- /* 1120 */ 19, 21, 23, 411, 75, 176, 42, 234, 204, 202,
- /* 1130 */ 427, 81, 427, 562, 427, 546, 200, 73, 74, 238,
- /* 1140 */ 522, 95, 556, 96, 529, 427, 101, 102, 103, 104,
- /* 1150 */ 105, 206, 210, 532, 535, 496, 466, 508, 510, 266,
- /* 1160 */ 96, 533, 885, 559, 75, 185, 565, 96, 56, 512,
- /* 1170 */ 96, 516, 96, 520, 101, 102, 103, 104, 105, 206,
- /* 1180 */ 210, 75, 187, 55, 526, 53, 60, 61, 75, 199,
- /* 1190 */ 96, 75, 201, 75, 203, 96, 64, 62, 96, 70,
- /* 1200 */ 96, 63, 96, 68, 96, 611, 96, 514, 518, 462,
- /* 1210 */ 84, 75, 205, 504, 96, 612, 75, 217, 81, 75,
- /* 1220 */ 219, 75, 229, 75, 231, 75, 233, 75, 246, 81,
- /* 1230 */ 79, 80, 96, 266, 82, 75, 262, 96, 263, 310,
- /* 1240 */ 86, 96, 261, 96, 85, 96, 247, 96, 87, 97,
- /* 1250 */ 99, 88, 90, 75, 267, 107, 89, 98, 75, 297,
- /* 1260 */ 75, 307, 75, 364, 75, 392, 75, 484, 75, 497,
- /* 1270 */ 118, 100, 131, 128, 165, 122, 181, 682, 239, 683,
- /* 1280 */ 684, 207, 230, 213, 126, 214, 215, 221, 225, 224,
- /* 1290 */ 223, 226, 240, 227, 241, 248, 242, 250, 254, 253,
- /* 1300 */ 252, 255, 236, 264, 259, 256, 260, 271, 276, 278,
- /* 1310 */ 279, 281, 284, 296, 282, 289, 287, 290, 288, 294,
- /* 1320 */ 302, 305, 311, 304, 321, 324, 326, 344, 328, 327,
- /* 1330 */ 331, 349, 357, 329, 353, 334, 341, 343, 380, 350,
- /* 1340 */ 378, 381, 354, 367, 359, 370, 384, 387, 396, 395,
- /* 1350 */ 399, 400, 385, 54, 406, 414, 376, 401, 390, 383,
- /* 1360 */ 415, 417, 418, 402, 419, 422, 425, 423, 424, 434,
- /* 1370 */ 426, 428, 430, 845, 431, 435, 850, 446, 851, 449,
- /* 1380 */ 450, 451, 452, 453, 821, 454, 822, 457, 460, 465,
- /* 1390 */ 743, 468, 744, 844, 470, 859, 463, 481, 475, 479,
- /* 1400 */ 861, 474, 473, 478, 483, 486, 487, 491, 488, 494,
- /* 1410 */ 862, 501, 502, 503, 864, 675, 677, 829, 871, 517,
- /* 1420 */ 515, 735, 519, 521, 523, 738, 525, 741, 831, 534,
- /* 1430 */ 832, 833, 530, 536, 834, 527, 537, 835, 544, 836,
- /* 1440 */ 545, 547, 872, 874, 549, 875, 557, 555, 548, 550,
- /* 1450 */ 553, 878, 880, 882, 561, 558, 883, 560, 551, 563,
- /* 1460 */ 566, 569, 564, 570, 572, 573, 884, 555, 555, 555,
- /* 1470 */ 555, 575,
+ /* 0 */ 286, 584, 113, 140, 142, 138, 144, 581, 150, 152,
+ /* 10 */ 154, 156, 158, 160, 162, 164, 166, 168, 3, 577,
+ /* 20 */ 740, 170, 178, 150, 152, 154, 156, 158, 160, 162,
+ /* 30 */ 164, 166, 168, 158, 160, 162, 164, 166, 168, 135,
+ /* 40 */ 97, 171, 181, 186, 191, 180, 185, 146, 148, 140,
+ /* 50 */ 142, 138, 144, 51, 150, 152, 154, 156, 158, 160,
+ /* 60 */ 162, 164, 166, 168, 16, 17, 18, 114, 7, 248,
+ /* 70 */ 150, 152, 154, 156, 158, 160, 162, 164, 166, 168,
+ /* 80 */ 13, 37, 362, 40, 59, 67, 69, 326, 357, 170,
+ /* 90 */ 6, 5, 331, 95, 364, 359, 25, 374, 258, 893,
+ /* 100 */ 1, 580, 514, 13, 4, 575, 33, 135, 97, 171,
+ /* 110 */ 181, 186, 191, 180, 185, 146, 148, 140, 142, 138,
+ /* 120 */ 144, 9, 150, 152, 154, 156, 158, 160, 162, 164,
+ /* 130 */ 166, 168, 374, 136, 592, 80, 112, 99, 269, 34,
+ /* 140 */ 32, 33, 132, 373, 115, 14, 15, 378, 333, 99,
+ /* 150 */ 380, 387, 392, 13, 367, 370, 194, 170, 78, 500,
+ /* 160 */ 525, 315, 395, 369, 375, 408, 10, 98, 14, 15,
+ /* 170 */ 78, 200, 286, 864, 113, 135, 97, 171, 181, 186,
+ /* 180 */ 191, 180, 185, 146, 148, 140, 142, 138, 144, 80,
+ /* 190 */ 150, 152, 154, 156, 158, 160, 162, 164, 166, 168,
+ /* 200 */ 104, 105, 106, 661, 496, 376, 374, 170, 467, 13,
+ /* 210 */ 2, 28, 237, 4, 409, 33, 3, 577, 14, 15,
+ /* 220 */ 51, 132, 133, 115, 241, 135, 97, 171, 181, 186,
+ /* 230 */ 191, 180, 185, 146, 148, 140, 142, 138, 144, 114,
+ /* 240 */ 150, 152, 154, 156, 158, 160, 162, 164, 166, 168,
+ /* 250 */ 40, 59, 67, 69, 326, 357, 136, 44, 45, 501,
+ /* 260 */ 473, 463, 359, 36, 361, 130, 128, 660, 275, 31,
+ /* 270 */ 84, 99, 356, 378, 14, 15, 380, 387, 392, 52,
+ /* 280 */ 170, 117, 122, 123, 113, 541, 369, 643, 395, 348,
+ /* 290 */ 98, 54, 78, 200, 302, 57, 58, 819, 135, 97,
+ /* 300 */ 171, 181, 186, 191, 180, 185, 146, 148, 140, 142,
+ /* 310 */ 138, 144, 861, 150, 152, 154, 156, 158, 160, 162,
+ /* 320 */ 164, 166, 168, 104, 105, 106, 817, 80, 48, 316,
+ /* 330 */ 162, 164, 166, 168, 319, 277, 12, 49, 99, 303,
+ /* 340 */ 283, 818, 99, 124, 304, 99, 241, 172, 593, 114,
+ /* 350 */ 50, 193, 46, 378, 170, 13, 380, 387, 392, 78,
+ /* 360 */ 260, 276, 47, 78, 200, 64, 78, 260, 395, 174,
+ /* 370 */ 175, 221, 135, 97, 171, 181, 186, 191, 180, 185,
+ /* 380 */ 146, 148, 140, 142, 138, 144, 199, 150, 152, 154,
+ /* 390 */ 156, 158, 160, 162, 164, 166, 168, 173, 252, 261,
+ /* 400 */ 120, 122, 123, 212, 170, 268, 254, 130, 128, 288,
+ /* 410 */ 590, 176, 246, 187, 192, 414, 195, 241, 197, 198,
+ /* 420 */ 14, 15, 135, 97, 171, 181, 186, 191, 180, 185,
+ /* 430 */ 146, 148, 140, 142, 138, 144, 433, 150, 152, 154,
+ /* 440 */ 156, 158, 160, 162, 164, 166, 168, 311, 99, 707,
+ /* 450 */ 99, 422, 708, 417, 275, 81, 318, 598, 99, 219,
+ /* 460 */ 13, 231, 124, 13, 176, 48, 187, 192, 20, 78,
+ /* 470 */ 317, 78, 214, 195, 49, 197, 198, 462, 170, 78,
+ /* 480 */ 200, 116, 27, 13, 410, 113, 591, 50, 80, 225,
+ /* 490 */ 195, 11, 197, 198, 506, 235, 135, 97, 171, 181,
+ /* 500 */ 186, 191, 180, 185, 146, 148, 140, 142, 138, 144,
+ /* 510 */ 80, 150, 152, 154, 156, 158, 160, 162, 164, 166,
+ /* 520 */ 168, 277, 215, 324, 606, 14, 15, 301, 14, 15,
+ /* 530 */ 512, 13, 508, 240, 196, 486, 195, 685, 197, 198,
+ /* 540 */ 22, 834, 445, 331, 462, 170, 444, 276, 14, 15,
+ /* 550 */ 114, 468, 278, 394, 599, 280, 470, 288, 446, 680,
+ /* 560 */ 13, 321, 404, 135, 97, 171, 181, 186, 191, 180,
+ /* 570 */ 185, 146, 148, 140, 142, 138, 144, 80, 150, 152,
+ /* 580 */ 154, 156, 158, 160, 162, 164, 166, 168, 74, 99,
+ /* 590 */ 540, 366, 73, 99, 352, 289, 14, 15, 176, 333,
+ /* 600 */ 187, 192, 486, 869, 359, 273, 283, 542, 543, 867,
+ /* 610 */ 78, 500, 510, 170, 78, 323, 682, 176, 472, 187,
+ /* 620 */ 192, 746, 118, 470, 119, 14, 15, 195, 346, 197,
+ /* 630 */ 198, 135, 97, 171, 181, 186, 191, 180, 185, 146,
+ /* 640 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156,
+ /* 650 */ 158, 160, 162, 164, 166, 168, 532, 334, 341, 343,
+ /* 660 */ 841, 39, 195, 170, 197, 198, 78, 94, 124, 356,
+ /* 670 */ 271, 353, 439, 441, 440, 544, 883, 428, 72, 862,
+ /* 680 */ 288, 135, 97, 171, 181, 186, 191, 180, 185, 146,
+ /* 690 */ 148, 140, 142, 138, 144, 13, 150, 152, 154, 156,
+ /* 700 */ 158, 160, 162, 164, 166, 168, 195, 99, 197, 198,
+ /* 710 */ 406, 330, 195, 170, 197, 198, 568, 405, 306, 195,
+ /* 720 */ 42, 197, 198, 65, 195, 539, 197, 198, 78, 96,
+ /* 730 */ 66, 135, 97, 171, 181, 186, 191, 180, 185, 146,
+ /* 740 */ 148, 140, 142, 138, 144, 885, 150, 152, 154, 156,
+ /* 750 */ 158, 160, 162, 164, 166, 168, 99, 740, 99, 298,
+ /* 760 */ 14, 15, 272, 170, 13, 74, 572, 86, 600, 73,
+ /* 770 */ 126, 127, 614, 709, 309, 478, 24, 78, 247, 78,
+ /* 780 */ 111, 135, 97, 171, 181, 186, 191, 180, 185, 146,
+ /* 790 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156,
+ /* 800 */ 158, 160, 162, 164, 166, 168, 99, 238, 113, 239,
+ /* 810 */ 295, 26, 296, 170, 338, 337, 78, 137, 294, 320,
+ /* 820 */ 347, 239, 348, 390, 211, 348, 30, 78, 139, 14,
+ /* 830 */ 15, 135, 189, 171, 181, 186, 191, 180, 185, 146,
+ /* 840 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156,
+ /* 850 */ 158, 160, 162, 164, 166, 168, 99, 80, 99, 372,
+ /* 860 */ 399, 442, 348, 170, 298, 243, 78, 141, 363, 601,
+ /* 870 */ 428, 437, 438, 114, 411, 269, 605, 78, 143, 78,
+ /* 880 */ 145, 448, 97, 171, 181, 186, 191, 180, 185, 146,
+ /* 890 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156,
+ /* 900 */ 158, 160, 162, 164, 166, 168, 99, 80, 99, 430,
+ /* 910 */ 99, 296, 555, 170, 413, 856, 78, 147, 672, 457,
+ /* 920 */ 352, 348, 298, 443, 465, 45, 35, 78, 149, 78,
+ /* 930 */ 151, 78, 153, 171, 181, 186, 191, 180, 185, 146,
+ /* 940 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156,
+ /* 950 */ 158, 160, 162, 164, 166, 168, 99, 459, 99, 29,
+ /* 960 */ 79, 464, 183, 483, 71, 339, 78, 155, 709, 421,
+ /* 970 */ 428, 79, 109, 99, 491, 71, 296, 78, 157, 78,
+ /* 980 */ 159, 490, 243, 109, 99, 340, 99, 449, 857, 223,
+ /* 990 */ 99, 460, 182, 709, 78, 161, 99, 349, 827, 136,
+ /* 1000 */ 223, 99, 80, 201, 99, 78, 163, 78, 165, 507,
+ /* 1010 */ 136, 78, 167, 42, 201, 38, 493, 78, 169, 569,
+ /* 1020 */ 207, 205, 78, 177, 674, 78, 179, 477, 203, 76,
+ /* 1030 */ 77, 207, 205, 98, 99, 84, 99, 42, 336, 203,
+ /* 1040 */ 76, 77, 99, 43, 98, 41, 428, 79, 494, 80,
+ /* 1050 */ 428, 71, 84, 99, 352, 78, 188, 78, 190, 109,
+ /* 1060 */ 499, 428, 497, 78, 202, 60, 104, 105, 106, 107,
+ /* 1070 */ 108, 209, 213, 99, 78, 204, 223, 104, 105, 106,
+ /* 1080 */ 107, 108, 209, 213, 820, 509, 136, 53, 383, 511,
+ /* 1090 */ 201, 99, 56, 61, 78, 206, 55, 428, 428, 889,
+ /* 1100 */ 513, 99, 243, 99, 352, 99, 79, 207, 205, 312,
+ /* 1110 */ 71, 99, 78, 208, 483, 203, 76, 77, 109, 533,
+ /* 1120 */ 98, 497, 78, 220, 78, 222, 78, 232, 84, 99,
+ /* 1130 */ 428, 353, 78, 234, 352, 223, 517, 521, 389, 99,
+ /* 1140 */ 62, 530, 99, 64, 63, 136, 68, 529, 70, 201,
+ /* 1150 */ 78, 236, 352, 104, 105, 106, 107, 108, 209, 213,
+ /* 1160 */ 78, 249, 99, 78, 265, 877, 207, 205, 398, 527,
+ /* 1170 */ 99, 615, 616, 313, 203, 76, 77, 99, 523, 98,
+ /* 1180 */ 80, 353, 8, 78, 270, 99, 456, 19, 21, 23,
+ /* 1190 */ 412, 78, 300, 75, 78, 310, 82, 84, 78, 365,
+ /* 1200 */ 563, 83, 547, 99, 87, 553, 78, 393, 85, 557,
+ /* 1210 */ 99, 353, 104, 105, 106, 107, 108, 209, 213, 99,
+ /* 1220 */ 269, 536, 99, 467, 78, 434, 88, 266, 534, 353,
+ /* 1230 */ 560, 78, 481, 566, 264, 89, 250, 90, 93, 91,
+ /* 1240 */ 78, 485, 101, 78, 498, 92, 100, 102, 103, 110,
+ /* 1250 */ 131, 121, 134, 125, 129, 168, 184, 242, 686, 687,
+ /* 1260 */ 688, 210, 233, 218, 224, 216, 227, 226, 217, 229,
+ /* 1270 */ 228, 230, 243, 251, 515, 519, 463, 245, 253, 244,
+ /* 1280 */ 505, 257, 255, 256, 258, 84, 259, 262, 263, 239,
+ /* 1290 */ 267, 279, 274, 281, 282, 299, 285, 292, 284, 287,
+ /* 1300 */ 290, 293, 297, 305, 314, 291, 307, 322, 308, 325,
+ /* 1310 */ 327, 345, 329, 328, 332, 350, 354, 330, 358, 335,
+ /* 1320 */ 342, 379, 381, 382, 344, 351, 368, 385, 355, 371,
+ /* 1330 */ 388, 360, 396, 397, 400, 401, 415, 54, 416, 386,
+ /* 1340 */ 384, 391, 418, 402, 407, 419, 377, 420, 423, 424,
+ /* 1350 */ 403, 426, 425, 427, 429, 435, 431, 849, 436, 854,
+ /* 1360 */ 432, 855, 450, 447, 451, 452, 454, 453, 825, 455,
+ /* 1370 */ 458, 826, 469, 461, 466, 747, 748, 848, 471, 464,
+ /* 1380 */ 863, 480, 474, 475, 476, 482, 865, 479, 487, 484,
+ /* 1390 */ 489, 488, 492, 866, 495, 868, 504, 679, 502, 681,
+ /* 1400 */ 833, 875, 518, 503, 516, 739, 520, 524, 522, 742,
+ /* 1410 */ 745, 531, 526, 835, 535, 528, 538, 537, 836, 837,
+ /* 1420 */ 838, 839, 545, 546, 840, 550, 876, 556, 551, 878,
+ /* 1430 */ 548, 549, 554, 879, 559, 882, 884, 562, 886, 561,
+ /* 1440 */ 552, 558, 564, 567, 570, 565, 571, 887, 576, 574,
+ /* 1450 */ 573, 888, 578, 559, 559, 579,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 25, 10, 27, 74, 75, 76, 77, 26, 79, 80,
- /* 10 */ 81, 82, 83, 84, 85, 86, 87, 88, 168, 169,
- /* 20 */ 170, 46, 78, 79, 80, 81, 82, 83, 84, 85,
- /* 30 */ 86, 87, 88, 83, 84, 85, 86, 87, 88, 64,
- /* 40 */ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- /* 50 */ 75, 76, 77, 23, 79, 80, 81, 82, 83, 84,
- /* 60 */ 85, 86, 87, 88, 189, 190, 26, 92, 79, 80,
- /* 70 */ 81, 82, 83, 84, 85, 86, 87, 88, 27, 152,
- /* 80 */ 230, 0, 24, 24, 26, 26, 46, 172, 147, 148,
- /* 90 */ 50, 10, 11, 23, 153, 180, 159, 27, 162, 118,
- /* 100 */ 159, 165, 166, 167, 64, 65, 66, 67, 68, 69,
- /* 110 */ 70, 71, 72, 73, 74, 75, 76, 77, 191, 79,
- /* 120 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 192,
- /* 130 */ 25, 152, 62, 192, 168, 169, 170, 10, 27, 160,
- /* 140 */ 161, 204, 205, 92, 93, 94, 209, 117, 97, 98,
- /* 150 */ 99, 46, 94, 83, 84, 97, 98, 99, 217, 47,
- /* 160 */ 109, 102, 92, 184, 185, 25, 96, 109, 241, 64,
- /* 170 */ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- /* 180 */ 75, 76, 77, 150, 79, 80, 81, 82, 83, 84,
- /* 190 */ 85, 86, 87, 88, 83, 84, 230, 152, 46, 129,
- /* 200 */ 130, 131, 157, 92, 93, 160, 161, 18, 144, 145,
- /* 210 */ 146, 10, 11, 149, 103, 103, 64, 65, 66, 67,
- /* 220 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- /* 230 */ 152, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- /* 240 */ 88, 146, 53, 94, 149, 46, 97, 98, 99, 14,
- /* 250 */ 15, 16, 165, 85, 86, 87, 88, 117, 109, 220,
- /* 260 */ 221, 222, 223, 64, 65, 66, 67, 68, 69, 70,
- /* 270 */ 71, 72, 73, 74, 75, 76, 77, 152, 79, 80,
- /* 280 */ 81, 82, 83, 84, 85, 86, 87, 88, 136, 211,
- /* 290 */ 203, 18, 66, 104, 105, 106, 10, 152, 173, 174,
- /* 300 */ 23, 62, 25, 24, 115, 26, 151, 220, 152, 222,
- /* 310 */ 223, 152, 23, 27, 169, 170, 27, 175, 159, 46,
- /* 320 */ 94, 95, 96, 97, 98, 99, 100, 101, 10, 173,
- /* 330 */ 174, 92, 173, 174, 108, 96, 137, 64, 65, 66,
- /* 340 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- /* 350 */ 77, 192, 79, 80, 81, 82, 83, 84, 85, 86,
- /* 360 */ 87, 88, 220, 23, 222, 223, 46, 27, 129, 130,
- /* 370 */ 131, 215, 93, 180, 181, 230, 152, 159, 92, 93,
- /* 380 */ 187, 92, 93, 227, 64, 65, 66, 67, 68, 69,
- /* 390 */ 70, 71, 72, 73, 74, 75, 76, 77, 119, 79,
- /* 400 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 152,
- /* 410 */ 192, 66, 24, 152, 19, 171, 172, 24, 24, 165,
- /* 420 */ 166, 167, 112, 28, 180, 24, 116, 27, 152, 27,
- /* 430 */ 173, 174, 92, 152, 18, 217, 41, 10, 43, 159,
- /* 440 */ 46, 96, 97, 98, 99, 100, 101, 152, 53, 173,
- /* 450 */ 174, 233, 191, 108, 173, 174, 238, 137, 64, 65,
- /* 460 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- /* 470 */ 76, 77, 192, 79, 80, 81, 82, 83, 84, 85,
- /* 480 */ 86, 87, 88, 24, 227, 27, 10, 46, 212, 213,
- /* 490 */ 27, 24, 92, 93, 92, 152, 215, 217, 152, 111,
- /* 500 */ 152, 113, 114, 27, 111, 46, 113, 114, 227, 68,
- /* 510 */ 69, 216, 111, 233, 113, 114, 173, 174, 238, 173,
- /* 520 */ 174, 173, 174, 64, 65, 66, 67, 68, 69, 70,
- /* 530 */ 71, 72, 73, 74, 75, 76, 77, 96, 79, 80,
- /* 540 */ 81, 82, 83, 84, 85, 86, 87, 88, 24, 19,
- /* 550 */ 92, 93, 136, 31, 138, 92, 93, 23, 28, 213,
- /* 560 */ 38, 27, 10, 27, 47, 152, 10, 224, 92, 93,
- /* 570 */ 46, 41, 10, 43, 14, 15, 10, 119, 111, 151,
- /* 580 */ 113, 114, 119, 66, 154, 152, 173, 174, 64, 65,
- /* 590 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- /* 600 */ 76, 77, 152, 79, 80, 81, 82, 83, 84, 85,
- /* 610 */ 86, 87, 88, 10, 10, 195, 13, 46, 10, 186,
- /* 620 */ 103, 85, 202, 173, 174, 108, 92, 93, 92, 93,
- /* 630 */ 12, 220, 219, 222, 223, 64, 65, 66, 67, 68,
- /* 640 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 10,
- /* 650 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
- /* 660 */ 151, 26, 229, 111, 46, 113, 114, 111, 152, 113,
- /* 670 */ 114, 165, 21, 111, 103, 113, 114, 111, 152, 113,
- /* 680 */ 114, 10, 64, 65, 66, 67, 68, 69, 70, 71,
- /* 690 */ 72, 73, 74, 75, 76, 77, 34, 79, 80, 81,
- /* 700 */ 82, 83, 84, 85, 86, 87, 88, 10, 57, 203,
- /* 710 */ 59, 46, 186, 83, 84, 111, 54, 113, 114, 111,
- /* 720 */ 23, 113, 114, 104, 105, 106, 152, 211, 93, 64,
- /* 730 */ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- /* 740 */ 75, 76, 77, 152, 79, 80, 81, 82, 83, 84,
- /* 750 */ 85, 86, 87, 88, 119, 229, 27, 164, 46, 152,
- /* 760 */ 186, 104, 105, 106, 173, 174, 173, 160, 161, 107,
- /* 770 */ 73, 10, 24, 152, 26, 21, 64, 65, 66, 67,
- /* 780 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- /* 790 */ 139, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- /* 800 */ 88, 152, 10, 229, 25, 46, 27, 186, 129, 130,
- /* 810 */ 219, 57, 112, 59, 24, 115, 26, 24, 26, 26,
- /* 820 */ 152, 92, 173, 174, 65, 66, 67, 68, 69, 70,
- /* 830 */ 71, 72, 73, 74, 75, 76, 77, 152, 79, 80,
- /* 840 */ 81, 82, 83, 84, 85, 86, 87, 88, 152, 10,
- /* 850 */ 229, 10, 46, 24, 186, 26, 204, 205, 173, 174,
- /* 860 */ 131, 24, 12, 26, 103, 22, 27, 152, 27, 173,
- /* 870 */ 174, 92, 66, 67, 68, 69, 70, 71, 72, 73,
- /* 880 */ 74, 75, 76, 77, 152, 79, 80, 81, 82, 83,
- /* 890 */ 84, 85, 86, 87, 88, 152, 23, 229, 29, 152,
- /* 900 */ 27, 152, 33, 96, 159, 173, 174, 23, 35, 151,
- /* 910 */ 155, 27, 66, 10, 45, 108, 173, 174, 126, 35,
- /* 920 */ 173, 174, 173, 174, 49, 52, 152, 95, 96, 158,
- /* 930 */ 152, 92, 93, 92, 93, 62, 52, 192, 152, 66,
- /* 940 */ 152, 98, 96, 24, 229, 26, 62, 173, 174, 152,
- /* 950 */ 66, 173, 174, 24, 165, 26, 83, 84, 85, 173,
- /* 960 */ 174, 173, 174, 159, 91, 92, 93, 83, 84, 96,
- /* 970 */ 173, 174, 24, 152, 26, 91, 92, 93, 103, 152,
- /* 980 */ 96, 23, 139, 228, 10, 27, 136, 232, 26, 159,
- /* 990 */ 152, 10, 203, 35, 173, 174, 192, 55, 56, 115,
- /* 1000 */ 173, 174, 129, 130, 131, 132, 133, 134, 135, 103,
- /* 1010 */ 52, 173, 174, 129, 130, 131, 132, 133, 134, 135,
- /* 1020 */ 62, 24, 192, 117, 66, 24, 152, 26, 163, 189,
- /* 1030 */ 190, 24, 64, 26, 152, 10, 24, 152, 26, 152,
- /* 1040 */ 23, 83, 84, 10, 27, 152, 10, 173, 174, 91,
- /* 1050 */ 92, 93, 35, 152, 96, 173, 174, 152, 173, 174,
- /* 1060 */ 173, 174, 152, 159, 152, 103, 173, 174, 23, 52,
- /* 1070 */ 175, 159, 27, 48, 173, 174, 152, 36, 152, 62,
- /* 1080 */ 35, 159, 61, 66, 152, 173, 174, 129, 130, 131,
- /* 1090 */ 132, 133, 134, 135, 136, 127, 192, 52, 117, 115,
- /* 1100 */ 83, 84, 85, 152, 192, 173, 174, 62, 91, 92,
- /* 1110 */ 93, 66, 128, 96, 192, 12, 211, 191, 152, 152,
- /* 1120 */ 17, 18, 19, 20, 173, 174, 103, 215, 83, 84,
- /* 1130 */ 152, 115, 152, 30, 152, 32, 91, 92, 93, 227,
- /* 1140 */ 216, 96, 39, 152, 128, 152, 129, 130, 131, 132,
- /* 1150 */ 133, 134, 135, 24, 51, 26, 53, 191, 191, 126,
- /* 1160 */ 152, 58, 141, 60, 173, 174, 63, 152, 44, 191,
- /* 1170 */ 152, 191, 152, 191, 129, 130, 131, 132, 133, 134,
- /* 1180 */ 135, 173, 174, 183, 191, 175, 48, 176, 173, 174,
- /* 1190 */ 152, 173, 174, 173, 174, 152, 102, 175, 152, 23,
- /* 1200 */ 152, 177, 152, 175, 152, 117, 152, 104, 105, 106,
- /* 1210 */ 196, 173, 174, 110, 152, 117, 173, 174, 115, 173,
- /* 1220 */ 174, 173, 174, 173, 174, 173, 174, 173, 174, 115,
- /* 1230 */ 193, 192, 152, 126, 194, 173, 174, 152, 123, 152,
- /* 1240 */ 198, 152, 124, 152, 197, 152, 121, 152, 199, 117,
- /* 1250 */ 117, 200, 125, 173, 174, 23, 201, 152, 173, 174,
- /* 1260 */ 173, 174, 173, 174, 173, 174, 173, 174, 173, 174,
- /* 1270 */ 24, 152, 24, 165, 88, 231, 96, 115, 152, 115,
- /* 1280 */ 115, 23, 136, 225, 231, 226, 18, 23, 26, 190,
- /* 1290 */ 24, 152, 117, 24, 152, 122, 156, 26, 101, 176,
- /* 1300 */ 214, 27, 26, 122, 214, 164, 176, 206, 152, 152,
- /* 1310 */ 119, 152, 152, 103, 156, 120, 207, 23, 208, 152,
- /* 1320 */ 24, 208, 117, 207, 24, 175, 152, 23, 179, 178,
- /* 1330 */ 152, 214, 164, 181, 214, 182, 182, 182, 48, 176,
- /* 1340 */ 152, 23, 176, 173, 183, 173, 24, 23, 23, 48,
- /* 1350 */ 100, 152, 175, 108, 185, 152, 185, 178, 175, 177,
- /* 1360 */ 156, 152, 156, 179, 25, 152, 235, 156, 234, 42,
- /* 1370 */ 103, 156, 236, 12, 237, 40, 103, 49, 103, 139,
- /* 1380 */ 152, 156, 103, 152, 10, 23, 139, 175, 12, 188,
- /* 1390 */ 127, 18, 127, 10, 10, 18, 64, 197, 107, 73,
- /* 1400 */ 10, 152, 188, 152, 73, 127, 152, 218, 23, 23,
- /* 1410 */ 10, 118, 152, 197, 10, 10, 10, 10, 10, 197,
- /* 1420 */ 118, 10, 188, 107, 197, 10, 127, 10, 10, 152,
- /* 1430 */ 10, 10, 23, 152, 10, 218, 156, 10, 152, 10,
- /* 1440 */ 24, 239, 10, 10, 25, 10, 239, 37, 165, 152,
- /* 1450 */ 165, 10, 10, 10, 156, 152, 10, 152, 240, 152,
- /* 1460 */ 21, 140, 156, 152, 141, 242, 10, 243, 243, 243,
- /* 1470 */ 243, 142,
+ /* 0 */ 28, 11, 30, 77, 78, 79, 80, 0, 82, 83,
+ /* 10 */ 84, 85, 86, 87, 88, 89, 90, 91, 11, 12,
+ /* 20 */ 11, 49, 81, 82, 83, 84, 85, 86, 87, 88,
+ /* 30 */ 89, 90, 91, 86, 87, 88, 89, 90, 91, 67,
+ /* 40 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
+ /* 50 */ 78, 79, 80, 69, 82, 83, 84, 85, 86, 87,
+ /* 60 */ 88, 89, 90, 91, 17, 18, 19, 95, 11, 29,
+ /* 70 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 80 */ 30, 97, 98, 99, 100, 101, 102, 103, 104, 49,
+ /* 90 */ 150, 151, 50, 53, 26, 111, 156, 155, 30, 147,
+ /* 100 */ 148, 149, 162, 30, 152, 163, 164, 67, 68, 69,
+ /* 110 */ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ /* 120 */ 80, 153, 82, 83, 84, 85, 86, 87, 88, 89,
+ /* 130 */ 90, 91, 155, 65, 11, 195, 28, 155, 129, 165,
+ /* 140 */ 163, 164, 168, 169, 170, 95, 96, 97, 106, 155,
+ /* 150 */ 100, 101, 102, 30, 86, 87, 162, 49, 176, 177,
+ /* 160 */ 220, 88, 112, 95, 187, 188, 154, 99, 95, 96,
+ /* 170 */ 176, 177, 28, 21, 30, 67, 68, 69, 70, 71,
+ /* 180 */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 195,
+ /* 190 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 200 */ 132, 133, 134, 27, 222, 29, 155, 49, 56, 30,
+ /* 210 */ 149, 160, 218, 152, 163, 164, 11, 12, 95, 96,
+ /* 220 */ 69, 168, 169, 170, 230, 67, 68, 69, 70, 71,
+ /* 230 */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 95,
+ /* 240 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 250 */ 99, 100, 101, 102, 103, 104, 65, 192, 193, 107,
+ /* 260 */ 108, 109, 111, 174, 175, 86, 87, 27, 29, 29,
+ /* 270 */ 118, 155, 183, 97, 95, 96, 100, 101, 102, 99,
+ /* 280 */ 49, 171, 172, 173, 30, 106, 95, 27, 112, 29,
+ /* 290 */ 99, 111, 176, 177, 162, 17, 18, 139, 67, 68,
+ /* 300 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ /* 310 */ 79, 80, 15, 82, 83, 84, 85, 86, 87, 88,
+ /* 320 */ 89, 90, 91, 132, 133, 134, 21, 195, 22, 27,
+ /* 330 */ 88, 89, 90, 91, 218, 96, 155, 31, 155, 207,
+ /* 340 */ 208, 21, 155, 233, 212, 155, 230, 49, 11, 95,
+ /* 350 */ 44, 26, 46, 97, 49, 30, 100, 101, 102, 176,
+ /* 360 */ 177, 122, 56, 176, 177, 105, 176, 177, 112, 71,
+ /* 370 */ 72, 140, 67, 68, 69, 70, 71, 72, 73, 74,
+ /* 380 */ 75, 76, 77, 78, 79, 80, 27, 82, 83, 84,
+ /* 390 */ 85, 86, 87, 88, 89, 90, 91, 99, 215, 216,
+ /* 400 */ 171, 172, 173, 27, 49, 218, 216, 86, 87, 168,
+ /* 410 */ 11, 223, 224, 225, 226, 24, 114, 230, 116, 117,
+ /* 420 */ 95, 96, 67, 68, 69, 70, 71, 72, 73, 74,
+ /* 430 */ 75, 76, 77, 78, 79, 80, 139, 82, 83, 84,
+ /* 440 */ 85, 86, 87, 88, 89, 90, 91, 206, 155, 27,
+ /* 450 */ 155, 60, 27, 62, 29, 162, 27, 11, 155, 139,
+ /* 460 */ 30, 141, 233, 30, 223, 22, 225, 226, 154, 176,
+ /* 470 */ 177, 176, 177, 114, 31, 116, 117, 162, 49, 176,
+ /* 480 */ 177, 26, 26, 30, 28, 30, 11, 44, 195, 46,
+ /* 490 */ 114, 16, 116, 117, 24, 140, 67, 68, 69, 70,
+ /* 500 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+ /* 510 */ 195, 82, 83, 84, 85, 86, 87, 88, 89, 90,
+ /* 520 */ 91, 96, 227, 27, 11, 95, 96, 26, 95, 96,
+ /* 530 */ 60, 30, 62, 230, 115, 220, 114, 118, 116, 117,
+ /* 540 */ 154, 11, 32, 50, 162, 49, 36, 122, 95, 96,
+ /* 550 */ 95, 236, 122, 178, 11, 122, 241, 168, 48, 11,
+ /* 560 */ 30, 88, 69, 67, 68, 69, 70, 71, 72, 73,
+ /* 570 */ 74, 75, 76, 77, 78, 79, 80, 195, 82, 83,
+ /* 580 */ 84, 85, 86, 87, 88, 89, 90, 91, 115, 155,
+ /* 590 */ 155, 27, 119, 155, 155, 206, 95, 96, 223, 106,
+ /* 600 */ 225, 226, 220, 11, 111, 207, 208, 172, 173, 11,
+ /* 610 */ 176, 177, 142, 49, 176, 177, 11, 223, 236, 225,
+ /* 620 */ 226, 11, 27, 241, 29, 95, 96, 114, 189, 116,
+ /* 630 */ 117, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ /* 640 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85,
+ /* 650 */ 86, 87, 88, 89, 90, 91, 222, 107, 108, 109,
+ /* 660 */ 11, 175, 114, 49, 116, 117, 176, 177, 233, 183,
+ /* 670 */ 29, 232, 107, 108, 109, 26, 11, 155, 26, 15,
+ /* 680 */ 168, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ /* 690 */ 76, 77, 78, 79, 80, 30, 82, 83, 84, 85,
+ /* 700 */ 86, 87, 88, 89, 90, 91, 114, 155, 116, 117,
+ /* 710 */ 183, 184, 114, 49, 116, 117, 194, 190, 206, 114,
+ /* 720 */ 106, 116, 117, 34, 114, 76, 116, 117, 176, 177,
+ /* 730 */ 41, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ /* 740 */ 76, 77, 78, 79, 80, 11, 82, 83, 84, 85,
+ /* 750 */ 86, 87, 88, 89, 90, 91, 155, 11, 155, 155,
+ /* 760 */ 95, 96, 121, 49, 30, 115, 244, 198, 11, 119,
+ /* 770 */ 132, 133, 120, 28, 205, 29, 154, 176, 177, 176,
+ /* 780 */ 177, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ /* 790 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85,
+ /* 800 */ 86, 87, 88, 89, 90, 91, 155, 27, 30, 29,
+ /* 810 */ 27, 157, 29, 49, 98, 99, 176, 177, 214, 27,
+ /* 820 */ 27, 29, 29, 27, 162, 29, 27, 176, 177, 95,
+ /* 830 */ 96, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ /* 840 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85,
+ /* 850 */ 86, 87, 88, 89, 90, 91, 155, 195, 155, 167,
+ /* 860 */ 27, 52, 29, 49, 155, 120, 176, 177, 176, 11,
+ /* 870 */ 155, 58, 59, 95, 162, 129, 11, 176, 177, 176,
+ /* 880 */ 177, 25, 68, 69, 70, 71, 72, 73, 74, 75,
+ /* 890 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85,
+ /* 900 */ 86, 87, 88, 89, 90, 91, 155, 195, 155, 194,
+ /* 910 */ 155, 29, 134, 49, 158, 106, 176, 177, 11, 27,
+ /* 920 */ 155, 29, 155, 214, 192, 193, 166, 176, 177, 176,
+ /* 930 */ 177, 176, 177, 69, 70, 71, 72, 73, 74, 75,
+ /* 940 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85,
+ /* 950 */ 86, 87, 88, 89, 90, 91, 155, 101, 155, 161,
+ /* 960 */ 26, 67, 69, 155, 30, 37, 176, 177, 106, 162,
+ /* 970 */ 155, 26, 38, 155, 27, 30, 29, 176, 177, 176,
+ /* 980 */ 177, 214, 120, 38, 155, 57, 155, 231, 106, 55,
+ /* 990 */ 155, 235, 99, 11, 176, 177, 155, 232, 142, 65,
+ /* 1000 */ 55, 155, 195, 69, 155, 176, 177, 176, 177, 194,
+ /* 1010 */ 65, 176, 177, 106, 69, 155, 162, 176, 177, 64,
+ /* 1020 */ 86, 87, 176, 177, 130, 176, 177, 219, 94, 95,
+ /* 1030 */ 96, 86, 87, 99, 155, 118, 155, 106, 110, 94,
+ /* 1040 */ 95, 96, 155, 39, 99, 178, 155, 26, 131, 195,
+ /* 1050 */ 155, 30, 118, 155, 155, 176, 177, 176, 177, 38,
+ /* 1060 */ 27, 155, 29, 176, 177, 51, 132, 133, 134, 135,
+ /* 1070 */ 136, 137, 138, 155, 176, 177, 55, 132, 133, 134,
+ /* 1080 */ 135, 136, 137, 138, 139, 194, 65, 178, 189, 194,
+ /* 1090 */ 69, 155, 47, 179, 176, 177, 186, 155, 155, 144,
+ /* 1100 */ 194, 155, 120, 155, 155, 155, 26, 86, 87, 88,
+ /* 1110 */ 30, 155, 176, 177, 155, 94, 95, 96, 38, 27,
+ /* 1120 */ 99, 29, 176, 177, 176, 177, 176, 177, 118, 155,
+ /* 1130 */ 155, 232, 176, 177, 155, 55, 194, 194, 189, 155,
+ /* 1140 */ 178, 131, 155, 105, 180, 65, 178, 162, 26, 69,
+ /* 1150 */ 176, 177, 155, 132, 133, 134, 135, 136, 137, 138,
+ /* 1160 */ 176, 177, 155, 176, 177, 11, 86, 87, 189, 194,
+ /* 1170 */ 155, 120, 120, 155, 94, 95, 96, 155, 219, 99,
+ /* 1180 */ 195, 232, 15, 176, 177, 155, 189, 20, 21, 22,
+ /* 1190 */ 23, 176, 177, 197, 176, 177, 196, 118, 176, 177,
+ /* 1200 */ 33, 195, 35, 155, 199, 51, 176, 177, 197, 42,
+ /* 1210 */ 155, 232, 132, 133, 134, 135, 136, 137, 138, 155,
+ /* 1220 */ 129, 54, 155, 56, 176, 177, 200, 126, 61, 232,
+ /* 1230 */ 63, 176, 177, 66, 127, 201, 124, 202, 128, 203,
+ /* 1240 */ 176, 177, 155, 176, 177, 204, 120, 120, 155, 26,
+ /* 1250 */ 168, 27, 27, 234, 234, 91, 99, 155, 118, 118,
+ /* 1260 */ 118, 26, 139, 21, 26, 228, 193, 27, 229, 155,
+ /* 1270 */ 29, 27, 120, 125, 107, 108, 109, 159, 29, 155,
+ /* 1280 */ 113, 104, 217, 179, 30, 118, 167, 217, 179, 29,
+ /* 1290 */ 125, 155, 209, 155, 122, 106, 159, 123, 155, 155,
+ /* 1300 */ 210, 26, 155, 27, 120, 211, 210, 27, 211, 178,
+ /* 1310 */ 155, 26, 182, 181, 155, 217, 217, 184, 167, 185,
+ /* 1320 */ 185, 155, 51, 26, 185, 179, 176, 27, 179, 176,
+ /* 1330 */ 26, 186, 51, 26, 103, 155, 155, 111, 159, 178,
+ /* 1340 */ 180, 178, 155, 181, 188, 159, 188, 28, 155, 159,
+ /* 1350 */ 182, 238, 237, 106, 159, 45, 239, 15, 43, 106,
+ /* 1360 */ 240, 106, 142, 52, 155, 159, 155, 106, 11, 26,
+ /* 1370 */ 178, 142, 21, 15, 191, 130, 130, 11, 11, 67,
+ /* 1380 */ 21, 76, 191, 155, 110, 200, 11, 155, 130, 76,
+ /* 1390 */ 26, 155, 221, 11, 26, 11, 200, 11, 121, 11,
+ /* 1400 */ 11, 11, 200, 155, 121, 11, 191, 200, 110, 11,
+ /* 1410 */ 11, 26, 130, 11, 155, 221, 159, 155, 11, 11,
+ /* 1420 */ 11, 11, 155, 27, 11, 28, 11, 40, 155, 11,
+ /* 1430 */ 242, 168, 168, 11, 155, 11, 11, 159, 11, 155,
+ /* 1440 */ 243, 242, 155, 24, 143, 159, 155, 11, 145, 245,
+ /* 1450 */ 144, 11, 13, 246, 246, 14,
};
-#define YY_SHIFT_USE_DFLT (-72)
+#define YY_SHIFT_USE_DFLT (-75)
static const short yy_shift_ofst[] = {
- /* 0 */ 201, 81, -72, -72, 1103, -9, 127, -72, 235, 603,
- /* 10 */ 318, 286, 427, -72, -72, -72, -72, -72, -72, 603,
- /* 20 */ 639, 603, 671, 603, 903, 277, 974, 400, 748, 997,
- /* 30 */ 1036, 51, -72, 402, -72, 226, -72, 400, 345, -72,
- /* 40 */ 1023, -72, 1041, 395, -72, -72, -72, -72, -72, -72,
- /* 50 */ -72, 807, 1023, -72, 1124, -72, 560, -72, -72, 1138,
- /* 60 */ 522, 1023, 1094, -72, -72, -72, -72, 1023, -72, 1176,
- /* 70 */ 1045, 30, 873, 1088, 1098, -72, 884, -72, 388, 1114,
- /* 80 */ -72, 310, -72, -19, 1107, 1115, 1118, 1125, 1127, -72,
- /* 90 */ 1045, 40, 1045, 665, 1045, -72, 1132, 400, 1133, 400,
- /* 100 */ -72, -72, -72, -72, -72, -72, 1232, 1045, 105, 402,
- /* 110 */ -72, -72, 340, 630, 790, -72, 630, 1246, -72, -72,
- /* 120 */ -72, 679, -72, -72, -72, 679, -72, -72, -72, -72,
- /* 130 */ 1248, -72, 1045, -72, 759, 1045, -11, 1045, -11, 1045,
- /* 140 */ -11, 1045, -11, 1045, -71, 1045, -71, 1045, -50, 1045,
- /* 150 */ -50, 1045, -50, 1045, -50, 1045, 168, 1045, 168, 1045,
- /* 160 */ 1186, 1045, 1186, 1045, 1186, 1045, -72, -72, 441, -72,
- /* 170 */ -72, -72, -72, 1045, -56, 1045, -11, -72, 846, -72,
- /* 180 */ 1180, -72, -72, -72, 1045, 712, 1045, -71, -72, 289,
- /* 190 */ 884, 393, 700, 1162, 1164, 1165, -72, 665, 1045, 806,
- /* 200 */ 1045, -72, 1045, -72, 1045, -72, 1258, 1114, 401, -72,
- /* 210 */ 958, 152, 1146, 416, 1268, -72, 1045, 199, 1045, 665,
- /* 220 */ 1264, 530, 1266, -72, 1262, 400, 1269, -72, 1045, 273,
- /* 230 */ 1045, 320, 1045, 665, 793, -72, 1045, -72, -72, 1175,
- /* 240 */ 400, -72, -72, -72, 806, 1045, 665, 1173, 1045, 1271,
- /* 250 */ 1045, 1197, 522, -72, 1274, -72, -72, 665, 1197, 522,
- /* 260 */ -72, 1045, 665, 1181, 1045, 1276, 1045, 665, -72, -72,
- /* 270 */ 635, -72, -72, -72, 458, -72, 463, -72, 1191, -72,
- /* 280 */ 534, 1175, 779, 400, -72, -72, 1210, 1195, -72, 1294,
- /* 290 */ 400, 829, -72, 400, -72, -72, 1045, 665, 1114, 467,
- /* 300 */ 279, 1296, 779, 1210, 1195, -72, 1017, -25, -72, -72,
- /* 310 */ 1205, 536, -72, -72, -72, -72, 394, -72, 837, -72,
- /* 320 */ 1300, -72, 459, 1023, -72, 400, 1304, -72, 112, -72,
- /* 330 */ 400, -72, 619, 662, -72, 832, -72, -72, -72, -72,
- /* 340 */ 662, -72, 662, -72, 400, 919, -72, 400, 1197, 522,
- /* 350 */ -72, -72, 1197, 522, -72, -72, 1274, -72, 1124, -72,
- /* 360 */ -72, 70, -72, 1045, 524, -72, 239, -72, -72, 239,
- /* 370 */ -72, -72, -72, -72, 58, 149, -72, 400, -72, 1290,
- /* 380 */ 1318, 400, 59, 1322, 1023, -72, 1324, 400, 929, 1023,
- /* 390 */ -72, 1045, 571, -72, 1301, 1325, 400, 948, 1250, 400,
- /* 400 */ 1304, -72, 517, 1245, -72, -72, -72, -72, -72, 1114,
- /* 410 */ 552, 843, 754, 400, 1175, -72, 400, 140, 1339, 1114,
- /* 420 */ 556, 400, 1175, 869, 657, 1267, 400, 1175, -72, 1327,
- /* 430 */ 850, 1361, 1045, 618, 1335, 942, -72, -72, 1273, 1275,
- /* 440 */ 875, 400, 962, -72, -72, 1328, -72, -72, 1240, 400,
- /* 450 */ 906, 1279, 400, 1362, 400, 1001, 761, 1374, 1247, 1376,
- /* 460 */ 189, 562, 968, 395, -72, 1263, 1265, 1373, 1383, 1384,
- /* 470 */ 189, 1377, 1332, 400, 1291, 400, 792, 400, 1326, 1045,
- /* 480 */ 665, 1390, 1331, 1045, 665, 1278, 400, 1385, 400, 1007,
- /* 490 */ -72, 984, 604, 1386, 1045, 1012, 1045, 665, 1400, 665,
- /* 500 */ 1293, 400, 1033, 1404, 651, 400, 1405, 400, 1406, 400,
- /* 510 */ 1407, 400, 1408, 566, 1302, 400, 1033, 1411, 1332, 400,
- /* 520 */ 1316, 400, 792, 1415, 1299, 400, 1385, 1016, 608, 1409,
- /* 530 */ 1045, 1129, 1417, 476, 1418, 400, 1175, 697, 111, 1420,
- /* 540 */ 1421, 1424, 1427, 400, 1416, 1429, 1410, 402, 1419, 400,
- /* 550 */ 1025, 1432, 729, 1433, 1435, -72, 1410, 400, 1441, 839,
- /* 560 */ 981, 1442, 841, 981, 1443, 1439, 400, 1021, 1321, 400,
- /* 570 */ 1446, 1323, 1329, 400, 1456, -72, -72, -72,
+ /* 0 */ 205, 7, -75, -75, 1167, -10, 57, -75, 47, 475,
+ /* 10 */ 399, 123, 337, -75, -75, -75, -75, -75, -75, 475,
+ /* 20 */ 446, 475, 543, 475, 757, 456, 858, 453, 240, 799,
+ /* 30 */ 865, 50, -75, 254, -75, -16, -75, 453, 151, -75,
+ /* 40 */ 931, -75, 1004, 306, -75, -75, -75, -75, -75, -75,
+ /* 50 */ -75, 180, 931, -75, 1045, -75, 278, -75, -75, 1014,
+ /* 60 */ 689, 931, 1038, -75, -75, -75, -75, 931, -75, 1122,
+ /* 70 */ 1080, 652, 473, -75, -75, 1080, 1051, 1052, -75, 934,
+ /* 80 */ -75, 302, 1079, -75, 650, -75, 641, 1091, 1101, 1107,
+ /* 90 */ 1112, 1110, -75, 1080, 40, 1080, 714, 1080, -75, 1126,
+ /* 100 */ 453, 1127, 453, -75, -75, -75, -75, -75, -75, 1223,
+ /* 110 */ 1080, 108, 254, -75, -75, 455, 321, 595, -75, 321,
+ /* 120 */ 1224, -75, -75, -75, 638, -75, -75, -75, 638, -75,
+ /* 130 */ -75, -75, -75, 1225, -75, 1080, -75, 814, 1080, -12,
+ /* 140 */ 1080, -12, 1080, -12, 1080, -12, 1080, -74, 1080, -74,
+ /* 150 */ 1080, -53, 1080, -53, 1080, -53, 1080, -53, 1080, 242,
+ /* 160 */ 1080, 242, 1080, 1164, 1080, 1164, 1080, 1164, 1080, -75,
+ /* 170 */ -75, 298, -75, -75, -75, -75, 1080, -59, 1080, -12,
+ /* 180 */ -75, 893, -75, 1157, -75, -75, -75, 1080, 764, 1080,
+ /* 190 */ -74, -75, 325, 934, 359, 419, 1140, 1141, 1142, -75,
+ /* 200 */ 714, 1080, 864, 1080, -75, 1080, -75, 1080, -75, 1235,
+ /* 210 */ 1079, 376, -75, 945, 158, 1123, 320, 1242, -75, 1080,
+ /* 220 */ 231, 1080, 714, 1238, 443, 1240, -75, 1241, 453, 1244,
+ /* 230 */ -75, 1080, 305, 1080, 355, 1080, 714, 780, -75, 1080,
+ /* 240 */ -75, -75, 1152, 453, -75, -75, -75, 864, 1080, 714,
+ /* 250 */ 1148, 1080, 1249, 1080, 1177, 689, -75, 1254, -75, -75,
+ /* 260 */ 714, 1177, 689, -75, 1080, 714, 1165, 1080, 1260, 1080,
+ /* 270 */ 714, -75, -75, 239, -75, -75, -75, 430, -75, 433,
+ /* 280 */ -75, 1172, -75, 501, 1152, 144, 453, -75, -75, 1189,
+ /* 290 */ 1174, -75, 1275, 453, 783, -75, 453, -75, -75, 1080,
+ /* 300 */ 714, 1079, 422, 425, 1276, 144, 1189, 1174, -75, 1021,
+ /* 310 */ -28, -75, -75, 1184, 73, -75, -75, 429, -75, 792,
+ /* 320 */ -75, 1280, -75, 496, 931, -75, 453, 1285, -75, 42,
+ /* 330 */ -75, 453, -75, 550, 928, -75, 716, -75, -75, -75,
+ /* 340 */ -75, 928, -75, 928, -75, 453, 793, -75, 453, 1177,
+ /* 350 */ 689, -75, -75, 1177, 689, -75, -75, 1254, -75, 1045,
+ /* 360 */ -75, -75, 68, -75, 1080, 564, -75, 191, -75, -75,
+ /* 370 */ 191, -75, -75, -75, -75, 176, 256, -75, 453, -75,
+ /* 380 */ 1271, 1297, 453, 260, 1300, 931, -75, 1304, 453, 796,
+ /* 390 */ 931, -75, 1080, 614, -75, 1281, 1307, 453, 833, 1231,
+ /* 400 */ 453, 1285, -75, 493, 1226, -75, -75, -75, -75, -75,
+ /* 410 */ 1079, 513, 856, 391, 453, 1152, -75, 453, 745, 1319,
+ /* 420 */ 1079, 548, 453, 1152, 510, 565, 1247, 453, 1152, -75,
+ /* 430 */ 1310, 297, 1342, 1080, 664, 1315, 813, -75, -75, 1253,
+ /* 440 */ 1255, 809, 453, 882, -75, -75, 1311, -75, -75, 1220,
+ /* 450 */ 453, 862, 1261, 453, 1343, 453, 892, 907, 1357, 1229,
+ /* 460 */ 1358, 152, 592, 894, 306, -75, 1245, 1246, 1351, 1366,
+ /* 470 */ 1367, 152, 1359, 1312, 453, 1274, 453, 746, 453, 1305,
+ /* 480 */ 1080, 714, 1375, 1313, 1080, 714, 1258, 453, 1364, 453,
+ /* 490 */ 947, -75, 917, 598, 1368, 1080, 1033, 1080, 714, 1382,
+ /* 500 */ 714, 1277, 453, 9, 1384, 470, 453, 1386, 453, 1388,
+ /* 510 */ 453, 1389, 453, 1390, 605, 1283, 453, 9, 1394, 1312,
+ /* 520 */ 453, 1298, 453, 746, 1398, 1282, 453, 1364, 1010, 610,
+ /* 530 */ 1385, 1080, 1092, 1399, 530, 1402, 453, 1152, 649, 179,
+ /* 540 */ 1407, 1408, 1409, 1410, 453, 1396, 1413, 1387, 254, 1397,
+ /* 550 */ 453, 1154, 1415, 778, 1418, 1422, -75, 1387, 453, 1424,
+ /* 560 */ 665, 982, 1425, 734, 982, 1427, 1419, 453, 955, 1301,
+ /* 570 */ 453, 1436, 1306, 1303, 453, 1440, -75, 1439, 1441, -75,
+ /* 580 */ -75,
};
-#define YY_REDUCE_USE_DFLT (-151)
+#define YY_REDUCE_USE_DFLT (-61)
static const short yy_reduce_ofst[] = {
- /* 0 */ 64, 95, -151, -151, -59, -151, -151, -151, 33, 155,
- /* 10 */ -151, 224, -151, -151, -151, -151, -151, -151, -151, 428,
- /* 20 */ -151, 509, -151, 758, -151, 430, -151, 45, 771, -151,
- /* 30 */ -151, -21, -151, -64, 865, 244, -151, 910, -85, -151,
- /* 40 */ 895, -151, -151, -125, -151, -151, -151, -151, -151, -151,
- /* 50 */ -151, -151, 1010, -151, 1000, -151, -151, -151, -151, -151,
- /* 60 */ 1011, 1022, 1024, -151, -151, -151, -151, 1028, -151, -151,
- /* 70 */ 125, -151, 156, -151, -151, -151, 159, -151, 1037, 1039,
- /* 80 */ -151, 1040, 420, 1014, 1047, 1042, 1049, 1051, 1055, -151,
- /* 90 */ 348, 411, 450, 411, 649, -151, -151, 1105, -151, 1119,
- /* 100 */ -151, -151, -151, -151, -151, -151, -151, 685, 411, 254,
- /* 110 */ -151, -151, 1108, -150, -151, -151, -34, -151, -151, -151,
- /* 120 */ -151, 1044, -151, -151, -151, 1053, -151, -151, -151, -151,
- /* 130 */ -151, -151, 696, -151, 411, 732, 411, 743, 411, 747,
- /* 140 */ 411, 749, 411, 778, 411, 786, 411, 788, 411, 797,
- /* 150 */ 411, 827, 411, 838, 411, 874, 411, 882, 411, 885,
- /* 160 */ 411, 887, 411, 893, 411, 901, 411, -151, -151, -151,
- /* 170 */ -151, -151, -151, 932, 39, 951, 411, -151, -151, -151,
- /* 180 */ -151, -151, -151, -151, 991, 411, 1008, 411, -151, 1126,
- /* 190 */ 912, 1037, -151, -151, -151, -151, -151, 411, 1015, 411,
- /* 200 */ 1018, 411, 1020, 411, 1038, 411, -151, 745, 1037, -151,
- /* 210 */ 343, 411, 1058, 1059, -151, -151, 1043, 411, 1046, 411,
- /* 220 */ -151, 1099, -151, -151, -151, 1139, -151, -151, 1048, 411,
- /* 230 */ 1050, 411, 1052, 411, -151, -151, 257, -151, -151, 1140,
- /* 240 */ 1142, -151, -151, -151, 411, 1054, 411, -151, 276, -151,
- /* 250 */ 346, 1086, 1123, -151, 1141, -151, -151, 411, 1090, 1130,
- /* 260 */ -151, 1062, 411, -151, 281, -151, 1080, 411, -151, 652,
- /* 270 */ 1101, -151, -151, -151, 1156, -151, 1157, -151, -151, -151,
- /* 280 */ 1159, 1158, 506, 1160, -151, -151, 1109, 1110, -151, -151,
- /* 290 */ 78, -151, -151, 1167, -151, -151, 1085, 411, -63, 1037,
- /* 300 */ 1101, -151, 789, 1116, 1113, -151, 1087, 87, -151, -151,
- /* 310 */ -151, 1105, -151, -151, -151, -151, 411, -151, -151, -151,
- /* 320 */ -151, -151, 411, 1150, -151, 1174, 1151, 1149, 1152, -151,
- /* 330 */ 1178, -151, -151, 1153, -151, -151, -151, -151, -151, -151,
- /* 340 */ 1154, -151, 1155, -151, 433, -151, -151, 715, 1117, 1163,
- /* 350 */ -151, -151, 1120, 1166, -151, -151, 1168, -151, 1161, -151,
- /* 360 */ -151, 593, -151, 1089, 411, -151, 1170, -151, -151, 1172,
- /* 370 */ -151, -151, -151, -151, 1169, 1171, -151, 1188, -151, -151,
- /* 380 */ -151, 526, 1182, -151, 1177, -151, -151, 574, -151, 1183,
- /* 390 */ -151, 1091, 142, -151, -151, -151, 621, -151, -151, 1199,
- /* 400 */ 1179, 1184, 193, -151, -151, -151, -151, -151, -151, 804,
- /* 410 */ 1037, 755, -151, 1203, 1204, -151, 1209, 1206, -151, 830,
- /* 420 */ 1037, 1213, 1211, 1134, 1131, -151, 261, 1215, -151, 1136,
- /* 430 */ 1137, -151, 774, 411, -151, -151, -151, -151, -151, -151,
- /* 440 */ -151, 516, -151, -151, -151, -151, -151, -151, -151, 1228,
- /* 450 */ 1225, -151, 1231, -151, 668, -151, 1212, -151, -151, -151,
- /* 460 */ 218, 1037, 1201, 840, -151, -151, -151, -151, -151, -151,
- /* 470 */ 280, -151, 1214, 1249, -151, 295, 1200, 1251, -151, 821,
- /* 480 */ 411, -151, -151, 1093, 411, -151, 1254, 1189, 905, -151,
- /* 490 */ -151, 904, 1037, -151, 413, -151, 1095, 411, -151, 411,
- /* 500 */ -151, 1260, 1216, -151, -151, 926, -151, 966, -151, 967,
- /* 510 */ -151, 978, -151, 1037, -151, 980, 1222, -151, 1234, 982,
- /* 520 */ -151, 924, 1227, -151, -151, 993, 1217, 922, 1037, -151,
- /* 530 */ 591, -151, -151, 1277, -151, 1281, 1280, -151, 145, -151,
- /* 540 */ -151, -151, -151, 1286, -151, -151, 1202, 1283, -151, 1297,
- /* 550 */ 1218, -151, 1285, -151, -151, -151, 1207, 1303, -151, 1305,
- /* 560 */ 1298, -151, 1307, 1306, -151, -151, -73, -151, -151, 1311,
- /* 570 */ -151, -151, 1223, 607, -151, -151, -151, -151,
+ /* 0 */ -48, 61, -61, -61, -60, -61, -61, -61, -32, 12,
+ /* 10 */ -61, 181, -61, -61, -61, -61, -61, -61, -61, 314,
+ /* 20 */ -61, 386, -61, 622, -61, 654, -61, 51, 798, -61,
+ /* 30 */ -61, -23, -61, -26, 760, 89, -61, 860, 486, -61,
+ /* 40 */ 867, -61, -61, 65, -61, -61, -61, -61, -61, -61,
+ /* 50 */ -61, -61, 909, -61, 910, -61, -61, -61, -61, -61,
+ /* 60 */ 914, 962, 964, -61, -61, -61, -61, 968, -61, -61,
+ /* 70 */ 438, -61, 996, -61, -61, 116, -61, -61, -61, 293,
+ /* 80 */ -61, 1000, 1006, -61, 1011, 569, 1005, 1026, 1034, 1035,
+ /* 90 */ 1036, 1041, -61, 490, 394, 552, 394, 601, -61, -61,
+ /* 100 */ 1087, -61, 1093, -61, -61, -61, -61, -61, -61, -61,
+ /* 110 */ 603, 394, 53, -61, -61, 1082, 110, -61, -61, 229,
+ /* 120 */ -61, -61, -61, -61, 1019, -61, -61, -61, 1020, -61,
+ /* 130 */ -61, -61, -61, -61, -61, 640, -61, 394, 651, 394,
+ /* 140 */ 690, 394, 701, 394, 703, 394, 740, 394, 751, 394,
+ /* 150 */ 753, 394, 755, 394, 790, 394, 801, 394, 803, 394,
+ /* 160 */ 818, 394, 829, 394, 831, 394, 835, 394, 841, 394,
+ /* 170 */ -61, -61, -61, -61, -61, -61, 846, 188, 849, 394,
+ /* 180 */ -61, -61, -61, -61, -61, -61, -61, 879, 394, 881,
+ /* 190 */ 394, -61, 1102, -6, 1000, -61, -61, -61, -61, -61,
+ /* 200 */ 394, 887, 394, 898, 394, 918, 394, 936, 394, -61,
+ /* 210 */ 662, 1000, -61, 295, 394, 1037, 1039, -61, -61, 946,
+ /* 220 */ 394, 948, 394, -61, 1073, -61, -61, -61, 1114, -61,
+ /* 230 */ -61, 950, 394, 956, 394, 974, 394, -61, -61, 303,
+ /* 240 */ -61, -61, 1118, 1124, -61, -61, -61, 394, 984, 394,
+ /* 250 */ -61, 183, -61, 190, 1065, 1104, -61, 1119, -61, -61,
+ /* 260 */ 394, 1070, 1109, -61, 987, 394, -61, 187, -61, 1007,
+ /* 270 */ 394, -61, 398, 1083, -61, -61, -61, 1136, -61, 1138,
+ /* 280 */ -61, -61, -61, 1143, 1137, 389, 1144, -61, -61, 1090,
+ /* 290 */ 1094, -61, -61, 604, -61, -61, 1147, -61, -61, 1015,
+ /* 300 */ 394, 132, 1000, 1083, -61, 512, 1096, 1097, -61, 1018,
+ /* 310 */ 241, -61, -61, -61, 1087, -61, -61, 394, -61, -61,
+ /* 320 */ -61, -61, -61, 394, 1131, -61, 1155, 1132, 1130, 1133,
+ /* 330 */ -61, 1159, -61, -61, 1134, -61, -61, -61, -61, -61,
+ /* 340 */ -61, 1135, -61, 1139, -61, 439, -61, -61, 765, 1098,
+ /* 350 */ 1146, -61, -61, 1099, 1149, -61, -61, 1151, -61, 1145,
+ /* 360 */ -61, -61, 692, -61, 1022, 394, -61, 1150, -61, -61,
+ /* 370 */ 1153, -61, -61, -61, -61, 1156, 1158, -61, 1166, -61,
+ /* 380 */ -61, -61, 899, 1160, -61, 1161, -61, -61, 949, -61,
+ /* 390 */ 1163, -61, 1030, 375, -61, -61, -61, 979, -61, -61,
+ /* 400 */ 1180, 1162, 1168, 527, -61, -61, -61, -61, -61, -61,
+ /* 410 */ 712, 1000, 756, -61, 1181, 1179, -61, 1187, 1186, -61,
+ /* 420 */ 807, 1000, 1193, 1190, 1115, 1113, -61, 715, 1195, -61,
+ /* 430 */ 1117, 1120, -61, 1048, 394, -61, -61, -61, -61, -61,
+ /* 440 */ -61, -61, 709, -61, -61, -61, -61, -61, -61, -61,
+ /* 450 */ 1209, 1206, -61, 1211, -61, 997, -61, 1192, -61, -61,
+ /* 460 */ -61, 315, 1000, 1183, 732, -61, -61, -61, -61, -61,
+ /* 470 */ -61, 382, -61, 1191, 1228, -61, 808, 1185, 1232, -61,
+ /* 480 */ 1055, 394, -61, -61, 1064, 394, -61, 1236, 1171, 767,
+ /* 490 */ -61, -61, 854, 1000, -61, -18, -61, 1067, 394, -61,
+ /* 500 */ 394, -61, 1248, 1196, -61, -61, 815, -61, 891, -61,
+ /* 510 */ 895, -61, 906, -61, 1000, -61, 942, 1202, -61, 1215,
+ /* 520 */ 943, -61, 959, 1207, -61, -61, 975, 1194, 985, 1000,
+ /* 530 */ -61, 434, -61, -61, 1259, -61, 1262, 1257, -61, 435,
+ /* 540 */ -61, -61, -61, -61, 1267, -61, -61, 1188, 1263, -61,
+ /* 550 */ 1273, 1197, -61, 1264, -61, -61, -61, 1199, 1279, -61,
+ /* 560 */ 1284, 1278, -61, 1287, 1286, -61, -61, 522, -61, -61,
+ /* 570 */ 1291, -61, -61, 1204, -58, -61, -61, -61, -61, -61,
+ /* 580 */ -61,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 584, 584, 579, 582, 888, 888, 888, 583, 590, 888,
- /* 10 */ 888, 888, 888, 610, 611, 612, 591, 592, 593, 888,
- /* 20 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888,
- /* 30 */ 888, 888, 603, 613, 623, 605, 622, 888, 888, 624,
- /* 40 */ 668, 631, 888, 888, 669, 672, 673, 674, 868, 869,
- /* 50 */ 870, 888, 668, 632, 653, 651, 888, 654, 655, 888,
- /* 60 */ 724, 668, 639, 633, 640, 722, 723, 668, 634, 888,
- /* 70 */ 888, 754, 820, 760, 755, 751, 888, 679, 888, 888,
- /* 80 */ 680, 688, 690, 697, 736, 727, 729, 717, 731, 685,
- /* 90 */ 888, 732, 888, 733, 888, 753, 888, 888, 756, 888,
- /* 100 */ 757, 758, 759, 761, 762, 763, 888, 888, 888, 888,
- /* 110 */ 608, 609, 615, 843, 888, 616, 843, 888, 617, 620,
- /* 120 */ 621, 888, 838, 840, 841, 888, 839, 842, 619, 618,
- /* 130 */ 888, 764, 888, 767, 769, 888, 770, 888, 771, 888,
- /* 140 */ 772, 888, 773, 888, 774, 888, 775, 888, 776, 888,
- /* 150 */ 777, 888, 778, 888, 779, 888, 780, 888, 781, 888,
- /* 160 */ 782, 888, 783, 888, 784, 888, 785, 786, 888, 787,
- /* 170 */ 794, 801, 804, 888, 789, 888, 788, 791, 888, 792,
- /* 180 */ 888, 795, 793, 800, 888, 888, 888, 802, 803, 888,
- /* 190 */ 820, 888, 888, 888, 888, 888, 807, 819, 888, 796,
- /* 200 */ 888, 797, 888, 798, 888, 799, 888, 888, 888, 809,
- /* 210 */ 888, 888, 888, 888, 888, 810, 888, 888, 888, 811,
- /* 220 */ 888, 888, 888, 866, 888, 888, 888, 867, 888, 888,
- /* 230 */ 888, 888, 888, 812, 888, 805, 820, 817, 818, 705,
- /* 240 */ 888, 706, 808, 790, 768, 888, 734, 888, 888, 718,
- /* 250 */ 888, 725, 724, 719, 888, 607, 726, 721, 725, 724,
- /* 260 */ 720, 888, 730, 888, 820, 728, 888, 737, 689, 700,
- /* 270 */ 698, 699, 708, 709, 888, 710, 888, 711, 888, 712,
- /* 280 */ 888, 705, 696, 888, 694, 695, 714, 716, 701, 888,
- /* 290 */ 888, 888, 715, 888, 749, 750, 888, 713, 700, 888,
- /* 300 */ 888, 888, 696, 714, 716, 702, 888, 696, 691, 692,
- /* 310 */ 888, 888, 693, 686, 687, 806, 888, 752, 888, 765,
- /* 320 */ 888, 766, 888, 668, 635, 888, 824, 641, 636, 642,
- /* 330 */ 888, 643, 888, 888, 644, 888, 647, 648, 649, 650,
- /* 340 */ 888, 645, 888, 646, 888, 888, 825, 888, 725, 724,
- /* 350 */ 826, 828, 725, 724, 827, 637, 888, 638, 653, 652,
- /* 360 */ 625, 888, 626, 888, 888, 627, 888, 628, 760, 888,
- /* 370 */ 629, 630, 614, 606, 888, 888, 658, 888, 661, 888,
- /* 380 */ 888, 888, 888, 888, 668, 662, 888, 888, 888, 668,
- /* 390 */ 663, 888, 668, 664, 888, 888, 888, 888, 888, 888,
- /* 400 */ 824, 641, 666, 888, 665, 667, 659, 660, 604, 888,
- /* 410 */ 888, 600, 888, 888, 705, 598, 888, 888, 888, 888,
- /* 420 */ 888, 888, 705, 849, 888, 888, 888, 705, 707, 854,
- /* 430 */ 888, 888, 888, 888, 888, 888, 855, 856, 888, 888,
- /* 440 */ 888, 888, 888, 846, 847, 888, 848, 599, 888, 888,
- /* 450 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888,
- /* 460 */ 888, 888, 888, 888, 671, 888, 888, 888, 888, 888,
- /* 470 */ 888, 888, 670, 888, 888, 888, 888, 888, 888, 888,
- /* 480 */ 739, 888, 888, 888, 740, 888, 888, 747, 888, 888,
- /* 490 */ 748, 888, 888, 888, 888, 888, 888, 745, 888, 746,
- /* 500 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888,
- /* 510 */ 888, 888, 888, 888, 888, 888, 888, 888, 670, 888,
- /* 520 */ 888, 888, 888, 888, 888, 888, 747, 888, 888, 888,
- /* 530 */ 888, 888, 888, 888, 888, 888, 705, 888, 843, 888,
- /* 540 */ 888, 888, 888, 888, 888, 888, 877, 888, 888, 888,
- /* 550 */ 888, 888, 888, 888, 888, 876, 877, 888, 888, 888,
- /* 560 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888,
- /* 570 */ 888, 888, 886, 888, 888, 887, 585, 580,
+ /* 0 */ 587, 587, 582, 585, 892, 892, 892, 586, 594, 892,
+ /* 10 */ 892, 892, 892, 614, 615, 616, 595, 596, 597, 892,
+ /* 20 */ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ /* 30 */ 892, 892, 607, 617, 627, 609, 626, 892, 892, 628,
+ /* 40 */ 672, 635, 892, 892, 673, 676, 677, 678, 872, 873,
+ /* 50 */ 874, 892, 672, 636, 657, 655, 892, 658, 659, 892,
+ /* 60 */ 728, 672, 643, 637, 644, 726, 727, 672, 638, 892,
+ /* 70 */ 892, 758, 692, 690, 691, 824, 764, 759, 755, 892,
+ /* 80 */ 683, 892, 892, 684, 692, 694, 701, 740, 731, 733,
+ /* 90 */ 721, 735, 689, 892, 736, 892, 737, 892, 757, 892,
+ /* 100 */ 892, 760, 892, 761, 762, 763, 765, 766, 767, 892,
+ /* 110 */ 892, 892, 892, 612, 613, 619, 847, 892, 620, 847,
+ /* 120 */ 892, 621, 624, 625, 892, 842, 844, 845, 892, 843,
+ /* 130 */ 846, 623, 622, 892, 768, 892, 771, 773, 892, 774,
+ /* 140 */ 892, 775, 892, 776, 892, 777, 892, 778, 892, 779,
+ /* 150 */ 892, 780, 892, 781, 892, 782, 892, 783, 892, 784,
+ /* 160 */ 892, 785, 892, 786, 892, 787, 892, 788, 892, 789,
+ /* 170 */ 790, 892, 791, 798, 805, 808, 892, 793, 892, 792,
+ /* 180 */ 795, 892, 796, 892, 799, 797, 804, 892, 892, 892,
+ /* 190 */ 806, 807, 892, 824, 892, 892, 892, 892, 892, 811,
+ /* 200 */ 823, 892, 800, 892, 801, 892, 802, 892, 803, 892,
+ /* 210 */ 892, 892, 813, 892, 892, 892, 892, 892, 814, 892,
+ /* 220 */ 892, 892, 815, 892, 892, 892, 870, 892, 892, 892,
+ /* 230 */ 871, 892, 892, 892, 892, 892, 816, 892, 809, 824,
+ /* 240 */ 821, 822, 709, 892, 710, 812, 794, 772, 892, 738,
+ /* 250 */ 892, 892, 722, 892, 729, 728, 723, 892, 611, 730,
+ /* 260 */ 725, 729, 728, 724, 892, 734, 892, 824, 732, 892,
+ /* 270 */ 741, 693, 704, 702, 703, 712, 713, 892, 714, 892,
+ /* 280 */ 715, 892, 716, 892, 709, 700, 892, 698, 699, 718,
+ /* 290 */ 720, 705, 892, 892, 892, 719, 892, 753, 754, 892,
+ /* 300 */ 717, 704, 892, 892, 892, 700, 718, 720, 706, 892,
+ /* 310 */ 700, 695, 696, 892, 892, 697, 810, 892, 756, 892,
+ /* 320 */ 769, 892, 770, 892, 672, 639, 892, 828, 645, 640,
+ /* 330 */ 646, 892, 647, 892, 892, 648, 892, 651, 652, 653,
+ /* 340 */ 654, 892, 649, 892, 650, 892, 892, 829, 892, 729,
+ /* 350 */ 728, 830, 832, 729, 728, 831, 641, 892, 642, 657,
+ /* 360 */ 656, 629, 892, 630, 892, 892, 631, 892, 632, 764,
+ /* 370 */ 892, 633, 634, 618, 610, 892, 892, 662, 892, 665,
+ /* 380 */ 892, 892, 892, 892, 892, 672, 666, 892, 892, 892,
+ /* 390 */ 672, 667, 892, 672, 668, 892, 892, 892, 892, 892,
+ /* 400 */ 892, 828, 645, 670, 892, 669, 671, 663, 664, 608,
+ /* 410 */ 892, 892, 604, 892, 892, 709, 602, 892, 892, 892,
+ /* 420 */ 892, 892, 892, 709, 853, 892, 892, 892, 709, 711,
+ /* 430 */ 858, 892, 892, 892, 892, 892, 892, 859, 860, 892,
+ /* 440 */ 892, 892, 892, 892, 850, 851, 892, 852, 603, 892,
+ /* 450 */ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ /* 460 */ 892, 892, 892, 892, 892, 675, 892, 892, 892, 892,
+ /* 470 */ 892, 892, 892, 674, 892, 892, 892, 892, 892, 892,
+ /* 480 */ 892, 743, 892, 892, 892, 744, 892, 892, 751, 892,
+ /* 490 */ 892, 752, 892, 892, 892, 892, 892, 892, 749, 892,
+ /* 500 */ 750, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ /* 510 */ 892, 892, 892, 892, 892, 892, 892, 892, 892, 674,
+ /* 520 */ 892, 892, 892, 892, 892, 892, 892, 751, 892, 892,
+ /* 530 */ 892, 892, 892, 892, 892, 892, 892, 709, 892, 847,
+ /* 540 */ 892, 892, 892, 892, 892, 892, 892, 881, 892, 892,
+ /* 550 */ 892, 892, 892, 892, 892, 892, 880, 881, 892, 892,
+ /* 560 */ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ /* 570 */ 892, 892, 892, 890, 892, 892, 891, 588, 892, 589,
+ /* 580 */ 583,
};
#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0]))
@@ -679,61 +678,64 @@ static const YYCODETYPE yyFallback[] = {
0, /* FUNCTION => nothing */
0, /* COLUMN => nothing */
0, /* AGG_FUNCTION => nothing */
+ 0, /* AGG_COLUMN => nothing */
0, /* CONST_FUNC => nothing */
0, /* SEMI => nothing */
- 27, /* EXPLAIN => ID */
- 27, /* BEGIN => ID */
+ 30, /* EXPLAIN => ID */
+ 30, /* QUERY => ID */
+ 30, /* PLAN => ID */
+ 30, /* BEGIN => ID */
0, /* TRANSACTION => nothing */
- 27, /* DEFERRED => ID */
- 27, /* IMMEDIATE => ID */
- 27, /* EXCLUSIVE => ID */
+ 30, /* DEFERRED => ID */
+ 30, /* IMMEDIATE => ID */
+ 30, /* EXCLUSIVE => ID */
0, /* COMMIT => nothing */
- 27, /* END => ID */
+ 30, /* END => ID */
0, /* ROLLBACK => nothing */
0, /* CREATE => nothing */
0, /* TABLE => nothing */
- 27, /* TEMP => ID */
+ 30, /* TEMP => ID */
0, /* LP => nothing */
0, /* RP => nothing */
0, /* AS => nothing */
0, /* COMMA => nothing */
0, /* ID => nothing */
- 27, /* ABORT => ID */
- 27, /* AFTER => ID */
- 27, /* ANALYZE => ID */
- 27, /* ASC => ID */
- 27, /* ATTACH => ID */
- 27, /* BEFORE => ID */
- 27, /* CASCADE => ID */
- 27, /* CAST => ID */
- 27, /* CONFLICT => ID */
- 27, /* DATABASE => ID */
- 27, /* DESC => ID */
- 27, /* DETACH => ID */
- 27, /* EACH => ID */
- 27, /* FAIL => ID */
- 27, /* FOR => ID */
- 27, /* IGNORE => ID */
- 27, /* INITIALLY => ID */
- 27, /* INSTEAD => ID */
- 27, /* LIKE_KW => ID */
- 27, /* MATCH => ID */
- 27, /* KEY => ID */
- 27, /* OF => ID */
- 27, /* OFFSET => ID */
- 27, /* PRAGMA => ID */
- 27, /* RAISE => ID */
- 27, /* REPLACE => ID */
- 27, /* RESTRICT => ID */
- 27, /* ROW => ID */
- 27, /* STATEMENT => ID */
- 27, /* TRIGGER => ID */
- 27, /* VACUUM => ID */
- 27, /* VIEW => ID */
- 27, /* REINDEX => ID */
- 27, /* RENAME => ID */
- 27, /* CTIME_KW => ID */
- 27, /* ALTER => ID */
+ 30, /* ABORT => ID */
+ 30, /* AFTER => ID */
+ 30, /* ANALYZE => ID */
+ 30, /* ASC => ID */
+ 30, /* ATTACH => ID */
+ 30, /* BEFORE => ID */
+ 30, /* CASCADE => ID */
+ 30, /* CAST => ID */
+ 30, /* CONFLICT => ID */
+ 30, /* DATABASE => ID */
+ 30, /* DESC => ID */
+ 30, /* DETACH => ID */
+ 30, /* EACH => ID */
+ 30, /* FAIL => ID */
+ 30, /* FOR => ID */
+ 30, /* IGNORE => ID */
+ 30, /* INITIALLY => ID */
+ 30, /* INSTEAD => ID */
+ 30, /* LIKE_KW => ID */
+ 30, /* MATCH => ID */
+ 30, /* KEY => ID */
+ 30, /* OF => ID */
+ 30, /* OFFSET => ID */
+ 30, /* PRAGMA => ID */
+ 30, /* RAISE => ID */
+ 30, /* REPLACE => ID */
+ 30, /* RESTRICT => ID */
+ 30, /* ROW => ID */
+ 30, /* STATEMENT => ID */
+ 30, /* TRIGGER => ID */
+ 30, /* VACUUM => ID */
+ 30, /* VIEW => ID */
+ 30, /* REINDEX => ID */
+ 30, /* RENAME => ID */
+ 30, /* CTIME_KW => ID */
+ 30, /* ALTER => ID */
0, /* OR => nothing */
0, /* AND => nothing */
0, /* NOT => nothing */
@@ -885,65 +887,66 @@ void sqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){
static const char *const yyTokenName[] = {
"$", "END_OF_FILE", "ILLEGAL", "SPACE",
"UNCLOSED_STRING", "COMMENT", "FUNCTION", "COLUMN",
- "AGG_FUNCTION", "CONST_FUNC", "SEMI", "EXPLAIN",
- "BEGIN", "TRANSACTION", "DEFERRED", "IMMEDIATE",
- "EXCLUSIVE", "COMMIT", "END", "ROLLBACK",
- "CREATE", "TABLE", "TEMP", "LP",
- "RP", "AS", "COMMA", "ID",
- "ABORT", "AFTER", "ANALYZE", "ASC",
- "ATTACH", "BEFORE", "CASCADE", "CAST",
- "CONFLICT", "DATABASE", "DESC", "DETACH",
- "EACH", "FAIL", "FOR", "IGNORE",
- "INITIALLY", "INSTEAD", "LIKE_KW", "MATCH",
- "KEY", "OF", "OFFSET", "PRAGMA",
- "RAISE", "REPLACE", "RESTRICT", "ROW",
- "STATEMENT", "TRIGGER", "VACUUM", "VIEW",
- "REINDEX", "RENAME", "CTIME_KW", "ALTER",
- "OR", "AND", "NOT", "IS",
- "BETWEEN", "IN", "ISNULL", "NOTNULL",
- "NE", "EQ", "GT", "LE",
- "LT", "GE", "ESCAPE", "BITAND",
- "BITOR", "LSHIFT", "RSHIFT", "PLUS",
- "MINUS", "STAR", "SLASH", "REM",
- "CONCAT", "UMINUS", "UPLUS", "BITNOT",
- "STRING", "JOIN_KW", "CONSTRAINT", "DEFAULT",
- "NULL", "PRIMARY", "UNIQUE", "CHECK",
- "REFERENCES", "COLLATE", "AUTOINCR", "ON",
- "DELETE", "UPDATE", "INSERT", "SET",
- "DEFERRABLE", "FOREIGN", "DROP", "UNION",
- "ALL", "INTERSECT", "EXCEPT", "SELECT",
- "DISTINCT", "DOT", "FROM", "JOIN",
- "USING", "ORDER", "BY", "GROUP",
- "HAVING", "LIMIT", "WHERE", "INTO",
- "VALUES", "INTEGER", "FLOAT", "BLOB",
- "REGISTER", "VARIABLE", "EXISTS", "CASE",
- "WHEN", "THEN", "ELSE", "INDEX",
- "TO", "ADD", "COLUMNKW", "error",
- "input", "cmdlist", "ecmd", "cmdx",
- "cmd", "explain", "transtype", "trans_opt",
- "nm", "create_table", "create_table_args", "temp",
- "dbnm", "columnlist", "conslist_opt", "select",
- "column", "columnid", "type", "carglist",
- "id", "ids", "typetoken", "typename",
- "signed", "plus_num", "minus_num", "carg",
- "ccons", "term", "expr", "onconf",
- "sortorder", "autoinc", "idxlist_opt", "refargs",
- "defer_subclause", "refarg", "refact", "init_deferred_pred_opt",
- "conslist", "tcons", "idxlist", "defer_subclause_opt",
- "orconf", "resolvetype", "raisetype", "fullname",
- "oneselect", "multiselect_op", "distinct", "selcollist",
- "from", "where_opt", "groupby_opt", "having_opt",
- "orderby_opt", "limit_opt", "sclp", "as",
- "seltablist", "stl_prefix", "joinop", "on_opt",
- "using_opt", "seltablist_paren", "joinop2", "inscollist",
- "sortlist", "sortitem", "collate", "exprlist",
- "setlist", "insert_cmd", "inscollist_opt", "itemlist",
- "likeop", "escape", "between_op", "in_op",
- "case_operand", "case_exprlist", "case_else", "expritem",
- "uniqueflag", "idxitem", "plus_opt", "number",
- "trigger_decl", "trigger_cmd_list", "trigger_time", "trigger_event",
- "foreach_clause", "when_clause", "trigger_cmd", "database_kw_opt",
- "key_opt", "add_column_fullname", "kwcolumn_opt",
+ "AGG_FUNCTION", "AGG_COLUMN", "CONST_FUNC", "SEMI",
+ "EXPLAIN", "QUERY", "PLAN", "BEGIN",
+ "TRANSACTION", "DEFERRED", "IMMEDIATE", "EXCLUSIVE",
+ "COMMIT", "END", "ROLLBACK", "CREATE",
+ "TABLE", "TEMP", "LP", "RP",
+ "AS", "COMMA", "ID", "ABORT",
+ "AFTER", "ANALYZE", "ASC", "ATTACH",
+ "BEFORE", "CASCADE", "CAST", "CONFLICT",
+ "DATABASE", "DESC", "DETACH", "EACH",
+ "FAIL", "FOR", "IGNORE", "INITIALLY",
+ "INSTEAD", "LIKE_KW", "MATCH", "KEY",
+ "OF", "OFFSET", "PRAGMA", "RAISE",
+ "REPLACE", "RESTRICT", "ROW", "STATEMENT",
+ "TRIGGER", "VACUUM", "VIEW", "REINDEX",
+ "RENAME", "CTIME_KW", "ALTER", "OR",
+ "AND", "NOT", "IS", "BETWEEN",
+ "IN", "ISNULL", "NOTNULL", "NE",
+ "EQ", "GT", "LE", "LT",
+ "GE", "ESCAPE", "BITAND", "BITOR",
+ "LSHIFT", "RSHIFT", "PLUS", "MINUS",
+ "STAR", "SLASH", "REM", "CONCAT",
+ "UMINUS", "UPLUS", "BITNOT", "STRING",
+ "JOIN_KW", "CONSTRAINT", "DEFAULT", "NULL",
+ "PRIMARY", "UNIQUE", "CHECK", "REFERENCES",
+ "COLLATE", "AUTOINCR", "ON", "DELETE",
+ "UPDATE", "INSERT", "SET", "DEFERRABLE",
+ "FOREIGN", "DROP", "UNION", "ALL",
+ "INTERSECT", "EXCEPT", "SELECT", "DISTINCT",
+ "DOT", "FROM", "JOIN", "USING",
+ "ORDER", "BY", "GROUP", "HAVING",
+ "LIMIT", "WHERE", "INTO", "VALUES",
+ "INTEGER", "FLOAT", "BLOB", "REGISTER",
+ "VARIABLE", "EXISTS", "CASE", "WHEN",
+ "THEN", "ELSE", "INDEX", "TO",
+ "ADD", "COLUMNKW", "error", "input",
+ "cmdlist", "ecmd", "cmdx", "cmd",
+ "explain", "transtype", "trans_opt", "nm",
+ "create_table", "create_table_args", "temp", "dbnm",
+ "columnlist", "conslist_opt", "select", "column",
+ "columnid", "type", "carglist", "id",
+ "ids", "typetoken", "typename", "signed",
+ "plus_num", "minus_num", "carg", "ccons",
+ "term", "expr", "onconf", "sortorder",
+ "autoinc", "idxlist_opt", "refargs", "defer_subclause",
+ "refarg", "refact", "init_deferred_pred_opt", "conslist",
+ "tcons", "idxlist", "defer_subclause_opt", "orconf",
+ "resolvetype", "raisetype", "fullname", "oneselect",
+ "multiselect_op", "distinct", "selcollist", "from",
+ "where_opt", "groupby_opt", "having_opt", "orderby_opt",
+ "limit_opt", "sclp", "as", "seltablist",
+ "stl_prefix", "joinop", "on_opt", "using_opt",
+ "seltablist_paren", "joinop2", "inscollist", "sortlist",
+ "sortitem", "collate", "exprlist", "setlist",
+ "insert_cmd", "inscollist_opt", "itemlist", "likeop",
+ "escape", "between_op", "in_op", "case_operand",
+ "case_exprlist", "case_else", "expritem", "uniqueflag",
+ "idxitem", "plus_opt", "number", "trigger_decl",
+ "trigger_cmd_list", "trigger_time", "trigger_event", "foreach_clause",
+ "when_clause", "trigger_cmd", "database_kw_opt", "key_opt",
+ "add_column_fullname", "kwcolumn_opt",
};
#endif /* NDEBUG */
@@ -959,308 +962,309 @@ static const char *const yyRuleName[] = {
/* 5 */ "ecmd ::= explain cmdx SEMI",
/* 6 */ "explain ::=",
/* 7 */ "explain ::= EXPLAIN",
- /* 8 */ "cmd ::= BEGIN transtype trans_opt",
- /* 9 */ "trans_opt ::=",
- /* 10 */ "trans_opt ::= TRANSACTION",
- /* 11 */ "trans_opt ::= TRANSACTION nm",
- /* 12 */ "transtype ::=",
- /* 13 */ "transtype ::= DEFERRED",
- /* 14 */ "transtype ::= IMMEDIATE",
- /* 15 */ "transtype ::= EXCLUSIVE",
- /* 16 */ "cmd ::= COMMIT trans_opt",
- /* 17 */ "cmd ::= END trans_opt",
- /* 18 */ "cmd ::= ROLLBACK trans_opt",
- /* 19 */ "cmd ::= create_table create_table_args",
- /* 20 */ "create_table ::= CREATE temp TABLE nm dbnm",
- /* 21 */ "temp ::= TEMP",
- /* 22 */ "temp ::=",
- /* 23 */ "create_table_args ::= LP columnlist conslist_opt RP",
- /* 24 */ "create_table_args ::= AS select",
- /* 25 */ "columnlist ::= columnlist COMMA column",
- /* 26 */ "columnlist ::= column",
- /* 27 */ "column ::= columnid type carglist",
- /* 28 */ "columnid ::= nm",
- /* 29 */ "id ::= ID",
- /* 30 */ "ids ::= ID",
- /* 31 */ "ids ::= STRING",
- /* 32 */ "nm ::= ID",
- /* 33 */ "nm ::= STRING",
- /* 34 */ "nm ::= JOIN_KW",
- /* 35 */ "type ::=",
- /* 36 */ "type ::= typetoken",
- /* 37 */ "typetoken ::= typename",
- /* 38 */ "typetoken ::= typename LP signed RP",
- /* 39 */ "typetoken ::= typename LP signed COMMA signed RP",
- /* 40 */ "typename ::= ids",
- /* 41 */ "typename ::= typename ids",
- /* 42 */ "signed ::= plus_num",
- /* 43 */ "signed ::= minus_num",
- /* 44 */ "carglist ::= carglist carg",
- /* 45 */ "carglist ::=",
- /* 46 */ "carg ::= CONSTRAINT nm ccons",
- /* 47 */ "carg ::= ccons",
- /* 48 */ "carg ::= DEFAULT term",
- /* 49 */ "carg ::= DEFAULT LP expr RP",
- /* 50 */ "carg ::= DEFAULT PLUS term",
- /* 51 */ "carg ::= DEFAULT MINUS term",
- /* 52 */ "carg ::= DEFAULT id",
- /* 53 */ "ccons ::= NULL onconf",
- /* 54 */ "ccons ::= NOT NULL onconf",
- /* 55 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
- /* 56 */ "ccons ::= UNIQUE onconf",
- /* 57 */ "ccons ::= CHECK LP expr RP onconf",
- /* 58 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
- /* 59 */ "ccons ::= defer_subclause",
- /* 60 */ "ccons ::= COLLATE id",
- /* 61 */ "autoinc ::=",
- /* 62 */ "autoinc ::= AUTOINCR",
- /* 63 */ "refargs ::=",
- /* 64 */ "refargs ::= refargs refarg",
- /* 65 */ "refarg ::= MATCH nm",
- /* 66 */ "refarg ::= ON DELETE refact",
- /* 67 */ "refarg ::= ON UPDATE refact",
- /* 68 */ "refarg ::= ON INSERT refact",
- /* 69 */ "refact ::= SET NULL",
- /* 70 */ "refact ::= SET DEFAULT",
- /* 71 */ "refact ::= CASCADE",
- /* 72 */ "refact ::= RESTRICT",
- /* 73 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
- /* 74 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
- /* 75 */ "init_deferred_pred_opt ::=",
- /* 76 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
- /* 77 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
- /* 78 */ "conslist_opt ::=",
- /* 79 */ "conslist_opt ::= COMMA conslist",
- /* 80 */ "conslist ::= conslist COMMA tcons",
- /* 81 */ "conslist ::= conslist tcons",
- /* 82 */ "conslist ::= tcons",
- /* 83 */ "tcons ::= CONSTRAINT nm",
- /* 84 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf",
- /* 85 */ "tcons ::= UNIQUE LP idxlist RP onconf",
- /* 86 */ "tcons ::= CHECK expr onconf",
- /* 87 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
- /* 88 */ "defer_subclause_opt ::=",
- /* 89 */ "defer_subclause_opt ::= defer_subclause",
- /* 90 */ "onconf ::=",
- /* 91 */ "onconf ::= ON CONFLICT resolvetype",
- /* 92 */ "orconf ::=",
- /* 93 */ "orconf ::= OR resolvetype",
- /* 94 */ "resolvetype ::= raisetype",
- /* 95 */ "resolvetype ::= IGNORE",
- /* 96 */ "resolvetype ::= REPLACE",
- /* 97 */ "cmd ::= DROP TABLE fullname",
- /* 98 */ "cmd ::= CREATE temp VIEW nm dbnm AS select",
- /* 99 */ "cmd ::= DROP VIEW fullname",
- /* 100 */ "cmd ::= select",
- /* 101 */ "select ::= oneselect",
- /* 102 */ "select ::= select multiselect_op oneselect",
- /* 103 */ "multiselect_op ::= UNION",
- /* 104 */ "multiselect_op ::= UNION ALL",
- /* 105 */ "multiselect_op ::= INTERSECT",
- /* 106 */ "multiselect_op ::= EXCEPT",
- /* 107 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
- /* 108 */ "distinct ::= DISTINCT",
- /* 109 */ "distinct ::= ALL",
- /* 110 */ "distinct ::=",
- /* 111 */ "sclp ::= selcollist COMMA",
- /* 112 */ "sclp ::=",
- /* 113 */ "selcollist ::= sclp expr as",
- /* 114 */ "selcollist ::= sclp STAR",
- /* 115 */ "selcollist ::= sclp nm DOT STAR",
- /* 116 */ "as ::= AS nm",
- /* 117 */ "as ::= ids",
- /* 118 */ "as ::=",
- /* 119 */ "from ::=",
- /* 120 */ "from ::= FROM seltablist",
- /* 121 */ "stl_prefix ::= seltablist joinop",
- /* 122 */ "stl_prefix ::=",
- /* 123 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt",
- /* 124 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt",
- /* 125 */ "seltablist_paren ::= select",
- /* 126 */ "seltablist_paren ::= seltablist",
- /* 127 */ "dbnm ::=",
- /* 128 */ "dbnm ::= DOT nm",
- /* 129 */ "fullname ::= nm dbnm",
- /* 130 */ "joinop ::= COMMA",
- /* 131 */ "joinop ::= JOIN",
- /* 132 */ "joinop ::= JOIN_KW JOIN",
- /* 133 */ "joinop ::= JOIN_KW nm JOIN",
- /* 134 */ "joinop ::= JOIN_KW nm nm JOIN",
- /* 135 */ "on_opt ::= ON expr",
- /* 136 */ "on_opt ::=",
- /* 137 */ "using_opt ::= USING LP inscollist RP",
- /* 138 */ "using_opt ::=",
- /* 139 */ "orderby_opt ::=",
- /* 140 */ "orderby_opt ::= ORDER BY sortlist",
- /* 141 */ "sortlist ::= sortlist COMMA sortitem collate sortorder",
- /* 142 */ "sortlist ::= sortitem collate sortorder",
- /* 143 */ "sortitem ::= expr",
- /* 144 */ "sortorder ::= ASC",
- /* 145 */ "sortorder ::= DESC",
- /* 146 */ "sortorder ::=",
- /* 147 */ "collate ::=",
- /* 148 */ "collate ::= COLLATE id",
- /* 149 */ "groupby_opt ::=",
- /* 150 */ "groupby_opt ::= GROUP BY exprlist",
- /* 151 */ "having_opt ::=",
- /* 152 */ "having_opt ::= HAVING expr",
- /* 153 */ "limit_opt ::=",
- /* 154 */ "limit_opt ::= LIMIT expr",
- /* 155 */ "limit_opt ::= LIMIT expr OFFSET expr",
- /* 156 */ "limit_opt ::= LIMIT expr COMMA expr",
- /* 157 */ "cmd ::= DELETE FROM fullname where_opt",
- /* 158 */ "where_opt ::=",
- /* 159 */ "where_opt ::= WHERE expr",
- /* 160 */ "cmd ::= UPDATE orconf fullname SET setlist where_opt",
- /* 161 */ "setlist ::= setlist COMMA nm EQ expr",
- /* 162 */ "setlist ::= nm EQ expr",
- /* 163 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP",
- /* 164 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
- /* 165 */ "insert_cmd ::= INSERT orconf",
- /* 166 */ "insert_cmd ::= REPLACE",
- /* 167 */ "itemlist ::= itemlist COMMA expr",
- /* 168 */ "itemlist ::= expr",
- /* 169 */ "inscollist_opt ::=",
- /* 170 */ "inscollist_opt ::= LP inscollist RP",
- /* 171 */ "inscollist ::= inscollist COMMA nm",
- /* 172 */ "inscollist ::= nm",
- /* 173 */ "expr ::= term",
- /* 174 */ "expr ::= LP expr RP",
- /* 175 */ "term ::= NULL",
- /* 176 */ "expr ::= ID",
- /* 177 */ "expr ::= JOIN_KW",
- /* 178 */ "expr ::= nm DOT nm",
- /* 179 */ "expr ::= nm DOT nm DOT nm",
- /* 180 */ "term ::= INTEGER",
- /* 181 */ "term ::= FLOAT",
- /* 182 */ "term ::= STRING",
- /* 183 */ "term ::= BLOB",
- /* 184 */ "expr ::= REGISTER",
- /* 185 */ "expr ::= VARIABLE",
- /* 186 */ "expr ::= CAST LP expr AS typetoken RP",
- /* 187 */ "expr ::= ID LP exprlist RP",
- /* 188 */ "expr ::= ID LP STAR RP",
- /* 189 */ "term ::= CTIME_KW",
- /* 190 */ "expr ::= expr AND expr",
- /* 191 */ "expr ::= expr OR expr",
- /* 192 */ "expr ::= expr LT expr",
- /* 193 */ "expr ::= expr GT expr",
- /* 194 */ "expr ::= expr LE expr",
- /* 195 */ "expr ::= expr GE expr",
- /* 196 */ "expr ::= expr NE expr",
- /* 197 */ "expr ::= expr EQ expr",
- /* 198 */ "expr ::= expr BITAND expr",
- /* 199 */ "expr ::= expr BITOR expr",
- /* 200 */ "expr ::= expr LSHIFT expr",
- /* 201 */ "expr ::= expr RSHIFT expr",
- /* 202 */ "expr ::= expr PLUS expr",
- /* 203 */ "expr ::= expr MINUS expr",
- /* 204 */ "expr ::= expr STAR expr",
- /* 205 */ "expr ::= expr SLASH expr",
- /* 206 */ "expr ::= expr REM expr",
- /* 207 */ "expr ::= expr CONCAT expr",
- /* 208 */ "likeop ::= LIKE_KW",
- /* 209 */ "likeop ::= NOT LIKE_KW",
- /* 210 */ "escape ::= ESCAPE expr",
- /* 211 */ "escape ::=",
- /* 212 */ "expr ::= expr likeop expr escape",
- /* 213 */ "expr ::= expr ISNULL",
- /* 214 */ "expr ::= expr IS NULL",
- /* 215 */ "expr ::= expr NOTNULL",
- /* 216 */ "expr ::= expr NOT NULL",
- /* 217 */ "expr ::= expr IS NOT NULL",
- /* 218 */ "expr ::= NOT expr",
- /* 219 */ "expr ::= BITNOT expr",
- /* 220 */ "expr ::= MINUS expr",
- /* 221 */ "expr ::= PLUS expr",
- /* 222 */ "between_op ::= BETWEEN",
- /* 223 */ "between_op ::= NOT BETWEEN",
- /* 224 */ "expr ::= expr between_op expr AND expr",
- /* 225 */ "in_op ::= IN",
- /* 226 */ "in_op ::= NOT IN",
- /* 227 */ "expr ::= expr in_op LP exprlist RP",
- /* 228 */ "expr ::= LP select RP",
- /* 229 */ "expr ::= expr in_op LP select RP",
- /* 230 */ "expr ::= expr in_op nm dbnm",
- /* 231 */ "expr ::= EXISTS LP select RP",
- /* 232 */ "expr ::= CASE case_operand case_exprlist case_else END",
- /* 233 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
- /* 234 */ "case_exprlist ::= WHEN expr THEN expr",
- /* 235 */ "case_else ::= ELSE expr",
- /* 236 */ "case_else ::=",
- /* 237 */ "case_operand ::= expr",
- /* 238 */ "case_operand ::=",
- /* 239 */ "exprlist ::= exprlist COMMA expritem",
- /* 240 */ "exprlist ::= expritem",
- /* 241 */ "expritem ::= expr",
- /* 242 */ "expritem ::=",
- /* 243 */ "cmd ::= CREATE uniqueflag INDEX nm dbnm ON nm LP idxlist RP onconf",
- /* 244 */ "uniqueflag ::= UNIQUE",
- /* 245 */ "uniqueflag ::=",
- /* 246 */ "idxlist_opt ::=",
- /* 247 */ "idxlist_opt ::= LP idxlist RP",
- /* 248 */ "idxlist ::= idxlist COMMA idxitem collate sortorder",
- /* 249 */ "idxlist ::= idxitem collate sortorder",
- /* 250 */ "idxitem ::= nm",
- /* 251 */ "cmd ::= DROP INDEX fullname",
- /* 252 */ "cmd ::= VACUUM",
- /* 253 */ "cmd ::= VACUUM nm",
- /* 254 */ "cmd ::= PRAGMA nm dbnm EQ nm",
- /* 255 */ "cmd ::= PRAGMA nm dbnm EQ ON",
- /* 256 */ "cmd ::= PRAGMA nm dbnm EQ plus_num",
- /* 257 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
- /* 258 */ "cmd ::= PRAGMA nm dbnm LP nm RP",
- /* 259 */ "cmd ::= PRAGMA nm dbnm",
- /* 260 */ "plus_num ::= plus_opt number",
- /* 261 */ "minus_num ::= MINUS number",
- /* 262 */ "number ::= INTEGER",
- /* 263 */ "number ::= FLOAT",
- /* 264 */ "plus_opt ::= PLUS",
- /* 265 */ "plus_opt ::=",
- /* 266 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END",
- /* 267 */ "trigger_decl ::= temp TRIGGER nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
- /* 268 */ "trigger_time ::= BEFORE",
- /* 269 */ "trigger_time ::= AFTER",
- /* 270 */ "trigger_time ::= INSTEAD OF",
- /* 271 */ "trigger_time ::=",
- /* 272 */ "trigger_event ::= DELETE",
- /* 273 */ "trigger_event ::= INSERT",
- /* 274 */ "trigger_event ::= UPDATE",
- /* 275 */ "trigger_event ::= UPDATE OF inscollist",
- /* 276 */ "foreach_clause ::=",
- /* 277 */ "foreach_clause ::= FOR EACH ROW",
- /* 278 */ "foreach_clause ::= FOR EACH STATEMENT",
- /* 279 */ "when_clause ::=",
- /* 280 */ "when_clause ::= WHEN expr",
- /* 281 */ "trigger_cmd_list ::= trigger_cmd SEMI trigger_cmd_list",
- /* 282 */ "trigger_cmd_list ::=",
- /* 283 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt",
- /* 284 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP",
- /* 285 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select",
- /* 286 */ "trigger_cmd ::= DELETE FROM nm where_opt",
- /* 287 */ "trigger_cmd ::= select",
- /* 288 */ "expr ::= RAISE LP IGNORE RP",
- /* 289 */ "expr ::= RAISE LP raisetype COMMA nm RP",
- /* 290 */ "raisetype ::= ROLLBACK",
- /* 291 */ "raisetype ::= ABORT",
- /* 292 */ "raisetype ::= FAIL",
- /* 293 */ "cmd ::= DROP TRIGGER fullname",
- /* 294 */ "cmd ::= ATTACH database_kw_opt ids AS nm key_opt",
- /* 295 */ "key_opt ::=",
- /* 296 */ "key_opt ::= KEY ids",
- /* 297 */ "key_opt ::= KEY BLOB",
- /* 298 */ "database_kw_opt ::= DATABASE",
- /* 299 */ "database_kw_opt ::=",
- /* 300 */ "cmd ::= DETACH database_kw_opt nm",
- /* 301 */ "cmd ::= REINDEX",
- /* 302 */ "cmd ::= REINDEX nm dbnm",
- /* 303 */ "cmd ::= ANALYZE",
- /* 304 */ "cmd ::= ANALYZE nm dbnm",
- /* 305 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
- /* 306 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
- /* 307 */ "add_column_fullname ::= fullname",
- /* 308 */ "kwcolumn_opt ::=",
- /* 309 */ "kwcolumn_opt ::= COLUMNKW",
+ /* 8 */ "explain ::= EXPLAIN QUERY PLAN",
+ /* 9 */ "cmd ::= BEGIN transtype trans_opt",
+ /* 10 */ "trans_opt ::=",
+ /* 11 */ "trans_opt ::= TRANSACTION",
+ /* 12 */ "trans_opt ::= TRANSACTION nm",
+ /* 13 */ "transtype ::=",
+ /* 14 */ "transtype ::= DEFERRED",
+ /* 15 */ "transtype ::= IMMEDIATE",
+ /* 16 */ "transtype ::= EXCLUSIVE",
+ /* 17 */ "cmd ::= COMMIT trans_opt",
+ /* 18 */ "cmd ::= END trans_opt",
+ /* 19 */ "cmd ::= ROLLBACK trans_opt",
+ /* 20 */ "cmd ::= create_table create_table_args",
+ /* 21 */ "create_table ::= CREATE temp TABLE nm dbnm",
+ /* 22 */ "temp ::= TEMP",
+ /* 23 */ "temp ::=",
+ /* 24 */ "create_table_args ::= LP columnlist conslist_opt RP",
+ /* 25 */ "create_table_args ::= AS select",
+ /* 26 */ "columnlist ::= columnlist COMMA column",
+ /* 27 */ "columnlist ::= column",
+ /* 28 */ "column ::= columnid type carglist",
+ /* 29 */ "columnid ::= nm",
+ /* 30 */ "id ::= ID",
+ /* 31 */ "ids ::= ID",
+ /* 32 */ "ids ::= STRING",
+ /* 33 */ "nm ::= ID",
+ /* 34 */ "nm ::= STRING",
+ /* 35 */ "nm ::= JOIN_KW",
+ /* 36 */ "type ::=",
+ /* 37 */ "type ::= typetoken",
+ /* 38 */ "typetoken ::= typename",
+ /* 39 */ "typetoken ::= typename LP signed RP",
+ /* 40 */ "typetoken ::= typename LP signed COMMA signed RP",
+ /* 41 */ "typename ::= ids",
+ /* 42 */ "typename ::= typename ids",
+ /* 43 */ "signed ::= plus_num",
+ /* 44 */ "signed ::= minus_num",
+ /* 45 */ "carglist ::= carglist carg",
+ /* 46 */ "carglist ::=",
+ /* 47 */ "carg ::= CONSTRAINT nm ccons",
+ /* 48 */ "carg ::= ccons",
+ /* 49 */ "carg ::= DEFAULT term",
+ /* 50 */ "carg ::= DEFAULT LP expr RP",
+ /* 51 */ "carg ::= DEFAULT PLUS term",
+ /* 52 */ "carg ::= DEFAULT MINUS term",
+ /* 53 */ "carg ::= DEFAULT id",
+ /* 54 */ "ccons ::= NULL onconf",
+ /* 55 */ "ccons ::= NOT NULL onconf",
+ /* 56 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
+ /* 57 */ "ccons ::= UNIQUE onconf",
+ /* 58 */ "ccons ::= CHECK LP expr RP onconf",
+ /* 59 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
+ /* 60 */ "ccons ::= defer_subclause",
+ /* 61 */ "ccons ::= COLLATE id",
+ /* 62 */ "autoinc ::=",
+ /* 63 */ "autoinc ::= AUTOINCR",
+ /* 64 */ "refargs ::=",
+ /* 65 */ "refargs ::= refargs refarg",
+ /* 66 */ "refarg ::= MATCH nm",
+ /* 67 */ "refarg ::= ON DELETE refact",
+ /* 68 */ "refarg ::= ON UPDATE refact",
+ /* 69 */ "refarg ::= ON INSERT refact",
+ /* 70 */ "refact ::= SET NULL",
+ /* 71 */ "refact ::= SET DEFAULT",
+ /* 72 */ "refact ::= CASCADE",
+ /* 73 */ "refact ::= RESTRICT",
+ /* 74 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
+ /* 75 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
+ /* 76 */ "init_deferred_pred_opt ::=",
+ /* 77 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
+ /* 78 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
+ /* 79 */ "conslist_opt ::=",
+ /* 80 */ "conslist_opt ::= COMMA conslist",
+ /* 81 */ "conslist ::= conslist COMMA tcons",
+ /* 82 */ "conslist ::= conslist tcons",
+ /* 83 */ "conslist ::= tcons",
+ /* 84 */ "tcons ::= CONSTRAINT nm",
+ /* 85 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf",
+ /* 86 */ "tcons ::= UNIQUE LP idxlist RP onconf",
+ /* 87 */ "tcons ::= CHECK expr onconf",
+ /* 88 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
+ /* 89 */ "defer_subclause_opt ::=",
+ /* 90 */ "defer_subclause_opt ::= defer_subclause",
+ /* 91 */ "onconf ::=",
+ /* 92 */ "onconf ::= ON CONFLICT resolvetype",
+ /* 93 */ "orconf ::=",
+ /* 94 */ "orconf ::= OR resolvetype",
+ /* 95 */ "resolvetype ::= raisetype",
+ /* 96 */ "resolvetype ::= IGNORE",
+ /* 97 */ "resolvetype ::= REPLACE",
+ /* 98 */ "cmd ::= DROP TABLE fullname",
+ /* 99 */ "cmd ::= CREATE temp VIEW nm dbnm AS select",
+ /* 100 */ "cmd ::= DROP VIEW fullname",
+ /* 101 */ "cmd ::= select",
+ /* 102 */ "select ::= oneselect",
+ /* 103 */ "select ::= select multiselect_op oneselect",
+ /* 104 */ "multiselect_op ::= UNION",
+ /* 105 */ "multiselect_op ::= UNION ALL",
+ /* 106 */ "multiselect_op ::= INTERSECT",
+ /* 107 */ "multiselect_op ::= EXCEPT",
+ /* 108 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
+ /* 109 */ "distinct ::= DISTINCT",
+ /* 110 */ "distinct ::= ALL",
+ /* 111 */ "distinct ::=",
+ /* 112 */ "sclp ::= selcollist COMMA",
+ /* 113 */ "sclp ::=",
+ /* 114 */ "selcollist ::= sclp expr as",
+ /* 115 */ "selcollist ::= sclp STAR",
+ /* 116 */ "selcollist ::= sclp nm DOT STAR",
+ /* 117 */ "as ::= AS nm",
+ /* 118 */ "as ::= ids",
+ /* 119 */ "as ::=",
+ /* 120 */ "from ::=",
+ /* 121 */ "from ::= FROM seltablist",
+ /* 122 */ "stl_prefix ::= seltablist joinop",
+ /* 123 */ "stl_prefix ::=",
+ /* 124 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt",
+ /* 125 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt",
+ /* 126 */ "seltablist_paren ::= select",
+ /* 127 */ "seltablist_paren ::= seltablist",
+ /* 128 */ "dbnm ::=",
+ /* 129 */ "dbnm ::= DOT nm",
+ /* 130 */ "fullname ::= nm dbnm",
+ /* 131 */ "joinop ::= COMMA",
+ /* 132 */ "joinop ::= JOIN",
+ /* 133 */ "joinop ::= JOIN_KW JOIN",
+ /* 134 */ "joinop ::= JOIN_KW nm JOIN",
+ /* 135 */ "joinop ::= JOIN_KW nm nm JOIN",
+ /* 136 */ "on_opt ::= ON expr",
+ /* 137 */ "on_opt ::=",
+ /* 138 */ "using_opt ::= USING LP inscollist RP",
+ /* 139 */ "using_opt ::=",
+ /* 140 */ "orderby_opt ::=",
+ /* 141 */ "orderby_opt ::= ORDER BY sortlist",
+ /* 142 */ "sortlist ::= sortlist COMMA sortitem collate sortorder",
+ /* 143 */ "sortlist ::= sortitem collate sortorder",
+ /* 144 */ "sortitem ::= expr",
+ /* 145 */ "sortorder ::= ASC",
+ /* 146 */ "sortorder ::= DESC",
+ /* 147 */ "sortorder ::=",
+ /* 148 */ "collate ::=",
+ /* 149 */ "collate ::= COLLATE id",
+ /* 150 */ "groupby_opt ::=",
+ /* 151 */ "groupby_opt ::= GROUP BY exprlist",
+ /* 152 */ "having_opt ::=",
+ /* 153 */ "having_opt ::= HAVING expr",
+ /* 154 */ "limit_opt ::=",
+ /* 155 */ "limit_opt ::= LIMIT expr",
+ /* 156 */ "limit_opt ::= LIMIT expr OFFSET expr",
+ /* 157 */ "limit_opt ::= LIMIT expr COMMA expr",
+ /* 158 */ "cmd ::= DELETE FROM fullname where_opt",
+ /* 159 */ "where_opt ::=",
+ /* 160 */ "where_opt ::= WHERE expr",
+ /* 161 */ "cmd ::= UPDATE orconf fullname SET setlist where_opt",
+ /* 162 */ "setlist ::= setlist COMMA nm EQ expr",
+ /* 163 */ "setlist ::= nm EQ expr",
+ /* 164 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP",
+ /* 165 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
+ /* 166 */ "insert_cmd ::= INSERT orconf",
+ /* 167 */ "insert_cmd ::= REPLACE",
+ /* 168 */ "itemlist ::= itemlist COMMA expr",
+ /* 169 */ "itemlist ::= expr",
+ /* 170 */ "inscollist_opt ::=",
+ /* 171 */ "inscollist_opt ::= LP inscollist RP",
+ /* 172 */ "inscollist ::= inscollist COMMA nm",
+ /* 173 */ "inscollist ::= nm",
+ /* 174 */ "expr ::= term",
+ /* 175 */ "expr ::= LP expr RP",
+ /* 176 */ "term ::= NULL",
+ /* 177 */ "expr ::= ID",
+ /* 178 */ "expr ::= JOIN_KW",
+ /* 179 */ "expr ::= nm DOT nm",
+ /* 180 */ "expr ::= nm DOT nm DOT nm",
+ /* 181 */ "term ::= INTEGER",
+ /* 182 */ "term ::= FLOAT",
+ /* 183 */ "term ::= STRING",
+ /* 184 */ "term ::= BLOB",
+ /* 185 */ "expr ::= REGISTER",
+ /* 186 */ "expr ::= VARIABLE",
+ /* 187 */ "expr ::= CAST LP expr AS typetoken RP",
+ /* 188 */ "expr ::= ID LP distinct exprlist RP",
+ /* 189 */ "expr ::= ID LP STAR RP",
+ /* 190 */ "term ::= CTIME_KW",
+ /* 191 */ "expr ::= expr AND expr",
+ /* 192 */ "expr ::= expr OR expr",
+ /* 193 */ "expr ::= expr LT expr",
+ /* 194 */ "expr ::= expr GT expr",
+ /* 195 */ "expr ::= expr LE expr",
+ /* 196 */ "expr ::= expr GE expr",
+ /* 197 */ "expr ::= expr NE expr",
+ /* 198 */ "expr ::= expr EQ expr",
+ /* 199 */ "expr ::= expr BITAND expr",
+ /* 200 */ "expr ::= expr BITOR expr",
+ /* 201 */ "expr ::= expr LSHIFT expr",
+ /* 202 */ "expr ::= expr RSHIFT expr",
+ /* 203 */ "expr ::= expr PLUS expr",
+ /* 204 */ "expr ::= expr MINUS expr",
+ /* 205 */ "expr ::= expr STAR expr",
+ /* 206 */ "expr ::= expr SLASH expr",
+ /* 207 */ "expr ::= expr REM expr",
+ /* 208 */ "expr ::= expr CONCAT expr",
+ /* 209 */ "likeop ::= LIKE_KW",
+ /* 210 */ "likeop ::= NOT LIKE_KW",
+ /* 211 */ "escape ::= ESCAPE expr",
+ /* 212 */ "escape ::=",
+ /* 213 */ "expr ::= expr likeop expr escape",
+ /* 214 */ "expr ::= expr ISNULL",
+ /* 215 */ "expr ::= expr IS NULL",
+ /* 216 */ "expr ::= expr NOTNULL",
+ /* 217 */ "expr ::= expr NOT NULL",
+ /* 218 */ "expr ::= expr IS NOT NULL",
+ /* 219 */ "expr ::= NOT expr",
+ /* 220 */ "expr ::= BITNOT expr",
+ /* 221 */ "expr ::= MINUS expr",
+ /* 222 */ "expr ::= PLUS expr",
+ /* 223 */ "between_op ::= BETWEEN",
+ /* 224 */ "between_op ::= NOT BETWEEN",
+ /* 225 */ "expr ::= expr between_op expr AND expr",
+ /* 226 */ "in_op ::= IN",
+ /* 227 */ "in_op ::= NOT IN",
+ /* 228 */ "expr ::= expr in_op LP exprlist RP",
+ /* 229 */ "expr ::= LP select RP",
+ /* 230 */ "expr ::= expr in_op LP select RP",
+ /* 231 */ "expr ::= expr in_op nm dbnm",
+ /* 232 */ "expr ::= EXISTS LP select RP",
+ /* 233 */ "expr ::= CASE case_operand case_exprlist case_else END",
+ /* 234 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
+ /* 235 */ "case_exprlist ::= WHEN expr THEN expr",
+ /* 236 */ "case_else ::= ELSE expr",
+ /* 237 */ "case_else ::=",
+ /* 238 */ "case_operand ::= expr",
+ /* 239 */ "case_operand ::=",
+ /* 240 */ "exprlist ::= exprlist COMMA expritem",
+ /* 241 */ "exprlist ::= expritem",
+ /* 242 */ "expritem ::= expr",
+ /* 243 */ "expritem ::=",
+ /* 244 */ "cmd ::= CREATE uniqueflag INDEX nm dbnm ON nm LP idxlist RP onconf",
+ /* 245 */ "uniqueflag ::= UNIQUE",
+ /* 246 */ "uniqueflag ::=",
+ /* 247 */ "idxlist_opt ::=",
+ /* 248 */ "idxlist_opt ::= LP idxlist RP",
+ /* 249 */ "idxlist ::= idxlist COMMA idxitem collate sortorder",
+ /* 250 */ "idxlist ::= idxitem collate sortorder",
+ /* 251 */ "idxitem ::= nm",
+ /* 252 */ "cmd ::= DROP INDEX fullname",
+ /* 253 */ "cmd ::= VACUUM",
+ /* 254 */ "cmd ::= VACUUM nm",
+ /* 255 */ "cmd ::= PRAGMA nm dbnm EQ nm",
+ /* 256 */ "cmd ::= PRAGMA nm dbnm EQ ON",
+ /* 257 */ "cmd ::= PRAGMA nm dbnm EQ plus_num",
+ /* 258 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
+ /* 259 */ "cmd ::= PRAGMA nm dbnm LP nm RP",
+ /* 260 */ "cmd ::= PRAGMA nm dbnm",
+ /* 261 */ "plus_num ::= plus_opt number",
+ /* 262 */ "minus_num ::= MINUS number",
+ /* 263 */ "number ::= INTEGER",
+ /* 264 */ "number ::= FLOAT",
+ /* 265 */ "plus_opt ::= PLUS",
+ /* 266 */ "plus_opt ::=",
+ /* 267 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END",
+ /* 268 */ "trigger_decl ::= temp TRIGGER nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
+ /* 269 */ "trigger_time ::= BEFORE",
+ /* 270 */ "trigger_time ::= AFTER",
+ /* 271 */ "trigger_time ::= INSTEAD OF",
+ /* 272 */ "trigger_time ::=",
+ /* 273 */ "trigger_event ::= DELETE",
+ /* 274 */ "trigger_event ::= INSERT",
+ /* 275 */ "trigger_event ::= UPDATE",
+ /* 276 */ "trigger_event ::= UPDATE OF inscollist",
+ /* 277 */ "foreach_clause ::=",
+ /* 278 */ "foreach_clause ::= FOR EACH ROW",
+ /* 279 */ "foreach_clause ::= FOR EACH STATEMENT",
+ /* 280 */ "when_clause ::=",
+ /* 281 */ "when_clause ::= WHEN expr",
+ /* 282 */ "trigger_cmd_list ::= trigger_cmd SEMI trigger_cmd_list",
+ /* 283 */ "trigger_cmd_list ::=",
+ /* 284 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt",
+ /* 285 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP",
+ /* 286 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select",
+ /* 287 */ "trigger_cmd ::= DELETE FROM nm where_opt",
+ /* 288 */ "trigger_cmd ::= select",
+ /* 289 */ "expr ::= RAISE LP IGNORE RP",
+ /* 290 */ "expr ::= RAISE LP raisetype COMMA nm RP",
+ /* 291 */ "raisetype ::= ROLLBACK",
+ /* 292 */ "raisetype ::= ABORT",
+ /* 293 */ "raisetype ::= FAIL",
+ /* 294 */ "cmd ::= DROP TRIGGER fullname",
+ /* 295 */ "cmd ::= ATTACH database_kw_opt ids AS nm key_opt",
+ /* 296 */ "key_opt ::=",
+ /* 297 */ "key_opt ::= KEY ids",
+ /* 298 */ "key_opt ::= KEY BLOB",
+ /* 299 */ "database_kw_opt ::= DATABASE",
+ /* 300 */ "database_kw_opt ::=",
+ /* 301 */ "cmd ::= DETACH database_kw_opt nm",
+ /* 302 */ "cmd ::= REINDEX",
+ /* 303 */ "cmd ::= REINDEX nm dbnm",
+ /* 304 */ "cmd ::= ANALYZE",
+ /* 305 */ "cmd ::= ANALYZE nm dbnm",
+ /* 306 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
+ /* 307 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
+ /* 308 */ "add_column_fullname ::= fullname",
+ /* 309 */ "kwcolumn_opt ::=",
+ /* 310 */ "kwcolumn_opt ::= COLUMNKW",
};
#endif /* NDEBUG */
@@ -1318,72 +1322,72 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){
** which appear on the RHS of the rule, but which are not used
** inside the C code.
*/
- case 159:
- case 192:
- case 209:
-#line 369 "parse.y"
-{sqlite3SelectDelete((yypminor->yy99));}
-#line 1328 "parse.c"
- break;
- case 173:
- case 174:
- case 197:
- case 199:
- case 207:
- case 213:
- case 227:
-#line 628 "parse.y"
-{sqlite3ExprDelete((yypminor->yy44));}
-#line 1339 "parse.c"
- break;
- case 178:
- case 186:
+ case 162:
case 195:
- case 198:
+ case 212:
+#line 370 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3SelectDelete((yypminor->yy375));}
+#line 1332 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 176:
+ case 177:
case 200:
case 202:
- case 212:
- case 215:
+ case 210:
case 216:
- case 219:
- case 225:
-#line 853 "parse.y"
-{sqlite3ExprListDelete((yypminor->yy412));}
-#line 1354 "parse.c"
+ case 230:
+#line 629 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3ExprDelete((yypminor->yy62));}
+#line 1343 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 191:
- case 196:
- case 204:
+ case 181:
+ case 189:
+ case 198:
+ case 201:
+ case 203:
case 205:
-#line 498 "parse.y"
-{sqlite3SrcListDelete((yypminor->yy367));}
-#line 1362 "parse.c"
+ case 215:
+ case 218:
+ case 219:
+ case 222:
+ case 228:
+#line 876 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3ExprListDelete((yypminor->yy418));}
+#line 1358 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 201:
-#line 560 "parse.y"
+ case 194:
+ case 199:
+ case 207:
+ case 208:
+#line 499 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3SrcListDelete((yypminor->yy151));}
+#line 1366 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 204:
+#line 561 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3ExprDelete((yypminor->yy112).pLimit);
- sqlite3ExprDelete((yypminor->yy112).pOffset);
+ sqlite3ExprDelete((yypminor->yy220).pLimit);
+ sqlite3ExprDelete((yypminor->yy220).pOffset);
}
-#line 1370 "parse.c"
+#line 1374 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 208:
case 211:
- case 218:
-#line 516 "parse.y"
-{sqlite3IdListDelete((yypminor->yy258));}
-#line 1377 "parse.c"
+ case 214:
+ case 221:
+#line 517 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3IdListDelete((yypminor->yy240));}
+#line 1381 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 233:
- case 238:
-#line 946 "parse.y"
-{sqlite3DeleteTriggerStep((yypminor->yy203));}
-#line 1383 "parse.c"
+ case 236:
+ case 241:
+#line 969 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3DeleteTriggerStep((yypminor->yy360));}
+#line 1387 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 235:
-#line 930 "parse.y"
-{sqlite3IdListDelete((yypminor->yy234).b);}
-#line 1388 "parse.c"
+ case 238:
+#line 953 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3IdListDelete((yypminor->yy30).b);}
+#line 1392 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
default: break; /* If no destructor action specified: do nothing */
}
@@ -1559,316 +1563,317 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
unsigned char nrhs; /* Number of right-hand side symbols in the rule */
} yyRuleInfo[] = {
- { 144, 1 },
- { 145, 2 },
- { 145, 1 },
{ 147, 1 },
- { 146, 1 },
- { 146, 3 },
- { 149, 0 },
- { 149, 1 },
- { 148, 3 },
- { 151, 0 },
- { 151, 1 },
- { 151, 2 },
- { 150, 0 },
- { 150, 1 },
- { 150, 1 },
- { 150, 1 },
- { 148, 2 },
- { 148, 2 },
{ 148, 2 },
- { 148, 2 },
- { 153, 5 },
- { 155, 1 },
- { 155, 0 },
- { 154, 4 },
+ { 148, 1 },
+ { 150, 1 },
+ { 149, 1 },
+ { 149, 3 },
+ { 152, 0 },
+ { 152, 1 },
+ { 152, 3 },
+ { 151, 3 },
+ { 154, 0 },
+ { 154, 1 },
{ 154, 2 },
- { 157, 3 },
- { 157, 1 },
+ { 153, 0 },
+ { 153, 1 },
+ { 153, 1 },
+ { 153, 1 },
+ { 151, 2 },
+ { 151, 2 },
+ { 151, 2 },
+ { 151, 2 },
+ { 156, 5 },
+ { 158, 1 },
+ { 158, 0 },
+ { 157, 4 },
+ { 157, 2 },
{ 160, 3 },
- { 161, 1 },
+ { 160, 1 },
+ { 163, 3 },
{ 164, 1 },
- { 165, 1 },
- { 165, 1 },
- { 152, 1 },
- { 152, 1 },
- { 152, 1 },
- { 162, 0 },
- { 162, 1 },
- { 166, 1 },
- { 166, 4 },
- { 166, 6 },
{ 167, 1 },
- { 167, 2 },
{ 168, 1 },
{ 168, 1 },
- { 163, 2 },
- { 163, 0 },
- { 171, 3 },
+ { 155, 1 },
+ { 155, 1 },
+ { 155, 1 },
+ { 165, 0 },
+ { 165, 1 },
+ { 169, 1 },
+ { 169, 4 },
+ { 169, 6 },
+ { 170, 1 },
+ { 170, 2 },
{ 171, 1 },
- { 171, 2 },
- { 171, 4 },
- { 171, 3 },
- { 171, 3 },
- { 171, 2 },
- { 172, 2 },
- { 172, 3 },
- { 172, 5 },
- { 172, 2 },
- { 172, 5 },
- { 172, 4 },
- { 172, 1 },
- { 172, 2 },
- { 177, 0 },
- { 177, 1 },
- { 179, 0 },
- { 179, 2 },
- { 181, 2 },
- { 181, 3 },
- { 181, 3 },
- { 181, 3 },
- { 182, 2 },
+ { 171, 1 },
+ { 166, 2 },
+ { 166, 0 },
+ { 174, 3 },
+ { 174, 1 },
+ { 174, 2 },
+ { 174, 4 },
+ { 174, 3 },
+ { 174, 3 },
+ { 174, 2 },
+ { 175, 2 },
+ { 175, 3 },
+ { 175, 5 },
+ { 175, 2 },
+ { 175, 5 },
+ { 175, 4 },
+ { 175, 1 },
+ { 175, 2 },
+ { 180, 0 },
+ { 180, 1 },
+ { 182, 0 },
{ 182, 2 },
- { 182, 1 },
- { 182, 1 },
- { 180, 3 },
- { 180, 2 },
- { 183, 0 },
- { 183, 2 },
- { 183, 2 },
- { 158, 0 },
- { 158, 2 },
- { 184, 3 },
{ 184, 2 },
- { 184, 1 },
+ { 184, 3 },
+ { 184, 3 },
+ { 184, 3 },
{ 185, 2 },
- { 185, 7 },
- { 185, 5 },
- { 185, 3 },
- { 185, 10 },
- { 187, 0 },
+ { 185, 2 },
+ { 185, 1 },
+ { 185, 1 },
+ { 183, 3 },
+ { 183, 2 },
+ { 186, 0 },
+ { 186, 2 },
+ { 186, 2 },
+ { 161, 0 },
+ { 161, 2 },
+ { 187, 3 },
+ { 187, 2 },
{ 187, 1 },
- { 175, 0 },
- { 175, 3 },
- { 188, 0 },
{ 188, 2 },
- { 189, 1 },
- { 189, 1 },
- { 189, 1 },
- { 148, 3 },
- { 148, 7 },
- { 148, 3 },
- { 148, 1 },
- { 159, 1 },
- { 159, 3 },
- { 193, 1 },
- { 193, 2 },
- { 193, 1 },
- { 193, 1 },
- { 192, 9 },
- { 194, 1 },
- { 194, 1 },
- { 194, 0 },
- { 202, 2 },
- { 202, 0 },
- { 195, 3 },
- { 195, 2 },
- { 195, 4 },
- { 203, 2 },
- { 203, 1 },
- { 203, 0 },
- { 196, 0 },
+ { 188, 7 },
+ { 188, 5 },
+ { 188, 3 },
+ { 188, 10 },
+ { 190, 0 },
+ { 190, 1 },
+ { 178, 0 },
+ { 178, 3 },
+ { 191, 0 },
+ { 191, 2 },
+ { 192, 1 },
+ { 192, 1 },
+ { 192, 1 },
+ { 151, 3 },
+ { 151, 7 },
+ { 151, 3 },
+ { 151, 1 },
+ { 162, 1 },
+ { 162, 3 },
+ { 196, 1 },
{ 196, 2 },
+ { 196, 1 },
+ { 196, 1 },
+ { 195, 9 },
+ { 197, 1 },
+ { 197, 1 },
+ { 197, 0 },
{ 205, 2 },
{ 205, 0 },
- { 204, 6 },
- { 204, 7 },
- { 209, 1 },
- { 209, 1 },
- { 156, 0 },
- { 156, 2 },
- { 191, 2 },
- { 206, 1 },
- { 206, 1 },
- { 206, 2 },
- { 206, 3 },
- { 206, 4 },
- { 207, 2 },
- { 207, 0 },
- { 208, 4 },
- { 208, 0 },
- { 200, 0 },
- { 200, 3 },
- { 212, 5 },
- { 212, 3 },
- { 213, 1 },
- { 176, 1 },
- { 176, 1 },
- { 176, 0 },
- { 214, 0 },
- { 214, 2 },
- { 198, 0 },
{ 198, 3 },
+ { 198, 2 },
+ { 198, 4 },
+ { 206, 2 },
+ { 206, 1 },
+ { 206, 0 },
{ 199, 0 },
{ 199, 2 },
- { 201, 0 },
- { 201, 2 },
- { 201, 4 },
- { 201, 4 },
- { 148, 4 },
- { 197, 0 },
- { 197, 2 },
- { 148, 6 },
- { 216, 5 },
- { 216, 3 },
- { 148, 8 },
- { 148, 5 },
+ { 208, 2 },
+ { 208, 0 },
+ { 207, 6 },
+ { 207, 7 },
+ { 212, 1 },
+ { 212, 1 },
+ { 159, 0 },
+ { 159, 2 },
+ { 194, 2 },
+ { 209, 1 },
+ { 209, 1 },
+ { 209, 2 },
+ { 209, 3 },
+ { 209, 4 },
+ { 210, 2 },
+ { 210, 0 },
+ { 211, 4 },
+ { 211, 0 },
+ { 203, 0 },
+ { 203, 3 },
+ { 215, 5 },
+ { 215, 3 },
+ { 216, 1 },
+ { 179, 1 },
+ { 179, 1 },
+ { 179, 0 },
+ { 217, 0 },
{ 217, 2 },
- { 217, 1 },
+ { 201, 0 },
+ { 201, 3 },
+ { 202, 0 },
+ { 202, 2 },
+ { 204, 0 },
+ { 204, 2 },
+ { 204, 4 },
+ { 204, 4 },
+ { 151, 4 },
+ { 200, 0 },
+ { 200, 2 },
+ { 151, 6 },
+ { 219, 5 },
{ 219, 3 },
- { 219, 1 },
- { 218, 0 },
- { 218, 3 },
- { 211, 3 },
- { 211, 1 },
- { 174, 1 },
- { 174, 3 },
- { 173, 1 },
- { 174, 1 },
- { 174, 1 },
- { 174, 3 },
- { 174, 5 },
- { 173, 1 },
- { 173, 1 },
- { 173, 1 },
- { 173, 1 },
- { 174, 1 },
- { 174, 1 },
- { 174, 6 },
- { 174, 4 },
- { 174, 4 },
- { 173, 1 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 174, 3 },
- { 220, 1 },
+ { 151, 8 },
+ { 151, 5 },
{ 220, 2 },
- { 221, 2 },
- { 221, 0 },
- { 174, 4 },
- { 174, 2 },
- { 174, 3 },
- { 174, 2 },
- { 174, 3 },
- { 174, 4 },
- { 174, 2 },
- { 174, 2 },
- { 174, 2 },
- { 174, 2 },
+ { 220, 1 },
+ { 222, 3 },
{ 222, 1 },
- { 222, 2 },
- { 174, 5 },
+ { 221, 0 },
+ { 221, 3 },
+ { 214, 3 },
+ { 214, 1 },
+ { 177, 1 },
+ { 177, 3 },
+ { 176, 1 },
+ { 177, 1 },
+ { 177, 1 },
+ { 177, 3 },
+ { 177, 5 },
+ { 176, 1 },
+ { 176, 1 },
+ { 176, 1 },
+ { 176, 1 },
+ { 177, 1 },
+ { 177, 1 },
+ { 177, 6 },
+ { 177, 5 },
+ { 177, 4 },
+ { 176, 1 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
+ { 177, 3 },
{ 223, 1 },
{ 223, 2 },
- { 174, 5 },
- { 174, 3 },
- { 174, 5 },
- { 174, 4 },
- { 174, 4 },
- { 174, 5 },
- { 225, 5 },
- { 225, 4 },
- { 226, 2 },
- { 226, 0 },
- { 224, 1 },
+ { 224, 2 },
{ 224, 0 },
- { 215, 3 },
- { 215, 1 },
+ { 177, 4 },
+ { 177, 2 },
+ { 177, 3 },
+ { 177, 2 },
+ { 177, 3 },
+ { 177, 4 },
+ { 177, 2 },
+ { 177, 2 },
+ { 177, 2 },
+ { 177, 2 },
+ { 225, 1 },
+ { 225, 2 },
+ { 177, 5 },
+ { 226, 1 },
+ { 226, 2 },
+ { 177, 5 },
+ { 177, 3 },
+ { 177, 5 },
+ { 177, 4 },
+ { 177, 4 },
+ { 177, 5 },
+ { 228, 5 },
+ { 228, 4 },
+ { 229, 2 },
+ { 229, 0 },
{ 227, 1 },
{ 227, 0 },
- { 148, 11 },
- { 228, 1 },
- { 228, 0 },
- { 178, 0 },
- { 178, 3 },
- { 186, 5 },
- { 186, 3 },
- { 229, 1 },
- { 148, 3 },
- { 148, 1 },
- { 148, 2 },
- { 148, 5 },
- { 148, 5 },
- { 148, 5 },
- { 148, 5 },
- { 148, 6 },
- { 148, 3 },
- { 169, 2 },
- { 170, 2 },
- { 231, 1 },
- { 231, 1 },
+ { 218, 3 },
+ { 218, 1 },
{ 230, 1 },
{ 230, 0 },
- { 148, 5 },
- { 232, 10 },
+ { 151, 11 },
+ { 231, 1 },
+ { 231, 0 },
+ { 181, 0 },
+ { 181, 3 },
+ { 189, 5 },
+ { 189, 3 },
+ { 232, 1 },
+ { 151, 3 },
+ { 151, 1 },
+ { 151, 2 },
+ { 151, 5 },
+ { 151, 5 },
+ { 151, 5 },
+ { 151, 5 },
+ { 151, 6 },
+ { 151, 3 },
+ { 172, 2 },
+ { 173, 2 },
{ 234, 1 },
{ 234, 1 },
- { 234, 2 },
- { 234, 0 },
- { 235, 1 },
- { 235, 1 },
- { 235, 1 },
- { 235, 3 },
- { 236, 0 },
- { 236, 3 },
- { 236, 3 },
- { 237, 0 },
- { 237, 2 },
- { 233, 3 },
+ { 233, 1 },
{ 233, 0 },
- { 238, 6 },
- { 238, 8 },
- { 238, 5 },
- { 238, 4 },
+ { 151, 5 },
+ { 235, 10 },
+ { 237, 1 },
+ { 237, 1 },
+ { 237, 2 },
+ { 237, 0 },
{ 238, 1 },
- { 174, 4 },
- { 174, 6 },
- { 190, 1 },
- { 190, 1 },
- { 190, 1 },
- { 148, 3 },
- { 148, 6 },
+ { 238, 1 },
+ { 238, 1 },
+ { 238, 3 },
+ { 239, 0 },
+ { 239, 3 },
+ { 239, 3 },
{ 240, 0 },
{ 240, 2 },
- { 240, 2 },
- { 239, 1 },
- { 239, 0 },
- { 148, 3 },
- { 148, 1 },
- { 148, 3 },
- { 148, 1 },
- { 148, 3 },
- { 148, 6 },
- { 148, 6 },
+ { 236, 3 },
+ { 236, 0 },
+ { 241, 6 },
+ { 241, 8 },
+ { 241, 5 },
+ { 241, 4 },
{ 241, 1 },
- { 242, 0 },
+ { 177, 4 },
+ { 177, 6 },
+ { 193, 1 },
+ { 193, 1 },
+ { 193, 1 },
+ { 151, 3 },
+ { 151, 6 },
+ { 243, 0 },
+ { 243, 2 },
+ { 243, 2 },
{ 242, 1 },
+ { 242, 0 },
+ { 151, 3 },
+ { 151, 1 },
+ { 151, 3 },
+ { 151, 1 },
+ { 151, 3 },
+ { 151, 6 },
+ { 151, 6 },
+ { 244, 1 },
+ { 245, 0 },
+ { 245, 1 },
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -1918,770 +1923,777 @@ static void yy_reduce(
** break;
*/
case 3:
-#line 102 "parse.y"
+#line 102 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{ sqlite3FinishCoding(pParse); }
-#line 1925 "parse.c"
+#line 1930 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 6:
-#line 105 "parse.y"
+#line 105 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{ sqlite3BeginParse(pParse, 0); }
-#line 1930 "parse.c"
+#line 1935 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 7:
-#line 107 "parse.y"
+#line 107 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{ sqlite3BeginParse(pParse, 1); }
-#line 1935 "parse.c"
+#line 1940 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 8:
-#line 113 "parse.y"
-{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy58);}
-#line 1940 "parse.c"
+#line 108 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ sqlite3BeginParse(pParse, 2); }
+#line 1945 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 12:
-#line 118 "parse.y"
-{yygotominor.yy58 = TK_DEFERRED;}
-#line 1945 "parse.c"
+ case 9:
+#line 114 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy280);}
+#line 1950 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 13:
+#line 119 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = TK_DEFERRED;}
+#line 1955 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
case 14:
case 15:
- case 103:
- case 105:
+ case 16:
+ case 104:
case 106:
-#line 119 "parse.y"
-{yygotominor.yy58 = yymsp[0].major;}
-#line 1955 "parse.c"
+ case 107:
+#line 120 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = yymsp[0].major;}
+#line 1965 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 16:
case 17:
-#line 122 "parse.y"
+ case 18:
+#line 123 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{sqlite3CommitTransaction(pParse);}
-#line 1961 "parse.c"
+#line 1971 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 18:
-#line 124 "parse.y"
+ case 19:
+#line 125 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{sqlite3RollbackTransaction(pParse);}
-#line 1966 "parse.c"
+#line 1976 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 20:
-#line 129 "parse.y"
+ case 21:
+#line 130 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3StartTable(pParse,&yymsp[-4].minor.yy0,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy144,yymsp[-3].minor.yy58,0);
+ sqlite3StartTable(pParse,&yymsp[-4].minor.yy0,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy198,yymsp[-3].minor.yy280,0);
}
-#line 1973 "parse.c"
- break;
- case 21:
- case 62:
- case 76:
- case 108:
- case 223:
- case 226:
-#line 134 "parse.y"
-{yygotominor.yy58 = 1;}
-#line 1983 "parse.c"
+#line 1983 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 22:
- case 61:
- case 75:
+ case 63:
case 77:
- case 88:
case 109:
- case 110:
- case 222:
- case 225:
-#line 136 "parse.y"
-{yygotominor.yy58 = 0;}
-#line 1996 "parse.c"
+ case 224:
+ case 227:
+#line 135 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = 1;}
+#line 1993 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 23:
-#line 137 "parse.y"
-{
- sqlite3EndTable(pParse,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy0,0);
-}
-#line 2003 "parse.c"
+ case 62:
+ case 76:
+ case 78:
+ case 89:
+ case 110:
+ case 111:
+ case 223:
+ case 226:
+#line 137 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = 0;}
+#line 2006 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 24:
-#line 140 "parse.y"
+#line 138 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy99);
- sqlite3SelectDelete(yymsp[0].minor.yy99);
+ sqlite3EndTable(pParse,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy0,0);
}
-#line 2011 "parse.c"
+#line 2013 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 27:
-#line 152 "parse.y"
+ case 25:
+#line 141 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy144.z = yymsp[-2].minor.yy144.z;
- yygotominor.yy144.n = (pParse->sLastToken.z-yymsp[-2].minor.yy144.z) + pParse->sLastToken.n;
+ sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy375);
+ sqlite3SelectDelete(yymsp[0].minor.yy375);
}
-#line 2019 "parse.c"
+#line 2021 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 28:
-#line 156 "parse.y"
+#line 153 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3AddColumn(pParse,&yymsp[0].minor.yy144);
- yygotominor.yy144 = yymsp[0].minor.yy144;
+ yygotominor.yy198.z = yymsp[-2].minor.yy198.z;
+ yygotominor.yy198.n = (pParse->sLastToken.z-yymsp[-2].minor.yy198.z) + pParse->sLastToken.n;
}
-#line 2027 "parse.c"
+#line 2029 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 29:
+#line 157 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ sqlite3AddColumn(pParse,&yymsp[0].minor.yy198);
+ yygotominor.yy198 = yymsp[0].minor.yy198;
+}
+#line 2037 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
case 30:
case 31:
case 32:
case 33:
case 34:
- case 262:
+ case 35:
case 263:
-#line 166 "parse.y"
-{yygotominor.yy144 = yymsp[0].minor.yy0;}
-#line 2039 "parse.c"
- break;
- case 36:
-#line 226 "parse.y"
-{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy144);}
-#line 2044 "parse.c"
+ case 264:
+#line 167 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy198 = yymsp[0].minor.yy0;}
+#line 2049 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 37:
- case 40:
- case 116:
+#line 227 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy198);}
+#line 2054 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 38:
+ case 41:
case 117:
- case 128:
- case 148:
- case 250:
- case 260:
+ case 118:
+ case 129:
+ case 149:
+ case 251:
case 261:
-#line 227 "parse.y"
-{yygotominor.yy144 = yymsp[0].minor.yy144;}
-#line 2057 "parse.c"
+ case 262:
+#line 228 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy198 = yymsp[0].minor.yy198;}
+#line 2067 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 38:
-#line 228 "parse.y"
+ case 39:
+#line 229 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy144.z = yymsp[-3].minor.yy144.z;
- yygotominor.yy144.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy144.z;
+ yygotominor.yy198.z = yymsp[-3].minor.yy198.z;
+ yygotominor.yy198.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy198.z;
}
-#line 2065 "parse.c"
+#line 2075 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 39:
-#line 232 "parse.y"
+ case 40:
+#line 233 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy144.z = yymsp[-5].minor.yy144.z;
- yygotominor.yy144.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy144.z;
+ yygotominor.yy198.z = yymsp[-5].minor.yy198.z;
+ yygotominor.yy198.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy198.z;
}
-#line 2073 "parse.c"
- break;
- case 41:
-#line 238 "parse.y"
-{yygotominor.yy144.z=yymsp[-1].minor.yy144.z; yygotominor.yy144.n=yymsp[0].minor.yy144.n+(yymsp[0].minor.yy144.z-yymsp[-1].minor.yy144.z);}
-#line 2078 "parse.c"
+#line 2083 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 42:
-#line 240 "parse.y"
-{ yygotominor.yy58 = atoi(yymsp[0].minor.yy144.z); }
-#line 2083 "parse.c"
+#line 239 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy198.z=yymsp[-1].minor.yy198.z; yygotominor.yy198.n=yymsp[0].minor.yy198.n+(yymsp[0].minor.yy198.z-yymsp[-1].minor.yy198.z);}
+#line 2088 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 43:
-#line 241 "parse.y"
-{ yygotominor.yy58 = -atoi(yymsp[0].minor.yy144.z); }
-#line 2088 "parse.c"
+#line 241 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = atoi(yymsp[0].minor.yy198.z); }
+#line 2093 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 48:
- case 50:
-#line 250 "parse.y"
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy44);}
-#line 2094 "parse.c"
+ case 44:
+#line 242 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = -atoi(yymsp[0].minor.yy198.z); }
+#line 2098 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 49:
-#line 251 "parse.y"
-{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy44);}
-#line 2099 "parse.c"
- break;
case 51:
-#line 253 "parse.y"
+#line 251 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy62);}
+#line 2104 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 50:
+#line 252 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy62);}
+#line 2109 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 52:
+#line 254 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- Expr *p = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy44, 0, 0);
+ Expr *p = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy62, 0, 0);
sqlite3AddDefaultValue(pParse,p);
}
-#line 2107 "parse.c"
+#line 2117 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 52:
-#line 257 "parse.y"
+ case 53:
+#line 258 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- Expr *p = sqlite3Expr(TK_STRING, 0, 0, &yymsp[0].minor.yy144);
+ Expr *p = sqlite3Expr(TK_STRING, 0, 0, &yymsp[0].minor.yy198);
sqlite3AddDefaultValue(pParse,p);
}
-#line 2115 "parse.c"
- break;
- case 54:
-#line 266 "parse.y"
-{sqlite3AddNotNull(pParse, yymsp[0].minor.yy58);}
-#line 2120 "parse.c"
+#line 2125 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 55:
-#line 268 "parse.y"
-{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy58,yymsp[0].minor.yy58);}
-#line 2125 "parse.c"
+#line 267 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3AddNotNull(pParse, yymsp[0].minor.yy280);}
+#line 2130 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 56:
-#line 269 "parse.y"
-{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy58,0,0);}
-#line 2130 "parse.c"
+#line 269 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy280,yymsp[0].minor.yy280);}
+#line 2135 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 57:
-#line 270 "parse.y"
-{sqlite3ExprDelete(yymsp[-2].minor.yy44);}
-#line 2135 "parse.c"
+#line 270 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy280,0,0);}
+#line 2140 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 58:
-#line 272 "parse.y"
-{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy144,yymsp[-1].minor.yy412,yymsp[0].minor.yy58);}
-#line 2140 "parse.c"
+#line 271 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3ExprDelete(yymsp[-2].minor.yy62);}
+#line 2145 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 59:
-#line 273 "parse.y"
-{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy58);}
-#line 2145 "parse.c"
+#line 273 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy198,yymsp[-1].minor.yy418,yymsp[0].minor.yy280);}
+#line 2150 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 60:
-#line 274 "parse.y"
-{sqlite3AddCollateType(pParse, yymsp[0].minor.yy144.z, yymsp[0].minor.yy144.n);}
-#line 2150 "parse.c"
+#line 274 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy280);}
+#line 2155 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 63:
-#line 287 "parse.y"
-{ yygotominor.yy58 = OE_Restrict * 0x010101; }
-#line 2155 "parse.c"
+ case 61:
+#line 275 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3AddCollateType(pParse, yymsp[0].minor.yy198.z, yymsp[0].minor.yy198.n);}
+#line 2160 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 64:
-#line 288 "parse.y"
-{ yygotominor.yy58 = (yymsp[-1].minor.yy58 & yymsp[0].minor.yy35.mask) | yymsp[0].minor.yy35.value; }
-#line 2160 "parse.c"
+#line 288 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = OE_Restrict * 0x010101; }
+#line 2165 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 65:
-#line 290 "parse.y"
-{ yygotominor.yy35.value = 0; yygotominor.yy35.mask = 0x000000; }
-#line 2165 "parse.c"
+#line 289 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = (yymsp[-1].minor.yy280 & yymsp[0].minor.yy359.mask) | yymsp[0].minor.yy359.value; }
+#line 2170 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 66:
-#line 291 "parse.y"
-{ yygotominor.yy35.value = yymsp[0].minor.yy58; yygotominor.yy35.mask = 0x0000ff; }
-#line 2170 "parse.c"
+#line 291 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy359.value = 0; yygotominor.yy359.mask = 0x000000; }
+#line 2175 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 67:
-#line 292 "parse.y"
-{ yygotominor.yy35.value = yymsp[0].minor.yy58<<8; yygotominor.yy35.mask = 0x00ff00; }
-#line 2175 "parse.c"
+#line 292 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy359.value = yymsp[0].minor.yy280; yygotominor.yy359.mask = 0x0000ff; }
+#line 2180 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 68:
-#line 293 "parse.y"
-{ yygotominor.yy35.value = yymsp[0].minor.yy58<<16; yygotominor.yy35.mask = 0xff0000; }
-#line 2180 "parse.c"
+#line 293 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy359.value = yymsp[0].minor.yy280<<8; yygotominor.yy359.mask = 0x00ff00; }
+#line 2185 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 69:
-#line 295 "parse.y"
-{ yygotominor.yy58 = OE_SetNull; }
-#line 2185 "parse.c"
+#line 294 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy359.value = yymsp[0].minor.yy280<<16; yygotominor.yy359.mask = 0xff0000; }
+#line 2190 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 70:
-#line 296 "parse.y"
-{ yygotominor.yy58 = OE_SetDflt; }
-#line 2190 "parse.c"
+#line 296 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = OE_SetNull; }
+#line 2195 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 71:
-#line 297 "parse.y"
-{ yygotominor.yy58 = OE_Cascade; }
-#line 2195 "parse.c"
+#line 297 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = OE_SetDflt; }
+#line 2200 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 72:
-#line 298 "parse.y"
-{ yygotominor.yy58 = OE_Restrict; }
-#line 2200 "parse.c"
+#line 298 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = OE_Cascade; }
+#line 2205 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 73:
+#line 299 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = OE_Restrict; }
+#line 2210 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
case 74:
- case 89:
- case 91:
- case 93:
+ case 75:
+ case 90:
+ case 92:
case 94:
- case 165:
-#line 300 "parse.y"
-{yygotominor.yy58 = yymsp[0].minor.yy58;}
-#line 2211 "parse.c"
- break;
- case 78:
-#line 310 "parse.y"
-{yygotominor.yy144.n = 0; yygotominor.yy144.z = 0;}
-#line 2216 "parse.c"
+ case 95:
+ case 166:
+#line 301 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = yymsp[0].minor.yy280;}
+#line 2221 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 79:
-#line 311 "parse.y"
-{yygotominor.yy144 = yymsp[-1].minor.yy0;}
-#line 2221 "parse.c"
+#line 311 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy198.n = 0; yygotominor.yy198.z = 0;}
+#line 2226 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 84:
-#line 317 "parse.y"
-{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy412,yymsp[0].minor.yy58,yymsp[-2].minor.yy58);}
-#line 2226 "parse.c"
+ case 80:
+#line 312 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy198 = yymsp[-1].minor.yy0;}
+#line 2231 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 85:
-#line 319 "parse.y"
-{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy412,yymsp[0].minor.yy58,0,0);}
-#line 2231 "parse.c"
+#line 318 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy418,yymsp[0].minor.yy280,yymsp[-2].minor.yy280);}
+#line 2236 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 86:
+#line 320 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy418,yymsp[0].minor.yy280,0,0);}
+#line 2241 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 87:
-#line 322 "parse.y"
+ case 88:
+#line 323 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy412, &yymsp[-3].minor.yy144, yymsp[-2].minor.yy412, yymsp[-1].minor.yy58);
- sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy58);
+ sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy418, &yymsp[-3].minor.yy198, yymsp[-2].minor.yy418, yymsp[-1].minor.yy280);
+ sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy280);
}
-#line 2239 "parse.c"
+#line 2249 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 90:
- case 92:
-#line 336 "parse.y"
-{yygotominor.yy58 = OE_Default;}
-#line 2245 "parse.c"
- break;
- case 95:
-#line 341 "parse.y"
-{yygotominor.yy58 = OE_Ignore;}
-#line 2250 "parse.c"
+ case 91:
+ case 93:
+#line 337 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = OE_Default;}
+#line 2255 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 96:
- case 166:
-#line 342 "parse.y"
-{yygotominor.yy58 = OE_Replace;}
-#line 2256 "parse.c"
+#line 342 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = OE_Ignore;}
+#line 2260 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 97:
-#line 346 "parse.y"
-{
- sqlite3DropTable(pParse, yymsp[0].minor.yy367, 0);
-}
-#line 2263 "parse.c"
+ case 167:
+#line 343 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = OE_Replace;}
+#line 2266 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 98:
-#line 353 "parse.y"
+#line 347 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3CreateView(pParse, &yymsp[-6].minor.yy0, &yymsp[-3].minor.yy144, &yymsp[-2].minor.yy144, yymsp[0].minor.yy99, yymsp[-5].minor.yy58);
+ sqlite3DropTable(pParse, yymsp[0].minor.yy151, 0);
}
-#line 2270 "parse.c"
+#line 2273 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 99:
-#line 356 "parse.y"
+#line 354 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3DropTable(pParse, yymsp[0].minor.yy367, 1);
+ sqlite3CreateView(pParse, &yymsp[-6].minor.yy0, &yymsp[-3].minor.yy198, &yymsp[-2].minor.yy198, yymsp[0].minor.yy375, yymsp[-5].minor.yy280);
}
-#line 2277 "parse.c"
+#line 2280 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 100:
-#line 363 "parse.y"
+#line 357 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3Select(pParse, yymsp[0].minor.yy99, SRT_Callback, 0, 0, 0, 0, 0);
- sqlite3SelectDelete(yymsp[0].minor.yy99);
+ sqlite3DropTable(pParse, yymsp[0].minor.yy151, 1);
}
-#line 2285 "parse.c"
+#line 2287 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 101:
- case 125:
-#line 373 "parse.y"
-{yygotominor.yy99 = yymsp[0].minor.yy99;}
-#line 2291 "parse.c"
+#line 364 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ sqlite3Select(pParse, yymsp[0].minor.yy375, SRT_Callback, 0, 0, 0, 0, 0);
+ sqlite3SelectDelete(yymsp[0].minor.yy375);
+}
+#line 2295 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 102:
-#line 375 "parse.y"
+ case 126:
+#line 374 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy375 = yymsp[0].minor.yy375;}
+#line 2301 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 103:
+#line 376 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- if( yymsp[0].minor.yy99 ){
- yymsp[0].minor.yy99->op = yymsp[-1].minor.yy58;
- yymsp[0].minor.yy99->pPrior = yymsp[-2].minor.yy99;
+ if( yymsp[0].minor.yy375 ){
+ yymsp[0].minor.yy375->op = yymsp[-1].minor.yy280;
+ yymsp[0].minor.yy375->pPrior = yymsp[-2].minor.yy375;
}
- yygotominor.yy99 = yymsp[0].minor.yy99;
+ yygotominor.yy375 = yymsp[0].minor.yy375;
}
-#line 2302 "parse.c"
+#line 2312 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 104:
-#line 384 "parse.y"
-{yygotominor.yy58 = TK_ALL;}
-#line 2307 "parse.c"
+ case 105:
+#line 385 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = TK_ALL;}
+#line 2317 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 107:
-#line 389 "parse.y"
+ case 108:
+#line 390 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy99 = sqlite3SelectNew(yymsp[-6].minor.yy412,yymsp[-5].minor.yy367,yymsp[-4].minor.yy44,yymsp[-3].minor.yy412,yymsp[-2].minor.yy44,yymsp[-1].minor.yy412,yymsp[-7].minor.yy58,yymsp[0].minor.yy112.pLimit,yymsp[0].minor.yy112.pOffset);
+ yygotominor.yy375 = sqlite3SelectNew(yymsp[-6].minor.yy418,yymsp[-5].minor.yy151,yymsp[-4].minor.yy62,yymsp[-3].minor.yy418,yymsp[-2].minor.yy62,yymsp[-1].minor.yy418,yymsp[-7].minor.yy280,yymsp[0].minor.yy220.pLimit,yymsp[0].minor.yy220.pOffset);
}
-#line 2314 "parse.c"
- break;
- case 111:
- case 247:
-#line 410 "parse.y"
-{yygotominor.yy412 = yymsp[-1].minor.yy412;}
-#line 2320 "parse.c"
+#line 2324 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 112:
- case 139:
- case 149:
- case 246:
-#line 411 "parse.y"
-{yygotominor.yy412 = 0;}
-#line 2328 "parse.c"
+ case 248:
+#line 411 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy418 = yymsp[-1].minor.yy418;}
+#line 2330 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 113:
-#line 412 "parse.y"
-{
- yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-2].minor.yy412,yymsp[-1].minor.yy44,yymsp[0].minor.yy144.n?&yymsp[0].minor.yy144:0);
-}
-#line 2335 "parse.c"
+ case 140:
+ case 150:
+ case 247:
+#line 412 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy418 = 0;}
+#line 2338 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 114:
-#line 415 "parse.y"
+#line 413 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-1].minor.yy412, sqlite3Expr(TK_ALL, 0, 0, 0), 0);
+ yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-2].minor.yy418,yymsp[-1].minor.yy62,yymsp[0].minor.yy198.n?&yymsp[0].minor.yy198:0);
}
-#line 2342 "parse.c"
+#line 2345 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 115:
-#line 418 "parse.y"
+#line 416 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- Expr *pRight = sqlite3Expr(TK_ALL, 0, 0, 0);
- Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy144);
- yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-3].minor.yy412, sqlite3Expr(TK_DOT, pLeft, pRight, 0), 0);
+ yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-1].minor.yy418, sqlite3Expr(TK_ALL, 0, 0, 0), 0);
}
-#line 2351 "parse.c"
+#line 2352 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 118:
-#line 430 "parse.y"
-{yygotominor.yy144.n = 0;}
-#line 2356 "parse.c"
+ case 116:
+#line 419 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ Expr *pRight = sqlite3Expr(TK_ALL, 0, 0, 0);
+ Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy198);
+ yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-3].minor.yy418, sqlite3Expr(TK_DOT, pLeft, pRight, 0), 0);
+}
+#line 2361 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 119:
-#line 442 "parse.y"
-{yygotominor.yy367 = sqliteMalloc(sizeof(*yygotominor.yy367));}
-#line 2361 "parse.c"
+#line 431 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy198.n = 0;}
+#line 2366 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 120:
-#line 443 "parse.y"
-{yygotominor.yy367 = yymsp[0].minor.yy367;}
-#line 2366 "parse.c"
+#line 443 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy151 = sqliteMalloc(sizeof(*yygotominor.yy151));}
+#line 2371 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 121:
-#line 448 "parse.y"
-{
- yygotominor.yy367 = yymsp[-1].minor.yy367;
- if( yygotominor.yy367 && yygotominor.yy367->nSrc>0 ) yygotominor.yy367->a[yygotominor.yy367->nSrc-1].jointype = yymsp[0].minor.yy58;
-}
-#line 2374 "parse.c"
+#line 444 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy151 = yymsp[0].minor.yy151;}
+#line 2376 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 122:
-#line 452 "parse.y"
-{yygotominor.yy367 = 0;}
-#line 2379 "parse.c"
+#line 449 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ yygotominor.yy151 = yymsp[-1].minor.yy151;
+ if( yygotominor.yy151 && yygotominor.yy151->nSrc>0 ) yygotominor.yy151->a[yygotominor.yy151->nSrc-1].jointype = yymsp[0].minor.yy280;
+}
+#line 2384 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 123:
-#line 453 "parse.y"
+#line 453 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy151 = 0;}
+#line 2389 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 124:
+#line 454 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy367 = sqlite3SrcListAppend(yymsp[-5].minor.yy367,&yymsp[-4].minor.yy144,&yymsp[-3].minor.yy144);
- if( yymsp[-2].minor.yy144.n ) sqlite3SrcListAddAlias(yygotominor.yy367,&yymsp[-2].minor.yy144);
- if( yymsp[-1].minor.yy44 ){
- if( yygotominor.yy367 && yygotominor.yy367->nSrc>1 ){ yygotominor.yy367->a[yygotominor.yy367->nSrc-2].pOn = yymsp[-1].minor.yy44; }
- else { sqlite3ExprDelete(yymsp[-1].minor.yy44); }
+ yygotominor.yy151 = sqlite3SrcListAppend(yymsp[-5].minor.yy151,&yymsp[-4].minor.yy198,&yymsp[-3].minor.yy198);
+ if( yymsp[-2].minor.yy198.n ) sqlite3SrcListAddAlias(yygotominor.yy151,&yymsp[-2].minor.yy198);
+ if( yymsp[-1].minor.yy62 ){
+ if( yygotominor.yy151 && yygotominor.yy151->nSrc>1 ){ yygotominor.yy151->a[yygotominor.yy151->nSrc-2].pOn = yymsp[-1].minor.yy62; }
+ else { sqlite3ExprDelete(yymsp[-1].minor.yy62); }
}
- if( yymsp[0].minor.yy258 ){
- if( yygotominor.yy367 && yygotominor.yy367->nSrc>1 ){ yygotominor.yy367->a[yygotominor.yy367->nSrc-2].pUsing = yymsp[0].minor.yy258; }
- else { sqlite3IdListDelete(yymsp[0].minor.yy258); }
+ if( yymsp[0].minor.yy240 ){
+ if( yygotominor.yy151 && yygotominor.yy151->nSrc>1 ){ yygotominor.yy151->a[yygotominor.yy151->nSrc-2].pUsing = yymsp[0].minor.yy240; }
+ else { sqlite3IdListDelete(yymsp[0].minor.yy240); }
}
}
-#line 2395 "parse.c"
+#line 2405 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 124:
-#line 467 "parse.y"
-{
- yygotominor.yy367 = sqlite3SrcListAppend(yymsp[-6].minor.yy367,0,0);
- yygotominor.yy367->a[yygotominor.yy367->nSrc-1].pSelect = yymsp[-4].minor.yy99;
- if( yymsp[-2].minor.yy144.n ) sqlite3SrcListAddAlias(yygotominor.yy367,&yymsp[-2].minor.yy144);
- if( yymsp[-1].minor.yy44 ){
- if( yygotominor.yy367 && yygotominor.yy367->nSrc>1 ){ yygotominor.yy367->a[yygotominor.yy367->nSrc-2].pOn = yymsp[-1].minor.yy44; }
- else { sqlite3ExprDelete(yymsp[-1].minor.yy44); }
+ case 125:
+#line 468 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ yygotominor.yy151 = sqlite3SrcListAppend(yymsp[-6].minor.yy151,0,0);
+ yygotominor.yy151->a[yygotominor.yy151->nSrc-1].pSelect = yymsp[-4].minor.yy375;
+ if( yymsp[-2].minor.yy198.n ) sqlite3SrcListAddAlias(yygotominor.yy151,&yymsp[-2].minor.yy198);
+ if( yymsp[-1].minor.yy62 ){
+ if( yygotominor.yy151 && yygotominor.yy151->nSrc>1 ){ yygotominor.yy151->a[yygotominor.yy151->nSrc-2].pOn = yymsp[-1].minor.yy62; }
+ else { sqlite3ExprDelete(yymsp[-1].minor.yy62); }
}
- if( yymsp[0].minor.yy258 ){
- if( yygotominor.yy367 && yygotominor.yy367->nSrc>1 ){ yygotominor.yy367->a[yygotominor.yy367->nSrc-2].pUsing = yymsp[0].minor.yy258; }
- else { sqlite3IdListDelete(yymsp[0].minor.yy258); }
+ if( yymsp[0].minor.yy240 ){
+ if( yygotominor.yy151 && yygotominor.yy151->nSrc>1 ){ yygotominor.yy151->a[yygotominor.yy151->nSrc-2].pUsing = yymsp[0].minor.yy240; }
+ else { sqlite3IdListDelete(yymsp[0].minor.yy240); }
}
}
-#line 2412 "parse.c"
+#line 2422 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 126:
-#line 488 "parse.y"
+ case 127:
+#line 489 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy99 = sqlite3SelectNew(0,yymsp[0].minor.yy367,0,0,0,0,0,0,0);
+ yygotominor.yy375 = sqlite3SelectNew(0,yymsp[0].minor.yy151,0,0,0,0,0,0,0);
}
-#line 2419 "parse.c"
- break;
- case 127:
-#line 494 "parse.y"
-{yygotominor.yy144.z=0; yygotominor.yy144.n=0;}
-#line 2424 "parse.c"
+#line 2429 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 129:
-#line 499 "parse.y"
-{yygotominor.yy367 = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy144);}
-#line 2429 "parse.c"
+ case 128:
+#line 495 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy198.z=0; yygotominor.yy198.n=0;}
+#line 2434 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 130:
- case 131:
-#line 503 "parse.y"
-{ yygotominor.yy58 = JT_INNER; }
-#line 2435 "parse.c"
+#line 500 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy151 = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy198);}
+#line 2439 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
+ case 131:
case 132:
-#line 505 "parse.y"
-{ yygotominor.yy58 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
-#line 2440 "parse.c"
+#line 504 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = JT_INNER; }
+#line 2445 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 133:
-#line 506 "parse.y"
-{ yygotominor.yy58 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy144,0); }
-#line 2445 "parse.c"
+#line 506 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
+#line 2450 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 134:
-#line 508 "parse.y"
-{ yygotominor.yy58 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy144,&yymsp[-1].minor.yy144); }
-#line 2450 "parse.c"
+#line 507 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy198,0); }
+#line 2455 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 135:
- case 143:
- case 152:
- case 159:
- case 173:
- case 210:
- case 235:
- case 237:
- case 241:
-#line 512 "parse.y"
-{yygotominor.yy44 = yymsp[0].minor.yy44;}
-#line 2463 "parse.c"
+#line 509 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy198,&yymsp[-1].minor.yy198); }
+#line 2460 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 136:
- case 151:
- case 158:
+ case 144:
+ case 153:
+ case 160:
+ case 174:
case 211:
case 236:
case 238:
case 242:
-#line 513 "parse.y"
-{yygotominor.yy44 = 0;}
-#line 2474 "parse.c"
+#line 513 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy62 = yymsp[0].minor.yy62;}
+#line 2473 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 137:
- case 170:
-#line 517 "parse.y"
-{yygotominor.yy258 = yymsp[-1].minor.yy258;}
-#line 2480 "parse.c"
+ case 152:
+ case 159:
+ case 212:
+ case 237:
+ case 239:
+ case 243:
+#line 514 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy62 = 0;}
+#line 2484 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 138:
- case 169:
-#line 518 "parse.y"
-{yygotominor.yy258 = 0;}
-#line 2486 "parse.c"
+ case 171:
+#line 518 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy240 = yymsp[-1].minor.yy240;}
+#line 2490 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 140:
- case 150:
-#line 529 "parse.y"
-{yygotominor.yy412 = yymsp[0].minor.yy412;}
-#line 2492 "parse.c"
+ case 139:
+ case 170:
+#line 519 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy240 = 0;}
+#line 2496 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 141:
-#line 530 "parse.y"
-{
- yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-4].minor.yy412,yymsp[-2].minor.yy44,yymsp[-1].minor.yy144.n>0?&yymsp[-1].minor.yy144:0);
- if( yygotominor.yy412 ) yygotominor.yy412->a[yygotominor.yy412->nExpr-1].sortOrder = yymsp[0].minor.yy58;
-}
-#line 2500 "parse.c"
+ case 151:
+#line 530 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy418 = yymsp[0].minor.yy418;}
+#line 2502 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 142:
-#line 534 "parse.y"
+#line 531 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy412 = sqlite3ExprListAppend(0,yymsp[-2].minor.yy44,yymsp[-1].minor.yy144.n>0?&yymsp[-1].minor.yy144:0);
- if( yygotominor.yy412 && yygotominor.yy412->a ) yygotominor.yy412->a[0].sortOrder = yymsp[0].minor.yy58;
+ yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-4].minor.yy418,yymsp[-2].minor.yy62,yymsp[-1].minor.yy198.n>0?&yymsp[-1].minor.yy198:0);
+ if( yygotominor.yy418 ) yygotominor.yy418->a[yygotominor.yy418->nExpr-1].sortOrder = yymsp[0].minor.yy280;
}
-#line 2508 "parse.c"
+#line 2510 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 144:
- case 146:
-#line 543 "parse.y"
-{yygotominor.yy58 = SQLITE_SO_ASC;}
-#line 2514 "parse.c"
+ case 143:
+#line 535 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ yygotominor.yy418 = sqlite3ExprListAppend(0,yymsp[-2].minor.yy62,yymsp[-1].minor.yy198.n>0?&yymsp[-1].minor.yy198:0);
+ if( yygotominor.yy418 && yygotominor.yy418->a ) yygotominor.yy418->a[0].sortOrder = yymsp[0].minor.yy280;
+}
+#line 2518 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 145:
-#line 544 "parse.y"
-{yygotominor.yy58 = SQLITE_SO_DESC;}
-#line 2519 "parse.c"
- break;
case 147:
-#line 546 "parse.y"
-{yygotominor.yy144.z = 0; yygotominor.yy144.n = 0;}
-#line 2524 "parse.c"
+#line 544 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = SQLITE_SO_ASC;}
+#line 2524 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 153:
-#line 564 "parse.y"
-{yygotominor.yy112.pLimit = 0; yygotominor.yy112.pOffset = 0;}
-#line 2529 "parse.c"
+ case 146:
+#line 545 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = SQLITE_SO_DESC;}
+#line 2529 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 148:
+#line 547 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy198.z = 0; yygotominor.yy198.n = 0;}
+#line 2534 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 154:
-#line 565 "parse.y"
-{yygotominor.yy112.pLimit = yymsp[0].minor.yy44; yygotominor.yy112.pOffset = 0;}
-#line 2534 "parse.c"
+#line 565 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy220.pLimit = 0; yygotominor.yy220.pOffset = 0;}
+#line 2539 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 155:
-#line 567 "parse.y"
-{yygotominor.yy112.pLimit = yymsp[-2].minor.yy44; yygotominor.yy112.pOffset = yymsp[0].minor.yy44;}
-#line 2539 "parse.c"
+#line 566 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy220.pLimit = yymsp[0].minor.yy62; yygotominor.yy220.pOffset = 0;}
+#line 2544 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 156:
-#line 569 "parse.y"
-{yygotominor.yy112.pOffset = yymsp[-2].minor.yy44; yygotominor.yy112.pLimit = yymsp[0].minor.yy44;}
-#line 2544 "parse.c"
+#line 568 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy220.pLimit = yymsp[-2].minor.yy62; yygotominor.yy220.pOffset = yymsp[0].minor.yy62;}
+#line 2549 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 157:
-#line 573 "parse.y"
-{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy367,yymsp[0].minor.yy44);}
-#line 2549 "parse.c"
+#line 570 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy220.pOffset = yymsp[-2].minor.yy62; yygotominor.yy220.pLimit = yymsp[0].minor.yy62;}
+#line 2554 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 160:
-#line 584 "parse.y"
-{sqlite3Update(pParse,yymsp[-3].minor.yy367,yymsp[-1].minor.yy412,yymsp[0].minor.yy44,yymsp[-4].minor.yy58);}
-#line 2554 "parse.c"
+ case 158:
+#line 574 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy151,yymsp[0].minor.yy62);}
+#line 2559 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 161:
-#line 590 "parse.y"
-{yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-4].minor.yy412,yymsp[0].minor.yy44,&yymsp[-2].minor.yy144);}
-#line 2559 "parse.c"
+#line 585 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Update(pParse,yymsp[-3].minor.yy151,yymsp[-1].minor.yy418,yymsp[0].minor.yy62,yymsp[-4].minor.yy280);}
+#line 2564 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 162:
-#line 591 "parse.y"
-{yygotominor.yy412 = sqlite3ExprListAppend(0,yymsp[0].minor.yy44,&yymsp[-2].minor.yy144);}
-#line 2564 "parse.c"
+#line 591 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-4].minor.yy418,yymsp[0].minor.yy62,&yymsp[-2].minor.yy198);}
+#line 2569 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 163:
-#line 597 "parse.y"
-{sqlite3Insert(pParse, yymsp[-5].minor.yy367, yymsp[-1].minor.yy412, 0, yymsp[-4].minor.yy258, yymsp[-7].minor.yy58);}
-#line 2569 "parse.c"
+#line 592 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy418 = sqlite3ExprListAppend(0,yymsp[0].minor.yy62,&yymsp[-2].minor.yy198);}
+#line 2574 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 164:
-#line 599 "parse.y"
-{sqlite3Insert(pParse, yymsp[-2].minor.yy367, 0, yymsp[0].minor.yy99, yymsp[-1].minor.yy258, yymsp[-4].minor.yy58);}
-#line 2574 "parse.c"
+#line 598 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Insert(pParse, yymsp[-5].minor.yy151, yymsp[-1].minor.yy418, 0, yymsp[-4].minor.yy240, yymsp[-7].minor.yy280);}
+#line 2579 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 167:
- case 239:
-#line 609 "parse.y"
-{yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-2].minor.yy412,yymsp[0].minor.yy44,0);}
-#line 2580 "parse.c"
+ case 165:
+#line 600 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Insert(pParse, yymsp[-2].minor.yy151, 0, yymsp[0].minor.yy375, yymsp[-1].minor.yy240, yymsp[-4].minor.yy280);}
+#line 2584 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 168:
case 240:
-#line 610 "parse.y"
-{yygotominor.yy412 = sqlite3ExprListAppend(0,yymsp[0].minor.yy44,0);}
-#line 2586 "parse.c"
+#line 610 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-2].minor.yy418,yymsp[0].minor.yy62,0);}
+#line 2590 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 171:
-#line 619 "parse.y"
-{yygotominor.yy258 = sqlite3IdListAppend(yymsp[-2].minor.yy258,&yymsp[0].minor.yy144);}
-#line 2591 "parse.c"
+ case 169:
+ case 241:
+#line 611 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy418 = sqlite3ExprListAppend(0,yymsp[0].minor.yy62,0);}
+#line 2596 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 172:
-#line 620 "parse.y"
-{yygotominor.yy258 = sqlite3IdListAppend(0,&yymsp[0].minor.yy144);}
-#line 2596 "parse.c"
+#line 620 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy240 = sqlite3IdListAppend(yymsp[-2].minor.yy240,&yymsp[0].minor.yy198);}
+#line 2601 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 174:
-#line 631 "parse.y"
-{yygotominor.yy44 = yymsp[-1].minor.yy44; sqlite3ExprSpan(yygotominor.yy44,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
-#line 2601 "parse.c"
+ case 173:
+#line 621 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy240 = sqlite3IdListAppend(0,&yymsp[0].minor.yy198);}
+#line 2606 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 175:
- case 180:
+#line 632 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy62 = yymsp[-1].minor.yy62; sqlite3ExprSpan(yygotominor.yy62,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
+#line 2611 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 176:
case 181:
case 182:
case 183:
-#line 632 "parse.y"
-{yygotominor.yy44 = sqlite3Expr(yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
-#line 2610 "parse.c"
+ case 184:
+#line 633 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy62 = sqlite3Expr(yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
+#line 2620 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 176:
case 177:
-#line 633 "parse.y"
-{yygotominor.yy44 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy0);}
-#line 2616 "parse.c"
- break;
case 178:
-#line 635 "parse.y"
+#line 634 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy62 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy0);}
+#line 2626 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 179:
+#line 636 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy144);
- Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy144);
- yygotominor.yy44 = sqlite3Expr(TK_DOT, temp1, temp2, 0);
+ Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy198);
+ Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy198);
+ yygotominor.yy62 = sqlite3Expr(TK_DOT, temp1, temp2, 0);
}
-#line 2625 "parse.c"
+#line 2635 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 179:
-#line 640 "parse.y"
+ case 180:
+#line 641 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-4].minor.yy144);
- Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy144);
- Expr *temp3 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy144);
+ Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-4].minor.yy198);
+ Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy198);
+ Expr *temp3 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy198);
Expr *temp4 = sqlite3Expr(TK_DOT, temp2, temp3, 0);
- yygotominor.yy44 = sqlite3Expr(TK_DOT, temp1, temp4, 0);
+ yygotominor.yy62 = sqlite3Expr(TK_DOT, temp1, temp4, 0);
}
-#line 2636 "parse.c"
- break;
- case 184:
-#line 651 "parse.y"
-{yygotominor.yy44 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);}
-#line 2641 "parse.c"
+#line 2646 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 185:
-#line 652 "parse.y"
-{
- Token *pToken = &yymsp[0].minor.yy0;
- Expr *pExpr = yygotominor.yy44 = sqlite3Expr(TK_VARIABLE, 0, 0, pToken);
- sqlite3ExprAssignVarNumber(pParse, pExpr);
-}
-#line 2650 "parse.c"
+#line 652 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy62 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);}
+#line 2651 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 186:
-#line 658 "parse.y"
+#line 653 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_CAST, yymsp[-3].minor.yy44, 0, &yymsp[-1].minor.yy144);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
+ Token *pToken = &yymsp[0].minor.yy0;
+ Expr *pExpr = yygotominor.yy62 = sqlite3Expr(TK_VARIABLE, 0, 0, pToken);
+ sqlite3ExprAssignVarNumber(pParse, pExpr);
}
-#line 2658 "parse.c"
+#line 2660 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 187:
-#line 663 "parse.y"
+#line 659 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3ExprFunction(yymsp[-1].minor.yy412, &yymsp[-3].minor.yy0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
+ yygotominor.yy62 = sqlite3Expr(TK_CAST, yymsp[-3].minor.yy62, 0, &yymsp[-1].minor.yy198);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
}
-#line 2666 "parse.c"
+#line 2668 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 188:
-#line 667 "parse.y"
+#line 664 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3ExprFunction(0, &yymsp[-3].minor.yy0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
+ yygotominor.yy62 = sqlite3ExprFunction(yymsp[-1].minor.yy418, &yymsp[-4].minor.yy0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
+ if( yymsp[-2].minor.yy280 ){
+ yygotominor.yy62->flags |= EP_Distinct;
+ }
}
-#line 2674 "parse.c"
+#line 2679 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 189:
-#line 671 "parse.y"
+#line 671 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ yygotominor.yy62 = sqlite3ExprFunction(0, &yymsp[-3].minor.yy0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
+}
+#line 2687 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 190:
+#line 675 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
/* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
** treated as functions that return constants */
- yygotominor.yy44 = sqlite3ExprFunction(0,&yymsp[0].minor.yy0);
- if( yygotominor.yy44 ) yygotominor.yy44->op = TK_CONST_FUNC;
+ yygotominor.yy62 = sqlite3ExprFunction(0,&yymsp[0].minor.yy0);
+ if( yygotominor.yy62 ) yygotominor.yy62->op = TK_CONST_FUNC;
}
-#line 2684 "parse.c"
+#line 2697 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 190:
case 191:
case 192:
case 193:
@@ -2699,486 +2711,506 @@ static void yy_reduce(
case 205:
case 206:
case 207:
-#line 677 "parse.y"
-{yygotominor.yy44 = sqlite3Expr(yymsp[-1].major, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, 0);}
-#line 2706 "parse.c"
- break;
case 208:
-#line 696 "parse.y"
-{yygotominor.yy432.operator = yymsp[0].minor.yy0; yygotominor.yy432.not = 0;}
-#line 2711 "parse.c"
+#line 681 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy62 = sqlite3Expr(yymsp[-1].major, yymsp[-2].minor.yy62, yymsp[0].minor.yy62, 0);}
+#line 2719 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 209:
-#line 697 "parse.y"
-{yygotominor.yy432.operator = yymsp[0].minor.yy0; yygotominor.yy432.not = 1;}
-#line 2716 "parse.c"
+#line 700 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy222.operator = yymsp[0].minor.yy0; yygotominor.yy222.not = 0;}
+#line 2724 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 212:
-#line 701 "parse.y"
-{
- ExprList *pList = sqlite3ExprListAppend(0, yymsp[-1].minor.yy44, 0);
- pList = sqlite3ExprListAppend(pList, yymsp[-3].minor.yy44, 0);
- if( yymsp[0].minor.yy44 ){
- pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy44, 0);
- }
- yygotominor.yy44 = sqlite3ExprFunction(pList, &yymsp[-2].minor.yy432.operator);
- if( yymsp[-2].minor.yy432.not ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44, &yymsp[-3].minor.yy44->span, &yymsp[-1].minor.yy44->span);
-}
-#line 2730 "parse.c"
+ case 210:
+#line 701 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy222.operator = yymsp[0].minor.yy0; yygotominor.yy222.not = 1;}
+#line 2729 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 213:
-#line 712 "parse.y"
+#line 705 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_ISNULL, yymsp[-1].minor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy44->span,&yymsp[0].minor.yy0);
+ ExprList *pList = sqlite3ExprListAppend(0, yymsp[-1].minor.yy62, 0);
+ pList = sqlite3ExprListAppend(pList, yymsp[-3].minor.yy62, 0);
+ if( yymsp[0].minor.yy62 ){
+ pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy62, 0);
+ }
+ yygotominor.yy62 = sqlite3ExprFunction(pList, &yymsp[-2].minor.yy222.operator);
+ if( yymsp[-2].minor.yy222.not ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62, &yymsp[-3].minor.yy62->span, &yymsp[-1].minor.yy62->span);
}
-#line 2738 "parse.c"
+#line 2743 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 214:
-#line 716 "parse.y"
+#line 716 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_ISNULL, yymsp[-2].minor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-2].minor.yy44->span,&yymsp[0].minor.yy0);
+ yygotominor.yy62 = sqlite3Expr(TK_ISNULL, yymsp[-1].minor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy62->span,&yymsp[0].minor.yy0);
}
-#line 2746 "parse.c"
+#line 2751 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 215:
-#line 720 "parse.y"
+#line 720 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_NOTNULL, yymsp[-1].minor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy44->span,&yymsp[0].minor.yy0);
+ yygotominor.yy62 = sqlite3Expr(TK_ISNULL, yymsp[-2].minor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-2].minor.yy62->span,&yymsp[0].minor.yy0);
}
-#line 2754 "parse.c"
+#line 2759 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 216:
-#line 724 "parse.y"
+#line 724 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_NOTNULL, yymsp[-2].minor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-2].minor.yy44->span,&yymsp[0].minor.yy0);
+ yygotominor.yy62 = sqlite3Expr(TK_NOTNULL, yymsp[-1].minor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy62->span,&yymsp[0].minor.yy0);
}
-#line 2762 "parse.c"
+#line 2767 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 217:
-#line 728 "parse.y"
+#line 728 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_NOTNULL, yymsp[-3].minor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-3].minor.yy44->span,&yymsp[0].minor.yy0);
+ yygotominor.yy62 = sqlite3Expr(TK_NOTNULL, yymsp[-2].minor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-2].minor.yy62->span,&yymsp[0].minor.yy0);
}
-#line 2770 "parse.c"
+#line 2775 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 218:
- case 219:
-#line 732 "parse.y"
+#line 732 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(yymsp[-1].major, yymsp[0].minor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy44->span);
+ yygotominor.yy62 = sqlite3Expr(TK_NOTNULL, yymsp[-3].minor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-3].minor.yy62->span,&yymsp[0].minor.yy0);
}
-#line 2779 "parse.c"
+#line 2783 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
+ case 219:
case 220:
-#line 740 "parse.y"
+#line 736 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy44->span);
+ yygotominor.yy62 = sqlite3Expr(yymsp[-1].major, yymsp[0].minor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy62->span);
}
-#line 2787 "parse.c"
+#line 2792 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 221:
-#line 744 "parse.y"
+#line 744 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_UPLUS, yymsp[0].minor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy44->span);
+ yygotominor.yy62 = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy62->span);
}
-#line 2795 "parse.c"
+#line 2800 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 224:
-#line 751 "parse.y"
+ case 222:
+#line 748 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- ExprList *pList = sqlite3ExprListAppend(0, yymsp[-2].minor.yy44, 0);
- pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy44, 0);
- yygotominor.yy44 = sqlite3Expr(TK_BETWEEN, yymsp[-4].minor.yy44, 0, 0);
- if( yygotominor.yy44 ) yygotominor.yy44->pList = pList;
- if( yymsp[-3].minor.yy58 ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-4].minor.yy44->span,&yymsp[0].minor.yy44->span);
+ yygotominor.yy62 = sqlite3Expr(TK_UPLUS, yymsp[0].minor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy62->span);
}
-#line 2807 "parse.c"
+#line 2808 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 227:
-#line 763 "parse.y"
+ case 225:
+#line 755 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy44, 0, 0);
- if( yygotominor.yy44 ){
- yygotominor.yy44->pList = yymsp[-1].minor.yy412;
- }else{
- sqlite3ExprListDelete(yymsp[-1].minor.yy412);
- }
- if( yymsp[-3].minor.yy58 ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-4].minor.yy44->span,&yymsp[0].minor.yy0);
- }
-#line 2821 "parse.c"
+ ExprList *pList = sqlite3ExprListAppend(0, yymsp[-2].minor.yy62, 0);
+ pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy62, 0);
+ yygotominor.yy62 = sqlite3Expr(TK_BETWEEN, yymsp[-4].minor.yy62, 0, 0);
+ if( yygotominor.yy62 ){
+ yygotominor.yy62->pList = pList;
+ }else{
+ sqlite3ExprListDelete(pList);
+ }
+ if( yymsp[-3].minor.yy280 ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-4].minor.yy62->span,&yymsp[0].minor.yy62->span);
+}
+#line 2824 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 228:
-#line 773 "parse.y"
+#line 771 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_SELECT, 0, 0, 0);
- if( yygotominor.yy44 ) yygotominor.yy44->pSelect = yymsp[-1].minor.yy99;
- if( !yygotominor.yy44 ) sqlite3SelectDelete(yymsp[-1].minor.yy99);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
+ yygotominor.yy62 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy62, 0, 0);
+ if( yygotominor.yy62 ){
+ yygotominor.yy62->pList = yymsp[-1].minor.yy418;
+ }else{
+ sqlite3ExprListDelete(yymsp[-1].minor.yy418);
+ }
+ if( yymsp[-3].minor.yy280 ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-4].minor.yy62->span,&yymsp[0].minor.yy0);
}
-#line 2831 "parse.c"
+#line 2838 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 229:
-#line 779 "parse.y"
+#line 781 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy44, 0, 0);
- if( yygotominor.yy44 ) yygotominor.yy44->pSelect = yymsp[-1].minor.yy99;
- if( !yygotominor.yy44 ) sqlite3SelectDelete(yymsp[-1].minor.yy99);
- if( yymsp[-3].minor.yy58 ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-4].minor.yy44->span,&yymsp[0].minor.yy0);
+ yygotominor.yy62 = sqlite3Expr(TK_SELECT, 0, 0, 0);
+ if( yygotominor.yy62 ){
+ yygotominor.yy62->pSelect = yymsp[-1].minor.yy375;
+ }else{
+ sqlite3SelectDelete(yymsp[-1].minor.yy375);
+ }
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
}
-#line 2842 "parse.c"
+#line 2851 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 230:
-#line 786 "parse.y"
+#line 790 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- SrcList *pSrc = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy144);
- yygotominor.yy44 = sqlite3Expr(TK_IN, yymsp[-3].minor.yy44, 0, 0);
- if( yygotominor.yy44 ) yygotominor.yy44->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0);
- if( yymsp[-2].minor.yy58 ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
- sqlite3ExprSpan(yygotominor.yy44,&yymsp[-3].minor.yy44->span,yymsp[0].minor.yy144.z?&yymsp[0].minor.yy144:&yymsp[-1].minor.yy144);
+ yygotominor.yy62 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy62, 0, 0);
+ if( yygotominor.yy62 ){
+ yygotominor.yy62->pSelect = yymsp[-1].minor.yy375;
+ }else{
+ sqlite3SelectDelete(yymsp[-1].minor.yy375);
+ }
+ if( yymsp[-3].minor.yy280 ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-4].minor.yy62->span,&yymsp[0].minor.yy0);
}
-#line 2853 "parse.c"
+#line 2865 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 231:
-#line 793 "parse.y"
+#line 800 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- Expr *p = yygotominor.yy44 = sqlite3Expr(TK_EXISTS, 0, 0, 0);
- if( p ){
- p->pSelect = yymsp[-1].minor.yy99;
- sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
+ SrcList *pSrc = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy198);
+ yygotominor.yy62 = sqlite3Expr(TK_IN, yymsp[-3].minor.yy62, 0, 0);
+ if( yygotominor.yy62 ){
+ yygotominor.yy62->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0);
+ }else{
+ sqlite3SrcListDelete(pSrc);
}
- if( !p ) sqlite3SelectDelete(yymsp[-1].minor.yy99);
+ if( yymsp[-2].minor.yy280 ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0);
+ sqlite3ExprSpan(yygotominor.yy62,&yymsp[-3].minor.yy62->span,yymsp[0].minor.yy198.z?&yymsp[0].minor.yy198:&yymsp[-1].minor.yy198);
}
-#line 2865 "parse.c"
+#line 2880 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 232:
-#line 804 "parse.y"
+#line 811 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_CASE, yymsp[-3].minor.yy44, yymsp[-1].minor.yy44, 0);
- if( yygotominor.yy44 ) yygotominor.yy44->pList = yymsp[-2].minor.yy412;
- sqlite3ExprSpan(yygotominor.yy44, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
-}
-#line 2874 "parse.c"
+ Expr *p = yygotominor.yy62 = sqlite3Expr(TK_EXISTS, 0, 0, 0);
+ if( p ){
+ p->pSelect = yymsp[-1].minor.yy375;
+ sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
+ }else{
+ sqlite3SelectDelete(yymsp[-1].minor.yy375);
+ }
+ }
+#line 2893 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 233:
-#line 811 "parse.y"
+#line 823 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-4].minor.yy412, yymsp[-2].minor.yy44, 0);
- yygotominor.yy412 = sqlite3ExprListAppend(yygotominor.yy412, yymsp[0].minor.yy44, 0);
+ yygotominor.yy62 = sqlite3Expr(TK_CASE, yymsp[-3].minor.yy62, yymsp[-1].minor.yy62, 0);
+ if( yygotominor.yy62 ){
+ yygotominor.yy62->pList = yymsp[-2].minor.yy418;
+ }else{
+ sqlite3ExprListDelete(yymsp[-2].minor.yy418);
+ }
+ sqlite3ExprSpan(yygotominor.yy62, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
}
-#line 2882 "parse.c"
+#line 2906 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 234:
-#line 815 "parse.y"
+#line 834 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy412 = sqlite3ExprListAppend(0, yymsp[-2].minor.yy44, 0);
- yygotominor.yy412 = sqlite3ExprListAppend(yygotominor.yy412, yymsp[0].minor.yy44, 0);
+ yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-4].minor.yy418, yymsp[-2].minor.yy62, 0);
+ yygotominor.yy418 = sqlite3ExprListAppend(yygotominor.yy418, yymsp[0].minor.yy62, 0);
}
-#line 2890 "parse.c"
+#line 2914 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 243:
-#line 840 "parse.y"
+ case 235:
+#line 838 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- if( yymsp[-9].minor.yy58!=OE_None ) yymsp[-9].minor.yy58 = yymsp[0].minor.yy58;
- if( yymsp[-9].minor.yy58==OE_Default) yymsp[-9].minor.yy58 = OE_Abort;
- sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy144, &yymsp[-6].minor.yy144, sqlite3SrcListAppend(0,&yymsp[-4].minor.yy144,0),yymsp[-2].minor.yy412,yymsp[-9].minor.yy58, &yymsp[-10].minor.yy0, &yymsp[-1].minor.yy0);
+ yygotominor.yy418 = sqlite3ExprListAppend(0, yymsp[-2].minor.yy62, 0);
+ yygotominor.yy418 = sqlite3ExprListAppend(yygotominor.yy418, yymsp[0].minor.yy62, 0);
}
-#line 2899 "parse.c"
+#line 2922 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 244:
- case 291:
-#line 847 "parse.y"
-{yygotominor.yy58 = OE_Abort;}
-#line 2905 "parse.c"
+#line 863 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ if( yymsp[-9].minor.yy280!=OE_None ) yymsp[-9].minor.yy280 = yymsp[0].minor.yy280;
+ if( yymsp[-9].minor.yy280==OE_Default) yymsp[-9].minor.yy280 = OE_Abort;
+ sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy198, &yymsp[-6].minor.yy198, sqlite3SrcListAppend(0,&yymsp[-4].minor.yy198,0),yymsp[-2].minor.yy418,yymsp[-9].minor.yy280, &yymsp[-10].minor.yy0, &yymsp[-1].minor.yy0);
+}
+#line 2931 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 245:
-#line 848 "parse.y"
-{yygotominor.yy58 = OE_None;}
-#line 2910 "parse.c"
+ case 292:
+#line 870 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = OE_Abort;}
+#line 2937 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 248:
-#line 858 "parse.y"
+ case 246:
+#line 871 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = OE_None;}
+#line 2942 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 249:
+#line 881 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
Expr *p = 0;
- if( yymsp[-1].minor.yy144.n>0 ){
+ if( yymsp[-1].minor.yy198.n>0 ){
p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
- if( p ) p->pColl = sqlite3LocateCollSeq(pParse, yymsp[-1].minor.yy144.z, yymsp[-1].minor.yy144.n);
+ if( p ) p->pColl = sqlite3LocateCollSeq(pParse, yymsp[-1].minor.yy198.z, yymsp[-1].minor.yy198.n);
}
- yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-4].minor.yy412, p, &yymsp[-2].minor.yy144);
+ yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-4].minor.yy418, p, &yymsp[-2].minor.yy198);
}
-#line 2922 "parse.c"
+#line 2954 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 249:
-#line 866 "parse.y"
+ case 250:
+#line 889 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
Expr *p = 0;
- if( yymsp[-1].minor.yy144.n>0 ){
+ if( yymsp[-1].minor.yy198.n>0 ){
p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
- if( p ) p->pColl = sqlite3LocateCollSeq(pParse, yymsp[-1].minor.yy144.z, yymsp[-1].minor.yy144.n);
+ if( p ) p->pColl = sqlite3LocateCollSeq(pParse, yymsp[-1].minor.yy198.z, yymsp[-1].minor.yy198.n);
}
- yygotominor.yy412 = sqlite3ExprListAppend(0, p, &yymsp[-2].minor.yy144);
+ yygotominor.yy418 = sqlite3ExprListAppend(0, p, &yymsp[-2].minor.yy198);
}
-#line 2934 "parse.c"
- break;
- case 251:
-#line 879 "parse.y"
-{sqlite3DropIndex(pParse, yymsp[0].minor.yy367);}
-#line 2939 "parse.c"
+#line 2966 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 252:
- case 253:
-#line 883 "parse.y"
-{sqlite3Vacuum(pParse,0);}
-#line 2945 "parse.c"
+#line 902 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3DropIndex(pParse, yymsp[0].minor.yy151);}
+#line 2971 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
+ case 253:
case 254:
- case 256:
-#line 889 "parse.y"
-{sqlite3Pragma(pParse,&yymsp[-3].minor.yy144,&yymsp[-2].minor.yy144,&yymsp[0].minor.yy144,0);}
-#line 2951 "parse.c"
+#line 906 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Vacuum(pParse,0);}
+#line 2977 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 255:
-#line 890 "parse.y"
-{sqlite3Pragma(pParse,&yymsp[-3].minor.yy144,&yymsp[-2].minor.yy144,&yymsp[0].minor.yy0,0);}
-#line 2956 "parse.c"
- break;
case 257:
-#line 892 "parse.y"
-{
- sqlite3Pragma(pParse,&yymsp[-3].minor.yy144,&yymsp[-2].minor.yy144,&yymsp[0].minor.yy144,1);
-}
-#line 2963 "parse.c"
+#line 912 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Pragma(pParse,&yymsp[-3].minor.yy198,&yymsp[-2].minor.yy198,&yymsp[0].minor.yy198,0);}
+#line 2983 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 256:
+#line 913 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Pragma(pParse,&yymsp[-3].minor.yy198,&yymsp[-2].minor.yy198,&yymsp[0].minor.yy0,0);}
+#line 2988 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 258:
-#line 895 "parse.y"
-{sqlite3Pragma(pParse,&yymsp[-4].minor.yy144,&yymsp[-3].minor.yy144,&yymsp[-1].minor.yy144,0);}
-#line 2968 "parse.c"
+#line 915 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ sqlite3Pragma(pParse,&yymsp[-3].minor.yy198,&yymsp[-2].minor.yy198,&yymsp[0].minor.yy198,1);
+}
+#line 2995 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 259:
-#line 896 "parse.y"
-{sqlite3Pragma(pParse,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy144,0,0);}
-#line 2973 "parse.c"
+#line 918 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Pragma(pParse,&yymsp[-4].minor.yy198,&yymsp[-3].minor.yy198,&yymsp[-1].minor.yy198,0);}
+#line 3000 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 266:
-#line 909 "parse.y"
-{
- Token all;
- all.z = yymsp[-3].minor.yy144.z;
- all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy144.z) + yymsp[0].minor.yy0.n;
- sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
-}
-#line 2983 "parse.c"
+ case 260:
+#line 919 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Pragma(pParse,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy198,0,0);}
+#line 3005 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 267:
-#line 918 "parse.y"
+#line 932 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy144, &yymsp[-6].minor.yy144, yymsp[-5].minor.yy58, yymsp[-4].minor.yy234.a, yymsp[-4].minor.yy234.b, yymsp[-2].minor.yy367, yymsp[-1].minor.yy58, yymsp[0].minor.yy44, yymsp[-9].minor.yy58);
- yygotominor.yy144 = (yymsp[-6].minor.yy144.n==0?yymsp[-7].minor.yy144:yymsp[-6].minor.yy144);
+ Token all;
+ all.z = yymsp[-3].minor.yy198.z;
+ all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy198.z) + yymsp[0].minor.yy0.n;
+ sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy360, &all);
}
-#line 2991 "parse.c"
+#line 3015 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 268:
- case 271:
-#line 924 "parse.y"
-{ yygotominor.yy58 = TK_BEFORE; }
-#line 2997 "parse.c"
+#line 941 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy198, &yymsp[-6].minor.yy198, yymsp[-5].minor.yy280, yymsp[-4].minor.yy30.a, yymsp[-4].minor.yy30.b, yymsp[-2].minor.yy151, yymsp[-1].minor.yy280, yymsp[0].minor.yy62, yymsp[-9].minor.yy280);
+ yygotominor.yy198 = (yymsp[-6].minor.yy198.n==0?yymsp[-7].minor.yy198:yymsp[-6].minor.yy198);
+}
+#line 3023 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 269:
-#line 925 "parse.y"
-{ yygotominor.yy58 = TK_AFTER; }
-#line 3002 "parse.c"
+ case 272:
+#line 947 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = TK_BEFORE; }
+#line 3029 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 270:
-#line 926 "parse.y"
-{ yygotominor.yy58 = TK_INSTEAD;}
-#line 3007 "parse.c"
+#line 948 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = TK_AFTER; }
+#line 3034 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 271:
+#line 949 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = TK_INSTEAD;}
+#line 3039 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 272:
case 273:
case 274:
-#line 931 "parse.y"
-{yygotominor.yy234.a = yymsp[0].major; yygotominor.yy234.b = 0;}
-#line 3014 "parse.c"
- break;
case 275:
-#line 934 "parse.y"
-{yygotominor.yy234.a = TK_UPDATE; yygotominor.yy234.b = yymsp[0].minor.yy258;}
-#line 3019 "parse.c"
+#line 954 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy30.a = yymsp[0].major; yygotominor.yy30.b = 0;}
+#line 3046 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 276:
- case 277:
-#line 937 "parse.y"
-{ yygotominor.yy58 = TK_ROW; }
-#line 3025 "parse.c"
+#line 957 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy30.a = TK_UPDATE; yygotominor.yy30.b = yymsp[0].minor.yy240;}
+#line 3051 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
+ case 277:
case 278:
-#line 939 "parse.y"
-{ yygotominor.yy58 = TK_STATEMENT; }
-#line 3030 "parse.c"
+#line 960 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = TK_ROW; }
+#line 3057 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 279:
-#line 942 "parse.y"
-{ yygotominor.yy44 = 0; }
-#line 3035 "parse.c"
+#line 962 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy280 = TK_STATEMENT; }
+#line 3062 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 280:
-#line 943 "parse.y"
-{ yygotominor.yy44 = yymsp[0].minor.yy44; }
-#line 3040 "parse.c"
+#line 965 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy62 = 0; }
+#line 3067 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 281:
-#line 947 "parse.y"
-{
- yymsp[-2].minor.yy203->pNext = yymsp[0].minor.yy203;
- yygotominor.yy203 = yymsp[-2].minor.yy203;
-}
-#line 3048 "parse.c"
+#line 966 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy62 = yymsp[0].minor.yy62; }
+#line 3072 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 282:
-#line 951 "parse.y"
-{ yygotominor.yy203 = 0; }
-#line 3053 "parse.c"
+#line 970 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ yymsp[-2].minor.yy360->pNext = yymsp[0].minor.yy360;
+ yygotominor.yy360 = yymsp[-2].minor.yy360;
+}
+#line 3080 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 283:
-#line 957 "parse.y"
-{ yygotominor.yy203 = sqlite3TriggerUpdateStep(&yymsp[-3].minor.yy144, yymsp[-1].minor.yy412, yymsp[0].minor.yy44, yymsp[-4].minor.yy58); }
-#line 3058 "parse.c"
+#line 974 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy360 = 0; }
+#line 3085 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 284:
-#line 962 "parse.y"
-{yygotominor.yy203 = sqlite3TriggerInsertStep(&yymsp[-5].minor.yy144, yymsp[-4].minor.yy258, yymsp[-1].minor.yy412, 0, yymsp[-7].minor.yy58);}
-#line 3063 "parse.c"
+#line 980 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy360 = sqlite3TriggerUpdateStep(&yymsp[-3].minor.yy198, yymsp[-1].minor.yy418, yymsp[0].minor.yy62, yymsp[-4].minor.yy280); }
+#line 3090 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 285:
-#line 965 "parse.y"
-{yygotominor.yy203 = sqlite3TriggerInsertStep(&yymsp[-2].minor.yy144, yymsp[-1].minor.yy258, 0, yymsp[0].minor.yy99, yymsp[-4].minor.yy58);}
-#line 3068 "parse.c"
+#line 985 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy360 = sqlite3TriggerInsertStep(&yymsp[-5].minor.yy198, yymsp[-4].minor.yy240, yymsp[-1].minor.yy418, 0, yymsp[-7].minor.yy280);}
+#line 3095 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 286:
-#line 969 "parse.y"
-{yygotominor.yy203 = sqlite3TriggerDeleteStep(&yymsp[-1].minor.yy144, yymsp[0].minor.yy44);}
-#line 3073 "parse.c"
+#line 988 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy360 = sqlite3TriggerInsertStep(&yymsp[-2].minor.yy198, yymsp[-1].minor.yy240, 0, yymsp[0].minor.yy375, yymsp[-4].minor.yy280);}
+#line 3100 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 287:
-#line 972 "parse.y"
-{yygotominor.yy203 = sqlite3TriggerSelectStep(yymsp[0].minor.yy99); }
-#line 3078 "parse.c"
+#line 992 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy360 = sqlite3TriggerDeleteStep(&yymsp[-1].minor.yy198, yymsp[0].minor.yy62);}
+#line 3105 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 288:
-#line 975 "parse.y"
-{
- yygotominor.yy44 = sqlite3Expr(TK_RAISE, 0, 0, 0);
- yygotominor.yy44->iColumn = OE_Ignore;
- sqlite3ExprSpan(yygotominor.yy44, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
-}
-#line 3087 "parse.c"
+#line 995 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy360 = sqlite3TriggerSelectStep(yymsp[0].minor.yy375); }
+#line 3110 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 289:
-#line 980 "parse.y"
+#line 998 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- yygotominor.yy44 = sqlite3Expr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy144);
- yygotominor.yy44->iColumn = yymsp[-3].minor.yy58;
- sqlite3ExprSpan(yygotominor.yy44, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
+ yygotominor.yy62 = sqlite3Expr(TK_RAISE, 0, 0, 0);
+ yygotominor.yy62->iColumn = OE_Ignore;
+ sqlite3ExprSpan(yygotominor.yy62, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
}
-#line 3096 "parse.c"
+#line 3119 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 290:
-#line 988 "parse.y"
-{yygotominor.yy58 = OE_Rollback;}
-#line 3101 "parse.c"
+#line 1003 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ yygotominor.yy62 = sqlite3Expr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy198);
+ yygotominor.yy62->iColumn = yymsp[-3].minor.yy280;
+ sqlite3ExprSpan(yygotominor.yy62, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
+}
+#line 3128 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 292:
-#line 990 "parse.y"
-{yygotominor.yy58 = OE_Fail;}
-#line 3106 "parse.c"
+ case 291:
+#line 1011 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = OE_Rollback;}
+#line 3133 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 293:
-#line 995 "parse.y"
-{
- sqlite3DropTrigger(pParse,yymsp[0].minor.yy367);
-}
-#line 3113 "parse.c"
+#line 1013 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{yygotominor.yy280 = OE_Fail;}
+#line 3138 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 294:
-#line 1001 "parse.y"
+#line 1018 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3Attach(pParse, &yymsp[-3].minor.yy144, &yymsp[-1].minor.yy144, yymsp[0].minor.yy300.type, &yymsp[0].minor.yy300.key);
+ sqlite3DropTrigger(pParse,yymsp[0].minor.yy151);
}
-#line 3120 "parse.c"
+#line 3145 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 295:
-#line 1005 "parse.y"
-{ yygotominor.yy300.type = 0; }
-#line 3125 "parse.c"
+#line 1024 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ sqlite3Attach(pParse, &yymsp[-3].minor.yy198, &yymsp[-1].minor.yy198, yymsp[0].minor.yy361.type, &yymsp[0].minor.yy361.key);
+}
+#line 3152 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 296:
-#line 1006 "parse.y"
-{ yygotominor.yy300.type=1; yygotominor.yy300.key = yymsp[0].minor.yy144; }
-#line 3130 "parse.c"
+#line 1028 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy361.type = 0; }
+#line 3157 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 297:
-#line 1007 "parse.y"
-{ yygotominor.yy300.type=2; yygotominor.yy300.key = yymsp[0].minor.yy0; }
-#line 3135 "parse.c"
+#line 1029 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy361.type=1; yygotominor.yy361.key = yymsp[0].minor.yy198; }
+#line 3162 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
- case 300:
-#line 1013 "parse.y"
-{
- sqlite3Detach(pParse, &yymsp[0].minor.yy144);
-}
-#line 3142 "parse.c"
+ case 298:
+#line 1030 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{ yygotominor.yy361.type=2; yygotominor.yy361.key = yymsp[0].minor.yy0; }
+#line 3167 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 301:
-#line 1019 "parse.y"
-{sqlite3Reindex(pParse, 0, 0);}
-#line 3147 "parse.c"
+#line 1036 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ sqlite3Detach(pParse, &yymsp[0].minor.yy198);
+}
+#line 3174 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 302:
-#line 1020 "parse.y"
-{sqlite3Reindex(pParse, &yymsp[-1].minor.yy144, &yymsp[0].minor.yy144);}
-#line 3152 "parse.c"
+#line 1042 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Reindex(pParse, 0, 0);}
+#line 3179 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 303:
-#line 1025 "parse.y"
-{sqlite3Analyze(pParse, 0, 0);}
-#line 3157 "parse.c"
+#line 1043 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Reindex(pParse, &yymsp[-1].minor.yy198, &yymsp[0].minor.yy198);}
+#line 3184 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 304:
-#line 1026 "parse.y"
-{sqlite3Analyze(pParse, &yymsp[-1].minor.yy144, &yymsp[0].minor.yy144);}
-#line 3162 "parse.c"
+#line 1048 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Analyze(pParse, 0, 0);}
+#line 3189 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 305:
-#line 1031 "parse.y"
-{
- sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy367,&yymsp[0].minor.yy144);
-}
-#line 3169 "parse.c"
+#line 1049 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{sqlite3Analyze(pParse, &yymsp[-1].minor.yy198, &yymsp[0].minor.yy198);}
+#line 3194 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 306:
-#line 1034 "parse.y"
+#line 1054 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy144);
+ sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy151,&yymsp[0].minor.yy198);
}
-#line 3176 "parse.c"
+#line 3201 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
case 307:
-#line 1037 "parse.y"
+#line 1057 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
+{
+ sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy198);
+}
+#line 3208 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
+ break;
+ case 308:
+#line 1060 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
{
- sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy367);
+ sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy151);
}
-#line 3183 "parse.c"
+#line 3215 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
break;
};
yygoto = yyRuleInfo[yyruleno].lhs;
@@ -3235,7 +3267,7 @@ static void yy_syntax_error(
){
sqlite3ParserARG_FETCH;
#define TOKEN (yyminor.yy0)
-#line 34 "parse.y"
+#line 34 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.y"
if( pParse->zErrMsg==0 ){
if( TOKEN.z[0] ){
@@ -3244,7 +3276,7 @@ static void yy_syntax_error(
sqlite3ErrorMsg(pParse, "incomplete SQL statement");
}
}
-#line 3250 "parse.c"
+#line 3282 "/home/rei/php_dev/php5.1/ext/pdo_sqlite/sqlite/src/parse.c"
sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}
diff --git a/ext/pdo_sqlite/sqlite/src/parse.h b/ext/pdo_sqlite/sqlite/src/parse.h
index c351d4025d..fcedda5896 100644
--- a/ext/pdo_sqlite/sqlite/src/parse.h
+++ b/ext/pdo_sqlite/sqlite/src/parse.h
@@ -6,137 +6,140 @@
#define TK_FUNCTION 6
#define TK_COLUMN 7
#define TK_AGG_FUNCTION 8
-#define TK_CONST_FUNC 9
-#define TK_SEMI 10
-#define TK_EXPLAIN 11
-#define TK_BEGIN 12
-#define TK_TRANSACTION 13
-#define TK_DEFERRED 14
-#define TK_IMMEDIATE 15
-#define TK_EXCLUSIVE 16
-#define TK_COMMIT 17
-#define TK_END 18
-#define TK_ROLLBACK 19
-#define TK_CREATE 20
-#define TK_TABLE 21
-#define TK_TEMP 22
-#define TK_LP 23
-#define TK_RP 24
-#define TK_AS 25
-#define TK_COMMA 26
-#define TK_ID 27
-#define TK_ABORT 28
-#define TK_AFTER 29
-#define TK_ANALYZE 30
-#define TK_ASC 31
-#define TK_ATTACH 32
-#define TK_BEFORE 33
-#define TK_CASCADE 34
-#define TK_CAST 35
-#define TK_CONFLICT 36
-#define TK_DATABASE 37
-#define TK_DESC 38
-#define TK_DETACH 39
-#define TK_EACH 40
-#define TK_FAIL 41
-#define TK_FOR 42
-#define TK_IGNORE 43
-#define TK_INITIALLY 44
-#define TK_INSTEAD 45
-#define TK_LIKE_KW 46
-#define TK_MATCH 47
-#define TK_KEY 48
-#define TK_OF 49
-#define TK_OFFSET 50
-#define TK_PRAGMA 51
-#define TK_RAISE 52
-#define TK_REPLACE 53
-#define TK_RESTRICT 54
-#define TK_ROW 55
-#define TK_STATEMENT 56
-#define TK_TRIGGER 57
-#define TK_VACUUM 58
-#define TK_VIEW 59
-#define TK_REINDEX 60
-#define TK_RENAME 61
-#define TK_CTIME_KW 62
-#define TK_ALTER 63
-#define TK_OR 64
-#define TK_AND 65
-#define TK_NOT 66
-#define TK_IS 67
-#define TK_BETWEEN 68
-#define TK_IN 69
-#define TK_ISNULL 70
-#define TK_NOTNULL 71
-#define TK_NE 72
-#define TK_EQ 73
-#define TK_GT 74
-#define TK_LE 75
-#define TK_LT 76
-#define TK_GE 77
-#define TK_ESCAPE 78
-#define TK_BITAND 79
-#define TK_BITOR 80
-#define TK_LSHIFT 81
-#define TK_RSHIFT 82
-#define TK_PLUS 83
-#define TK_MINUS 84
-#define TK_STAR 85
-#define TK_SLASH 86
-#define TK_REM 87
-#define TK_CONCAT 88
-#define TK_UMINUS 89
-#define TK_UPLUS 90
-#define TK_BITNOT 91
-#define TK_STRING 92
-#define TK_JOIN_KW 93
-#define TK_CONSTRAINT 94
-#define TK_DEFAULT 95
-#define TK_NULL 96
-#define TK_PRIMARY 97
-#define TK_UNIQUE 98
-#define TK_CHECK 99
-#define TK_REFERENCES 100
-#define TK_COLLATE 101
-#define TK_AUTOINCR 102
-#define TK_ON 103
-#define TK_DELETE 104
-#define TK_UPDATE 105
-#define TK_INSERT 106
-#define TK_SET 107
-#define TK_DEFERRABLE 108
-#define TK_FOREIGN 109
-#define TK_DROP 110
-#define TK_UNION 111
-#define TK_ALL 112
-#define TK_INTERSECT 113
-#define TK_EXCEPT 114
-#define TK_SELECT 115
-#define TK_DISTINCT 116
-#define TK_DOT 117
-#define TK_FROM 118
-#define TK_JOIN 119
-#define TK_USING 120
-#define TK_ORDER 121
-#define TK_BY 122
-#define TK_GROUP 123
-#define TK_HAVING 124
-#define TK_LIMIT 125
-#define TK_WHERE 126
-#define TK_INTO 127
-#define TK_VALUES 128
-#define TK_INTEGER 129
-#define TK_FLOAT 130
-#define TK_BLOB 131
-#define TK_REGISTER 132
-#define TK_VARIABLE 133
-#define TK_EXISTS 134
-#define TK_CASE 135
-#define TK_WHEN 136
-#define TK_THEN 137
-#define TK_ELSE 138
-#define TK_INDEX 139
-#define TK_TO 140
-#define TK_ADD 141
-#define TK_COLUMNKW 142
+#define TK_AGG_COLUMN 9
+#define TK_CONST_FUNC 10
+#define TK_SEMI 11
+#define TK_EXPLAIN 12
+#define TK_QUERY 13
+#define TK_PLAN 14
+#define TK_BEGIN 15
+#define TK_TRANSACTION 16
+#define TK_DEFERRED 17
+#define TK_IMMEDIATE 18
+#define TK_EXCLUSIVE 19
+#define TK_COMMIT 20
+#define TK_END 21
+#define TK_ROLLBACK 22
+#define TK_CREATE 23
+#define TK_TABLE 24
+#define TK_TEMP 25
+#define TK_LP 26
+#define TK_RP 27
+#define TK_AS 28
+#define TK_COMMA 29
+#define TK_ID 30
+#define TK_ABORT 31
+#define TK_AFTER 32
+#define TK_ANALYZE 33
+#define TK_ASC 34
+#define TK_ATTACH 35
+#define TK_BEFORE 36
+#define TK_CASCADE 37
+#define TK_CAST 38
+#define TK_CONFLICT 39
+#define TK_DATABASE 40
+#define TK_DESC 41
+#define TK_DETACH 42
+#define TK_EACH 43
+#define TK_FAIL 44
+#define TK_FOR 45
+#define TK_IGNORE 46
+#define TK_INITIALLY 47
+#define TK_INSTEAD 48
+#define TK_LIKE_KW 49
+#define TK_MATCH 50
+#define TK_KEY 51
+#define TK_OF 52
+#define TK_OFFSET 53
+#define TK_PRAGMA 54
+#define TK_RAISE 55
+#define TK_REPLACE 56
+#define TK_RESTRICT 57
+#define TK_ROW 58
+#define TK_STATEMENT 59
+#define TK_TRIGGER 60
+#define TK_VACUUM 61
+#define TK_VIEW 62
+#define TK_REINDEX 63
+#define TK_RENAME 64
+#define TK_CTIME_KW 65
+#define TK_ALTER 66
+#define TK_OR 67
+#define TK_AND 68
+#define TK_NOT 69
+#define TK_IS 70
+#define TK_BETWEEN 71
+#define TK_IN 72
+#define TK_ISNULL 73
+#define TK_NOTNULL 74
+#define TK_NE 75
+#define TK_EQ 76
+#define TK_GT 77
+#define TK_LE 78
+#define TK_LT 79
+#define TK_GE 80
+#define TK_ESCAPE 81
+#define TK_BITAND 82
+#define TK_BITOR 83
+#define TK_LSHIFT 84
+#define TK_RSHIFT 85
+#define TK_PLUS 86
+#define TK_MINUS 87
+#define TK_STAR 88
+#define TK_SLASH 89
+#define TK_REM 90
+#define TK_CONCAT 91
+#define TK_UMINUS 92
+#define TK_UPLUS 93
+#define TK_BITNOT 94
+#define TK_STRING 95
+#define TK_JOIN_KW 96
+#define TK_CONSTRAINT 97
+#define TK_DEFAULT 98
+#define TK_NULL 99
+#define TK_PRIMARY 100
+#define TK_UNIQUE 101
+#define TK_CHECK 102
+#define TK_REFERENCES 103
+#define TK_COLLATE 104
+#define TK_AUTOINCR 105
+#define TK_ON 106
+#define TK_DELETE 107
+#define TK_UPDATE 108
+#define TK_INSERT 109
+#define TK_SET 110
+#define TK_DEFERRABLE 111
+#define TK_FOREIGN 112
+#define TK_DROP 113
+#define TK_UNION 114
+#define TK_ALL 115
+#define TK_INTERSECT 116
+#define TK_EXCEPT 117
+#define TK_SELECT 118
+#define TK_DISTINCT 119
+#define TK_DOT 120
+#define TK_FROM 121
+#define TK_JOIN 122
+#define TK_USING 123
+#define TK_ORDER 124
+#define TK_BY 125
+#define TK_GROUP 126
+#define TK_HAVING 127
+#define TK_LIMIT 128
+#define TK_WHERE 129
+#define TK_INTO 130
+#define TK_VALUES 131
+#define TK_INTEGER 132
+#define TK_FLOAT 133
+#define TK_BLOB 134
+#define TK_REGISTER 135
+#define TK_VARIABLE 136
+#define TK_EXISTS 137
+#define TK_CASE 138
+#define TK_WHEN 139
+#define TK_THEN 140
+#define TK_ELSE 141
+#define TK_INDEX 142
+#define TK_TO 143
+#define TK_ADD 144
+#define TK_COLUMNKW 145
diff --git a/ext/pdo_sqlite/sqlite/src/parse.y b/ext/pdo_sqlite/sqlite/src/parse.y
index c7b661652a..1f16c20a8c 100644
--- a/ext/pdo_sqlite/sqlite/src/parse.y
+++ b/ext/pdo_sqlite/sqlite/src/parse.y
@@ -93,7 +93,7 @@ struct AttachKey { int type; Token key; };
// add them to the parse.h output file.
//
%nonassoc END_OF_FILE ILLEGAL SPACE UNCLOSED_STRING COMMENT FUNCTION
- COLUMN AGG_FUNCTION CONST_FUNC.
+ COLUMN AGG_FUNCTION AGG_COLUMN CONST_FUNC.
// Input is a single SQL command
input ::= cmdlist.
@@ -104,7 +104,8 @@ ecmd ::= SEMI.
ecmd ::= explain cmdx SEMI.
explain ::= . { sqlite3BeginParse(pParse, 0); }
%ifndef SQLITE_OMIT_EXPLAIN
-explain ::= EXPLAIN. { sqlite3BeginParse(pParse, 1); }
+explain ::= EXPLAIN. { sqlite3BeginParse(pParse, 1); }
+explain ::= EXPLAIN QUERY PLAN. { sqlite3BeginParse(pParse, 2); }
%endif
///////////////////// Begin and end transactions. ////////////////////////////
@@ -172,7 +173,7 @@ id(A) ::= ID(X). {A = X;}
%fallback ID
ABORT AFTER ANALYZE ASC ATTACH BEFORE BEGIN CASCADE CAST CONFLICT
DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL FOR
- IGNORE IMMEDIATE INITIALLY INSTEAD LIKE_KW MATCH KEY
+ IGNORE IMMEDIATE INITIALLY INSTEAD LIKE_KW MATCH PLAN QUERY KEY
OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW STATEMENT
TEMP TRIGGER VACUUM VIEW
%ifdef SQLITE_OMIT_COMPOUND_SELECT
@@ -660,9 +661,12 @@ expr(A) ::= CAST(X) LP expr(E) AS typetoken(T) RP(Y). {
sqlite3ExprSpan(A,&X,&Y);
}
%endif // SQLITE_OMIT_CAST
-expr(A) ::= ID(X) LP exprlist(Y) RP(E). {
+expr(A) ::= ID(X) LP distinct(D) exprlist(Y) RP(E). {
A = sqlite3ExprFunction(Y, &X);
sqlite3ExprSpan(A,&X,&E);
+ if( D ){
+ A->flags |= EP_Distinct;
+ }
}
expr(A) ::= ID(X) LP STAR RP(E). {
A = sqlite3ExprFunction(0, &X);
@@ -752,7 +756,11 @@ expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
ExprList *pList = sqlite3ExprListAppend(0, X, 0);
pList = sqlite3ExprListAppend(pList, Y, 0);
A = sqlite3Expr(TK_BETWEEN, W, 0, 0);
- if( A ) A->pList = pList;
+ if( A ){
+ A->pList = pList;
+ }else{
+ sqlite3ExprListDelete(pList);
+ }
if( N ) A = sqlite3Expr(TK_NOT, A, 0, 0);
sqlite3ExprSpan(A,&W->span,&Y->span);
}
@@ -772,21 +780,31 @@ expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
}
expr(A) ::= LP(B) select(X) RP(E). {
A = sqlite3Expr(TK_SELECT, 0, 0, 0);
- if( A ) A->pSelect = X;
- if( !A ) sqlite3SelectDelete(X);
+ if( A ){
+ A->pSelect = X;
+ }else{
+ sqlite3SelectDelete(X);
+ }
sqlite3ExprSpan(A,&B,&E);
}
expr(A) ::= expr(X) in_op(N) LP select(Y) RP(E). [IN] {
A = sqlite3Expr(TK_IN, X, 0, 0);
- if( A ) A->pSelect = Y;
- if( !A ) sqlite3SelectDelete(Y);
+ if( A ){
+ A->pSelect = Y;
+ }else{
+ sqlite3SelectDelete(Y);
+ }
if( N ) A = sqlite3Expr(TK_NOT, A, 0, 0);
sqlite3ExprSpan(A,&X->span,&E);
}
expr(A) ::= expr(X) in_op(N) nm(Y) dbnm(Z). [IN] {
SrcList *pSrc = sqlite3SrcListAppend(0,&Y,&Z);
A = sqlite3Expr(TK_IN, X, 0, 0);
- if( A ) A->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0);
+ if( A ){
+ A->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0);
+ }else{
+ sqlite3SrcListDelete(pSrc);
+ }
if( N ) A = sqlite3Expr(TK_NOT, A, 0, 0);
sqlite3ExprSpan(A,&X->span,Z.z?&Z:&Y);
}
@@ -795,15 +813,20 @@ expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
if( p ){
p->pSelect = Y;
sqlite3ExprSpan(p,&B,&E);
+ }else{
+ sqlite3SelectDelete(Y);
}
- if( !p ) sqlite3SelectDelete(Y);
}
%endif // SQLITE_OMIT_SUBQUERY
/* CASE expressions */
expr(A) ::= CASE(C) case_operand(X) case_exprlist(Y) case_else(Z) END(E). {
A = sqlite3Expr(TK_CASE, X, Z, 0);
- if( A ) A->pList = Y;
+ if( A ){
+ A->pList = Y;
+ }else{
+ sqlite3ExprListDelete(Y);
+ }
sqlite3ExprSpan(A, &C, &E);
}
%type case_exprlist {ExprList*}
diff --git a/ext/pdo_sqlite/sqlite/src/pragma.c b/ext/pdo_sqlite/sqlite/src/pragma.c
index 839488e862..e366401d26 100644
--- a/ext/pdo_sqlite/sqlite/src/pragma.c
+++ b/ext/pdo_sqlite/sqlite/src/pragma.c
@@ -626,14 +626,6 @@ void sqlite3Pragma(
if( sqlite3StrICmp(zLeft, "integrity_check")==0 ){
int i, j, addr;
- /* Code that initializes the integrity check program. Set the
- ** error count 0
- */
- static const VdbeOpList initCode[] = {
- { OP_Integer, 0, 0, 0},
- { OP_MemStore, 0, 1, 0},
- };
-
/* Code that appears at the end of the integrity check. If no error
** messages have been generated, output OK. Otherwise output the
** error message
@@ -650,7 +642,7 @@ void sqlite3Pragma(
if( sqlite3ReadSchema(pParse) ) goto pragma_out;
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, "integrity_check", P3_STATIC);
- sqlite3VdbeAddOpList(v, ArraySize(initCode), initCode);
+ sqlite3VdbeAddOp(v, OP_MemInt, 0, 0); /* Initialize error count to 0 */
/* Do an integrity check on each database file */
for(i=0; i<db->nDb; i++){
@@ -696,8 +688,7 @@ void sqlite3Pragma(
if( pTab->pIndex==0 ) continue;
sqlite3OpenTableAndIndices(pParse, pTab, 1, OP_OpenRead);
- sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
- sqlite3VdbeAddOp(v, OP_MemStore, 1, 1);
+ sqlite3VdbeAddOp(v, OP_MemInt, 0, 1);
loopTop = sqlite3VdbeAddOp(v, OP_Rewind, 1, 0);
sqlite3VdbeAddOp(v, OP_MemIncr, 1, 0);
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
@@ -715,39 +706,38 @@ void sqlite3Pragma(
jmp2 = sqlite3VdbeAddOp(v, OP_Found, j+2, 0);
addr = sqlite3VdbeAddOpList(v, ArraySize(idxErr), idxErr);
sqlite3VdbeChangeP3(v, addr+4, pIdx->zName, P3_STATIC);
- sqlite3VdbeChangeP2(v, jmp2, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, jmp2);
}
sqlite3VdbeAddOp(v, OP_Next, 1, loopTop+1);
- sqlite3VdbeChangeP2(v, loopTop, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, loopTop);
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
static const VdbeOpList cntIdx[] = {
- { OP_Integer, 0, 0, 0},
- { OP_MemStore, 2, 1, 0},
- { OP_Rewind, 0, 0, 0}, /* 2 */
+ { OP_MemInt, 0, 2, 0},
+ { OP_Rewind, 0, 0, 0}, /* 1 */
{ OP_MemIncr, 2, 0, 0},
- { OP_Next, 0, 0, 0}, /* 4 */
+ { OP_Next, 0, 0, 0}, /* 3 */
{ OP_MemLoad, 1, 0, 0},
{ OP_MemLoad, 2, 0, 0},
- { OP_Eq, 0, 0, 0}, /* 7 */
+ { OP_Eq, 0, 0, 0}, /* 6 */
{ OP_MemIncr, 0, 0, 0},
{ OP_String8, 0, 0, "wrong # of entries in index "},
- { OP_String8, 0, 0, 0}, /* 10 */
+ { OP_String8, 0, 0, 0}, /* 9 */
{ OP_Concat, 0, 0, 0},
{ OP_Callback, 1, 0, 0},
};
if( pIdx->tnum==0 ) continue;
addr = sqlite3VdbeAddOpList(v, ArraySize(cntIdx), cntIdx);
- sqlite3VdbeChangeP1(v, addr+2, j+2);
- sqlite3VdbeChangeP2(v, addr+2, addr+5);
- sqlite3VdbeChangeP1(v, addr+4, j+2);
- sqlite3VdbeChangeP2(v, addr+4, addr+3);
- sqlite3VdbeChangeP2(v, addr+7, addr+ArraySize(cntIdx));
- sqlite3VdbeChangeP3(v, addr+10, pIdx->zName, P3_STATIC);
+ sqlite3VdbeChangeP1(v, addr+1, j+2);
+ sqlite3VdbeChangeP2(v, addr+1, addr+4);
+ sqlite3VdbeChangeP1(v, addr+3, j+2);
+ sqlite3VdbeChangeP2(v, addr+3, addr+2);
+ sqlite3VdbeJumpHere(v, addr+6);
+ sqlite3VdbeChangeP3(v, addr+9, pIdx->zName, P3_STATIC);
}
}
}
addr = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode);
- sqlite3VdbeChangeP2(v, addr+2, addr+ArraySize(endCode));
+ sqlite3VdbeJumpHere(v, addr+2);
}else
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
@@ -903,13 +893,13 @@ void sqlite3Pragma(
Btree *pBt;
Pager *pPager;
if( db->aDb[i].zName==0 ) continue;
- sqlite3VdbeOp3(v, OP_String, 0, 0, db->aDb[i].zName, P3_STATIC);
+ sqlite3VdbeOp3(v, OP_String8, 0, 0, db->aDb[i].zName, P3_STATIC);
pBt = db->aDb[i].pBt;
if( pBt==0 || (pPager = sqlite3BtreePager(pBt))==0 ){
- sqlite3VdbeOp3(v, OP_String, 0, 0, "closed", P3_STATIC);
+ sqlite3VdbeOp3(v, OP_String8, 0, 0, "closed", P3_STATIC);
}else{
int j = sqlite3pager_lockstate(pPager);
- sqlite3VdbeOp3(v, OP_String, 0, 0,
+ sqlite3VdbeOp3(v, OP_String8, 0, 0,
(j>=0 && j<=4) ? azLockName[j] : "unknown", P3_STATIC);
}
sqlite3VdbeAddOp(v, OP_Callback, 2, 0);
diff --git a/ext/pdo_sqlite/sqlite/src/prepare.c b/ext/pdo_sqlite/sqlite/src/prepare.c
index 628afbd991..ad7c712789 100644
--- a/ext/pdo_sqlite/sqlite/src/prepare.c
+++ b/ext/pdo_sqlite/sqlite/src/prepare.c
@@ -458,12 +458,19 @@ int sqlite3_prepare(
#ifndef SQLITE_OMIT_EXPLAIN
if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){
- sqlite3VdbeSetNumCols(sParse.pVdbe, 5);
- sqlite3VdbeSetColName(sParse.pVdbe, 0, "addr", P3_STATIC);
- sqlite3VdbeSetColName(sParse.pVdbe, 1, "opcode", P3_STATIC);
- sqlite3VdbeSetColName(sParse.pVdbe, 2, "p1", P3_STATIC);
- sqlite3VdbeSetColName(sParse.pVdbe, 3, "p2", P3_STATIC);
- sqlite3VdbeSetColName(sParse.pVdbe, 4, "p3", P3_STATIC);
+ if( sParse.explain==2 ){
+ sqlite3VdbeSetNumCols(sParse.pVdbe, 3);
+ sqlite3VdbeSetColName(sParse.pVdbe, 0, "order", P3_STATIC);
+ sqlite3VdbeSetColName(sParse.pVdbe, 1, "from", P3_STATIC);
+ sqlite3VdbeSetColName(sParse.pVdbe, 2, "detail", P3_STATIC);
+ }else{
+ sqlite3VdbeSetNumCols(sParse.pVdbe, 5);
+ sqlite3VdbeSetColName(sParse.pVdbe, 0, "addr", P3_STATIC);
+ sqlite3VdbeSetColName(sParse.pVdbe, 1, "opcode", P3_STATIC);
+ sqlite3VdbeSetColName(sParse.pVdbe, 2, "p1", P3_STATIC);
+ sqlite3VdbeSetColName(sParse.pVdbe, 3, "p2", P3_STATIC);
+ sqlite3VdbeSetColName(sParse.pVdbe, 4, "p3", P3_STATIC);
+ }
}
#endif
diff --git a/ext/pdo_sqlite/sqlite/src/printf.c b/ext/pdo_sqlite/sqlite/src/printf.c
index d4cb66499f..a669eb8d44 100644
--- a/ext/pdo_sqlite/sqlite/src/printf.c
+++ b/ext/pdo_sqlite/sqlite/src/printf.c
@@ -163,7 +163,15 @@ static int et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){
}
#endif
-#define etBUFSIZE 1000 /* Size of the output buffer */
+/*
+** On machines with a small stack size, you can redefine the
+** SQLITE_PRINT_BUF_SIZE to be less than 350. But beware - for
+** smaller values some %f conversions may go into an infinite loop.
+*/
+#ifndef SQLITE_PRINT_BUF_SIZE
+# define SQLITE_PRINT_BUF_SIZE 350
+#endif
+#define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */
/*
** The root program. All variations call this core.
@@ -440,9 +448,9 @@ static int vxprintf(
/* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
exp = 0;
if( realvalue>0.0 ){
- while( realvalue>1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; }
- while( realvalue>1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }
- while( realvalue>10.0 && exp<=350 ){ realvalue *= 0.1; exp++; }
+ while( realvalue>=1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; }
+ while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }
+ while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; }
while( realvalue<1e-8 && exp>=-350 ){ realvalue *= 1e8; exp-=8; }
while( realvalue<1.0 && exp>=-350 ){ realvalue *= 10.0; exp--; }
if( exp>350 || exp<-350 ){
@@ -718,7 +726,11 @@ static void mout(void *arg, const char *zNewText, int nNewChar){
memcpy(pM->zText, pM->zBase, pM->nChar);
}
}else{
- pM->zText = pM->xRealloc(pM->zText, pM->nAlloc);
+ char *zNew;
+ zNew = pM->xRealloc(pM->zText, pM->nAlloc);
+ if( zNew ){
+ pM->zText = zNew;
+ }
}
}
}
@@ -756,7 +768,10 @@ static char *base_vprintf(
memcpy(sM.zText, sM.zBase, sM.nChar+1);
}
}else if( sM.nAlloc>sM.nChar+10 ){
- sM.zText = xRealloc(sM.zText, sM.nChar+1);
+ char *zNew = xRealloc(sM.zText, sM.nChar+1);
+ if( zNew ){
+ sM.zText = zNew;
+ }
}
}
return sM.zText;
@@ -774,7 +789,7 @@ static void *printf_realloc(void *old, int size){
** %-conversion extensions.
*/
char *sqlite3VMPrintf(const char *zFormat, va_list ap){
- char zBase[1000];
+ char zBase[SQLITE_PRINT_BUF_SIZE];
return base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap);
}
@@ -785,7 +800,7 @@ char *sqlite3VMPrintf(const char *zFormat, va_list ap){
char *sqlite3MPrintf(const char *zFormat, ...){
va_list ap;
char *z;
- char zBase[1000];
+ char zBase[SQLITE_PRINT_BUF_SIZE];
va_start(ap, zFormat);
z = base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap);
va_end(ap);
diff --git a/ext/pdo_sqlite/sqlite/src/select.c b/ext/pdo_sqlite/sqlite/src/select.c
index a4eb3fca4a..8a51208d79 100644
--- a/ext/pdo_sqlite/sqlite/src/select.c
+++ b/ext/pdo_sqlite/sqlite/src/select.c
@@ -60,6 +60,9 @@ Select *sqlite3SelectNew(
pNew->pOffset = pOffset;
pNew->iLimit = -1;
pNew->iOffset = -1;
+ pNew->addrOpenVirt[0] = -1;
+ pNew->addrOpenVirt[1] = -1;
+ pNew->addrOpenVirt[2] = -1;
}
return pNew;
}
@@ -70,6 +73,7 @@ Select *sqlite3SelectNew(
** in terms of the following bit values:
**
** JT_INNER
+** JT_CROSS
** JT_OUTER
** JT_NATURAL
** JT_LEFT
@@ -95,7 +99,7 @@ int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){
{ "full", 4, JT_LEFT|JT_RIGHT|JT_OUTER },
{ "outer", 5, JT_OUTER },
{ "inner", 5, JT_INNER },
- { "cross", 5, JT_INNER },
+ { "cross", 5, JT_INNER|JT_CROSS },
};
int i, j;
apAll[0] = pA;
@@ -175,6 +179,7 @@ static void addWhereTerm(
const char *zAlias1, /* Alias for first table. May be NULL */
const Table *pTab2, /* Second table */
const char *zAlias2, /* Alias for second table. May be NULL */
+ int iRightJoinTable, /* VDBE cursor for the right table */
Expr **ppExpr /* Add the equality term to this expression */
){
Expr *pE1a, *pE1b, *pE1c;
@@ -195,11 +200,14 @@ static void addWhereTerm(
pE2c = sqlite3Expr(TK_DOT, pE2b, pE2a, 0);
pE = sqlite3Expr(TK_EQ, pE1c, pE2c, 0);
ExprSetProperty(pE, EP_FromJoin);
+ pE->iRightJoinTable = iRightJoinTable;
*ppExpr = sqlite3ExprAnd(*ppExpr, pE);
}
/*
** Set the EP_FromJoin property on all terms of the given expression.
+** And set the Expr.iRightJoinTable to iTable for every term in the
+** expression.
**
** The EP_FromJoin property is used on terms of an expression to tell
** the LEFT OUTER JOIN processing logic that this term is part of the
@@ -207,11 +215,26 @@ static void addWhereTerm(
** of the more general WHERE clause. These terms are moved over to the
** WHERE clause during join processing but we need to remember that they
** originated in the ON or USING clause.
+**
+** The Expr.iRightJoinTable tells the WHERE clause processing that the
+** expression depends on table iRightJoinTable even if that table is not
+** explicitly mentioned in the expression. That information is needed
+** for cases like this:
+**
+** SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5
+**
+** The where clause needs to defer the handling of the t1.x=5
+** term until after the t2 loop of the join. In that way, a
+** NULL t2 row will be inserted whenever t1.x!=5. If we do not
+** defer the handling of t1.x=5, it will be processed immediately
+** after the t1 loop and rows with t1.x!=5 will never appear in
+** the output, which is incorrect.
*/
-static void setJoinExpr(Expr *p){
+static void setJoinExpr(Expr *p, int iTable){
while( p ){
ExprSetProperty(p, EP_FromJoin);
- setJoinExpr(p->pLeft);
+ p->iRightJoinTable = iTable;
+ setJoinExpr(p->pLeft, iTable);
p = p->pRight;
}
}
@@ -258,7 +281,9 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){
char *zName = pLeftTab->aCol[j].zName;
if( columnIndex(pRightTab, zName)>=0 ){
addWhereTerm(zName, pLeftTab, pLeft->zAlias,
- pRightTab, pRight->zAlias, &p->pWhere);
+ pRightTab, pRight->zAlias,
+ pRight->iCursor, &p->pWhere);
+
}
}
}
@@ -275,7 +300,7 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){
** an AND operator.
*/
if( pLeft->pOn ){
- setJoinExpr(pLeft->pOn);
+ setJoinExpr(pLeft->pOn, pRight->iCursor);
p->pWhere = sqlite3ExprAnd(p->pWhere, pLeft->pOn);
pLeft->pOn = 0;
}
@@ -297,7 +322,8 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){
return 1;
}
addWhereTerm(zName, pLeftTab, pLeft->zAlias,
- pRightTab, pRight->zAlias, &p->pWhere);
+ pRightTab, pRight->zAlias,
+ pRight->iCursor, &p->pWhere);
}
}
}
@@ -327,8 +353,10 @@ void sqlite3SelectDelete(Select *p){
*/
static void pushOntoSorter(Parse *pParse, Vdbe *v, ExprList *pOrderBy){
sqlite3ExprCodeExprList(pParse, pOrderBy);
- sqlite3VdbeAddOp(v, OP_MakeRecord, pOrderBy->nExpr, 0);
- sqlite3VdbeAddOp(v, OP_SortInsert, 0, 0);
+ sqlite3VdbeAddOp(v, OP_Sequence, pOrderBy->iECursor, 0);
+ sqlite3VdbeAddOp(v, OP_Pull, pOrderBy->nExpr + 1, 0);
+ sqlite3VdbeAddOp(v, OP_MakeRecord, pOrderBy->nExpr + 2, 0);
+ sqlite3VdbeAddOp(v, OP_IdxInsert, pOrderBy->iECursor, 0);
}
/*
@@ -341,7 +369,7 @@ static void codeLimiter(
int iBreak, /* Jump here to end the loop */
int nPop /* Number of times to pop stack when jumping */
){
- if( p->iOffset>=0 ){
+ if( p->iOffset>=0 && iContinue!=0 ){
int addr = sqlite3VdbeCurrentAddr(v) + 3;
if( nPop>0 ) addr++;
sqlite3VdbeAddOp(v, OP_MemIncr, p->iOffset, 0);
@@ -352,13 +380,41 @@ static void codeLimiter(
sqlite3VdbeAddOp(v, OP_Goto, 0, iContinue);
VdbeComment((v, "# skip OFFSET records"));
}
- if( p->iLimit>=0 ){
+ if( p->iLimit>=0 && iBreak!=0 ){
sqlite3VdbeAddOp(v, OP_MemIncr, p->iLimit, iBreak);
VdbeComment((v, "# exit when LIMIT reached"));
}
}
/*
+** Add code that will check to make sure the top N elements of the
+** stack are distinct. iTab is a sorting index that holds previously
+** seen combinations of the N values. A new entry is made in iTab
+** if the current N values are new.
+**
+** A jump to addrRepeat is made and the K values are popped from the
+** stack if the top N elements are not distinct.
+*/
+static void codeDistinct(
+ Vdbe *v, /* Generate code into this VM */
+ int iTab, /* A sorting index used to test for distinctness */
+ int addrRepeat, /* Jump to here if not distinct */
+ int N, /* The top N elements of the stack must be distinct */
+ int K /* Pop K elements from the stack if indistinct */
+){
+#if NULL_ALWAYS_DISTINCT
+ sqlite3VdbeAddOp(v, OP_IsNull, -N, sqlite3VdbeCurrentAddr(v)+6);
+#endif
+ sqlite3VdbeAddOp(v, OP_MakeRecord, -N, 0);
+ sqlite3VdbeAddOp(v, OP_Distinct, iTab, sqlite3VdbeCurrentAddr(v)+3);
+ sqlite3VdbeAddOp(v, OP_Pop, K, 0);
+ sqlite3VdbeAddOp(v, OP_Goto, 0, addrRepeat);
+ VdbeComment((v, "# skip indistinct records"));
+ sqlite3VdbeAddOp(v, OP_IdxInsert, iTab, 0);
+}
+
+
+/*
** This routine generates the code for the inside of the inner loop
** of a SELECT.
**
@@ -413,30 +469,22 @@ static int selectInnerLoop(
*/
if( hasDistinct ){
int n = pEList->nExpr;
-#if NULL_ALWAYS_DISTINCT
- sqlite3VdbeAddOp(v, OP_IsNull, -pEList->nExpr, sqlite3VdbeCurrentAddr(v)+7);
-#endif
- /* Deliberately leave the affinity string off of the following
- ** OP_MakeRecord */
- sqlite3VdbeAddOp(v, OP_MakeRecord, -n, 0);
- sqlite3VdbeAddOp(v, OP_Distinct, distinct, sqlite3VdbeCurrentAddr(v)+3);
- sqlite3VdbeAddOp(v, OP_Pop, n+1, 0);
- sqlite3VdbeAddOp(v, OP_Goto, 0, iContinue);
- VdbeComment((v, "# skip indistinct records"));
- sqlite3VdbeAddOp(v, OP_IdxInsert, distinct, 0);
+ codeDistinct(v, distinct, iContinue, n, n+1);
if( pOrderBy==0 ){
codeLimiter(v, p, iContinue, iBreak, nColumn);
}
}
switch( eDest ){
-#ifndef SQLITE_OMIT_COMPOUND_SELECT
/* In this mode, write each query result to the key of the temporary
** table iParm.
*/
+#ifndef SQLITE_OMIT_COMPOUND_SELECT
case SRT_Union: {
sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, NULL_ALWAYS_DISTINCT);
- sqlite3VdbeChangeP3(v, -1, aff, P3_STATIC);
+ if( aff ){
+ sqlite3VdbeChangeP3(v, -1, aff, P3_STATIC);
+ }
sqlite3VdbeAddOp(v, OP_IdxInsert, iParm, 0);
break;
}
@@ -458,7 +506,7 @@ static int selectInnerLoop(
/* Store the result as data using a unique key.
*/
case SRT_Table:
- case SRT_TempTable: {
+ case SRT_VirtualTab: {
sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, 0);
if( pOrderBy ){
pushOntoSorter(pParse, v, pOrderBy);
@@ -484,6 +532,10 @@ static int selectInnerLoop(
sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
addr2 = sqlite3VdbeAddOp(v, OP_Goto, 0, 0);
if( pOrderBy ){
+ /* At first glance you would think we could optimize out the
+ ** ORDER BY in this case since the order of entries in the set
+ ** does not matter. But there might be a LIMIT clause, in which
+ ** case the order does matter */
pushOntoSorter(pParse, v, pOrderBy);
}else{
char aff = (iParm>>16)&0xFF;
@@ -491,7 +543,7 @@ static int selectInnerLoop(
sqlite3VdbeOp3(v, OP_MakeRecord, 1, 0, &aff, 1);
sqlite3VdbeAddOp(v, OP_IdxInsert, (iParm&0x0000FFFF), 0);
}
- sqlite3VdbeChangeP2(v, addr2, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, addr2);
break;
}
@@ -517,15 +569,13 @@ static int selectInnerLoop(
** popping the data from the stack.
*/
case SRT_Subroutine:
- case SRT_Callback:
- case SRT_Sorter: {
+ case SRT_Callback: {
if( pOrderBy ){
sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, 0);
pushOntoSorter(pParse, v, pOrderBy);
}else if( eDest==SRT_Subroutine ){
sqlite3VdbeAddOp(v, OP_Gosub, 0, iParm);
}else{
- assert( eDest!=SRT_Sorter );
sqlite3VdbeAddOp(v, OP_Callback, nColumn, 0);
}
break;
@@ -548,6 +598,48 @@ static int selectInnerLoop(
}
/*
+** Given an expression list, generate a KeyInfo structure that records
+** the collating sequence for each expression in that expression list.
+**
+** If the ExprList is an ORDER BY or GROUP BY clause then the resulting
+** KeyInfo structure is appropriate for initializing a virtual index to
+** implement that clause. If the ExprList is the result set of a SELECT
+** then the KeyInfo structure is appropriate for initializing a virtual
+** index to implement a DISTINCT test.
+**
+** Space to hold the KeyInfo structure is obtain from malloc. The calling
+** function is responsible for seeing that this structure is eventually
+** freed. Add the KeyInfo structure to the P3 field of an opcode using
+** P3_KEYINFO_HANDOFF is the usual way of dealing with this.
+*/
+static KeyInfo *keyInfoFromExprList(Parse *pParse, ExprList *pList){
+ sqlite3 *db = pParse->db;
+ int nExpr;
+ KeyInfo *pInfo;
+ struct ExprList_item *pItem;
+ int i;
+
+ nExpr = pList->nExpr;
+ pInfo = sqliteMalloc( sizeof(*pInfo) + nExpr*(sizeof(CollSeq*)+1) );
+ if( pInfo ){
+ pInfo->aSortOrder = (char*)&pInfo->aColl[nExpr];
+ pInfo->nField = nExpr;
+ pInfo->enc = db->enc;
+ for(i=0, pItem=pList->a; i<nExpr; i++, pItem++){
+ CollSeq *pColl;
+ pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
+ if( !pColl ){
+ pColl = db->pDfltColl;
+ }
+ pInfo->aColl[i] = pColl;
+ pInfo->aSortOrder[i] = pItem->sortOrder;
+ }
+ }
+ return pInfo;
+}
+
+
+/*
** If the inner loop was generated using a non-null pOrderBy argument,
** then the results were placed in a sorter. After the loop is terminated
** we need to run the sorter and output the results. The following
@@ -561,38 +653,19 @@ static void generateSortTail(
int eDest, /* Write the sorted results here */
int iParm /* Optional parameter associated with eDest */
){
- int end1 = sqlite3VdbeMakeLabel(v);
- int end2 = sqlite3VdbeMakeLabel(v);
+ int brk = sqlite3VdbeMakeLabel(v);
+ int cont = sqlite3VdbeMakeLabel(v);
int addr;
- KeyInfo *pInfo;
- ExprList *pOrderBy;
- int nCol, i;
- sqlite3 *db = pParse->db;
+ int iTab;
+ ExprList *pOrderBy = p->pOrderBy;
- if( eDest==SRT_Sorter ) return;
- pOrderBy = p->pOrderBy;
- nCol = pOrderBy->nExpr;
- pInfo = sqliteMalloc( sizeof(*pInfo) + nCol*(sizeof(CollSeq*)+1) );
- if( pInfo==0 ) return;
- pInfo->aSortOrder = (char*)&pInfo->aColl[nCol];
- pInfo->nField = nCol;
- for(i=0; i<nCol; i++){
- /* If a collation sequence was specified explicity, then it
- ** is stored in pOrderBy->a[i].zName. Otherwise, use the default
- ** collation type for the expression.
- */
- pInfo->aColl[i] = sqlite3ExprCollSeq(pParse, pOrderBy->a[i].pExpr);
- if( !pInfo->aColl[i] ){
- pInfo->aColl[i] = db->pDfltColl;
- }
- pInfo->aSortOrder[i] = pOrderBy->a[i].sortOrder;
- }
- sqlite3VdbeOp3(v, OP_Sort, 0, 0, (char*)pInfo, P3_KEYINFO_HANDOFF);
- addr = sqlite3VdbeAddOp(v, OP_SortNext, 0, end1);
- codeLimiter(v, p, addr, end2, 1);
+ iTab = pOrderBy->iECursor;
+ addr = 1 + sqlite3VdbeAddOp(v, OP_Sort, iTab, brk);
+ codeLimiter(v, p, cont, brk, 0);
+ sqlite3VdbeAddOp(v, OP_Column, iTab, pOrderBy->nExpr + 1);
switch( eDest ){
case SRT_Table:
- case SRT_TempTable: {
+ case SRT_VirtualTab: {
sqlite3VdbeAddOp(v, OP_NewRowid, iParm, 0);
sqlite3VdbeAddOp(v, OP_Pull, 1, 0);
sqlite3VdbeAddOp(v, OP_Insert, iParm, 0);
@@ -612,7 +685,7 @@ static void generateSortTail(
case SRT_Mem: {
assert( nColumn==1 );
sqlite3VdbeAddOp(v, OP_MemStore, iParm, 1);
- sqlite3VdbeAddOp(v, OP_Goto, 0, end1);
+ sqlite3VdbeAddOp(v, OP_Goto, 0, brk);
break;
}
#endif
@@ -637,11 +710,9 @@ static void generateSortTail(
break;
}
}
- sqlite3VdbeAddOp(v, OP_Goto, 0, addr);
- sqlite3VdbeResolveLabel(v, end2);
- sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
- sqlite3VdbeResolveLabel(v, end1);
- sqlite3VdbeAddOp(v, OP_SortReset, 0, 0);
+ sqlite3VdbeResolveLabel(v, cont);
+ sqlite3VdbeAddOp(v, OP_Next, iTab, addr);
+ sqlite3VdbeResolveLabel(v, brk);
}
/*
@@ -1305,59 +1376,33 @@ static void computeLimitRegisters(Parse *pParse, Select *p){
}
/*
-** Generate VDBE instructions that will open a transient table that
-** will be used for an index or to store keyed results for a compound
-** select. In other words, open a transient table that needs a
-** KeyInfo structure. The number of columns in the KeyInfo is determined
-** by the result set of the SELECT statement in the second argument.
-**
-** Specifically, this routine is called to open an index table for
-** DISTINCT, UNION, INTERSECT and EXCEPT select statements (but not
-** UNION ALL).
-**
-** The value returned is the address of the OP_OpenVirtual instruction.
+** Allocate a virtual index to use for sorting.
*/
-static int openVirtualIndex(Parse *pParse, Select *p, int iTab){
- KeyInfo *pKeyInfo;
- int nColumn;
- sqlite3 *db = pParse->db;
- int i;
- Vdbe *v = pParse->pVdbe;
- int addr;
-
- if( prepSelectStmt(pParse, p) ){
- return 0;
- }
- nColumn = p->pEList->nExpr;
- pKeyInfo = sqliteMalloc( sizeof(*pKeyInfo)+nColumn*sizeof(CollSeq*) );
- if( pKeyInfo==0 ) return 0;
- pKeyInfo->enc = db->enc;
- pKeyInfo->nField = nColumn;
- for(i=0; i<nColumn; i++){
- pKeyInfo->aColl[i] = sqlite3ExprCollSeq(pParse, p->pEList->a[i].pExpr);
- if( !pKeyInfo->aColl[i] ){
- pKeyInfo->aColl[i] = db->pDfltColl;
- }
+static void createSortingIndex(Parse *pParse, Select *p, ExprList *pOrderBy){
+ if( pOrderBy ){
+ int addr;
+ assert( pOrderBy->iECursor==0 );
+ pOrderBy->iECursor = pParse->nTab++;
+ addr = sqlite3VdbeAddOp(pParse->pVdbe, OP_OpenVirtual,
+ pOrderBy->iECursor, pOrderBy->nExpr+1);
+ assert( p->addrOpenVirt[2] == -1 );
+ p->addrOpenVirt[2] = addr;
}
- addr = sqlite3VdbeOp3(v, OP_OpenVirtual, iTab, 0,
- (char*)pKeyInfo, P3_KEYINFO_HANDOFF);
- return addr;
}
-#ifndef SQLITE_OMIT_COMPOUND_SELECT
/*
-** Add the address "addr" to the set of all OpenVirtual opcode addresses
-** that are being accumulated in p->ppOpenVirtual.
+** The opcode at addr is an OP_OpenVirtual that created a sorting
+** index tha we ended up not needing. This routine changes that
+** opcode to OP_Noop.
*/
-static int multiSelectOpenVirtualAddr(Select *p, int addr){
- IdList *pList = *p->ppOpenVirtual = sqlite3IdListAppend(*p->ppOpenVirtual, 0);
- if( pList==0 ){
- return SQLITE_NOMEM;
- }
- pList->a[pList->nId-1].idx = addr;
- return SQLITE_OK;
+static void uncreateSortingIndex(Parse *pParse, int addr){
+ Vdbe *v = pParse->pVdbe;
+ VdbeOp *pOp = sqlite3VdbeGetOp(v, addr);
+ sqlite3VdbeChangeP3(v, addr, 0, 0);
+ pOp->opcode = OP_Noop;
+ pOp->p1 = 0;
+ pOp->p2 = 0;
}
-#endif /* SQLITE_OMIT_COMPOUND_SELECT */
#ifndef SQLITE_OMIT_COMPOUND_SELECT
/*
@@ -1423,10 +1468,10 @@ static int multiSelect(
int rc = SQLITE_OK; /* Success code from a subroutine */
Select *pPrior; /* Another SELECT immediately to our left */
Vdbe *v; /* Generate code to this VDBE */
- IdList *pOpenVirtual = 0;/* OP_OpenVirtual opcodes that need a KeyInfo */
- int aAddr[5]; /* Addresses of SetNumColumns operators */
- int nAddr = 0; /* Number used */
int nCol; /* Number of columns in the result set */
+ ExprList *pOrderBy; /* The ORDER BY clause on p */
+ int aSetP2[2]; /* Set P2 value of these op to number of columns */
+ int nSetP2 = 0; /* Number of slots in aSetP2[] used */
/* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only
** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.
@@ -1436,6 +1481,8 @@ static int multiSelect(
goto multi_select_end;
}
pPrior = p->pPrior;
+ assert( pPrior->pRightmost!=pPrior );
+ assert( pPrior->pRightmost==p->pRightmost );
if( pPrior->pOrderBy ){
sqlite3ErrorMsg(pParse,"ORDER BY clause should come after %s not before",
selectOpName(p->op));
@@ -1457,32 +1504,21 @@ static int multiSelect(
goto multi_select_end;
}
- /* If *p this is the right-most select statement, then initialize
- ** p->ppOpenVirtual to point to pOpenVirtual. If *p is not the right most
- ** statement then p->ppOpenVirtual will have already been initialized
- ** by a prior call to this same procedure. Pass along the pOpenVirtual
- ** pointer to pPrior, the next statement to our left.
- */
- if( p->ppOpenVirtual==0 ){
- p->ppOpenVirtual = &pOpenVirtual;
- }
- pPrior->ppOpenVirtual = p->ppOpenVirtual;
-
/* Create the destination temporary table if necessary
*/
- if( eDest==SRT_TempTable ){
+ if( eDest==SRT_VirtualTab ){
assert( p->pEList );
- sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 0);
- assert( nAddr==0 );
- aAddr[nAddr++] = sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, 0);
+ assert( nSetP2<sizeof(aSetP2)/sizeof(aSetP2[0]) );
+ aSetP2[nSetP2++] = sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 0);
eDest = SRT_Table;
}
/* Generate code for the left and right SELECT statements.
*/
+ pOrderBy = p->pOrderBy;
switch( p->op ){
case TK_ALL: {
- if( p->pOrderBy==0 ){
+ if( pOrderBy==0 ){
assert( !pPrior->pLimit );
pPrior->pLimit = p->pLimit;
pPrior->pOffset = p->pOffset;
@@ -1510,11 +1546,10 @@ static int multiSelect(
int op = 0; /* One of the SRT_ operations to apply to self */
int priorOp; /* The SRT_ operation to apply to prior selects */
Expr *pLimit, *pOffset; /* Saved values of p->nLimit and p->nOffset */
- ExprList *pOrderBy; /* The ORDER BY clause for the right SELECT */
int addr;
priorOp = p->op==TK_ALL ? SRT_Table : SRT_Union;
- if( eDest==priorOp && p->pOrderBy==0 && !p->pLimit && !p->pOffset ){
+ if( eDest==priorOp && pOrderBy==0 && !p->pLimit && !p->pOffset ){
/* We can reuse a temporary table generated by a SELECT to our
** right.
*/
@@ -1524,20 +1559,20 @@ static int multiSelect(
** intermediate results.
*/
unionTab = pParse->nTab++;
- if( p->pOrderBy
- && matchOrderbyToColumn(pParse, p, p->pOrderBy, unionTab, 1) ){
+ if( pOrderBy && matchOrderbyToColumn(pParse, p, pOrderBy, unionTab,1) ){
rc = 1;
goto multi_select_end;
}
addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, unionTab, 0);
- if( p->op!=TK_ALL ){
- rc = multiSelectOpenVirtualAddr(p, addr);
- if( rc!=SQLITE_OK ){
- goto multi_select_end;
- }
+ if( priorOp==SRT_Table ){
+ assert( nSetP2<sizeof(aSetP2)/sizeof(aSetP2[0]) );
+ aSetP2[nSetP2++] = addr;
+ }else{
+ assert( p->addrOpenVirt[0] == -1 );
+ p->addrOpenVirt[0] = addr;
+ p->pRightmost->usesVirt = 1;
}
- assert( nAddr<sizeof(aAddr)/sizeof(aAddr[0]) );
- aAddr[nAddr++] = sqlite3VdbeAddOp(v, OP_SetNumColumns, unionTab, 0);
+ createSortingIndex(pParse, p, pOrderBy);
assert( p->pEList );
}
@@ -1557,8 +1592,8 @@ static int multiSelect(
case TK_ALL: op = SRT_Table; break;
}
p->pPrior = 0;
- pOrderBy = p->pOrderBy;
p->pOrderBy = 0;
+ p->disallowOrderBy = pOrderBy!=0;
pLimit = p->pLimit;
p->pLimit = 0;
pOffset = p->pOffset;
@@ -1591,7 +1626,7 @@ static int multiSelect(
computeLimitRegisters(pParse, p);
iStart = sqlite3VdbeCurrentAddr(v);
rc = selectInnerLoop(pParse, p, p->pEList, unionTab, p->pEList->nExpr,
- p->pOrderBy, -1, eDest, iParm,
+ pOrderBy, -1, eDest, iParm,
iCont, iBreak, 0);
if( rc ){
rc = 1;
@@ -1616,18 +1651,16 @@ static int multiSelect(
*/
tab1 = pParse->nTab++;
tab2 = pParse->nTab++;
- if( p->pOrderBy && matchOrderbyToColumn(pParse,p,p->pOrderBy,tab1,1) ){
+ if( pOrderBy && matchOrderbyToColumn(pParse,p,pOrderBy,tab1,1) ){
rc = 1;
goto multi_select_end;
}
+ createSortingIndex(pParse, p, pOrderBy);
addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, tab1, 0);
- rc = multiSelectOpenVirtualAddr(p, addr);
- if( rc!=SQLITE_OK ){
- goto multi_select_end;
- }
- assert( nAddr<sizeof(aAddr)/sizeof(aAddr[0]) );
- aAddr[nAddr++] = sqlite3VdbeAddOp(v, OP_SetNumColumns, tab1, 0);
+ assert( p->addrOpenVirt[0] == -1 );
+ p->addrOpenVirt[0] = addr;
+ p->pRightmost->usesVirt = 1;
assert( p->pEList );
/* Code the SELECTs to our left into temporary table "tab1".
@@ -1640,12 +1673,8 @@ static int multiSelect(
/* Code the current SELECT into temporary table "tab2"
*/
addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, tab2, 0);
- rc = multiSelectOpenVirtualAddr(p, addr);
- if( rc!=SQLITE_OK ){
- goto multi_select_end;
- }
- assert( nAddr<sizeof(aAddr)/sizeof(aAddr[0]) );
- aAddr[nAddr++] = sqlite3VdbeAddOp(v, OP_SetNumColumns, tab2, 0);
+ assert( p->addrOpenVirt[1] == -1 );
+ p->addrOpenVirt[1] = addr;
p->pPrior = 0;
pLimit = p->pLimit;
p->pLimit = 0;
@@ -1674,7 +1703,7 @@ static int multiSelect(
iStart = sqlite3VdbeAddOp(v, OP_RowKey, tab1, 0);
sqlite3VdbeAddOp(v, OP_NotFound, tab2, iCont);
rc = selectInnerLoop(pParse, p, p->pEList, tab1, p->pEList->nExpr,
- p->pOrderBy, -1, eDest, iParm,
+ pOrderBy, -1, eDest, iParm,
iCont, iBreak, 0);
if( rc ){
rc = 1;
@@ -1703,9 +1732,8 @@ static int multiSelect(
/* Set the number of columns in temporary tables
*/
nCol = p->pEList->nExpr;
- while( nAddr>0 ){
- nAddr--;
- sqlite3VdbeChangeP2(v, aAddr[nAddr], nCol);
+ while( nSetP2 ){
+ sqlite3VdbeChangeP2(v, aSetP2[--nSetP2], nCol);
}
/* Compute collating sequences used by either the ORDER BY clause or
@@ -1718,12 +1746,15 @@ static int multiSelect(
** SELECT might also skip this part if it has no ORDER BY clause and
** no temp tables are required.
*/
- if( p->pOrderBy || (pOpenVirtual && pOpenVirtual->nId>0) ){
+ if( pOrderBy || p->usesVirt ){
int i; /* Loop counter */
KeyInfo *pKeyInfo; /* Collating sequence for the result set */
+ Select *pLoop; /* For looping through SELECT statements */
+ CollSeq **apColl;
+ CollSeq **aCopy;
- assert( p->ppOpenVirtual == &pOpenVirtual );
- pKeyInfo = sqliteMalloc(sizeof(*pKeyInfo)+nCol*sizeof(CollSeq*));
+ assert( p->pRightmost==p );
+ pKeyInfo = sqliteMalloc(sizeof(*pKeyInfo)+nCol*2*sizeof(CollSeq*) + nCol);
if( !pKeyInfo ){
rc = SQLITE_NOMEM;
goto multi_select_end;
@@ -1732,46 +1763,62 @@ static int multiSelect(
pKeyInfo->enc = pParse->db->enc;
pKeyInfo->nField = nCol;
- for(i=0; i<nCol; i++){
- pKeyInfo->aColl[i] = multiSelectCollSeq(pParse, p, i);
- if( !pKeyInfo->aColl[i] ){
- pKeyInfo->aColl[i] = pParse->db->pDfltColl;
+ for(i=0, apColl=pKeyInfo->aColl; i<nCol; i++, apColl++){
+ *apColl = multiSelectCollSeq(pParse, p, i);
+ if( 0==*apColl ){
+ *apColl = pParse->db->pDfltColl;
}
}
- for(i=0; pOpenVirtual && i<pOpenVirtual->nId; i++){
- int p3type = (i==0?P3_KEYINFO_HANDOFF:P3_KEYINFO);
- int addr = pOpenVirtual->a[i].idx;
- sqlite3VdbeChangeP3(v, addr, (char *)pKeyInfo, p3type);
+ for(pLoop=p; pLoop; pLoop=pLoop->pPrior){
+ for(i=0; i<2; i++){
+ int addr = pLoop->addrOpenVirt[i];
+ if( addr<0 ){
+ /* If [0] is unused then [1] is also unused. So we can
+ ** always safely abort as soon as the first unused slot is found */
+ assert( pLoop->addrOpenVirt[1]<0 );
+ break;
+ }
+ sqlite3VdbeChangeP2(v, addr, nCol);
+ sqlite3VdbeChangeP3(v, addr, (char*)pKeyInfo, P3_KEYINFO);
+ }
}
- if( p->pOrderBy ){
- struct ExprList_item *pOrderByTerm = p->pOrderBy->a;
- for(i=0; i<p->pOrderBy->nExpr; i++, pOrderByTerm++){
- Expr *pExpr = pOrderByTerm->pExpr;
- char *zName = pOrderByTerm->zName;
+ if( pOrderBy ){
+ struct ExprList_item *pOTerm = pOrderBy->a;
+ int nExpr = pOrderBy->nExpr;
+ int addr;
+ u8 *pSortOrder;
+
+ aCopy = (CollSeq**)&pKeyInfo[1];
+ pSortOrder = pKeyInfo->aSortOrder = (u8*)&aCopy[nExpr];
+ memcpy(aCopy, pKeyInfo->aColl, nCol*sizeof(CollSeq*));
+ apColl = pKeyInfo->aColl;
+ for(i=0; i<pOrderBy->nExpr; i++, pOTerm++, apColl++, pSortOrder++){
+ Expr *pExpr = pOTerm->pExpr;
+ char *zName = pOTerm->zName;
assert( pExpr->op==TK_COLUMN && pExpr->iColumn<nCol );
- /* assert( !pExpr->pColl ); */
if( zName ){
- pExpr->pColl = sqlite3LocateCollSeq(pParse, zName, -1);
+ *apColl = sqlite3LocateCollSeq(pParse, zName, -1);
}else{
- pExpr->pColl = pKeyInfo->aColl[pExpr->iColumn];
+ *apColl = aCopy[pExpr->iColumn];
}
+ *pSortOrder = pOTerm->sortOrder;
}
+ assert( p->pRightmost==p );
+ assert( p->addrOpenVirt[2]>=0 );
+ addr = p->addrOpenVirt[2];
+ sqlite3VdbeChangeP2(v, addr, p->pEList->nExpr+2);
+ pKeyInfo->nField = pOrderBy->nExpr;
+ sqlite3VdbeChangeP3(v, addr, (char*)pKeyInfo, P3_KEYINFO_HANDOFF);
+ pKeyInfo = 0;
generateSortTail(pParse, p, v, p->pEList->nExpr, eDest, iParm);
}
- if( !pOpenVirtual ){
- /* This happens for UNION ALL ... ORDER BY */
- sqliteFree(pKeyInfo);
- }
+ sqliteFree(pKeyInfo);
}
multi_select_end:
- if( pOpenVirtual ){
- sqlite3IdListDelete(pOpenVirtual);
- }
- p->ppOpenVirtual = 0;
return rc;
}
#endif /* SQLITE_OMIT_COMPOUND_SELECT */
@@ -1947,7 +1994,7 @@ static int flattenSubquery(
return 0;
}
if( p->isDistinct && subqueryIsAgg ) return 0;
- if( p->pOrderBy && pSub->pOrderBy ) return 0;
+ if( (p->disallowOrderBy || p->pOrderBy) && pSub->pOrderBy ) return 0;
/* Restriction 3: If the subquery is a join, make sure the subquery is
** not used as the right operand of an outer join. Examples of why this
@@ -2175,9 +2222,8 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
/* If the output is destined for a temporary table, open that table.
*/
- if( eDest==SRT_TempTable ){
- sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 0);
- sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, 1);
+ if( eDest==SRT_VirtualTab ){
+ sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 1);
}
/* Generating code to find the min or the max. Basically all we have
@@ -2286,6 +2332,7 @@ int sqlite3SelectResolve(
ExprList *pEList; /* Result set. */
int i; /* For-loop variable used in multiple places */
NameContext sNC; /* Local name-context */
+ ExprList *pGroupBy; /* The group by clause */
/* If this routine has run before, return immediately. */
if( p->isResolved ){
@@ -2329,18 +2376,6 @@ int sqlite3SelectResolve(
sNC.pSrcList = p->pSrc;
sNC.pNext = pOuterNC;
- /* NameContext.nDepth stores the depth of recursion for this query. For
- ** an outer query (e.g. SELECT * FROM sqlite_master) this is 1. For
- ** a subquery it is 2. For a subquery of a subquery, 3. And so on.
- ** Parse.nMaxDepth is the maximum depth for any subquery resolved so
- ** far. This is used to determine the number of aggregate contexts
- ** required at runtime.
- */
- sNC.nDepth = (pOuterNC?pOuterNC->nDepth+1:1);
- if( sNC.nDepth>pParse->nMaxDepth ){
- pParse->nMaxDepth = sNC.nDepth;
- }
-
/* Resolve names in the result set. */
pEList = p->pEList;
if( !pEList ) return SQLITE_ERROR;
@@ -2355,7 +2390,8 @@ int sqlite3SelectResolve(
** expression, do not allow aggregates in any of the other expressions.
*/
assert( !p->isAgg );
- if( p->pGroupBy || sNC.hasAgg ){
+ pGroupBy = p->pGroupBy;
+ if( pGroupBy || sNC.hasAgg ){
p->isAgg = 1;
}else{
sNC.allowAgg = 0;
@@ -2363,7 +2399,7 @@ int sqlite3SelectResolve(
/* If a HAVING clause is present, then there must be a GROUP BY clause.
*/
- if( p->pHaving && !p->pGroupBy ){
+ if( p->pHaving && !pGroupBy ){
sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING");
return SQLITE_ERROR;
}
@@ -2380,49 +2416,128 @@ int sqlite3SelectResolve(
if( sqlite3ExprResolveNames(&sNC, p->pWhere) ||
sqlite3ExprResolveNames(&sNC, p->pHaving) ||
processOrderGroupBy(&sNC, p->pOrderBy, "ORDER") ||
- processOrderGroupBy(&sNC, p->pGroupBy, "GROUP")
+ processOrderGroupBy(&sNC, pGroupBy, "GROUP")
){
return SQLITE_ERROR;
}
+ /* Make sure the GROUP BY clause does not contain aggregate functions.
+ */
+ if( pGroupBy ){
+ struct ExprList_item *pItem;
+
+ for(i=0, pItem=pGroupBy->a; i<pGroupBy->nExpr; i++, pItem++){
+ if( ExprHasProperty(pItem->pExpr, EP_Agg) ){
+ sqlite3ErrorMsg(pParse, "aggregate functions are not allowed in "
+ "the GROUP BY clause");
+ return SQLITE_ERROR;
+ }
+ }
+ }
+
return SQLITE_OK;
}
/*
-** An instance of the following struct is used by sqlite3Select()
-** to save aggregate related information from the Parse object
-** at the start of each call and to restore it at the end. See
-** saveAggregateInfo() and restoreAggregateInfo().
-*/
-struct AggregateInfo {
- int nAgg;
- AggExpr *aAgg;
-};
-typedef struct AggregateInfo AggregateInfo;
-
-/*
-** Copy aggregate related information from the Parse structure
-** into the AggregateInfo structure. Zero the aggregate related
-** values in the Parse struct.
+** Reset the aggregate accumulator.
+**
+** The aggregate accumulator is a set of memory cells that hold
+** intermediate results while calculating an aggregate. This
+** routine simply stores NULLs in all of those memory cells.
+*/
+static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){
+ Vdbe *v = pParse->pVdbe;
+ int i;
+ struct AggInfo_func *pFunc;
+ if( pAggInfo->nFunc+pAggInfo->nColumn==0 ){
+ return;
+ }
+ for(i=0; i<pAggInfo->nColumn; i++){
+ sqlite3VdbeAddOp(v, OP_MemNull, pAggInfo->aCol[i].iMem, 0);
+ }
+ for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){
+ sqlite3VdbeAddOp(v, OP_MemNull, pFunc->iMem, 0);
+ if( pFunc->iDistinct>=0 ){
+ Expr *pE = pFunc->pExpr;
+ if( pE->pList==0 || pE->pList->nExpr!=1 ){
+ sqlite3ErrorMsg(pParse, "DISTINCT in aggregate must be followed "
+ "by an expression");
+ pFunc->iDistinct = -1;
+ }else{
+ KeyInfo *pKeyInfo = keyInfoFromExprList(pParse, pE->pList);
+ sqlite3VdbeOp3(v, OP_OpenVirtual, pFunc->iDistinct, 0,
+ (char*)pKeyInfo, P3_KEYINFO_HANDOFF);
+ }
+ }
+ }
+}
+
+/*
+** Invoke the OP_AggFinalize opcode for every aggregate function
+** in the AggInfo structure.
*/
-static void saveAggregateInfo(Parse *pParse, AggregateInfo *pInfo){
- pInfo->aAgg = pParse->aAgg;
- pInfo->nAgg = pParse->nAgg;
- pParse->aAgg = 0;
- pParse->nAgg = 0;
+static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){
+ Vdbe *v = pParse->pVdbe;
+ int i;
+ struct AggInfo_func *pF;
+ for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
+ ExprList *pList = pF->pExpr->pList;
+ sqlite3VdbeOp3(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0,
+ (void*)pF->pFunc, P3_FUNCDEF);
+ }
}
/*
-** Copy aggregate related information from the AggregateInfo struct
-** back into the Parse structure. The aggregate related information
-** currently stored in the Parse structure is deleted.
+** Update the accumulator memory cells for an aggregate based on
+** the current cursor position.
*/
-static void restoreAggregateInfo(Parse *pParse, AggregateInfo *pInfo){
- sqliteFree(pParse->aAgg);
- pParse->aAgg = pInfo->aAgg;
- pParse->nAgg = pInfo->nAgg;
+static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
+ Vdbe *v = pParse->pVdbe;
+ int i;
+ struct AggInfo_func *pF;
+ struct AggInfo_col *pC;
+
+ pAggInfo->directMode = 1;
+ for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
+ int nArg;
+ int addrNext = 0;
+ ExprList *pList = pF->pExpr->pList;
+ if( pList ){
+ nArg = pList->nExpr;
+ sqlite3ExprCodeExprList(pParse, pList);
+ }else{
+ nArg = 0;
+ }
+ if( pF->iDistinct>=0 ){
+ addrNext = sqlite3VdbeMakeLabel(v);
+ assert( nArg==1 );
+ codeDistinct(v, pF->iDistinct, addrNext, 1, 2);
+ }
+ if( pF->pFunc->needCollSeq ){
+ CollSeq *pColl = 0;
+ struct ExprList_item *pItem;
+ int j;
+ for(j=0, pItem=pList->a; !pColl && j<pList->nExpr; j++, pItem++){
+ pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
+ }
+ if( !pColl ){
+ pColl = pParse->db->pDfltColl;
+ }
+ sqlite3VdbeOp3(v, OP_CollSeq, 0, 0, (char *)pColl, P3_COLLSEQ);
+ }
+ sqlite3VdbeOp3(v, OP_AggStep, pF->iMem, nArg, (void*)pF->pFunc, P3_FUNCDEF);
+ if( addrNext ){
+ sqlite3VdbeResolveLabel(v, addrNext);
+ }
+ }
+ for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
+ sqlite3ExprCode(pParse, pC->pExpr);
+ sqlite3VdbeAddOp(v, OP_MemStore, pC->iMem, 1);
+ }
+ pAggInfo->directMode = 0;
}
-
+
+
/*
** Generate code for the given SELECT statement.
**
@@ -2485,9 +2600,9 @@ int sqlite3Select(
int *pParentAgg, /* True if pParent uses aggregate functions */
char *aff /* If eDest is SRT_Union, the affinity string */
){
- int i;
- WhereInfo *pWInfo;
- Vdbe *v;
+ int i, j; /* Loop counters */
+ WhereInfo *pWInfo; /* Return from sqlite3WhereBegin() */
+ Vdbe *v; /* The virtual machine under construction */
int isAgg; /* True for select lists like "count(*)" */
ExprList *pEList; /* List of columns to extract. */
SrcList *pTabList; /* List of tables to select from */
@@ -2498,22 +2613,29 @@ int sqlite3Select(
int isDistinct; /* True if the DISTINCT keyword is present */
int distinct; /* Table to use for the distinct set */
int rc = 1; /* Value to return from this function */
- AggregateInfo sAggInfo;
+ int addrSortIndex; /* Address of an OP_OpenVirtual instruction */
+ AggInfo sAggInfo; /* Information used by aggregate queries */
if( sqlite3_malloc_failed || pParse->nErr || p==0 ) return 1;
if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
+ memset(&sAggInfo, 0, sizeof(sAggInfo));
#ifndef SQLITE_OMIT_COMPOUND_SELECT
/* If there is are a sequence of queries, do the earlier ones first.
*/
if( p->pPrior ){
+ if( p->pRightmost==0 ){
+ Select *pLoop;
+ for(pLoop=p; pLoop; pLoop=pLoop->pPrior){
+ pLoop->pRightmost = p;
+ }
+ }
return multiSelect(pParse, p, eDest, iParm, aff);
}
#endif
- saveAggregateInfo(pParse, &sAggInfo);
pOrderBy = p->pOrderBy;
- if( eDest==SRT_Union || eDest==SRT_Except || eDest==SRT_Discard ){
+ if( IgnorableOrderby(eDest) ){
p->pOrderBy = 0;
}
if( sqlite3SelectResolve(pParse, p, 0) ){
@@ -2552,14 +2674,8 @@ int sqlite3Select(
/* ORDER BY is ignored for some destinations.
*/
- switch( eDest ){
- case SRT_Union:
- case SRT_Except:
- case SRT_Discard:
- pOrderBy = 0;
- break;
- default:
- break;
+ if( IgnorableOrderby(eDest) ){
+ pOrderBy = 0;
}
/* Begin generating code.
@@ -2580,23 +2696,24 @@ int sqlite3Select(
for(i=0; i<pTabList->nSrc; i++){
const char *zSavedAuthContext = 0;
int needRestoreContext;
+ struct SrcList_item *pItem = &pTabList->a[i];
- if( pTabList->a[i].pSelect==0 ) continue;
- if( pTabList->a[i].zName!=0 ){
+ if( pItem->pSelect==0 ) continue;
+ if( pItem->zName!=0 ){
zSavedAuthContext = pParse->zAuthContext;
- pParse->zAuthContext = pTabList->a[i].zName;
+ pParse->zAuthContext = pItem->zName;
needRestoreContext = 1;
}else{
needRestoreContext = 0;
}
- sqlite3Select(pParse, pTabList->a[i].pSelect, SRT_TempTable,
- pTabList->a[i].iCursor, p, i, &isAgg, 0);
+ sqlite3Select(pParse, pItem->pSelect, SRT_VirtualTab,
+ pItem->iCursor, p, i, &isAgg, 0);
if( needRestoreContext ){
pParse->zAuthContext = zSavedAuthContext;
}
pTabList = p->pSrc;
pWhere = p->pWhere;
- if( eDest!=SRT_Union && eDest!=SRT_Except && eDest!=SRT_Discard ){
+ if( !IgnorableOrderby(eDest) ){
pOrderBy = p->pOrderBy;
}
pGroupBy = p->pGroupBy;
@@ -2625,18 +2742,32 @@ int sqlite3Select(
#endif
/* If there is an ORDER BY clause, resolve any collation sequences
- ** names that have been explicitly specified.
+ ** names that have been explicitly specified and create a sorting index.
+ **
+ ** This sorting index might end up being unused if the data can be
+ ** extracted in pre-sorted order. If that is the case, then the
+ ** OP_OpenVirtual instruction will be changed to an OP_Noop once
+ ** we figure out that the sorting index is not needed. The addrSortIndex
+ ** variable is used to facilitate that change.
*/
if( pOrderBy ){
- for(i=0; i<pOrderBy->nExpr; i++){
- if( pOrderBy->a[i].zName ){
- pOrderBy->a[i].pExpr->pColl =
- sqlite3LocateCollSeq(pParse, pOrderBy->a[i].zName, -1);
+ struct ExprList_item *pTerm;
+ KeyInfo *pKeyInfo;
+ for(i=0, pTerm=pOrderBy->a; i<pOrderBy->nExpr; i++, pTerm++){
+ if( pTerm->zName ){
+ pTerm->pExpr->pColl = sqlite3LocateCollSeq(pParse, pTerm->zName, -1);
}
}
if( pParse->nErr ){
goto select_end;
}
+ pKeyInfo = keyInfoFromExprList(pParse, pOrderBy);
+ pOrderBy->iECursor = pParse->nTab++;
+ p->addrOpenVirt[2] = addrSortIndex =
+ sqlite3VdbeOp3(v, OP_OpenVirtual, pOrderBy->iECursor, pOrderBy->nExpr+2,
+ (char*)pKeyInfo, P3_KEYINFO_HANDOFF);
+ }else{
+ addrSortIndex = -1;
}
/* Set the limiter.
@@ -2645,184 +2776,320 @@ int sqlite3Select(
/* If the output is destined for a temporary table, open that table.
*/
- if( eDest==SRT_TempTable ){
- sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 0);
- sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, pEList->nExpr);
+ if( eDest==SRT_VirtualTab ){
+ sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, pEList->nExpr);
}
- /* Do an analysis of aggregate expressions.
- */
- if( isAgg || pGroupBy ){
- NameContext sNC;
- memset(&sNC, 0, sizeof(sNC));
- sNC.pParse = pParse;
- sNC.pSrcList = pTabList;
-
- assert( pParse->nAgg==0 );
- isAgg = 1;
- for(i=0; i<pEList->nExpr; i++){
- if( sqlite3ExprAnalyzeAggregates(&sNC, pEList->a[i].pExpr) ){
- goto select_end;
- }
- }
- if( pGroupBy ){
- for(i=0; i<pGroupBy->nExpr; i++){
- if( sqlite3ExprAnalyzeAggregates(&sNC, pGroupBy->a[i].pExpr) ){
- goto select_end;
- }
- }
- }
- if( pHaving && sqlite3ExprAnalyzeAggregates(&sNC, pHaving) ){
- goto select_end;
- }
- if( pOrderBy ){
- for(i=0; i<pOrderBy->nExpr; i++){
- if( sqlite3ExprAnalyzeAggregates(&sNC, pOrderBy->a[i].pExpr) ){
- goto select_end;
- }
- }
- }
- }
-
- /* Reset the aggregator
- */
- if( isAgg ){
- int addr = sqlite3VdbeAddOp(v, OP_AggReset, (pGroupBy?0:1), pParse->nAgg);
- for(i=0; i<pParse->nAgg; i++){
- FuncDef *pFunc;
- if( (pFunc = pParse->aAgg[i].pFunc)!=0 && pFunc->xFinalize!=0 ){
- int nExpr = 0;
-#ifdef SQLITE_SSE
- Expr *pAggExpr = pParse->aAgg[i].pExpr;
- if( pAggExpr && pAggExpr->pList ){
- nExpr = pAggExpr->pList->nExpr;
- }
-#endif
- sqlite3VdbeOp3(v, OP_AggInit, nExpr, i, (char*)pFunc, P3_FUNCDEF);
- }
- }
- if( pGroupBy ){
- int sz = sizeof(KeyInfo) + pGroupBy->nExpr*sizeof(CollSeq*);
- KeyInfo *pKey = (KeyInfo *)sqliteMalloc(sz);
- if( 0==pKey ){
- goto select_end;
- }
- pKey->enc = pParse->db->enc;
- pKey->nField = pGroupBy->nExpr;
- for(i=0; i<pGroupBy->nExpr; i++){
- pKey->aColl[i] = sqlite3ExprCollSeq(pParse, pGroupBy->a[i].pExpr);
- if( !pKey->aColl[i] ){
- pKey->aColl[i] = pParse->db->pDfltColl;
- }
- }
- sqlite3VdbeChangeP3(v, addr, (char *)pKey, P3_KEYINFO_HANDOFF);
- }
- }
/* Initialize the memory cell to NULL for SRT_Mem or 0 for SRT_Exists
*/
- if( eDest==SRT_Mem || eDest==SRT_Exists ){
- sqlite3VdbeAddOp(v, eDest==SRT_Mem ? OP_Null : OP_Integer, 0, 0);
- sqlite3VdbeAddOp(v, OP_MemStore, iParm, 1);
+ if( eDest==SRT_Mem ){
+ sqlite3VdbeAddOp(v, OP_MemNull, iParm, 0);
+ }else if( eDest==SRT_Exists ){
+ sqlite3VdbeAddOp(v, OP_MemInt, 0, iParm);
}
- /* Open a temporary table to use for the distinct set.
+ /* Open a virtual index to use for the distinct set.
*/
if( isDistinct ){
+ KeyInfo *pKeyInfo;
distinct = pParse->nTab++;
- openVirtualIndex(pParse, p, distinct);
+ pKeyInfo = keyInfoFromExprList(pParse, p->pEList);
+ sqlite3VdbeOp3(v, OP_OpenVirtual, distinct, 0,
+ (char*)pKeyInfo, P3_KEYINFO_HANDOFF);
}else{
distinct = -1;
}
- /* Begin the database scan
- */
- pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,
- pGroupBy ? 0 : &pOrderBy);
- if( pWInfo==0 ) goto select_end;
+ /* Aggregate and non-aggregate queries are handled differently */
+ if( !isAgg && pGroupBy==0 ){
+ /* This case is for non-aggregate queries
+ ** Begin the database scan
+ */
+ pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pOrderBy);
+ if( pWInfo==0 ) goto select_end;
- /* Use the standard inner loop if we are not dealing with
- ** aggregates
- */
- if( !isAgg ){
+ /* If sorting index that was created by a prior OP_OpenVirtual
+ ** instruction ended up not being needed, then change the OP_OpenVirtual
+ ** into an OP_Noop.
+ */
+ if( addrSortIndex>=0 && pOrderBy==0 ){
+ uncreateSortingIndex(pParse, addrSortIndex);
+ p->addrOpenVirt[2] = -1;
+ }
+
+ /* Use the standard inner loop
+ */
if( selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, eDest,
iParm, pWInfo->iContinue, pWInfo->iBreak, aff) ){
goto select_end;
}
- }
- /* If we are dealing with aggregates, then do the special aggregate
- ** processing.
- */
- else{
- AggExpr *pAgg;
- int lbl1 = 0;
- pParse->fillAgg = 1;
+ /* End the database scan loop.
+ */
+ sqlite3WhereEnd(pWInfo);
+ }else{
+ /* This is the processing for aggregate queries */
+ NameContext sNC; /* Name context for processing aggregate information */
+ int iAMem; /* First Mem address for storing current GROUP BY */
+ int iBMem; /* First Mem address for previous GROUP BY */
+ int iUseFlag; /* Mem address holding flag indicating that at least
+ ** one row of the input to the aggregator has been
+ ** processed */
+ int iAbortFlag; /* Mem address which causes query abort if positive */
+ int groupBySort; /* Rows come from source in GROUP BY order */
+
+
+ /* The following variables hold addresses or labels for parts of the
+ ** virtual machine program we are putting together */
+ int addrOutputRow; /* Start of subroutine that outputs a result row */
+ int addrSetAbort; /* Set the abort flag and return */
+ int addrInitializeLoop; /* Start of code that initializes the input loop */
+ int addrTopOfLoop; /* Top of the input loop */
+ int addrGroupByChange; /* Code that runs when any GROUP BY term changes */
+ int addrProcessRow; /* Code to process a single input row */
+ int addrEnd; /* End of all processing */
+ int addrSortingIdx; /* The OP_OpenVirtual for the sorting index */
+ int addrReset; /* Subroutine for resetting the accumulator */
+
+ addrEnd = sqlite3VdbeMakeLabel(v);
+
+ /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in
+ ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the
+ ** SELECT statement.
+ */
+ memset(&sNC, 0, sizeof(sNC));
+ sNC.pParse = pParse;
+ sNC.pSrcList = pTabList;
+ sNC.pAggInfo = &sAggInfo;
+ sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr+1 : 0;
+ sAggInfo.pGroupBy = pGroupBy;
+ if( sqlite3ExprAnalyzeAggList(&sNC, pEList) ){
+ goto select_end;
+ }
+ if( sqlite3ExprAnalyzeAggList(&sNC, pOrderBy) ){
+ goto select_end;
+ }
+ if( pHaving && sqlite3ExprAnalyzeAggregates(&sNC, pHaving) ){
+ goto select_end;
+ }
+ sAggInfo.nAccumulator = sAggInfo.nColumn;
+ for(i=0; i<sAggInfo.nFunc; i++){
+ if( sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->pList) ){
+ goto select_end;
+ }
+ }
+ if( sqlite3_malloc_failed ) goto select_end;
+
+ /* Processing for aggregates with GROUP BY is very different and
+ ** much more complex tha aggregates without a GROUP BY.
+ */
if( pGroupBy ){
- sqlite3ExprCodeExprList(pParse, pGroupBy);
- /* No affinity string is attached to the following OP_MakeRecord
- ** because we do not need to do any coercion of datatypes. */
- sqlite3VdbeAddOp(v, OP_MakeRecord, pGroupBy->nExpr, 0);
- lbl1 = sqlite3VdbeMakeLabel(v);
- sqlite3VdbeAddOp(v, OP_AggFocus, 0, lbl1);
- }
- for(i=0, pAgg=pParse->aAgg; i<pParse->nAgg; i++, pAgg++){
- if( pAgg->isAgg ) continue;
- sqlite3ExprCode(pParse, pAgg->pExpr);
- sqlite3VdbeAddOp(v, OP_AggSet, 0, i);
- }
- pParse->fillAgg = 0;
- if( lbl1<0 ){
- sqlite3VdbeResolveLabel(v, lbl1);
- }
- for(i=0, pAgg=pParse->aAgg; i<pParse->nAgg; i++, pAgg++){
- Expr *pE;
- int nExpr;
- FuncDef *pDef;
- if( !pAgg->isAgg ) continue;
- assert( pAgg->pFunc!=0 );
- assert( pAgg->pFunc->xStep!=0 );
- pDef = pAgg->pFunc;
- pE = pAgg->pExpr;
- assert( pE!=0 );
- assert( pE->op==TK_AGG_FUNCTION );
- nExpr = sqlite3ExprCodeExprList(pParse, pE->pList);
- sqlite3VdbeAddOp(v, OP_Integer, i, 0);
- if( pDef->needCollSeq ){
- CollSeq *pColl = 0;
- int j;
- for(j=0; !pColl && j<nExpr; j++){
- pColl = sqlite3ExprCollSeq(pParse, pE->pList->a[j].pExpr);
+ KeyInfo *pKeyInfo; /* Keying information for the group by clause */
+
+ /* Create labels that we will be needing
+ */
+
+ addrInitializeLoop = sqlite3VdbeMakeLabel(v);
+ addrGroupByChange = sqlite3VdbeMakeLabel(v);
+ addrProcessRow = sqlite3VdbeMakeLabel(v);
+
+ /* If there is a GROUP BY clause we might need a sorting index to
+ ** implement it. Allocate that sorting index now. If it turns out
+ ** that we do not need it after all, the OpenVirtual instruction
+ ** will be converted into a Noop.
+ */
+ sAggInfo.sortingIdx = pParse->nTab++;
+ pKeyInfo = keyInfoFromExprList(pParse, pGroupBy);
+ addrSortingIdx =
+ sqlite3VdbeOp3(v, OP_OpenVirtual, sAggInfo.sortingIdx,
+ sAggInfo.nSortingColumn,
+ (char*)pKeyInfo, P3_KEYINFO_HANDOFF);
+
+ /* Initialize memory locations used by GROUP BY aggregate processing
+ */
+ iUseFlag = pParse->nMem++;
+ iAbortFlag = pParse->nMem++;
+ iAMem = pParse->nMem;
+ pParse->nMem += pGroupBy->nExpr;
+ iBMem = pParse->nMem;
+ pParse->nMem += pGroupBy->nExpr;
+ sqlite3VdbeAddOp(v, OP_MemInt, 0, iAbortFlag);
+ VdbeComment((v, "# clear abort flag"));
+ sqlite3VdbeAddOp(v, OP_MemInt, 0, iUseFlag);
+ VdbeComment((v, "# indicate accumulator empty"));
+ sqlite3VdbeAddOp(v, OP_Goto, 0, addrInitializeLoop);
+
+ /* Generate a subroutine that outputs a single row of the result
+ ** set. This subroutine first looks at the iUseFlag. If iUseFlag
+ ** is less than or equal to zero, the subroutine is a no-op. If
+ ** the processing calls for the query to abort, this subroutine
+ ** increments the iAbortFlag memory location before returning in
+ ** order to signal the caller to abort.
+ */
+ addrSetAbort = sqlite3VdbeCurrentAddr(v);
+ sqlite3VdbeAddOp(v, OP_MemInt, 1, iAbortFlag);
+ VdbeComment((v, "# set abort flag"));
+ sqlite3VdbeAddOp(v, OP_Return, 0, 0);
+ addrOutputRow = sqlite3VdbeCurrentAddr(v);
+ sqlite3VdbeAddOp(v, OP_IfMemPos, iUseFlag, addrOutputRow+2);
+ VdbeComment((v, "# Groupby result generator entry point"));
+ sqlite3VdbeAddOp(v, OP_Return, 0, 0);
+ finalizeAggFunctions(pParse, &sAggInfo);
+ if( pHaving ){
+ sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, 1);
+ }
+ rc = selectInnerLoop(pParse, p, p->pEList, 0, 0, pOrderBy,
+ distinct, eDest, iParm,
+ addrOutputRow+1, addrSetAbort, aff);
+ if( rc ){
+ goto select_end;
+ }
+ sqlite3VdbeAddOp(v, OP_Return, 0, 0);
+ VdbeComment((v, "# end groupby result generator"));
+
+ /* Generate a subroutine that will reset the group-by accumulator
+ */
+ addrReset = sqlite3VdbeCurrentAddr(v);
+ resetAccumulator(pParse, &sAggInfo);
+ sqlite3VdbeAddOp(v, OP_Return, 0, 0);
+
+ /* Begin a loop that will extract all source rows in GROUP BY order.
+ ** This might involve two separate loops with an OP_Sort in between, or
+ ** it might be a single loop that uses an index to extract information
+ ** in the right order to begin with.
+ */
+ sqlite3VdbeResolveLabel(v, addrInitializeLoop);
+ sqlite3VdbeAddOp(v, OP_Gosub, 0, addrReset);
+ pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pGroupBy);
+ if( pWInfo==0 ) goto select_end;
+ if( pGroupBy==0 ){
+ /* The optimizer is able to deliver rows in group by order so
+ ** we do not have to sort. The OP_OpenVirtual table will be
+ ** cancelled later because we still need to use the pKeyInfo
+ */
+ pGroupBy = p->pGroupBy;
+ groupBySort = 0;
+ }else{
+ /* Rows are coming out in undetermined order. We have to push
+ ** each row into a sorting index, terminate the first loop,
+ ** then loop over the sorting index in order to get the output
+ ** in sorted order
+ */
+ groupBySort = 1;
+ sqlite3ExprCodeExprList(pParse, pGroupBy);
+ sqlite3VdbeAddOp(v, OP_Sequence, sAggInfo.sortingIdx, 0);
+ j = pGroupBy->nExpr+1;
+ for(i=0; i<sAggInfo.nColumn; i++){
+ struct AggInfo_col *pCol = &sAggInfo.aCol[i];
+ if( pCol->iSorterColumn<j ) continue;
+ if( pCol->iColumn<0 ){
+ sqlite3VdbeAddOp(v, OP_Rowid, pCol->iTable, 0);
+ }else{
+ sqlite3VdbeAddOp(v, OP_Column, pCol->iTable, pCol->iColumn);
+ }
+ j++;
}
- if( !pColl ) pColl = pParse->db->pDfltColl;
- sqlite3VdbeOp3(v, OP_CollSeq, 0, 0, (char *)pColl, P3_COLLSEQ);
+ sqlite3VdbeAddOp(v, OP_MakeRecord, j, 0);
+ sqlite3VdbeAddOp(v, OP_IdxInsert, sAggInfo.sortingIdx, 0);
+ sqlite3WhereEnd(pWInfo);
+ sqlite3VdbeAddOp(v, OP_Sort, sAggInfo.sortingIdx, addrEnd);
+ VdbeComment((v, "# GROUP BY sort"));
+ sAggInfo.useSortingIdx = 1;
}
- sqlite3VdbeOp3(v, OP_AggFunc, 0, nExpr, (char*)pDef, P3_FUNCDEF);
- }
- }
- /* End the database scan loop.
- */
- sqlite3WhereEnd(pWInfo);
+ /* Evaluate the current GROUP BY terms and store in b0, b1, b2...
+ ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth)
+ ** Then compare the current GROUP BY terms against the GROUP BY terms
+ ** from the previous row currently stored in a0, a1, a2...
+ */
+ addrTopOfLoop = sqlite3VdbeCurrentAddr(v);
+ for(j=0; j<pGroupBy->nExpr; j++){
+ if( groupBySort ){
+ sqlite3VdbeAddOp(v, OP_Column, sAggInfo.sortingIdx, j);
+ }else{
+ sAggInfo.directMode = 1;
+ sqlite3ExprCode(pParse, pGroupBy->a[j].pExpr);
+ }
+ sqlite3VdbeAddOp(v, OP_MemStore, iBMem+j, j<pGroupBy->nExpr-1);
+ }
+ for(j=pGroupBy->nExpr-1; j>=0; j--){
+ if( j<pGroupBy->nExpr-1 ){
+ sqlite3VdbeAddOp(v, OP_MemLoad, iBMem+j, 0);
+ }
+ sqlite3VdbeAddOp(v, OP_MemLoad, iAMem+j, 0);
+ if( j==0 ){
+ sqlite3VdbeAddOp(v, OP_Eq, 0x200, addrProcessRow);
+ }else{
+ sqlite3VdbeAddOp(v, OP_Ne, 0x200, addrGroupByChange);
+ }
+ sqlite3VdbeChangeP3(v, -1, (void*)pKeyInfo->aColl[j], P3_COLLSEQ);
+ }
- /* If we are processing aggregates, we need to set up a second loop
- ** over all of the aggregate values and process them.
- */
- if( isAgg ){
- int endagg = sqlite3VdbeMakeLabel(v);
- int startagg;
- startagg = sqlite3VdbeAddOp(v, OP_AggNext, 0, endagg);
- if( pHaving ){
- sqlite3ExprIfFalse(pParse, pHaving, startagg, 1);
- }
- if( selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, eDest,
- iParm, startagg, endagg, aff) ){
- goto select_end;
+ /* Generate code that runs whenever the GROUP BY changes.
+ ** Change in the GROUP BY are detected by the previous code
+ ** block. If there were no changes, this block is skipped.
+ **
+ ** This code copies current group by terms in b0,b1,b2,...
+ ** over to a0,a1,a2. It then calls the output subroutine
+ ** and resets the aggregate accumulator registers in preparation
+ ** for the next GROUP BY batch.
+ */
+ sqlite3VdbeResolveLabel(v, addrGroupByChange);
+ for(j=0; j<pGroupBy->nExpr; j++){
+ sqlite3VdbeAddOp(v, OP_MemMove, iAMem+j, iBMem+j);
+ }
+ sqlite3VdbeAddOp(v, OP_Gosub, 0, addrOutputRow);
+ VdbeComment((v, "# output one row"));
+ sqlite3VdbeAddOp(v, OP_IfMemPos, iAbortFlag, addrEnd);
+ VdbeComment((v, "# check abort flag"));
+ sqlite3VdbeAddOp(v, OP_Gosub, 0, addrReset);
+ VdbeComment((v, "# reset accumulator"));
+
+ /* Update the aggregate accumulators based on the content of
+ ** the current row
+ */
+ sqlite3VdbeResolveLabel(v, addrProcessRow);
+ updateAccumulator(pParse, &sAggInfo);
+ sqlite3VdbeAddOp(v, OP_MemInt, 1, iUseFlag);
+ VdbeComment((v, "# indicate data in accumulator"));
+
+ /* End of the loop
+ */
+ if( groupBySort ){
+ sqlite3VdbeAddOp(v, OP_Next, sAggInfo.sortingIdx, addrTopOfLoop);
+ }else{
+ sqlite3WhereEnd(pWInfo);
+ uncreateSortingIndex(pParse, addrSortingIdx);
+ }
+
+ /* Output the final row of result
+ */
+ sqlite3VdbeAddOp(v, OP_Gosub, 0, addrOutputRow);
+ VdbeComment((v, "# output final row"));
+
+ } /* endif pGroupBy */
+ else {
+ /* This case runs if the aggregate has no GROUP BY clause. The
+ ** processing is much simpler since there is only a single row
+ ** of output.
+ */
+ resetAccumulator(pParse, &sAggInfo);
+ pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0);
+ if( pWInfo==0 ) goto select_end;
+ updateAccumulator(pParse, &sAggInfo);
+ sqlite3WhereEnd(pWInfo);
+ finalizeAggFunctions(pParse, &sAggInfo);
+ pOrderBy = 0;
+ if( pHaving ){
+ sqlite3ExprIfFalse(pParse, pHaving, addrEnd, 1);
+ }
+ selectInnerLoop(pParse, p, p->pEList, 0, 0, 0, -1,
+ eDest, iParm, addrEnd, addrEnd, aff);
}
- sqlite3VdbeAddOp(v, OP_Goto, 0, startagg);
- sqlite3VdbeResolveLabel(v, endagg);
- sqlite3VdbeAddOp(v, OP_Noop, 0, 0);
- }
+ sqlite3VdbeResolveLabel(v, addrEnd);
+
+ } /* endif aggregate query */
/* If there is an ORDER BY clause, then we need to sort the results
** and send them to the callback one by one.
@@ -2854,6 +3121,7 @@ int sqlite3Select(
** successful coding of the SELECT.
*/
select_end:
- restoreAggregateInfo(pParse, &sAggInfo);
+ sqliteFree(sAggInfo.aCol);
+ sqliteFree(sAggInfo.aFunc);
return rc;
}
diff --git a/ext/pdo_sqlite/sqlite/src/shell.c b/ext/pdo_sqlite/sqlite/src/shell.c
index cd32a9e172..61ff2482d5 100644
--- a/ext/pdo_sqlite/sqlite/src/shell.c
+++ b/ext/pdo_sqlite/sqlite/src/shell.c
@@ -313,7 +313,7 @@ static void output_c_string(FILE *out, const char *z){
fputc('\\', out);
fputc('r', out);
}else if( !isprint(c) ){
- fprintf(out, "\\%03o", c);
+ fprintf(out, "\\%03o", c&0xff);
}else{
fputc(c, out);
}
@@ -656,10 +656,14 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
zType = azArg[1];
zSql = azArg[2];
- if( strcmp(zTable,"sqlite_sequence")!=0 ){
- fprintf(p->out, "%s;\n", zSql);
- }else{
+ if( strcmp(zTable, "sqlite_sequence")==0 ){
fprintf(p->out, "DELETE FROM sqlite_sequence;\n");
+ }else if( strcmp(zTable, "sqlite_stat1")==0 ){
+ fprintf(p->out, "ANALYZE sqlite_master;\n");
+ }else if( strncmp(zTable, "sqlite_", 7)==0 ){
+ return 0;
+ }else{
+ fprintf(p->out, "%s;\n", zSql);
}
if( strcmp(zType, "table")==0 ){
@@ -1290,7 +1294,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
"SELECT sql FROM "
" (SELECT * FROM sqlite_master UNION ALL"
" SELECT * FROM sqlite_temp_master) "
- "WHERE type!='meta' AND sql NOTNULL "
+ "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
"ORDER BY substr(type,2,1), name",
callback, &data, &zErrMsg
);
@@ -1334,7 +1338,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
if( nArg==1 ){
rc = sqlite3_get_table(p->db,
"SELECT name FROM sqlite_master "
- "WHERE type IN ('table','view') "
+ "WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%'"
"UNION ALL "
"SELECT name FROM sqlite_temp_master "
"WHERE type IN ('table','view') "
@@ -1698,6 +1702,13 @@ int main(int argc, char **argv){
}
data.out = stdout;
+#ifdef SQLITE_OMIT_MEMORYDB
+ if( data.zDbFilename==0 ){
+ fprintf(stderr,"%s: no database filename specified\n", argv[0]);
+ exit(1);
+ }
+#endif
+
/* Go ahead and open the database file if it already exists. If the
** file does not exist, delay opening it. This prevents empty database
** files from being created if a user mistypes the database name argument
diff --git a/ext/pdo_sqlite/sqlite/src/sqlite.h.in b/ext/pdo_sqlite/sqlite/src/sqlite.h.in
index ceed1f8249..6b2dd551d6 100644
--- a/ext/pdo_sqlite/sqlite/src/sqlite.h.in
+++ b/ext/pdo_sqlite/sqlite/src/sqlite.h.in
@@ -373,8 +373,9 @@ void sqlite3_free_table(char **result);
**
** We can use this text in an SQL statement as follows:
**
-** sqlite3_exec_printf(db, "INSERT INTO table VALUES('%q')",
-** callback1, 0, 0, zText);
+** char *z = sqlite3_mprintf("INSERT INTO TABLES('%q')", zText);
+** sqlite3_exec(db, z, callback1, 0, 0);
+** sqlite3_free(z);
**
** Because the %q format string is used, the '\'' character in zText
** is escaped and the SQL generated is as follows:
@@ -464,11 +465,18 @@ int sqlite3_set_authorizer(
#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */
/*
-** Register a function that is called at every invocation of sqlite3_exec()
-** or sqlite3_prepare(). This function can be used (for example) to generate
-** a log file of all SQL executed against a database.
+** Register a function for tracing SQL command evaluation. The function
+** registered by sqlite3_trace() is invoked at the first sqlite3_step()
+** for the evaluation of an SQL statement. The function registered by
+** sqlite3_profile() runs at the end of each SQL statement and includes
+** information on how long that statement ran.
+**
+** The sqlite3_profile() API is currently considered experimental and
+** is subject to change.
*/
void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
+void *sqlite3_profile(sqlite3*,
+ void(*xProfile)(void*,const char*,sqlite_uint64), void*);
/*
** This routine configures a callback function - the progress callback - that
diff --git a/ext/pdo_sqlite/sqlite/src/sqliteInt.h b/ext/pdo_sqlite/sqlite/src/sqliteInt.h
index a5245015eb..1635369c4a 100644
--- a/ext/pdo_sqlite/sqlite/src/sqliteInt.h
+++ b/ext/pdo_sqlite/sqlite/src/sqliteInt.h
@@ -17,6 +17,17 @@
#define _SQLITEINT_H_
/*
+** Many people are failing to set -DNDEBUG=1 when compiling SQLite.
+** Setting NDEBUG makes the code smaller and run faster. So the following
+** lines are added to automatically set NDEBUG unless the -DSQLITE_DEBUG=1
+** option is set. Thus NDEBUG becomes an opt-in rather than an opt-out
+** feature.
+*/
+#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
+# define NDEBUG 1
+#endif
+
+/*
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it. If the OS lacks
** large file support, or if the OS is windows, these should be no-ops.
@@ -298,7 +309,7 @@ extern int sqlite3_iMallocReset; /* Set iMallocFail to this when it reaches 0 */
/*
** Forward references to structures
*/
-typedef struct AggExpr AggExpr;
+typedef struct AggInfo AggInfo;
typedef struct AuthContext AuthContext;
typedef struct CollSeq CollSeq;
typedef struct Column Column;
@@ -420,8 +431,10 @@ struct sqlite3 {
} init;
struct Vdbe *pVdbe; /* List of active virtual machines */
int activeVdbeCnt; /* Number of vdbes currently executing */
- void (*xTrace)(void*,const char*); /* Trace function */
- void *pTraceArg; /* Argument to the trace function */
+ void (*xTrace)(void*,const char*); /* Trace function */
+ void *pTraceArg; /* Argument to the trace function */
+ void (*xProfile)(void*,const char*,u64); /* Profiling function */
+ void *pProfileArg; /* Argument to profile function */
void *pCommitArg; /* Argument to xCommitCallback() */
int (*xCommitCallback)(void*);/* Invoked at every commit. */
void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);
@@ -511,7 +524,8 @@ struct FuncDef {
/*
** Possible values for FuncDef.flags
*/
-#define SQLITE_FUNC_LIKEOPT 0x01 /* Candidate for the LIKE optimization */
+#define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */
+#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
/*
** information about each column of an SQL table is held in an instance
@@ -551,11 +565,20 @@ struct Column {
struct CollSeq {
char *zName; /* Name of the collating sequence, UTF-8 encoded */
u8 enc; /* Text encoding handled by xCmp() */
+ u8 type; /* One of the SQLITE_COLL_... values below */
void *pUser; /* First argument to xCmp() */
int (*xCmp)(void*,int, const void*, int, const void*);
};
/*
+** Allowed values of CollSeq flags:
+*/
+#define SQLITE_COLL_BINARY 1 /* The default memcmp() collating sequence */
+#define SQLITE_COLL_NOCASE 2 /* The built-in NOCASE collating sequence */
+#define SQLITE_COLL_REVERSE 3 /* The built-in REVERSE collating sequence */
+#define SQLITE_COLL_USER 0 /* Any other user-defined collating sequence */
+
+/*
** A sort order can be either ASC or DESC.
*/
#define SQLITE_SO_ASC 0 /* Sort in ascending order */
@@ -777,6 +800,49 @@ struct Token {
};
/*
+** An instance of this structure contains information needed to generate
+** code for a SELECT that contains aggregate functions.
+**
+** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
+** pointer to this structure. The Expr.iColumn field is the index in
+** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
+** code for that node.
+**
+** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
+** original Select structure that describes the SELECT statement. These
+** fields do not need to be freed when deallocating the AggInfo structure.
+*/
+struct AggInfo {
+ u8 directMode; /* Direct rendering mode means take data directly
+ ** from source tables rather than from accumulators */
+ u8 useSortingIdx; /* In direct mode, reference the sorting index rather
+ ** than the source table */
+ int sortingIdx; /* Cursor number of the sorting index */
+ ExprList *pGroupBy; /* The group by clause */
+ int nSortingColumn; /* Number of columns in the sorting index */
+ struct AggInfo_col { /* For each column used in source tables */
+ int iTable; /* Cursor number of the source table */
+ int iColumn; /* Column number within the source table */
+ int iSorterColumn; /* Column number in the sorting index */
+ int iMem; /* Memory location that acts as accumulator */
+ Expr *pExpr; /* The original expression */
+ } *aCol;
+ int nColumn; /* Number of used entries in aCol[] */
+ int nColumnAlloc; /* Number of slots allocated for aCol[] */
+ int nAccumulator; /* Number of columns that show through to the output.
+ ** Additional columns are used only as parameters to
+ ** aggregate functions */
+ struct AggInfo_func { /* For each aggregate function */
+ Expr *pExpr; /* Expression encoding the function */
+ FuncDef *pFunc; /* The aggregate function implementation */
+ int iMem; /* Memory location that acts as accumulator */
+ int iDistinct; /* Virtual table used to enforce DISTINCT */
+ } *aFunc;
+ int nFunc; /* Number of entries in aFunc[] */
+ int nFuncAlloc; /* Number of slots allocated for aFunc[] */
+};
+
+/*
** Each node of an expression in the parse tree is an instance
** of this structure.
**
@@ -835,9 +901,9 @@ struct Expr {
Token span; /* Complete text of the expression */
int iTable, iColumn; /* When op==TK_COLUMN, then this expr node means the
** iColumn-th field of the iTable-th table. */
- int iAgg; /* When op==TK_COLUMN and pParse->fillAgg==FALSE, pull
- ** result from the iAgg-th element of the aggregator */
- int iAggCtx; /* The value to pass as P1 of OP_AggGet. */
+ AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
+ int iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
+ int iRightJoinTable; /* If EP_FromJoin, the right table of the join */
Select *pSelect; /* When the expression is a sub-select. Also the
** right side of "<expr> IN (<select>)" */
Table *pTab; /* Table for OP_Column expressions. */
@@ -850,7 +916,7 @@ struct Expr {
#define EP_Agg 0x02 /* Contains one or more aggregate functions */
#define EP_Resolved 0x04 /* IDs have been resolved to COLUMNs */
#define EP_Error 0x08 /* Expression contains one or more errors */
-#define EP_Not 0x10 /* Operator preceeded by NOT */
+#define EP_Distinct 0x10 /* Aggregate function with DISTINCT keyword */
#define EP_VarSelect 0x20 /* pSelect is correlated, not constant */
#define EP_Dequoted 0x40 /* True if the string has been dequoted */
@@ -874,6 +940,7 @@ struct Expr {
struct ExprList {
int nExpr; /* Number of expressions on the list */
int nAlloc; /* Number of entries allocated below */
+ int iECursor; /* VDBE Cursor associated with this ExprList */
struct ExprList_item {
Expr *pExpr; /* The list of expressions */
char *zName; /* Token associated with this expression */
@@ -899,12 +966,12 @@ struct ExprList {
** If "a" is the k-th column of table "t", then IdList.a[0].idx==k.
*/
struct IdList {
- int nId; /* Number of identifiers on the list */
- int nAlloc; /* Number of entries allocated for a[] below */
struct IdList_item {
char *zName; /* Name of the identifier */
int idx; /* Index in some Table.aCol[] of a column named zName */
} *a;
+ int nId; /* Number of identifiers on the list */
+ int nAlloc; /* Number of entries allocated for a[] below */
};
/*
@@ -944,11 +1011,12 @@ struct SrcList {
** Permitted values of the SrcList.a.jointype field
*/
#define JT_INNER 0x0001 /* Any kind of inner or cross join */
-#define JT_NATURAL 0x0002 /* True for a "natural" join */
-#define JT_LEFT 0x0004 /* Left outer join */
-#define JT_RIGHT 0x0008 /* Right outer join */
-#define JT_OUTER 0x0010 /* The "OUTER" keyword is present */
-#define JT_ERROR 0x0020 /* unknown or unsupported join type */
+#define JT_CROSS 0x0002 /* Explicit use of the CROSS keyword */
+#define JT_NATURAL 0x0004 /* True for a "natural" join */
+#define JT_LEFT 0x0008 /* Left outer join */
+#define JT_RIGHT 0x0010 /* Right outer join */
+#define JT_OUTER 0x0020 /* The "OUTER" keyword is present */
+#define JT_ERROR 0x0040 /* unknown or unsupported join type */
/*
** For each nested loop in a WHERE clause implementation, the WhereInfo
@@ -1018,8 +1086,9 @@ struct NameContext {
int nRef; /* Number of names resolved by this context */
int nErr; /* Number of errors encountered while resolving names */
u8 allowAgg; /* Aggregate functions allowed here */
- u8 hasAgg;
+ u8 hasAgg; /* True if aggregates are seen */
int nDepth; /* Depth of subquery recursion. 1 for no recursion */
+ AggInfo *pAggInfo; /* Information about aggregates at this level */
NameContext *pNext; /* Next outer name context. NULL for outermost */
};
@@ -1032,64 +1101,55 @@ struct NameContext {
** limit and nOffset to the value of the offset (or 0 if there is not
** offset). But later on, nLimit and nOffset become the memory locations
** in the VDBE that record the limit and offset counters.
+**
+** addrOpenVirt[] entries contain the address of OP_OpenVirtual opcodes.
+** These addresses must be stored so that we can go back and fill in
+** the P3_KEYINFO and P2 parameters later. Neither the KeyInfo nor
+** the number of columns in P2 can be computed at the same time
+** as the OP_OpenVirtual instruction is coded because not
+** enough information about the compound query is known at that point.
+** The KeyInfo for addrOpenVirt[0] and [1] contains collating sequences
+** for the result set. The KeyInfo for addrOpenVirt[2] contains collating
+** sequences for the ORDER BY clause.
*/
struct Select {
ExprList *pEList; /* The fields of the result */
u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */
u8 isDistinct; /* True if the DISTINCT keyword is present */
+ u8 isResolved; /* True once sqlite3SelectResolve() has run. */
+ u8 isAgg; /* True if this is an aggregate query */
+ u8 usesVirt; /* True if uses an OpenVirtual opcode */
+ u8 disallowOrderBy; /* Do not allow an ORDER BY to be attached if TRUE */
SrcList *pSrc; /* The FROM clause */
Expr *pWhere; /* The WHERE clause */
ExprList *pGroupBy; /* The GROUP BY clause */
Expr *pHaving; /* The HAVING clause */
ExprList *pOrderBy; /* The ORDER BY clause */
Select *pPrior; /* Prior select in a compound select statement */
+ Select *pRightmost; /* Right-most select in a compound select statement */
Expr *pLimit; /* LIMIT expression. NULL means not used. */
Expr *pOffset; /* OFFSET expression. NULL means not used. */
int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
- IdList **ppOpenVirtual;/* OP_OpenVirtual addresses used by multi-selects */
- u8 isResolved; /* True once sqlite3SelectResolve() has run. */
- u8 isAgg; /* True if this is an aggregate query */
+ int addrOpenVirt[3]; /* OP_OpenVirtual opcodes related to this select */
};
/*
** The results of a select can be distributed in several ways.
*/
-#define SRT_Callback 1 /* Invoke a callback with each row of result */
-#define SRT_Mem 2 /* Store result in a memory cell */
-#define SRT_Set 3 /* Store result as unique keys in a table */
-#define SRT_Union 5 /* Store result as keys in a table */
-#define SRT_Except 6 /* Remove result from a UNION table */
-#define SRT_Table 7 /* Store result as data with a unique key */
-#define SRT_TempTable 8 /* Store result in a trasient table */
-#define SRT_Discard 9 /* Do not save the results anywhere */
-#define SRT_Sorter 10 /* Store results in the sorter */
-#define SRT_Subroutine 11 /* Call a subroutine to handle results */
-#define SRT_Exists 12 /* Put 0 or 1 in a memory cell */
-
-/*
-** When a SELECT uses aggregate functions (like "count(*)" or "avg(f1)")
-** we have to do some additional analysis of expressions. An instance
-** of the following structure holds information about a single subexpression
-** somewhere in the SELECT statement. An array of these structures holds
-** all the information we need to generate code for aggregate
-** expressions.
-**
-** Note that when analyzing a SELECT containing aggregates, both
-** non-aggregate field variables and aggregate functions are stored
-** in the AggExpr array of the Parser structure.
-**
-** The pExpr field points to an expression that is part of either the
-** field list, the GROUP BY clause, the HAVING clause or the ORDER BY
-** clause. The expression will be freed when those clauses are cleaned
-** up. Do not try to delete the expression attached to AggExpr.pExpr.
-**
-** If AggExpr.pExpr==0, that means the expression is "count(*)".
-*/
-struct AggExpr {
- int isAgg; /* if TRUE contains an aggregate function */
- Expr *pExpr; /* The expression */
- FuncDef *pFunc; /* Information about the aggregate function */
-};
+#define SRT_Union 1 /* Store result as keys in an index */
+#define SRT_Except 2 /* Remove result from a UNION index */
+#define SRT_Discard 3 /* Do not save the results anywhere */
+
+/* The ORDER BY clause is ignored for all of the above */
+#define IgnorableOrderby(X) (X<=SRT_Discard)
+
+#define SRT_Callback 4 /* Invoke a callback with each row of result */
+#define SRT_Mem 5 /* Store result in a memory cell */
+#define SRT_Set 6 /* Store non-null results as keys in an index */
+#define SRT_Table 7 /* Store result as data with an automatic rowid */
+#define SRT_VirtualTab 8 /* Create virtual table and store like SRT_Table */
+#define SRT_Subroutine 9 /* Call a subroutine to handle results */
+#define SRT_Exists 10 /* Put 0 or 1 in a memory cell */
/*
** An SQL parser context. A copy of this structure is passed through
@@ -1110,7 +1170,6 @@ struct Parse {
u8 nameClash; /* A permanent table name clashes with temp table name */
u8 checkSchema; /* Causes schema cookie check after an error */
u8 nested; /* Number of nested calls to the parser/code generator */
- u8 fillAgg; /* If true, ignore the Expr.iAgg field. Normally false */
int nErr; /* Number of errors seen */
int nTab; /* Number of previously allocated VDBE cursors */
int nMem; /* Number of memory cells used so far */
@@ -1137,9 +1196,6 @@ struct Parse {
Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
TriggerStack *trigStack; /* Trigger actions being coded */
const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
- int nAgg; /* Number of aggregate expressions */
- AggExpr *aAgg; /* An array of aggregate expressions */
- int nMaxDepth; /* Maximum depth of subquery recursion */
};
/*
@@ -1320,6 +1376,19 @@ typedef struct {
extern int sqlite3_always_code_trigger_setup;
/*
+** The SQLITE_CORRUPT_BKPT macro can be either a constant (for production
+** builds) or a function call (for debugging). If it is a function call,
+** it allows the operator to set a breakpoint at the spot where database
+** corruption is first detected.
+*/
+#ifdef SQLITE_DEBUG
+ extern int sqlite3Corrupt(void);
+# define SQLITE_CORRUPT_BKPT sqlite3Corrupt()
+#else
+# define SQLITE_CORRUPT_BKPT SQLITE_CORRUPT
+#endif
+
+/*
** Internal function prototypes
*/
int sqlite3StrICmp(const char *, const char *);
@@ -1346,6 +1415,7 @@ void sqlite3RealToSortable(double r, char *);
# define sqlite3CheckMemory(a,b)
# define sqlite3MallocX sqlite3Malloc
#endif
+void sqlite3ReallocOrFree(void**,int);
void sqlite3FreeX(void*);
void *sqlite3MallocX(int);
char *sqlite3MPrintf(const char*, ...);
@@ -1396,6 +1466,7 @@ void sqlite3EndTable(Parse*,Token*,Token*,Select*);
void sqlite3DropTable(Parse*, SrcList*, int);
void sqlite3DeleteTable(sqlite3*, Table*);
void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);
+int sqlite3ArrayAllocate(void**,int,int);
IdList *sqlite3IdListAppend(IdList*, Token*);
int sqlite3IdListIndex(IdList*,const char*);
SrcList *sqlite3SrcListAppend(SrcList*, Token*, Token*);
@@ -1440,6 +1511,7 @@ int sqlite3ExprCompare(Expr*, Expr*);
int sqliteFuncId(Token*);
int sqlite3ExprResolveNames(NameContext *, Expr *);
int sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
+int sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
Vdbe *sqlite3GetVdbe(Parse*);
void sqlite3Randomness(int, void*);
void sqlite3RollbackAll(sqlite3*);
@@ -1557,7 +1629,7 @@ const void *sqlite3ValueText(sqlite3_value*, u8);
int sqlite3ValueBytes(sqlite3_value*, u8);
void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, void(*)(void*));
void sqlite3ValueFree(sqlite3_value*);
-sqlite3_value *sqlite3ValueNew();
+sqlite3_value *sqlite3ValueNew(void);
sqlite3_value *sqlite3GetTransientValue(sqlite3*db);
int sqlite3ValueFromExpr(Expr *, u8, u8, sqlite3_value **);
void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
@@ -1583,7 +1655,7 @@ int sqlite3FindDb(sqlite3*, Token*);
void sqlite3AnalysisLoad(sqlite3*,int iDB);
void sqlite3DefaultRowEst(Index*);
void sqlite3RegisterLikeFunctions(sqlite3*, int);
-int sqlite3IsLikeFunction(sqlite3*,Expr*,char*);
+int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*);
#ifdef SQLITE_SSE
#include "sseInt.h"
diff --git a/ext/pdo_sqlite/sqlite/src/tclsqlite.c b/ext/pdo_sqlite/sqlite/src/tclsqlite.c
index d3a116877f..9a8b823b7e 100644
--- a/ext/pdo_sqlite/sqlite/src/tclsqlite.c
+++ b/ext/pdo_sqlite/sqlite/src/tclsqlite.c
@@ -84,6 +84,7 @@ struct SqliteDb {
char *zBusy; /* The busy callback routine */
char *zCommit; /* The commit hook callback routine */
char *zTrace; /* The trace callback routine */
+ char *zProfile; /* The profile callback routine */
char *zProgress; /* The progress callback routine */
char *zAuth; /* The authorization callback routine */
char *zNull; /* Text to substitute for an SQL NULL value */
@@ -190,6 +191,9 @@ static void DbDeleteCmd(void *db){
if( pDb->zTrace ){
Tcl_Free(pDb->zTrace);
}
+ if( pDb->zProfile ){
+ Tcl_Free(pDb->zProfile);
+ }
if( pDb->zAuth ){
Tcl_Free(pDb->zAuth);
}
@@ -248,6 +252,25 @@ static void DbTraceHandler(void *cd, const char *zSql){
}
/*
+** This routine is called by the SQLite profile handler after a statement
+** SQL has executed. The TCL script in pDb->zProfile is evaluated.
+*/
+static void DbProfileHandler(void *cd, const char *zSql, sqlite_uint64 tm){
+ SqliteDb *pDb = (SqliteDb*)cd;
+ Tcl_DString str;
+ char zTm[100];
+
+ sqlite3_snprintf(sizeof(zTm)-1, zTm, "%lld", tm);
+ Tcl_DStringInit(&str);
+ Tcl_DStringAppend(&str, pDb->zProfile, -1);
+ Tcl_DStringAppendElement(&str, zSql);
+ Tcl_DStringAppendElement(&str, zTm);
+ Tcl_Eval(pDb->interp, Tcl_DStringValue(&str));
+ Tcl_DStringFree(&str);
+ Tcl_ResetResult(pDb->interp);
+}
+
+/*
** This routine is called when a transaction is committed. The
** TCL script in pDb->zCommit is executed. If it returns non-zero or
** if it throws an exception, the transaction is rolled back instead
@@ -589,9 +612,10 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
"collation_needed", "commit_hook", "complete",
"copy", "errorcode", "eval",
"function", "last_insert_rowid", "nullvalue",
- "onecolumn", "progress", "rekey",
- "timeout", "total_changes", "trace",
- "transaction", "version", 0
+ "onecolumn", "profile", "progress",
+ "rekey", "timeout", "total_changes",
+ "trace", "transaction", "version",
+ 0
};
enum DB_enum {
DB_AUTHORIZER, DB_BUSY, DB_CACHE,
@@ -599,9 +623,9 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
DB_COLLATION_NEEDED, DB_COMMIT_HOOK, DB_COMPLETE,
DB_COPY, DB_ERRORCODE, DB_EVAL,
DB_FUNCTION, DB_LAST_INSERT_ROWID,DB_NULLVALUE,
- DB_ONECOLUMN, DB_PROGRESS, DB_REKEY,
- DB_TIMEOUT, DB_TOTAL_CHANGES, DB_TRACE,
- DB_TRANSACTION, DB_VERSION,
+ DB_ONECOLUMN, DB_PROFILE, DB_PROGRESS,
+ DB_REKEY, DB_TIMEOUT, DB_TOTAL_CHANGES,
+ DB_TRACE, DB_TRANSACTION, DB_VERSION
};
/* don't leave trailing commas on DB_enum, it confuses the AIX xlc compiler */
@@ -780,44 +804,6 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
break;
}
- /* $db commit_hook ?CALLBACK?
- **
- ** Invoke the given callback just before committing every SQL transaction.
- ** If the callback throws an exception or returns non-zero, then the
- ** transaction is aborted. If CALLBACK is an empty string, the callback
- ** is disabled.
- */
- case DB_COMMIT_HOOK: {
- if( objc>3 ){
- Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?");
- return TCL_ERROR;
- }else if( objc==2 ){
- if( pDb->zCommit ){
- Tcl_AppendResult(interp, pDb->zCommit, 0);
- }
- }else{
- char *zCommit;
- int len;
- if( pDb->zCommit ){
- Tcl_Free(pDb->zCommit);
- }
- zCommit = Tcl_GetStringFromObj(objv[2], &len);
- if( zCommit && len>0 ){
- pDb->zCommit = Tcl_Alloc( len + 1 );
- strcpy(pDb->zCommit, zCommit);
- }else{
- pDb->zCommit = 0;
- }
- if( pDb->zCommit ){
- pDb->interp = interp;
- sqlite3_commit_hook(pDb->db, DbCommitHandler, pDb);
- }else{
- sqlite3_commit_hook(pDb->db, 0, 0);
- }
- }
- break;
- }
-
/*
** $db collate NAME SCRIPT
**
@@ -870,6 +856,44 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
break;
}
+ /* $db commit_hook ?CALLBACK?
+ **
+ ** Invoke the given callback just before committing every SQL transaction.
+ ** If the callback throws an exception or returns non-zero, then the
+ ** transaction is aborted. If CALLBACK is an empty string, the callback
+ ** is disabled.
+ */
+ case DB_COMMIT_HOOK: {
+ if( objc>3 ){
+ Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?");
+ return TCL_ERROR;
+ }else if( objc==2 ){
+ if( pDb->zCommit ){
+ Tcl_AppendResult(interp, pDb->zCommit, 0);
+ }
+ }else{
+ char *zCommit;
+ int len;
+ if( pDb->zCommit ){
+ Tcl_Free(pDb->zCommit);
+ }
+ zCommit = Tcl_GetStringFromObj(objv[2], &len);
+ if( zCommit && len>0 ){
+ pDb->zCommit = Tcl_Alloc( len + 1 );
+ strcpy(pDb->zCommit, zCommit);
+ }else{
+ pDb->zCommit = 0;
+ }
+ if( pDb->zCommit ){
+ pDb->interp = interp;
+ sqlite3_commit_hook(pDb->db, DbCommitHandler, pDb);
+ }else{
+ sqlite3_commit_hook(pDb->db, 0, 0);
+ }
+ }
+ break;
+ }
+
/* $db complete SQL
**
** Return TRUE if SQL is a complete SQL statement. Return FALSE if
@@ -891,6 +915,192 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
break;
}
+ /* $db copy conflict-algorithm table filename ?SEPARATOR? ?NULLINDICATOR?
+ **
+ ** Copy data into table from filename, optionally using SEPARATOR
+ ** as column separators. If a column contains a null string, or the
+ ** value of NULLINDICATOR, a NULL is inserted for the column.
+ ** conflict-algorithm is one of the sqlite conflict algorithms:
+ ** rollback, abort, fail, ignore, replace
+ ** On success, return the number of lines processed, not necessarily same
+ ** as 'db changes' due to conflict-algorithm selected.
+ **
+ ** This code is basically an implementation/enhancement of
+ ** the sqlite3 shell.c ".import" command.
+ **
+ ** This command usage is equivalent to the sqlite2.x COPY statement,
+ ** which imports file data into a table using the PostgreSQL COPY file format:
+ ** $db copy $conflit_algo $table_name $filename \t \\N
+ */
+ case DB_COPY: {
+ char *zTable; /* Insert data into this table */
+ char *zFile; /* The file from which to extract data */
+ char *zConflict; /* The conflict algorithm to use */
+ sqlite3_stmt *pStmt; /* A statement */
+ int rc; /* Result code */
+ int nCol; /* Number of columns in the table */
+ int nByte; /* Number of bytes in an SQL string */
+ int i, j; /* Loop counters */
+ int nSep; /* Number of bytes in zSep[] */
+ int nNull; /* Number of bytes in zNull[] */
+ char *zSql; /* An SQL statement */
+ char *zLine; /* A single line of input from the file */
+ char **azCol; /* zLine[] broken up into columns */
+ char *zCommit; /* How to commit changes */
+ FILE *in; /* The input file */
+ int lineno = 0; /* Line number of input file */
+ char zLineNum[80]; /* Line number print buffer */
+ Tcl_Obj *pResult; /* interp result */
+
+ char *zSep;
+ char *zNull;
+ if( objc<5 || objc>7 ){
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "CONFLICT-ALGORITHM TABLE FILENAME ?SEPARATOR? ?NULLINDICATOR?");
+ return TCL_ERROR;
+ }
+ if( objc>=6 ){
+ zSep = Tcl_GetStringFromObj(objv[5], 0);
+ }else{
+ zSep = "\t";
+ }
+ if( objc>=7 ){
+ zNull = Tcl_GetStringFromObj(objv[6], 0);
+ }else{
+ zNull = "";
+ }
+ zConflict = Tcl_GetStringFromObj(objv[2], 0);
+ zTable = Tcl_GetStringFromObj(objv[3], 0);
+ zFile = Tcl_GetStringFromObj(objv[4], 0);
+ nSep = strlen(zSep);
+ nNull = strlen(zNull);
+ if( nSep==0 ){
+ Tcl_AppendResult(interp, "Error: non-null separator required for copy", 0);
+ return TCL_ERROR;
+ }
+ if(sqlite3StrICmp(zConflict, "rollback") != 0 &&
+ sqlite3StrICmp(zConflict, "abort" ) != 0 &&
+ sqlite3StrICmp(zConflict, "fail" ) != 0 &&
+ sqlite3StrICmp(zConflict, "ignore" ) != 0 &&
+ sqlite3StrICmp(zConflict, "replace" ) != 0 ) {
+ Tcl_AppendResult(interp, "Error: \"", zConflict,
+ "\", conflict-algorithm must be one of: rollback, "
+ "abort, fail, ignore, or replace", 0);
+ return TCL_ERROR;
+ }
+ zSql = sqlite3_mprintf("SELECT * FROM '%q'", zTable);
+ if( zSql==0 ){
+ Tcl_AppendResult(interp, "Error: no such table: ", zTable, 0);
+ return TCL_ERROR;
+ }
+ nByte = strlen(zSql);
+ rc = sqlite3_prepare(pDb->db, zSql, 0, &pStmt, 0);
+ sqlite3_free(zSql);
+ if( rc ){
+ Tcl_AppendResult(interp, "Error: ", sqlite3_errmsg(pDb->db), 0);
+ nCol = 0;
+ }else{
+ nCol = sqlite3_column_count(pStmt);
+ }
+ sqlite3_finalize(pStmt);
+ if( nCol==0 ) {
+ return TCL_ERROR;
+ }
+ zSql = malloc( nByte + 50 + nCol*2 );
+ if( zSql==0 ) {
+ Tcl_AppendResult(interp, "Error: can't malloc()", 0);
+ return TCL_ERROR;
+ }
+ sqlite3_snprintf(nByte+50, zSql, "INSERT OR %q INTO '%q' VALUES(?",
+ zConflict, zTable);
+ j = strlen(zSql);
+ for(i=1; i<nCol; i++){
+ zSql[j++] = ',';
+ zSql[j++] = '?';
+ }
+ zSql[j++] = ')';
+ zSql[j] = 0;
+ rc = sqlite3_prepare(pDb->db, zSql, 0, &pStmt, 0);
+ free(zSql);
+ if( rc ){
+ Tcl_AppendResult(interp, "Error: ", sqlite3_errmsg(pDb->db), 0);
+ sqlite3_finalize(pStmt);
+ return TCL_ERROR;
+ }
+ in = fopen(zFile, "rb");
+ if( in==0 ){
+ Tcl_AppendResult(interp, "Error: cannot open file: ", zFile, NULL);
+ sqlite3_finalize(pStmt);
+ return TCL_ERROR;
+ }
+ azCol = malloc( sizeof(azCol[0])*(nCol+1) );
+ if( azCol==0 ) {
+ Tcl_AppendResult(interp, "Error: can't malloc()", 0);
+ return TCL_ERROR;
+ }
+ sqlite3_exec(pDb->db, "BEGIN", 0, 0, 0);
+ zCommit = "COMMIT";
+ while( (zLine = local_getline(0, in))!=0 ){
+ char *z;
+ i = 0;
+ lineno++;
+ azCol[0] = zLine;
+ for(i=0, z=zLine; *z; z++){
+ if( *z==zSep[0] && strncmp(z, zSep, nSep)==0 ){
+ *z = 0;
+ i++;
+ if( i<nCol ){
+ azCol[i] = &z[nSep];
+ z += nSep-1;
+ }
+ }
+ }
+ if( i+1!=nCol ){
+ char *zErr;
+ zErr = malloc(200 + strlen(zFile));
+ sprintf(zErr,"Error: %s line %d: expected %d columns of data but found %d",
+ zFile, lineno, nCol, i+1);
+ Tcl_AppendResult(interp, zErr, 0);
+ free(zErr);
+ zCommit = "ROLLBACK";
+ break;
+ }
+ for(i=0; i<nCol; i++){
+ /* check for null data, if so, bind as null */
+ if ((nNull>0 && strcmp(azCol[i], zNull)==0) || strlen(azCol[i])==0) {
+ sqlite3_bind_null(pStmt, i+1);
+ }else{
+ sqlite3_bind_text(pStmt, i+1, azCol[i], -1, SQLITE_STATIC);
+ }
+ }
+ sqlite3_step(pStmt);
+ rc = sqlite3_reset(pStmt);
+ free(zLine);
+ if( rc!=SQLITE_OK ){
+ Tcl_AppendResult(interp,"Error: ", sqlite3_errmsg(pDb->db), 0);
+ zCommit = "ROLLBACK";
+ break;
+ }
+ }
+ free(azCol);
+ fclose(in);
+ sqlite3_finalize(pStmt);
+ sqlite3_exec(pDb->db, zCommit, 0, 0, 0);
+
+ if( zCommit[0] == 'C' ){
+ /* success, set result as number of lines processed */
+ pResult = Tcl_GetObjResult(interp);
+ Tcl_SetIntObj(pResult, lineno);
+ rc = TCL_OK;
+ }else{
+ /* failure, append lineno where failed */
+ sprintf(zLineNum,"%d",lineno);
+ Tcl_AppendResult(interp,", failed while processing line: ",zLineNum,0);
+ rc = TCL_ERROR;
+ }
+ break;
+ }
+
/*
** $db errorcode
**
@@ -1302,6 +1512,37 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
}
/*
+ ** $db nullvalue ?STRING?
+ **
+ ** Change text used when a NULL comes back from the database. If ?STRING?
+ ** is not present, then the current string used for NULL is returned.
+ ** If STRING is present, then STRING is returned.
+ **
+ */
+ case DB_NULLVALUE: {
+ if( objc!=2 && objc!=3 ){
+ Tcl_WrongNumArgs(interp, 2, objv, "NULLVALUE");
+ return TCL_ERROR;
+ }
+ if( objc==3 ){
+ int len;
+ char *zNull = Tcl_GetStringFromObj(objv[2], &len);
+ if( pDb->zNull ){
+ Tcl_Free(pDb->zNull);
+ }
+ if( zNull && len>0 ){
+ pDb->zNull = Tcl_Alloc( len + 1 );
+ strncpy(pDb->zNull, zNull, len);
+ pDb->zNull[len] = '\0';
+ }else{
+ pDb->zNull = 0;
+ }
+ }
+ Tcl_SetObjResult(interp, dbTextToObj(pDb->zNull));
+ break;
+ }
+
+ /*
** $db last_insert_rowid
**
** Return an integer which is the ROWID for the most recent insert.
@@ -1365,6 +1606,45 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
break;
}
+ /* $db profile ?CALLBACK?
+ **
+ ** Make arrangements to invoke the CALLBACK routine after each SQL statement
+ ** that has run. The text of the SQL and the amount of elapse time are
+ ** appended to CALLBACK before the script is run.
+ */
+ case DB_PROFILE: {
+ if( objc>3 ){
+ Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?");
+ return TCL_ERROR;
+ }else if( objc==2 ){
+ if( pDb->zProfile ){
+ Tcl_AppendResult(interp, pDb->zProfile, 0);
+ }
+ }else{
+ char *zProfile;
+ int len;
+ if( pDb->zProfile ){
+ Tcl_Free(pDb->zProfile);
+ }
+ zProfile = Tcl_GetStringFromObj(objv[2], &len);
+ if( zProfile && len>0 ){
+ pDb->zProfile = Tcl_Alloc( len + 1 );
+ strcpy(pDb->zProfile, zProfile);
+ }else{
+ pDb->zProfile = 0;
+ }
+#ifndef SQLITE_OMIT_TRACE
+ if( pDb->zProfile ){
+ pDb->interp = interp;
+ sqlite3_profile(pDb->db, DbProfileHandler, pDb);
+ }else{
+ sqlite3_profile(pDb->db, 0, 0);
+ }
+#endif
+ }
+ break;
+ }
+
/*
** $db rekey KEY
**
@@ -1403,37 +1683,6 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
sqlite3_busy_timeout(pDb->db, ms);
break;
}
-
- /*
- ** $db nullvalue ?STRING?
- **
- ** Change text used when a NULL comes back from the database. If ?STRING?
- ** is not present, then the current string used for NULL is returned.
- ** If STRING is present, then STRING is returned.
- **
- */
- case DB_NULLVALUE: {
- if( objc!=2 && objc!=3 ){
- Tcl_WrongNumArgs(interp, 2, objv, "NULLVALUE");
- return TCL_ERROR;
- }
- if( objc==3 ){
- int len;
- char *zNull = Tcl_GetStringFromObj(objv[2], &len);
- if( pDb->zNull ){
- Tcl_Free(pDb->zNull);
- }
- if( zNull && len>0 ){
- pDb->zNull = Tcl_Alloc( len + 1 );
- strncpy(pDb->zNull, zNull, len);
- pDb->zNull[len] = '\0';
- }else{
- pDb->zNull = 0;
- }
- }
- Tcl_SetObjResult(interp, dbTextToObj(pDb->zNull));
- break;
- }
/*
** $db total_changes
@@ -1479,12 +1728,14 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
}else{
pDb->zTrace = 0;
}
+#ifndef SQLITE_OMIT_TRACE
if( pDb->zTrace ){
pDb->interp = interp;
sqlite3_trace(pDb->db, DbTraceHandler, pDb);
}else{
sqlite3_trace(pDb->db, 0, 0);
}
+#endif
}
break;
}
@@ -1546,192 +1797,6 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
break;
}
- /* $db copy conflict-algorithm table filename ?SEPARATOR? ?NULLINDICATOR?
- **
- ** Copy data into table from filename, optionally using SEPARATOR
- ** as column separators. If a column contains a null string, or the
- ** value of NULLINDICATOR, a NULL is inserted for the column.
- ** conflict-algorithm is one of the sqlite conflict algorithms:
- ** rollback, abort, fail, ignore, replace
- ** On success, return the number of lines processed, not necessarily same
- ** as 'db changes' due to conflict-algorithm selected.
- **
- ** This code is basically an implementation/enhancement of
- ** the sqlite3 shell.c ".import" command.
- **
- ** This command usage is equivalent to the sqlite2.x COPY statement,
- ** which imports file data into a table using the PostgreSQL COPY file format:
- ** $db copy $conflit_algo $table_name $filename \t \\N
- */
- case DB_COPY: {
- char *zTable; /* Insert data into this table */
- char *zFile; /* The file from which to extract data */
- char *zConflict; /* The conflict algorithm to use */
- sqlite3_stmt *pStmt; /* A statement */
- int rc; /* Result code */
- int nCol; /* Number of columns in the table */
- int nByte; /* Number of bytes in an SQL string */
- int i, j; /* Loop counters */
- int nSep; /* Number of bytes in zSep[] */
- int nNull; /* Number of bytes in zNull[] */
- char *zSql; /* An SQL statement */
- char *zLine; /* A single line of input from the file */
- char **azCol; /* zLine[] broken up into columns */
- char *zCommit; /* How to commit changes */
- FILE *in; /* The input file */
- int lineno = 0; /* Line number of input file */
- char zLineNum[80]; /* Line number print buffer */
- Tcl_Obj *pResult; /* interp result */
-
- char *zSep;
- char *zNull;
- if( objc<5 || objc>7 ){
- Tcl_WrongNumArgs(interp, 2, objv,
- "CONFLICT-ALGORITHM TABLE FILENAME ?SEPARATOR? ?NULLINDICATOR?");
- return TCL_ERROR;
- }
- if( objc>=6 ){
- zSep = Tcl_GetStringFromObj(objv[5], 0);
- }else{
- zSep = "\t";
- }
- if( objc>=7 ){
- zNull = Tcl_GetStringFromObj(objv[6], 0);
- }else{
- zNull = "";
- }
- zConflict = Tcl_GetStringFromObj(objv[2], 0);
- zTable = Tcl_GetStringFromObj(objv[3], 0);
- zFile = Tcl_GetStringFromObj(objv[4], 0);
- nSep = strlen(zSep);
- nNull = strlen(zNull);
- if( nSep==0 ){
- Tcl_AppendResult(interp, "Error: non-null separator required for copy", 0);
- return TCL_ERROR;
- }
- if(sqlite3StrICmp(zConflict, "rollback") != 0 &&
- sqlite3StrICmp(zConflict, "abort" ) != 0 &&
- sqlite3StrICmp(zConflict, "fail" ) != 0 &&
- sqlite3StrICmp(zConflict, "ignore" ) != 0 &&
- sqlite3StrICmp(zConflict, "replace" ) != 0 ) {
- Tcl_AppendResult(interp, "Error: \"", zConflict,
- "\", conflict-algorithm must be one of: rollback, "
- "abort, fail, ignore, or replace", 0);
- return TCL_ERROR;
- }
- zSql = sqlite3_mprintf("SELECT * FROM '%q'", zTable);
- if( zSql==0 ){
- Tcl_AppendResult(interp, "Error: no such table: ", zTable, 0);
- return TCL_ERROR;
- }
- nByte = strlen(zSql);
- rc = sqlite3_prepare(pDb->db, zSql, 0, &pStmt, 0);
- sqlite3_free(zSql);
- if( rc ){
- Tcl_AppendResult(interp, "Error: ", sqlite3_errmsg(pDb->db), 0);
- nCol = 0;
- }else{
- nCol = sqlite3_column_count(pStmt);
- }
- sqlite3_finalize(pStmt);
- if( nCol==0 ) {
- return TCL_ERROR;
- }
- zSql = malloc( nByte + 50 + nCol*2 );
- if( zSql==0 ) {
- Tcl_AppendResult(interp, "Error: can't malloc()", 0);
- return TCL_ERROR;
- }
- sqlite3_snprintf(nByte+50, zSql, "INSERT OR %q INTO '%q' VALUES(?",
- zConflict, zTable);
- j = strlen(zSql);
- for(i=1; i<nCol; i++){
- zSql[j++] = ',';
- zSql[j++] = '?';
- }
- zSql[j++] = ')';
- zSql[j] = 0;
- rc = sqlite3_prepare(pDb->db, zSql, 0, &pStmt, 0);
- free(zSql);
- if( rc ){
- Tcl_AppendResult(interp, "Error: ", sqlite3_errmsg(pDb->db), 0);
- sqlite3_finalize(pStmt);
- return TCL_ERROR;
- }
- in = fopen(zFile, "rb");
- if( in==0 ){
- Tcl_AppendResult(interp, "Error: cannot open file: ", zFile, NULL);
- sqlite3_finalize(pStmt);
- return TCL_ERROR;
- }
- azCol = malloc( sizeof(azCol[0])*(nCol+1) );
- if( azCol==0 ) {
- Tcl_AppendResult(interp, "Error: can't malloc()", 0);
- return TCL_ERROR;
- }
- sqlite3_exec(pDb->db, "BEGIN", 0, 0, 0);
- zCommit = "COMMIT";
- while( (zLine = local_getline(0, in))!=0 ){
- char *z;
- i = 0;
- lineno++;
- azCol[0] = zLine;
- for(i=0, z=zLine; *z; z++){
- if( *z==zSep[0] && strncmp(z, zSep, nSep)==0 ){
- *z = 0;
- i++;
- if( i<nCol ){
- azCol[i] = &z[nSep];
- z += nSep-1;
- }
- }
- }
- if( i+1!=nCol ){
- char *zErr;
- zErr = malloc(200 + strlen(zFile));
- sprintf(zErr,"Error: %s line %d: expected %d columns of data but found %d",
- zFile, lineno, nCol, i+1);
- Tcl_AppendResult(interp, zErr, 0);
- free(zErr);
- zCommit = "ROLLBACK";
- break;
- }
- for(i=0; i<nCol; i++){
- /* check for null data, if so, bind as null */
- if ((nNull>0 && strcmp(azCol[i], zNull)==0) || strlen(azCol[i])==0) {
- sqlite3_bind_null(pStmt, i+1);
- }else{
- sqlite3_bind_text(pStmt, i+1, azCol[i], -1, SQLITE_STATIC);
- }
- }
- sqlite3_step(pStmt);
- rc = sqlite3_reset(pStmt);
- free(zLine);
- if( rc!=SQLITE_OK ){
- Tcl_AppendResult(interp,"Error: ", sqlite3_errmsg(pDb->db), 0);
- zCommit = "ROLLBACK";
- break;
- }
- }
- free(azCol);
- fclose(in);
- sqlite3_finalize(pStmt);
- sqlite3_exec(pDb->db, zCommit, 0, 0, 0);
-
- if( zCommit[0] == 'C' ){
- /* success, set result as number of lines processed */
- pResult = Tcl_GetObjResult(interp);
- Tcl_SetIntObj(pResult, lineno);
- rc = TCL_OK;
- }else{
- /* failure, append lineno where failed */
- sprintf(zLineNum,"%d",lineno);
- Tcl_AppendResult(interp,", failed while processing line: ",zLineNum,0);
- rc = TCL_ERROR;
- }
- break;
- }
-
/* $db version
**
** Return the version string for this database.
diff --git a/ext/pdo_sqlite/sqlite/src/test1.c b/ext/pdo_sqlite/sqlite/src/test1.c
index 8cb4bf2bca..ceac5cd6da 100644
--- a/ext/pdo_sqlite/sqlite/src/test1.c
+++ b/ext/pdo_sqlite/sqlite/src/test1.c
@@ -661,7 +661,7 @@ static int sqlite3_mprintf_str(
}
/*
-** Usage: sqlite3_mprintf_str FORMAT INTEGER INTEGER DOUBLE
+** Usage: sqlite3_mprintf_double FORMAT INTEGER INTEGER DOUBLE
**
** Call mprintf with two integer arguments and one double argument
*/
@@ -676,7 +676,7 @@ static int sqlite3_mprintf_double(
char *z;
if( argc!=5 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " FORMAT INT INT STRING\"", 0);
+ " FORMAT INT INT DOUBLE\"", 0);
return TCL_ERROR;
}
for(i=2; i<4; i++){
@@ -690,7 +690,7 @@ static int sqlite3_mprintf_double(
}
/*
-** Usage: sqlite3_mprintf_str FORMAT DOUBLE DOUBLE
+** Usage: sqlite3_mprintf_scaled FORMAT DOUBLE DOUBLE
**
** Call mprintf with a single double argument which is the product of the
** two arguments given above. This is used to generate overflow and underflow
@@ -745,6 +745,40 @@ static int sqlite3_mprintf_stronly(
}
/*
+** Usage: sqlite3_mprintf_hexdouble FORMAT HEX
+**
+** Call mprintf with a single double argument which is derived from the
+** hexadecimal encoding of an IEEE double.
+*/
+static int sqlite3_mprintf_hexdouble(
+ void *NotUsed,
+ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
+ int argc, /* Number of arguments */
+ char **argv /* Text of each argument */
+){
+ char *z;
+ double r;
+ unsigned x1, x2;
+ long long unsigned d;
+ if( argc!=3 ){
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " FORMAT STRING\"", 0);
+ return TCL_ERROR;
+ }
+ if( sscanf(argv[2], "%08x%08x", &x2, &x1)!=2 ){
+ Tcl_AppendResult(interp, "2nd argument should be 16-characters of hex", 0);
+ return TCL_ERROR;
+ }
+ d = x2;
+ d = (d<<32) + x1;
+ memcpy(&r, &d, sizeof(r));
+ z = sqlite3_mprintf(argv[1], r);
+ Tcl_AppendResult(interp, z, 0);
+ sqlite3_free(z);
+ return TCL_OK;
+}
+
+/*
** Usage: sqlite_malloc_fail N ?REPEAT-INTERVAL?
**
** Rig sqliteMalloc() to fail on the N-th call and every REPEAT-INTERVAL call
@@ -1107,6 +1141,7 @@ static int test_collate_func(
Tcl_Interp *i = pTestCollateInterp;
int encin = (int)pCtx;
int res;
+ int n;
sqlite3_value *pVal;
Tcl_Obj *pX;
@@ -1130,9 +1165,11 @@ static int test_collate_func(
pVal = sqlite3ValueNew();
sqlite3ValueSetStr(pVal, nA, zA, encin, SQLITE_STATIC);
- Tcl_ListObjAppendElement(i,pX,Tcl_NewStringObj(sqlite3_value_text(pVal),-1));
+ n = sqlite3_value_bytes(pVal);
+ Tcl_ListObjAppendElement(i,pX,Tcl_NewStringObj(sqlite3_value_text(pVal),n));
sqlite3ValueSetStr(pVal, nB, zB, encin, SQLITE_STATIC);
- Tcl_ListObjAppendElement(i,pX,Tcl_NewStringObj(sqlite3_value_text(pVal),-1));
+ n = sqlite3_value_bytes(pVal);
+ Tcl_ListObjAppendElement(i,pX,Tcl_NewStringObj(sqlite3_value_text(pVal),n));
sqlite3ValueFree(pVal);
Tcl_EvalObjEx(i, pX, 0);
@@ -2620,27 +2657,51 @@ static int test_interrupt(
return TCL_OK;
}
+static u8 *sqlite3_stack_baseline = 0;
+
+/*
+** Fill the stack with a known bitpattern.
+*/
+static void prepStack(void){
+ int i;
+ u32 bigBuf[65536];
+ for(i=0; i<sizeof(bigBuf); i++) bigBuf[i] = 0xdeadbeef;
+ sqlite3_stack_baseline = (u8*)&bigBuf[65536];
+}
+
/*
-** Usage: sqlite3_sleep ms
+** Get the current stack depth. Used for debugging only.
+*/
+u64 sqlite3StackDepth(void){
+ u8 x;
+ return (u64)(sqlite3_stack_baseline - &x);
+}
+
+/*
+** Usage: sqlite3_stack_used DB SQL
**
-** Sleep for the specified number of ms.
+** Try to measure the amount of stack space used by a call to sqlite3_exec
*/
-#if 0
-static int test_sleep(
+static int test_stack_used(
void * clientData,
Tcl_Interp *interp,
int argc,
char **argv
){
sqlite3 *db;
- if( argc!=2 ){
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " ms", 0);
+ int i;
+ if( argc!=3 ){
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " DB SQL", 0);
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_sleep(atoi(argv[1]))));
+ if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
+ prepStack();
+ sqlite3_exec(db, argv[2], 0, 0, 0);
+ for(i=65535; i>=0 && ((u32*)sqlite3_stack_baseline)[-i]==0xdeadbeef; i--){}
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(i*4));
return TCL_OK;
}
-#endif
/*
** Usage: sqlite_delete_function DB function-name
@@ -2954,6 +3015,12 @@ static void set_options(Tcl_Interp *interp){
Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "0", TCL_GLOBAL_ONLY);
#endif
+#ifdef SQLITE_OMIT_TRACE
+ Tcl_SetVar2(interp, "sqlite_options", "trace", "0", TCL_GLOBAL_ONLY);
+#else
+ Tcl_SetVar2(interp, "sqlite_options", "trace", "1", TCL_GLOBAL_ONLY);
+#endif
+
#ifdef SQLITE_OMIT_TRIGGER
Tcl_SetVar2(interp, "sqlite_options", "trigger", "0", TCL_GLOBAL_ONLY);
#else
@@ -3004,6 +3071,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_mprintf_stronly", (Tcl_CmdProc*)sqlite3_mprintf_stronly},
{ "sqlite3_mprintf_double", (Tcl_CmdProc*)sqlite3_mprintf_double },
{ "sqlite3_mprintf_scaled", (Tcl_CmdProc*)sqlite3_mprintf_scaled },
+ { "sqlite3_mprintf_hexdouble", (Tcl_CmdProc*)sqlite3_mprintf_hexdouble},
{ "sqlite3_mprintf_z_test", (Tcl_CmdProc*)test_mprintf_z },
{ "sqlite3_last_insert_rowid", (Tcl_CmdProc*)test_last_rowid },
{ "sqlite3_exec_printf", (Tcl_CmdProc*)test_exec_printf },
@@ -3029,6 +3097,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite_delete_function", (Tcl_CmdProc*)delete_function },
{ "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation },
{ "sqlite3_get_autocommit", (Tcl_CmdProc*)get_autocommit },
+ { "sqlite3_stack_used", (Tcl_CmdProc*)test_stack_used },
};
static struct {
char *zName;
@@ -3111,12 +3180,17 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
extern int sqlite3_opentemp_count;
extern int sqlite3_memUsed;
extern int sqlite3_memMax;
- extern char sqlite3_query_plan[];
extern int sqlite3_like_count;
+#if OS_WIN
+ extern int sqlite3_os_type;
+#endif
#ifdef SQLITE_DEBUG
extern int sqlite3_vdbe_addop_trace;
#endif
+#ifdef SQLITE_TEST
+ extern char sqlite3_query_plan[];
static char *query_plan = sqlite3_query_plan;
+#endif
for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){
Tcl_CreateCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0);
@@ -3139,11 +3213,19 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
(char*)&sqlite3_current_time, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_os_trace",
(char*)&sqlite3_os_trace, TCL_LINK_INT);
- Tcl_LinkVar(interp, "sqlite_where_trace",
- (char*)&sqlite3_where_trace, TCL_LINK_INT);
+#if OS_WIN
+ Tcl_LinkVar(interp, "sqlite_os_type",
+ (char*)&sqlite3_os_type, TCL_LINK_INT);
+#endif
+#ifdef SQLITE_TEST
+ Tcl_LinkVar(interp, "sqlite_query_plan",
+ (char*)&query_plan, TCL_LINK_STRING|TCL_LINK_READ_ONLY);
+#endif
#ifdef SQLITE_DEBUG
Tcl_LinkVar(interp, "sqlite_addop_trace",
(char*)&sqlite3_vdbe_addop_trace, TCL_LINK_INT);
+ Tcl_LinkVar(interp, "sqlite_where_trace",
+ (char*)&sqlite3_where_trace, TCL_LINK_INT);
#endif
#ifdef SQLITE_MEMDEBUG
Tcl_LinkVar(interp, "sqlite_memused",
@@ -3151,8 +3233,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
Tcl_LinkVar(interp, "sqlite_memmax",
(char*)&sqlite3_memMax, TCL_LINK_INT | TCL_LINK_READ_ONLY);
#endif
- Tcl_LinkVar(interp, "sqlite_query_plan",
- (char*)&query_plan, TCL_LINK_STRING|TCL_LINK_READ_ONLY);
#ifndef SQLITE_OMIT_DISKIO
Tcl_LinkVar(interp, "sqlite_opentemp_count",
(char*)&sqlite3_opentemp_count, TCL_LINK_INT);
diff --git a/ext/pdo_sqlite/sqlite/src/test2.c b/ext/pdo_sqlite/sqlite/src/test2.c
index 768811ffe5..d4c5544b63 100644
--- a/ext/pdo_sqlite/sqlite/src/test2.c
+++ b/ext/pdo_sqlite/sqlite/src/test2.c
@@ -561,6 +561,7 @@ static int fake_big_file(
int Sqlitetest2_Init(Tcl_Interp *interp){
extern int sqlite3_io_error_pending;
extern int sqlite3_diskfull_pending;
+ extern int sqlite3_diskfull;
static struct {
char *zName;
Tcl_CmdProc *xProc;
@@ -593,6 +594,10 @@ int Sqlitetest2_Init(Tcl_Interp *interp){
(char*)&sqlite3_io_error_pending, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_diskfull_pending",
(char*)&sqlite3_diskfull_pending, TCL_LINK_INT);
+ Tcl_LinkVar(interp, "sqlite_diskfull",
+ (char*)&sqlite3_diskfull, TCL_LINK_INT);
+ Tcl_LinkVar(interp, "sqlite_pending_byte",
+ (char*)&sqlite3_pending_byte, TCL_LINK_INT);
Tcl_LinkVar(interp, "pager_pagesize",
(char*)&test_pagesize, TCL_LINK_INT);
return TCL_OK;
diff --git a/ext/pdo_sqlite/sqlite/src/trigger.c b/ext/pdo_sqlite/sqlite/src/trigger.c
index f39d2bd83f..348dfdd572 100644
--- a/ext/pdo_sqlite/sqlite/src/trigger.c
+++ b/ext/pdo_sqlite/sqlite/src/trigger.c
@@ -11,6 +11,7 @@
*
*/
#include "sqliteInt.h"
+#include "vdbe.h"
#ifndef SQLITE_OMIT_TRIGGER
/*
diff --git a/ext/pdo_sqlite/sqlite/src/update.c b/ext/pdo_sqlite/sqlite/src/update.c
index b1f28ad8cf..b6c6b8b1ed 100644
--- a/ext/pdo_sqlite/sqlite/src/update.c
+++ b/ext/pdo_sqlite/sqlite/src/update.c
@@ -259,13 +259,13 @@ void sqlite3Update(
if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
sqlite3BeginWriteOperation(pParse, 1, pTab->iDb);
- /* If we are trying to update a view, construct that view into
- ** a temporary table.
+ /* If we are trying to update a view, realize that view into
+ ** a ephemeral table.
*/
if( isView ){
Select *pView;
pView = sqlite3SelectDup(pTab->pSelect);
- sqlite3Select(pParse, pView, SRT_TempTable, iCur, 0, 0, 0, 0);
+ sqlite3Select(pParse, pView, SRT_VirtualTab, iCur, 0, 0, 0, 0);
sqlite3SelectDelete(pView);
}
@@ -469,7 +469,7 @@ void sqlite3Update(
** all record selected by the WHERE clause have been updated.
*/
sqlite3VdbeAddOp(v, OP_Goto, 0, addr);
- sqlite3VdbeChangeP2(v, addr, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, addr);
/* Close all tables if there were no FOR EACH ROW triggers */
if( !triggers_exist ){
diff --git a/ext/pdo_sqlite/sqlite/src/util.c b/ext/pdo_sqlite/sqlite/src/util.c
index a35a43fce3..de716d9820 100644
--- a/ext/pdo_sqlite/sqlite/src/util.c
+++ b/ext/pdo_sqlite/sqlite/src/util.c
@@ -367,6 +367,19 @@ char *sqlite3StrNDup(const char *z, int n){
#endif /* !defined(SQLITE_MEMDEBUG) */
/*
+** Reallocate a buffer to a different size. This is similar to
+** sqliteRealloc() except that if the allocation fails the buffer
+** is freed.
+*/
+void sqlite3ReallocOrFree(void **ppBuf, int newSize){
+ void *pNew = sqliteRealloc(*ppBuf, newSize);
+ if( pNew==0 ){
+ sqliteFree(*ppBuf);
+ }
+ *ppBuf = pNew;
+}
+
+/*
** Create a string from the 2nd and subsequent arguments (up to the
** first NULL argument), store the string in memory obtained from
** sqliteMalloc() and make the pointer indicated by the 1st argument
diff --git a/ext/pdo_sqlite/sqlite/src/vdbe.c b/ext/pdo_sqlite/sqlite/src/vdbe.c
index ae33e39961..a3c3cd11f0 100644
--- a/ext/pdo_sqlite/sqlite/src/vdbe.c
+++ b/ext/pdo_sqlite/sqlite/src/vdbe.c
@@ -161,38 +161,6 @@ static void _storeTypeInfo(Mem *pMem){
}
/*
-** Insert a new aggregate element and make it the element that
-** has focus.
-**
-** Return 0 on success and 1 if memory is exhausted.
-*/
-static int AggInsert(Agg *p, char *zKey, int nKey){
- AggElem *pElem;
- int i;
- int rc;
- pElem = sqliteMalloc( sizeof(AggElem) + nKey +
- (p->nMem-1)*sizeof(pElem->aMem[0]) );
- if( pElem==0 ) return SQLITE_NOMEM;
- pElem->zKey = (char*)&pElem->aMem[p->nMem];
- memcpy(pElem->zKey, zKey, nKey);
- pElem->nKey = nKey;
-
- if( p->pCsr ){
- rc = sqlite3BtreeInsert(p->pCsr, zKey, nKey, &pElem, sizeof(AggElem*));
- if( rc!=SQLITE_OK ){
- sqliteFree(pElem);
- return rc;
- }
- }
-
- for(i=0; i<p->nMem; i++){
- pElem->aMem[i].flags = MEM_Null;
- }
- p->pCurrent = pElem;
- return 0;
-}
-
-/*
** Pop the stack N times.
*/
static void popStack(Mem **ppTos, int N){
@@ -206,39 +174,6 @@ static void popStack(Mem **ppTos, int N){
}
/*
-** The parameters are pointers to the head of two sorted lists
-** of Sorter structures. Merge these two lists together and return
-** a single sorted list. This routine forms the core of the merge-sort
-** algorithm.
-**
-** In the case of a tie, left sorts in front of right.
-*/
-static Sorter *Merge(Sorter *pLeft, Sorter *pRight, KeyInfo *pKeyInfo){
- Sorter sHead;
- Sorter *pTail;
- pTail = &sHead;
- pTail->pNext = 0;
- while( pLeft && pRight ){
- int c = sqlite3VdbeRecordCompare(pKeyInfo, pLeft->nKey, pLeft->zKey,
- pRight->nKey, pRight->zKey);
- if( c<=0 ){
- pTail->pNext = pLeft;
- pLeft = pLeft->pNext;
- }else{
- pTail->pNext = pRight;
- pRight = pRight->pNext;
- }
- pTail = pTail->pNext;
- }
- if( pLeft ){
- pTail->pNext = pLeft;
- }else if( pRight ){
- pTail->pNext = pRight;
- }
- return sHead.pNext;
-}
-
-/*
** Allocate cursor number iCur. Return a pointer to it. Return NULL
** if we run out of memory.
*/
@@ -635,7 +570,7 @@ case OP_Return: { /* no-push */
/* Opcode: Halt P1 P2 P3
**
-** Exit immediately. All open cursors, Lists, Sorts, etc are closed
+** Exit immediately. All open cursors, Fifos, etc are closed
** automatically.
**
** P1 is the result code returned by sqlite3_exec(), sqlite3_reset(),
@@ -773,6 +708,7 @@ case OP_String: {
case OP_Null: {
pTos++;
pTos->flags = MEM_Null;
+ pTos->n = 0;
break;
}
@@ -1164,26 +1100,25 @@ case OP_CollSeq: { /* no-push */
/* Opcode: Function P1 P2 P3
**
** Invoke a user function (P3 is a pointer to a Function structure that
-** defines the function) with P1 arguments taken from the stack. Pop all
+** defines the function) with P2 arguments taken from the stack. Pop all
** arguments from the stack and push back the result.
**
-** P2 is a 32-bit bitmask indicating whether or not each argument to the
+** P1 is a 32-bit bitmask indicating whether or not each argument to the
** function was determined to be constant at compile time. If the first
-** argument was constant then bit 0 of P2 is set. This is used to determine
+** argument was constant then bit 0 of P1 is set. This is used to determine
** whether meta data associated with a user function argument using the
** sqlite3_set_auxdata() API may be safely retained until the next
** invocation of this opcode.
**
-** See also: AggFunc
+** See also: AggStep and AggFinal
*/
case OP_Function: {
int i;
Mem *pArg;
sqlite3_context ctx;
sqlite3_value **apVal;
- int n = pOp->p1;
+ int n = pOp->p2;
- n = pOp->p1;
apVal = p->apArg;
assert( apVal || n==0 );
@@ -1222,7 +1157,7 @@ case OP_Function: {
** immediately call the destructor for any non-static values.
*/
if( ctx.pVdbeFunc ){
- sqlite3VdbeDeleteAuxData(ctx.pVdbeFunc, pOp->p2);
+ sqlite3VdbeDeleteAuxData(ctx.pVdbeFunc, pOp->p1);
pOp->p3 = (char *)ctx.pVdbeFunc;
pOp->p3type = P3_VDBEFUNC;
}
@@ -1476,9 +1411,16 @@ case OP_ToBlob: { /* no-push */
** jump to instruction P2. Otherwise, continue to the next instruction.
**
** If the 0x100 bit of P1 is true and either operand is NULL then take the
-** jump. If the 0x100 bit of P1 is false then fall thru if either operand
+** jump. If the 0x100 bit of P1 is clear then fall thru if either operand
** is NULL.
**
+** If the 0x200 bit of P1 is set and either operand is NULL then
+** both operands are converted to integers prior to comparison.
+** NULL operands are converted to zero and non-NULL operands are
+** converted to 1. Thus, for example, with 0x200 set, NULL==NULL is true
+** whereas it would normally be NULL. Similarly, NULL==123 is false when
+** 0x200 is set but is NULL when the 0x200 bit of P1 is clear.
+**
** The least significant byte of P1 (mask 0xff) must be an affinity character -
** 'n', 't', 'i' or 'o' - or 0x00. An attempt is made to coerce both values
** according to the affinity before the comparison is made. If the byte is
@@ -1546,14 +1488,36 @@ case OP_Ge: { /* same as TK_GE, no-push */
** the stack.
*/
if( flags&MEM_Null ){
- popStack(&pTos, 2);
- if( pOp->p2 ){
- if( pOp->p1 & 0x100 ) pc = pOp->p2-1;
+ if( (pOp->p1 & 0x200)!=0 ){
+ /* The 0x200 bit of P1 means, roughly "do not treat NULL as the
+ ** magic SQL value it normally is - treat it as if it were another
+ ** integer".
+ **
+ ** With 0x200 set, if either operand is NULL then both operands
+ ** are converted to integers prior to being passed down into the
+ ** normal comparison logic below. NULL operands are converted to
+ ** zero and non-NULL operands are converted to 1. Thus, for example,
+ ** with 0x200 set, NULL==NULL is true whereas it would normally
+ ** be NULL. Similarly, NULL!=123 is true.
+ */
+ sqlite3VdbeMemSetInt64(pTos, (pTos->flags & MEM_Null)==0);
+ sqlite3VdbeMemSetInt64(pNos, (pNos->flags & MEM_Null)==0);
}else{
- pTos++;
- pTos->flags = MEM_Null;
+ /* If the 0x200 bit of P1 is clear and either operand is NULL then
+ ** the result is always NULL. The jump is taken if the 0x100 bit
+ ** of P1 is set.
+ */
+ popStack(&pTos, 2);
+ if( pOp->p2 ){
+ if( pOp->p1 & 0x100 ){
+ pc = pOp->p2-1;
+ }
+ }else{
+ pTos++;
+ pTos->flags = MEM_Null;
+ }
+ break;
}
- break;
}
affinity = pOp->p1 & 0xFF;
@@ -1710,6 +1674,13 @@ case OP_BitNot: { /* same as TK_BITNOT, no-push */
** Do nothing. This instruction is often useful as a jump
** destination.
*/
+/*
+** The magic Explain opcode are only inserted when explain==2 (which
+** is to say when the EXPLAIN QUERY PLAN syntax is used.)
+** This opcode records information from the optimizer. It is the
+** the same as a no-op. This opcodesnever appears in a real VM program.
+*/
+case OP_Explain:
case OP_Noop: { /* no-push */
break;
}
@@ -2020,7 +1991,7 @@ case OP_Column: {
** we are dealing with a malformed record.
*/
if( idx!=szHdr || offset!=payloadSize ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto op_column_out;
}
@@ -2574,7 +2545,7 @@ case OP_OpenWrite: { /* no-push */
** only mean that we are dealing with a corrupt database file
*/
if( (flags & 0xf0)!=0 || ((flags & 0x07)!=5 && (flags & 0x07)!=2) ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
}
pCur->isTable = (flags & BTREE_INTKEY)!=0;
@@ -2585,7 +2556,7 @@ case OP_OpenWrite: { /* no-push */
*/
if( (pCur->isTable && pOp->p3type==P3_KEYINFO)
|| (pCur->isIndex && pOp->p3type!=P3_KEYINFO) ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
}
break;
@@ -2603,13 +2574,14 @@ case OP_OpenWrite: { /* no-push */
break;
}
-/* Opcode: OpenVirtual P1 * P3
+/* Opcode: OpenVirtual P1 P2 P3
**
-** Open a new cursor to a transient or virtual table.
+** Open a new cursor P1 to a transient or virtual table.
** The cursor is always opened read/write even if
** the main database is read-only. The transient or virtual
** table is deleted automatically when the cursor is closed.
**
+** P2 is the number of columns in the virtual table.
** The cursor points to a BTree table if P3==0 and to a BTree index
** if P3 is not 0. If P3 is not NULL, it points to a KeyInfo structure
** that defines the format of keys in the index.
@@ -2650,6 +2622,7 @@ case OP_OpenVirtual: { /* no-push */
pCx->pIncrKey = &pCx->bogusIncrKey;
}
}
+ pCx->nField = pOp->p2;
pCx->isIndex = !pCx->isTable;
break;
}
@@ -3035,6 +3008,24 @@ case OP_NotExists: { /* no-push */
break;
}
+/* Opcode: Sequence P1 * *
+**
+** Push an integer onto the stack which is the next available
+** sequence number for cursor P1. The sequence number on the
+** cursor is incremented after the push.
+*/
+case OP_Sequence: {
+ int i = pOp->p1;
+ assert( pTos>=p->aStack );
+ assert( i>=0 && i<p->nCursor );
+ assert( p->apCsr[i]!=0 );
+ pTos++;
+ pTos->i = p->apCsr[i]->seqCount++;
+ pTos->flags = MEM_Int;
+ break;
+}
+
+
/* Opcode: NewRowid P1 P2 *
**
** Get a new integer record number (a.k.a "rowid") used as the key to a table.
@@ -3094,7 +3085,7 @@ case OP_NewRowid: {
cnt = 0;
if( (sqlite3BtreeFlags(pC->pCursor)&(BTREE_INTKEY|BTREE_ZERODATA)) !=
BTREE_INTKEY ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
}
assert( (sqlite3BtreeFlags(pC->pCursor) & BTREE_INTKEY)!=0 );
@@ -3464,6 +3455,24 @@ case OP_Last: { /* no-push */
break;
}
+
+/* Opcode: Sort P1 P2 *
+**
+** This opcode does exactly the same thing as OP_Rewind except that
+** it increments an undocumented global variable used for testing.
+**
+** Sorting is accomplished by writing records into a sorting index,
+** then rewinding that index and playing it back from beginning to
+** end. We use the OP_Sort opcode instead of OP_Rewind to do the
+** rewinding so that the global variable will be incremented and
+** regression tests can determine whether or not the optimizer is
+** correctly optimizing out sorts.
+*/
+case OP_Sort: { /* no-push */
+ sqlite3_sort_count++;
+ sqlite3_search_count--;
+ /* Fall through into OP_Rewind */
+}
/* Opcode: Rewind P1 P2 *
**
** The next use of the Rowid or Column or Next instruction for P1
@@ -3685,13 +3694,12 @@ case OP_IdxLT: /* no-push */
case OP_IdxGT: /* no-push */
case OP_IdxGE: { /* no-push */
int i= pOp->p1;
- BtCursor *pCrsr;
Cursor *pC;
assert( i>=0 && i<p->nCursor );
assert( p->apCsr[i]!=0 );
assert( pTos>=p->aStack );
- if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
+ if( (pC = p->apCsr[i])->pCursor!=0 ){
int res, rc;
assert( pTos->flags & MEM_Blob ); /* Created using OP_Make*Key */
@@ -4023,31 +4031,6 @@ case OP_FifoRead: {
break;
}
-#ifndef SQLITE_OMIT_SUBQUERY
-/* Opcode: AggContextPush * * *
-**
-** Save the state of the current aggregator. It is restored an
-** AggContextPop opcode.
-**
-*/
-case OP_AggContextPush: { /* no-push */
- p->pAgg++;
- assert( p->pAgg<&p->apAgg[p->nAgg] );
- break;
-}
-
-/* Opcode: AggContextPop * * *
-**
-** Restore the aggregator to the state it was in when AggContextPush
-** was last called. Any data in the current aggregator is deleted.
-*/
-case OP_AggContextPop: { /* no-push */
- p->pAgg--;
- assert( p->pAgg>=p->apAgg );
- break;
-}
-#endif
-
#ifndef SQLITE_OMIT_TRIGGER
/* Opcode: ContextPush * * *
**
@@ -4063,7 +4046,7 @@ case OP_ContextPush: { /* no-push */
/* FIX ME: This should be allocated as part of the vdbe at compile-time */
if( i>=p->contextStackDepth ){
p->contextStackDepth = i+1;
- p->contextStack = sqliteRealloc(p->contextStack, sizeof(Context)*(i+1));
+ sqlite3ReallocOrFree((void**)&p->contextStack, sizeof(Context)*(i+1));
if( p->contextStack==0 ) goto no_mem;
}
pContext = &p->contextStack[i];
@@ -4091,108 +4074,6 @@ case OP_ContextPop: { /* no-push */
}
#endif /* #ifndef SQLITE_OMIT_TRIGGER */
-/* Opcode: SortInsert * * *
-**
-** The TOS is the key and the NOS is the data. Pop both from the stack
-** and put them on the sorter. The key and data should have been
-** made using the MakeRecord opcode.
-*/
-case OP_SortInsert: { /* no-push */
- Mem *pNos = &pTos[-1];
- Sorter *pSorter;
- assert( pNos>=p->aStack );
- if( Dynamicify(pTos, db->enc) ) goto no_mem;
- pSorter = sqliteMallocRaw( sizeof(Sorter) );
- if( pSorter==0 ) goto no_mem;
- pSorter->pNext = 0;
- if( p->pSortTail ){
- p->pSortTail->pNext = pSorter;
- }else{
- p->pSort = pSorter;
- }
- p->pSortTail = pSorter;
- assert( pTos->flags & MEM_Dyn );
- pSorter->nKey = pTos->n;
- pSorter->zKey = pTos->z;
- pSorter->data.flags = MEM_Null;
- rc = sqlite3VdbeMemMove(&pSorter->data, pNos);
- pTos -= 2;
- break;
-}
-
-/* Opcode: Sort * * P3
-**
-** Sort all elements on the sorter. The algorithm is a
-** mergesort. The P3 argument is a pointer to a KeyInfo structure
-** that describes the keys to be sorted.
-*/
-case OP_Sort: { /* no-push */
- int i;
- KeyInfo *pKeyInfo = (KeyInfo*)pOp->p3;
- Sorter *pElem;
- Sorter *apSorter[NSORT];
- sqlite3_sort_count++;
- pKeyInfo->enc = p->db->enc;
- for(i=0; i<NSORT; i++){
- apSorter[i] = 0;
- }
- while( p->pSort ){
- pElem = p->pSort;
- p->pSort = pElem->pNext;
- pElem->pNext = 0;
- for(i=0; i<NSORT-1; i++){
- if( apSorter[i]==0 ){
- apSorter[i] = pElem;
- break;
- }else{
- pElem = Merge(apSorter[i], pElem, pKeyInfo);
- apSorter[i] = 0;
- }
- }
- if( i>=NSORT-1 ){
- apSorter[NSORT-1] = Merge(apSorter[NSORT-1],pElem, pKeyInfo);
- }
- }
- pElem = 0;
- for(i=0; i<NSORT; i++){
- pElem = Merge(apSorter[i], pElem, pKeyInfo);
- }
- p->pSort = pElem;
- break;
-}
-
-/* Opcode: SortNext * P2 *
-**
-** Push the data for the topmost element in the sorter onto the
-** stack, then remove the element from the sorter. If the sorter
-** is empty, push nothing on the stack and instead jump immediately
-** to instruction P2.
-*/
-case OP_SortNext: {
- Sorter *pSorter = p->pSort;
- CHECK_FOR_INTERRUPT;
- if( pSorter!=0 ){
- p->pSort = pSorter->pNext;
- pTos++;
- pTos->flags = MEM_Null;
- rc = sqlite3VdbeMemMove(pTos, &pSorter->data);
- sqliteFree(pSorter->zKey);
- sqliteFree(pSorter);
- }else{
- pc = pOp->p2 - 1;
- }
- break;
-}
-
-/* Opcode: SortReset * * *
-**
-** Remove any elements that remain on the sorter.
-*/
-case OP_SortReset: { /* no-push */
- sqlite3VdbeSorterReset(p);
- break;
-}
-
/* Opcode: MemStore P1 P2 *
**
** Write the top of the stack into memory location P1.
@@ -4296,64 +4177,49 @@ case OP_IfMemPos: { /* no-push */
break;
}
-/* Opcode: AggReset P1 P2 P3
+/* Opcode: MemNull P1 * *
**
-** Reset the current aggregator context so that it no longer contains any
-** data. Future aggregator elements will contain P2 values each and be sorted
-** using the KeyInfo structure pointed to by P3.
-**
-** If P1 is non-zero, then only a single aggregator row is available (i.e.
-** there is no GROUP BY expression). In this case it is illegal to invoke
-** OP_AggFocus.
+** Store a NULL in memory cell P1
*/
-case OP_AggReset: { /* no-push */
- assert( !pOp->p3 || pOp->p3type==P3_KEYINFO );
- if( pOp->p1 ){
- rc = sqlite3VdbeAggReset(0, p->pAgg, (KeyInfo *)pOp->p3);
- p->pAgg->nMem = pOp->p2; /* Agg.nMem is used by AggInsert() */
- rc = AggInsert(p->pAgg, 0, 0);
- }else{
- rc = sqlite3VdbeAggReset(db, p->pAgg, (KeyInfo *)pOp->p3);
- p->pAgg->nMem = pOp->p2;
- }
- if( rc!=SQLITE_OK ){
- goto abort_due_to_error;
- }
- p->pAgg->apFunc = sqliteMalloc( p->pAgg->nMem*sizeof(p->pAgg->apFunc[0]) );
- if( p->pAgg->apFunc==0 ) goto no_mem;
+case OP_MemNull: {
+ assert( pOp->p1>=0 && pOp->p1<p->nMem );
+ sqlite3VdbeMemSetNull(&p->aMem[pOp->p1]);
break;
}
-/* Opcode: AggInit P1 P2 P3
+/* Opcode: MemInt P1 P2 *
**
-** Initialize the function parameters for an aggregate function.
-** The aggregate will operate out of aggregate column P2.
-** P3 is a pointer to the FuncDef structure for the function.
+** Store the integer value P1 in memory cell P2.
+*/
+case OP_MemInt: {
+ assert( pOp->p2>=0 && pOp->p2<p->nMem );
+ sqlite3VdbeMemSetInt64(&p->aMem[pOp->p2], pOp->p1);
+ break;
+}
+
+/* Opcode: MemMove P1 P2 *
**
-** The P1 argument is not used by this opcode. However if the SSE
-** extension is compiled in, P1 is set to the number of arguments that
-** will be passed to the aggregate function, if any. This is used
-** by SSE to select the correct function when (de)serializing statements.
+** Move the content of memory cell P2 over to memory cell P1.
+** Any prior content of P1 is erased. Memory cell P2 is left
+** containing a NULL.
*/
-case OP_AggInit: { /* no-push */
- int i = pOp->p2;
- assert( i>=0 && i<p->pAgg->nMem );
- p->pAgg->apFunc[i] = (FuncDef*)pOp->p3;
+case OP_MemMove: {
+ assert( pOp->p1>=0 && pOp->p1<p->nMem );
+ assert( pOp->p2>=0 && pOp->p2<p->nMem );
+ rc = sqlite3VdbeMemMove(&p->aMem[pOp->p1], &p->aMem[pOp->p2]);
break;
}
-/* Opcode: AggFunc * P2 P3
+/* Opcode: AggStep P1 P2 P3
**
** Execute the step function for an aggregate. The
** function has P2 arguments. P3 is a pointer to the FuncDef
-** structure that specifies the function.
+** structure that specifies the function. Use memory location
+** P1 as the accumulator.
**
-** The top of the stack must be an integer which is the index of
-** the aggregate column that corresponds to this aggregate function.
-** Ideally, this index would be another parameter, but there are
-** no free parameters left. The integer is popped from the stack.
+** The P2 arguments are popped from the stack.
*/
-case OP_AggFunc: { /* no-push */
+case OP_AggStep: { /* no-push */
int n = pOp->p2;
int i;
Mem *pMem, *pRec;
@@ -4361,24 +4227,18 @@ case OP_AggFunc: { /* no-push */
sqlite3_value **apVal;
assert( n>=0 );
- assert( pTos->flags==MEM_Int );
- pRec = &pTos[-n];
+ pRec = &pTos[1-n];
assert( pRec>=p->aStack );
-
apVal = p->apArg;
assert( apVal || n==0 );
-
for(i=0; i<n; i++, pRec++){
apVal[i] = pRec;
storeTypeInfo(pRec, db->enc);
}
- i = pTos->i;
- assert( i>=0 && i<p->pAgg->nMem );
ctx.pFunc = (FuncDef*)pOp->p3;
- pMem = &p->pAgg->pCurrent->aMem[i];
- ctx.s.z = pMem->zShort; /* Space used for small aggregate contexts */
- ctx.pAgg = pMem->z;
- ctx.cnt = ++pMem->i;
+ assert( pOp->p1>=0 && pOp->p1<p->nMem );
+ ctx.pMem = pMem = &p->aMem[pOp->p1];
+ pMem->n++;
ctx.isError = 0;
ctx.pColl = 0;
if( ctx.pFunc->needCollSeq ){
@@ -4388,182 +4248,34 @@ case OP_AggFunc: { /* no-push */
ctx.pColl = (CollSeq *)pOp[-1].p3;
}
(ctx.pFunc->xStep)(&ctx, n, apVal);
- pMem->z = ctx.pAgg;
- pMem->flags = MEM_AggCtx;
- popStack(&pTos, n+1);
+ popStack(&pTos, n);
if( ctx.isError ){
rc = SQLITE_ERROR;
}
break;
}
-/* Opcode: AggFocus * P2 *
-**
-** Pop the top of the stack and use that as an aggregator key. If
-** an aggregator with that same key already exists, then make the
-** aggregator the current aggregator and jump to P2. If no aggregator
-** with the given key exists, create one and make it current but
-** do not jump.
+/* Opcode: AggFinal P1 P2 P3
**
-** The order of aggregator opcodes is important. The order is:
-** AggReset AggFocus AggNext. In other words, you must execute
-** AggReset first, then zero or more AggFocus operations, then
-** zero or more AggNext operations. You must not execute an AggFocus
-** in between an AggNext and an AggReset.
-*/
-case OP_AggFocus: { /* no-push */
- char *zKey;
- int nKey;
- int res;
- assert( pTos>=p->aStack );
- Stringify(pTos, db->enc);
- zKey = pTos->z;
- nKey = pTos->n;
- assert( p->pAgg->pBtree );
- assert( p->pAgg->pCsr );
- rc = sqlite3BtreeMoveto(p->pAgg->pCsr, zKey, nKey, &res);
- if( rc!=SQLITE_OK ){
- goto abort_due_to_error;
- }
- if( res==0 ){
- rc = sqlite3BtreeData(p->pAgg->pCsr, 0, sizeof(AggElem*),
- (char *)&p->pAgg->pCurrent);
- pc = pOp->p2 - 1;
- }else{
- rc = AggInsert(p->pAgg, zKey, nKey);
- }
- if( rc!=SQLITE_OK ){
- goto abort_due_to_error;
- }
- Release(pTos);
- pTos--;
- break;
-}
-
-/* Opcode: AggSet * P2 *
+** Execute the finalizer function for an aggregate. P1 is
+** the memory location that is the accumulator for the aggregate.
**
-** Move the top of the stack into the P2-th field of the current
-** aggregate. String values are duplicated into new memory.
+** P2 is the number of arguments that the step function takes and
+** P3 is a pointer to the FuncDef for this function. The P2
+** argument is not used by this opcode. It is only there to disambiguate
+** functions that can take varying numbers of arguments. The
+** P3 argument is only needed for the degenerate case where
+** the step function was not previously called.
*/
-case OP_AggSet: { /* no-push */
- AggElem *pFocus;
- int i = pOp->p2;
- pFocus = p->pAgg->pCurrent;
- assert( pTos>=p->aStack );
- if( pFocus==0 ) goto no_mem;
- assert( i>=0 && i<p->pAgg->nMem );
- rc = sqlite3VdbeMemMove(&pFocus->aMem[i], pTos);
- pTos--;
- break;
-}
-
-/* Opcode: AggGet P1 P2 *
-**
-** Push a new entry onto the stack which is a copy of the P2-th field
-** of the current aggregate. Strings are not duplicated so
-** string values will be ephemeral.
-**
-** If P1 is zero, then the value is pulled out of the current aggregate
-** in the current aggregate context. If P1 is greater than zero, then
-** the value is taken from the P1th outer aggregate context. (i.e. if
-** P1==1 then read from the aggregate context that will be restored
-** by the next OP_AggContextPop opcode).
-*/
-case OP_AggGet: {
- AggElem *pFocus;
- int i = pOp->p2;
- Agg *pAgg = &p->pAgg[-pOp->p1];
- assert( pAgg>=p->apAgg );
- pFocus = pAgg->pCurrent;
- if( pFocus==0 ){
- int res;
- if( sqlite3_malloc_failed ) goto no_mem;
- rc = sqlite3BtreeFirst(pAgg->pCsr, &res);
- if( rc!=SQLITE_OK ){
- return rc;
- }
- if( res!=0 ){
- rc = AggInsert(pAgg, "", 1);
- pFocus = pAgg->pCurrent;
- }else{
- rc = sqlite3BtreeData(pAgg->pCsr, 0, 4, (char *)&pFocus);
- }
- }
- assert( i>=0 && i<pAgg->nMem );
- pTos++;
- sqlite3VdbeMemShallowCopy(pTos, &pFocus->aMem[i], MEM_Ephem);
- if( pTos->flags&MEM_Str ){
- sqlite3VdbeChangeEncoding(pTos, db->enc);
- }
+case OP_AggFinal: { /* no-push */
+ Mem *pMem;
+ assert( pOp->p1>=0 && pOp->p1<p->nMem );
+ pMem = &p->aMem[pOp->p1];
+ assert( (pMem->flags & ~(MEM_Null|MEM_Agg))==0 );
+ sqlite3VdbeMemFinalize(pMem, (FuncDef*)pOp->p3);
break;
}
-/* Opcode: AggNext * P2 *
-**
-** Make the next aggregate value the current aggregate. The prior
-** aggregate is deleted. If all aggregate values have been consumed,
-** jump to P2.
-**
-** The order of aggregator opcodes is important. The order is:
-** AggReset AggFocus AggNext. In other words, you must execute
-** AggReset first, then zero or more AggFocus operations, then
-** zero or more AggNext operations. You must not execute an AggFocus
-** in between an AggNext and an AggReset.
-*/
-case OP_AggNext: { /* no-push */
- int res;
- assert( rc==SQLITE_OK );
- CHECK_FOR_INTERRUPT;
- if( p->pAgg->searching==0 ){
- p->pAgg->searching = 1;
- if( p->pAgg->pCsr ){
- rc = sqlite3BtreeFirst(p->pAgg->pCsr, &res);
- }else{
- res = 0;
- }
- }else{
- if( p->pAgg->pCsr ){
- rc = sqlite3BtreeNext(p->pAgg->pCsr, &res);
- }else{
- res = 1;
- }
- }
- if( rc!=SQLITE_OK ) goto abort_due_to_error;
- if( res!=0 ){
- pc = pOp->p2 - 1;
- }else{
- int i;
- sqlite3_context ctx;
- Mem *aMem;
-
- if( p->pAgg->pCsr ){
- rc = sqlite3BtreeData(p->pAgg->pCsr, 0, sizeof(AggElem*),
- (char *)&p->pAgg->pCurrent);
- if( rc!=SQLITE_OK ) goto abort_due_to_error;
- }
- aMem = p->pAgg->pCurrent->aMem;
- for(i=0; i<p->pAgg->nMem; i++){
- FuncDef *pFunc = p->pAgg->apFunc[i];
- Mem *pMem = &aMem[i];
- if( pFunc==0 || pFunc->xFinalize==0 ) continue;
- ctx.s.flags = MEM_Null;
- ctx.s.z = pMem->zShort;
- ctx.pAgg = (void*)pMem->z;
- ctx.cnt = pMem->i;
- ctx.pFunc = pFunc;
- pFunc->xFinalize(&ctx);
- pMem->z = ctx.pAgg;
- if( pMem->z && pMem->z!=pMem->zShort ){
- sqliteFree( pMem->z );
- }
- *pMem = ctx.s;
- if( pMem->flags & MEM_Short ){
- pMem->z = pMem->zShort;
- }
- }
- }
- break;
-}
/* Opcode: Vacuum * * *
**
diff --git a/ext/pdo_sqlite/sqlite/src/vdbe.h b/ext/pdo_sqlite/sqlite/src/vdbe.h
index 77695d1cda..06932503fc 100644
--- a/ext/pdo_sqlite/sqlite/src/vdbe.h
+++ b/ext/pdo_sqlite/sqlite/src/vdbe.h
@@ -104,11 +104,12 @@ int sqlite3VdbeOp3(Vdbe*,int,int,int,const char *zP3,int);
int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
+void sqlite3VdbeJumpHere(Vdbe*, int addr);
void sqlite3VdbeChangeP3(Vdbe*, int addr, const char *zP1, int N);
VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
int sqlite3VdbeMakeLabel(Vdbe*);
void sqlite3VdbeDelete(Vdbe*);
-void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int,int);
+void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int);
int sqlite3VdbeFinalize(Vdbe*);
void sqlite3VdbeResolveLabel(Vdbe*, int);
int sqlite3VdbeCurrentAddr(Vdbe*);
diff --git a/ext/pdo_sqlite/sqlite/src/vdbeInt.h b/ext/pdo_sqlite/sqlite/src/vdbeInt.h
index 7bf2a0ec5d..1746ee561f 100644
--- a/ext/pdo_sqlite/sqlite/src/vdbeInt.h
+++ b/ext/pdo_sqlite/sqlite/src/vdbeInt.h
@@ -81,6 +81,7 @@ struct Cursor {
u8 *pIncrKey; /* Pointer to pKeyInfo->incrKey */
KeyInfo *pKeyInfo; /* Info about index keys needed by index cursors */
int nField; /* Number of fields in the header */
+ i64 seqCount; /* Sequence counter */
/* Cached information about the header for the data record that the
** cursor is currently pointing to. Only valid if cacheValid is true.
@@ -113,35 +114,18 @@ typedef struct Cursor Cursor;
** SQLITE_BLOB.
*/
struct Mem {
- i64 i; /* Integer value */
+ i64 i; /* Integer value. Or FuncDef* when flags==MEM_Agg */
+ double r; /* Real value */
+ char *z; /* String or BLOB value */
int n; /* Number of characters in string value, including '\0' */
u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
u8 type; /* One of MEM_Null, MEM_Str, etc. */
u8 enc; /* TEXT_Utf8, TEXT_Utf16le, or TEXT_Utf16be */
- double r; /* Real value */
- char *z; /* String or BLOB value */
void (*xDel)(void *); /* If not null, call this function to delete Mem.z */
char zShort[NBFS]; /* Space for short strings */
};
typedef struct Mem Mem;
-/*
-** A sorter builds a list of elements to be sorted. Each element of
-** the list is an instance of the following structure.
-*/
-typedef struct Sorter Sorter;
-struct Sorter {
- int nKey; /* Number of bytes in the key */
- char *zKey; /* The key by which we will sort */
- Mem data;
- Sorter *pNext; /* Next in the list */
-};
-
-/*
-** Number of buckets used for merge-sort.
-*/
-#define NSORT 30
-
/* One or more of the following flags are set to indicate the validOK
** representations of the value stored in the Mem struct.
**
@@ -173,12 +157,7 @@ struct Sorter {
#define MEM_Static 0x0080 /* Mem.z points to a static string */
#define MEM_Ephem 0x0100 /* Mem.z points to an ephemeral string */
#define MEM_Short 0x0200 /* Mem.z points to Mem.zShort */
-
-/* The following MEM_ value appears only in AggElem.aMem.s.flag fields.
-** It indicates that the corresponding AggElem.aMem.z points to a
-** aggregate function context that needs to be finalized.
-*/
-#define MEM_AggCtx 0x0400 /* Mem.z points to an agg function context */
+#define MEM_Agg 0x0400 /* Mem.z points to an agg function context */
/* A VdbeFunc is just a FuncDef (defined in sqliteInt.h) that contains
@@ -210,41 +189,16 @@ typedef struct VdbeFunc VdbeFunc;
** But this file is the only place where the internal details of this
** structure are known.
**
-** This structure is defined inside of vdbe.c because it uses substructures
+** This structure is defined inside of vdbeInt.h because it uses substructures
** (Mem) which are only defined there.
*/
struct sqlite3_context {
- FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */
+ FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */
VdbeFunc *pVdbeFunc; /* Auxilary data, if created. */
- Mem s; /* The return value is stored here */
- void *pAgg; /* Aggregate context */
- u8 isError; /* Set to true for an error */
- int cnt; /* Number of times that the step function has been called */
- CollSeq *pColl;
-};
-
-/*
-** An Agg structure describes an Aggregator. Each Agg consists of
-** zero or more Aggregator elements (AggElem). Each AggElem contains
-** a key and one or more values. The values are used in processing
-** aggregate functions in a SELECT. The key is used to implement
-** the GROUP BY clause of a select.
-*/
-typedef struct Agg Agg;
-typedef struct AggElem AggElem;
-struct Agg {
- int nMem; /* Number of values stored in each AggElem */
- AggElem *pCurrent; /* The AggElem currently in focus */
- FuncDef **apFunc; /* Information about aggregate functions */
- Btree *pBtree; /* The tmp. btree used to group elements, if required. */
- BtCursor *pCsr; /* Read/write cursor to the table in pBtree */
- int nTab; /* Root page of the table in pBtree */
- u8 searching; /* True between the first AggNext and AggReset */
-};
-struct AggElem {
- char *zKey; /* The key to this AggElem */
- int nKey; /* Number of bytes in the key, including '\0' at end */
- Mem aMem[1]; /* The values for this AggElem */
+ Mem s; /* The return value is stored here */
+ Mem *pMem; /* Memory cell used to store aggregate context */
+ u8 isError; /* Set to true for an error */
+ CollSeq *pColl; /* Collating sequence */
};
/*
@@ -324,8 +278,6 @@ struct Vdbe {
Mem *aColName; /* Column names to return */
int nCursor; /* Number of slots in apCsr[] */
Cursor **apCsr; /* One element of this array for each open cursor */
- Sorter *pSort; /* A linked list of objects to be sorted */
- Sorter *pSortTail; /* Last element on the pSort list */
int nVar; /* Number of entries in aVar[] */
Mem *aVar; /* Values for the OP_Variable opcode. */
char **azVar; /* Name of variables */
@@ -333,9 +285,6 @@ struct Vdbe {
int magic; /* Magic number for sanity checking */
int nMem; /* Number of memory locations currently allocated */
Mem *aMem; /* The memory locations */
- int nAgg; /* Number of elements in apAgg */
- Agg *apAgg; /* Array of aggregate contexts */
- Agg *pAgg; /* Current aggregate context */
int nCallback; /* Number of callbacks invoked so far */
Fifo sFifo; /* A list of ROWIDs */
int contextStackTop; /* Index of top element in the context stack */
@@ -358,6 +307,7 @@ struct Vdbe {
u8 aborted; /* True if ROLLBACK in another VM causes an abort */
u8 expired; /* True if the VM needs to be recompiled */
int nChange; /* Number of db changes made since last reset */
+ i64 startTime; /* Time when query started - used for profiling */
};
/*
@@ -372,8 +322,6 @@ struct Vdbe {
** Function prototypes
*/
void sqlite3VdbeFreeCursor(Cursor*);
-void sqlite3VdbeSorterReset(Vdbe*);
-int sqlite3VdbeAggReset(sqlite3*, Agg *, KeyInfo *);
void sqliteVdbePopStack(Vdbe*,int);
int sqlite3VdbeCursorMoveto(Cursor*);
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
@@ -415,6 +363,7 @@ double sqlite3VdbeRealValue(Mem*);
int sqlite3VdbeMemRealify(Mem*);
int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*);
void sqlite3VdbeMemRelease(Mem *p);
+void sqlite3VdbeMemFinalize(Mem*, FuncDef*);
#ifndef NDEBUG
void sqlite3VdbeMemSanity(Mem*, u8);
int sqlite3VdbeOpcodeNoPush(u8);
diff --git a/ext/pdo_sqlite/sqlite/src/vdbeapi.c b/ext/pdo_sqlite/sqlite/src/vdbeapi.c
index dfe8f12c41..2fd54f38e3 100644
--- a/ext/pdo_sqlite/sqlite/src/vdbeapi.c
+++ b/ext/pdo_sqlite/sqlite/src/vdbeapi.c
@@ -15,6 +15,7 @@
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
+#include "os.h"
/*
** Return TRUE (non-zero) of the statement supplied as an argument needs
@@ -173,9 +174,10 @@ int sqlite3_step(sqlite3_stmt *pStmt){
return SQLITE_MISUSE;
}
if( p->pc<0 ){
+#ifndef SQLITE_OMIT_TRACE
/* Invoke the trace callback if there is one
*/
- if( (db = p->db)->xTrace && !db->init.busy ){
+ if( db->xTrace && !db->init.busy ){
assert( p->nOp>0 );
assert( p->aOp[p->nOp-1].opcode==OP_Noop );
assert( p->aOp[p->nOp-1].p3!=0 );
@@ -187,6 +189,12 @@ int sqlite3_step(sqlite3_stmt *pStmt){
return SQLITE_MISUSE;
}
}
+ if( db->xProfile && !db->init.busy ){
+ double rNow;
+ sqlite3OsCurrentTime(&rNow);
+ p->startTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0;
+ }
+#endif
/* Print a copy of SQL as it is executed if the SQL_TRACE pragma is turned
** on in debugging mode.
@@ -213,6 +221,23 @@ int sqlite3_step(sqlite3_stmt *pStmt){
rc = SQLITE_MISUSE;
}
+#ifndef SQLITE_OMIT_TRACE
+ /* Invoke the profile callback if there is one
+ */
+ if( rc!=SQLITE_ROW && db->xProfile && !db->init.busy ){
+ double rNow;
+ u64 elapseTime;
+
+ sqlite3OsCurrentTime(&rNow);
+ elapseTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0 - p->startTime;
+ assert( p->nOp>0 );
+ assert( p->aOp[p->nOp-1].opcode==OP_Noop );
+ assert( p->aOp[p->nOp-1].p3!=0 );
+ assert( p->aOp[p->nOp-1].p3type==P3_DYNAMIC );
+ db->xProfile(db->pProfileArg, p->aOp[p->nOp-1].p3, elapseTime);
+ }
+#endif
+
sqlite3Error(p->db, rc, p->zErrMsg ? "%s" : 0, p->zErrMsg);
return rc;
}
@@ -232,16 +257,25 @@ void *sqlite3_user_data(sqlite3_context *p){
** same context that was returned on prior calls.
*/
void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
+ Mem *pMem = p->pMem;
assert( p && p->pFunc && p->pFunc->xStep );
- if( p->pAgg==0 ){
- if( nByte<=NBFS ){
- p->pAgg = (void*)p->s.z;
- memset(p->pAgg, 0, nByte);
+ if( (pMem->flags & MEM_Agg)==0 ){
+ if( nByte==0 ){
+ assert( pMem->flags==MEM_Null );
+ pMem->z = 0;
}else{
- p->pAgg = sqliteMalloc( nByte );
+ pMem->flags = MEM_Agg;
+ pMem->xDel = sqlite3FreeX;
+ *(FuncDef**)&pMem->i = p->pFunc;
+ if( nByte<=NBFS ){
+ pMem->z = pMem->zShort;
+ memset(pMem->z, 0, nByte);
+ }else{
+ pMem->z = sqliteMalloc( nByte );
+ }
}
}
- return p->pAgg;
+ return (void*)pMem->z;
}
/*
@@ -274,8 +308,9 @@ void sqlite3_set_auxdata(
pVdbeFunc = pCtx->pVdbeFunc;
if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){
int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg;
- pCtx->pVdbeFunc = pVdbeFunc = sqliteRealloc(pVdbeFunc, nMalloc);
+ pVdbeFunc = sqliteRealloc(pVdbeFunc, nMalloc);
if( !pVdbeFunc ) return;
+ pCtx->pVdbeFunc = pVdbeFunc;
memset(&pVdbeFunc->apAux[pVdbeFunc->nAux], 0,
sizeof(struct AuxData)*(iArg+1-pVdbeFunc->nAux));
pVdbeFunc->nAux = iArg+1;
@@ -300,7 +335,7 @@ void sqlite3_set_auxdata(
*/
int sqlite3_aggregate_count(sqlite3_context *p){
assert( p && p->pFunc && p->pFunc->xStep );
- return p->cnt;
+ return p->pMem->n;
}
/*
diff --git a/ext/pdo_sqlite/sqlite/src/vdbeaux.c b/ext/pdo_sqlite/sqlite/src/vdbeaux.c
index d9541a3fee..cba9c096d6 100644
--- a/ext/pdo_sqlite/sqlite/src/vdbeaux.c
+++ b/ext/pdo_sqlite/sqlite/src/vdbeaux.c
@@ -62,16 +62,18 @@ void sqlite3VdbeTrace(Vdbe *p, FILE *trace){
** elements.
*/
static void resizeOpArray(Vdbe *p, int N){
- if( p->magic==VDBE_MAGIC_RUN ){
- assert( N==p->nOp );
- p->nOpAlloc = N;
- p->aOp = sqliteRealloc(p->aOp, N*sizeof(Op));
- }else if( p->nOpAlloc<N ){
+ int runMode = p->magic==VDBE_MAGIC_RUN;
+ if( runMode || p->nOpAlloc<N ){
+ VdbeOp *pNew;
+ int nNew = N + 100*(!runMode);
int oldSize = p->nOpAlloc;
- p->nOpAlloc = N+100;
- p->aOp = sqliteRealloc(p->aOp, p->nOpAlloc*sizeof(Op));
- if( p->aOp ){
- memset(&p->aOp[oldSize], 0, (p->nOpAlloc-oldSize)*sizeof(Op));
+ pNew = sqliteRealloc(p->aOp, nNew*sizeof(Op));
+ if( pNew ){
+ p->nOpAlloc = nNew;
+ p->aOp = pNew;
+ if( nNew>oldSize ){
+ memset(&p->aOp[oldSize], 0, (nNew-oldSize)*sizeof(Op));
+ }
}
}
}
@@ -100,7 +102,7 @@ int sqlite3VdbeAddOp(Vdbe *p, int op, int p1, int p2){
p->nOp++;
assert( p->magic==VDBE_MAGIC_INIT );
resizeOpArray(p, i+1);
- if( p->aOp==0 ){
+ if( sqlite3_malloc_failed ){
return 0;
}
pOp = &p->aOp[i];
@@ -145,7 +147,8 @@ int sqlite3VdbeMakeLabel(Vdbe *p){
assert( p->magic==VDBE_MAGIC_INIT );
if( i>=p->nLabelAlloc ){
p->nLabelAlloc = p->nLabelAlloc*2 + 10;
- p->aLabel = sqliteRealloc( p->aLabel, p->nLabelAlloc*sizeof(p->aLabel[0]));
+ sqlite3ReallocOrFree((void**)&p->aLabel,
+ p->nLabelAlloc*sizeof(p->aLabel[0]));
}
if( p->aLabel ){
p->aLabel[i] = -1;
@@ -215,8 +218,8 @@ int sqlite3VdbeOpcodeNoPush(u8 op){
**
** This routine is called once after all opcodes have been inserted.
**
-** Variable *pMaxFuncArgs is set to the maximum value of any P1 argument
-** to an OP_Function or P2 to an OP_AggFunc opcode. This is used by
+** Variable *pMaxFuncArgs is set to the maximum value of any P2 argument
+** to an OP_Function or OP_AggStep opcode. This is used by
** sqlite3VdbeMakeReady() to size the Vdbe.apArg[] array.
**
** The integer *pMaxStack is set to the maximum number of vdbe stack
@@ -239,12 +242,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs, int *pMaxStack){
for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){
u8 opcode = pOp->opcode;
- /* Todo: Maybe OP_AggFunc should change to use P1 in the same
- * way as OP_Function.
- */
- if( opcode==OP_Function ){
- if( pOp->p1>nMaxArgs ) nMaxArgs = pOp->p1;
- }else if( opcode==OP_AggFunc ){
+ if( opcode==OP_Function || opcode==OP_AggStep ){
if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
}else if( opcode==OP_Halt ){
if( pOp->p1==SQLITE_CONSTRAINT && pOp->p2==OE_Abort ){
@@ -302,7 +300,7 @@ int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){
int addr;
assert( p->magic==VDBE_MAGIC_INIT );
resizeOpArray(p, p->nOp + nOp);
- if( p->aOp==0 ){
+ if( sqlite3_malloc_failed ){
return 0;
}
addr = p->nOp;
@@ -354,6 +352,41 @@ void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){
}
/*
+** Change teh P2 operand of instruction addr so that it points to
+** the address of the next instruction to be coded.
+*/
+void sqlite3VdbeJumpHere(Vdbe *p, int addr){
+ sqlite3VdbeChangeP2(p, addr, p->nOp);
+}
+
+/*
+** Delete a P3 value if necessary.
+*/
+static void freeP3(int p3type, void *p3){
+ if( p3 ){
+ switch( p3type ){
+ case P3_DYNAMIC:
+ case P3_KEYINFO:
+ case P3_KEYINFO_HANDOFF: {
+ sqliteFree(p3);
+ break;
+ }
+ case P3_VDBEFUNC: {
+ VdbeFunc *pVdbeFunc = (VdbeFunc *)p3;
+ sqlite3VdbeDeleteAuxData(pVdbeFunc, 0);
+ sqliteFree(pVdbeFunc);
+ break;
+ }
+ case P3_MEM: {
+ sqlite3ValueFree((sqlite3_value*)p3);
+ break;
+ }
+ }
+ }
+}
+
+
+/*
** Change the value of the P3 operand for a specific instruction.
** This routine is useful when a large program is loaded from a
** static array using sqlite3VdbeAddOpList but we want to make a
@@ -382,12 +415,7 @@ void sqlite3VdbeChangeP3(Vdbe *p, int addr, const char *zP3, int n){
Op *pOp;
assert( p->magic==VDBE_MAGIC_INIT );
if( p==0 || p->aOp==0 ){
- if( n==P3_DYNAMIC || n==P3_KEYINFO_HANDOFF ){
- sqliteFree((void*)zP3);
- }
- if( n==P3_MEM ){
- sqlite3ValueFree((sqlite3_value *)zP3);
- }
+ freeP3(n, (void*)*(char**)&zP3);
return;
}
if( addr<0 || addr>=p->nOp ){
@@ -395,16 +423,19 @@ void sqlite3VdbeChangeP3(Vdbe *p, int addr, const char *zP3, int n){
if( addr<0 ) return;
}
pOp = &p->aOp[addr];
- if( pOp->p3 && pOp->p3type==P3_DYNAMIC ){
- sqliteFree(pOp->p3);
- pOp->p3 = 0;
- }
+ freeP3(pOp->p3type, pOp->p3);
+ pOp->p3 = 0;
if( zP3==0 ){
pOp->p3 = 0;
pOp->p3type = P3_NOTUSED;
}else if( n==P3_KEYINFO ){
KeyInfo *pKeyInfo;
int nField, nByte;
+
+ /* KeyInfo structures that include an KeyInfo.aSortOrder are always
+ ** sent in using P3_KEYINFO_HANDOFF. The KeyInfo.aSortOrder array
+ ** is not duplicated when P3_KEYINFO is used. */
+ /* assert( pKeyInfo->aSortOrder==0 ); */
nField = ((KeyInfo*)zP3)->nField;
nByte = sizeof(*pKeyInfo) + (nField-1)*sizeof(pKeyInfo->aColl[0]);
pKeyInfo = sqliteMallocRaw( nByte );
@@ -577,8 +608,9 @@ int sqlite3VdbeList(
}
p->resOnStack = 0;
-
- i = p->pc++;
+ do{
+ i = p->pc++;
+ }while( i<p->nOp && p->explain==2 && p->aOp[i].opcode!=OP_Explain );
if( i>=p->nOp ){
p->rc = SQLITE_OK;
rc = SQLITE_DONE;
@@ -617,7 +649,7 @@ int sqlite3VdbeList(
pMem->type = SQLITE_TEXT;
pMem->enc = SQLITE_UTF8;
- p->nResColumn = 5;
+ p->nResColumn = 5 - 2*(p->explain-1);
p->pTos = pMem;
p->rc = SQLITE_OK;
p->resOnStack = 1;
@@ -658,7 +690,6 @@ void sqlite3VdbeMakeReady(
int nVar, /* Number of '?' see in the SQL statement */
int nMem, /* Number of memory cells to allocate */
int nCursor, /* Number of cursors to allocate */
- int nAgg, /* Number of aggregate contexts required */
int isExplain /* True if the EXPLAIN keywords is present */
){
int n;
@@ -701,7 +732,6 @@ void sqlite3VdbeMakeReady(
+ nVar*sizeof(char*) /* azVar */
+ nMem*sizeof(Mem) /* aMem */
+ nCursor*sizeof(Cursor*) /* apCsr */
- + nAgg*sizeof(Agg) /* Aggregate contexts */
);
if( !sqlite3_malloc_failed ){
p->aMem = &p->aStack[nStack];
@@ -712,17 +742,12 @@ void sqlite3VdbeMakeReady(
p->apArg = (Mem**)&p->aVar[nVar];
p->azVar = (char**)&p->apArg[nArg];
p->apCsr = (Cursor**)&p->azVar[nVar];
- if( nAgg>0 ){
- p->nAgg = nAgg;
- p->apAgg = (Agg*)&p->apCsr[nCursor];
- }
p->nCursor = nCursor;
for(n=0; n<nVar; n++){
p->aVar[n].flags = MEM_Null;
}
}
}
- p->pAgg = p->apAgg;
for(n=0; n<p->nMem; n++){
p->aMem[n].flags = MEM_Null;
}
@@ -763,155 +788,6 @@ void sqlite3VdbeMakeReady(
#endif
}
-
-/*
-** Remove any elements that remain on the sorter for the VDBE given.
-*/
-void sqlite3VdbeSorterReset(Vdbe *p){
- while( p->pSort ){
- Sorter *pSorter = p->pSort;
- p->pSort = pSorter->pNext;
- sqliteFree(pSorter->zKey);
- sqlite3VdbeMemRelease(&pSorter->data);
- sqliteFree(pSorter);
- }
- p->pSortTail = 0;
-}
-
-/*
-** Free all resources allociated with AggElem pElem, an element of
-** aggregate pAgg.
-*/
-static void freeAggElem(AggElem *pElem, Agg *pAgg){
- int i;
- for(i=0; i<pAgg->nMem; i++){
- Mem *pMem = &pElem->aMem[i];
- if( pAgg->apFunc && pAgg->apFunc[i] && (pMem->flags & MEM_AggCtx)!=0 ){
- sqlite3_context ctx;
- ctx.pFunc = pAgg->apFunc[i];
- ctx.s.flags = MEM_Null;
- ctx.pAgg = pMem->z;
- ctx.cnt = pMem->i;
- ctx.isError = 0;
- (*ctx.pFunc->xFinalize)(&ctx);
- pMem->z = ctx.pAgg;
- if( pMem->z!=0 && pMem->z!=pMem->zShort ){
- sqliteFree(pMem->z);
- }
- sqlite3VdbeMemRelease(&ctx.s);
- }else{
- sqlite3VdbeMemRelease(pMem);
- }
- }
- sqliteFree(pElem);
-}
-
-/*
-** Reset an Agg structure. Delete all its contents.
-**
-** For installable aggregate functions, if the step function has been
-** called, make sure the finalizer function has also been called. The
-** finalizer might need to free memory that was allocated as part of its
-** private context. If the finalizer has not been called yet, call it
-** now.
-**
-** If db is NULL, then this is being called from sqliteVdbeReset(). In
-** this case clean up all references to the temp-table used for
-** aggregates (if it was ever opened).
-**
-** If db is not NULL, then this is being called from with an OP_AggReset
-** opcode. Open the temp-table, if it has not already been opened and
-** delete the contents of the table used for aggregate information, ready
-** for the next round of aggregate processing.
-*/
-int sqlite3VdbeAggReset(sqlite3 *db, Agg *pAgg, KeyInfo *pKeyInfo){
- int rc = 0;
- BtCursor *pCsr;
-
- if( !pAgg ) return SQLITE_OK;
- pCsr = pAgg->pCsr;
- assert( (pCsr && pAgg->nTab>0) || (!pCsr && pAgg->nTab==0)
- || sqlite3_malloc_failed );
-
- /* If pCsr is not NULL, then the table used for aggregate information
- ** is open. Loop through it and free the AggElem* structure pointed at
- ** by each entry. If the finalizer has not been called for an AggElem,
- ** do that too. Finally, clear the btree table itself.
- */
- if( pCsr ){
- int res;
- assert( pAgg->pBtree );
- assert( pAgg->nTab>0 );
-
- rc=sqlite3BtreeFirst(pCsr, &res);
- while( res==0 && rc==SQLITE_OK ){
- AggElem *pElem;
- rc = sqlite3BtreeData(pCsr, 0, sizeof(AggElem*), (char *)&pElem);
- if( rc!=SQLITE_OK ){
- return rc;
- }
- assert( pAgg->apFunc!=0 );
- freeAggElem(pElem, pAgg);
- rc=sqlite3BtreeNext(pCsr, &res);
- }
- if( rc!=SQLITE_OK ){
- return rc;
- }
-
- sqlite3BtreeCloseCursor(pCsr);
- sqlite3BtreeClearTable(pAgg->pBtree, pAgg->nTab);
- }else{
- /* The cursor may not be open because the aggregator was never used,
- ** or it could be that it was used but there was no GROUP BY clause.
- */
- if( pAgg->pCurrent ){
- freeAggElem(pAgg->pCurrent, pAgg);
- }
- }
-
- /* If db is not NULL and we have not yet and we have not yet opened
- ** the temporary btree then do so and create the table to store aggregate
- ** information.
- **
- ** If db is NULL, then close the temporary btree if it is open.
- */
- if( db ){
- if( !pAgg->pBtree ){
- assert( pAgg->nTab==0 );
-#ifndef SQLITE_OMIT_MEMORYDB
- rc = sqlite3BtreeFactory(db, ":memory:", 0, TEMP_PAGES, &pAgg->pBtree);
-#else
- rc = sqlite3BtreeFactory(db, 0, 0, TEMP_PAGES, &pAgg->pBtree);
-#endif
- if( rc!=SQLITE_OK ) return rc;
- sqlite3BtreeBeginTrans(pAgg->pBtree, 1);
- rc = sqlite3BtreeCreateTable(pAgg->pBtree, &pAgg->nTab, 0);
- if( rc!=SQLITE_OK ) return rc;
- }
- assert( pAgg->nTab!=0 );
-
- rc = sqlite3BtreeCursor(pAgg->pBtree, pAgg->nTab, 1,
- sqlite3VdbeRecordCompare, pKeyInfo, &pAgg->pCsr);
- if( rc!=SQLITE_OK ) return rc;
- }else{
- if( pAgg->pBtree ){
- sqlite3BtreeClose(pAgg->pBtree);
- pAgg->pBtree = 0;
- pAgg->nTab = 0;
- }
- pAgg->pCsr = 0;
- }
-
- if( pAgg->apFunc ){
- sqliteFree(pAgg->apFunc);
- pAgg->apFunc = 0;
- }
- pAgg->pCurrent = 0;
- pAgg->nMem = 0;
- pAgg->searching = 0;
- return SQLITE_OK;
-}
-
/*
** Close a cursor and release all the resources that cursor happens
** to hold.
@@ -965,10 +841,6 @@ static void Cleanup(Vdbe *p){
}
sqliteFree(p->contextStack);
}
- sqlite3VdbeSorterReset(p);
- for(i=0; i<p->nAgg; i++){
- sqlite3VdbeAggReset(0, &p->apAgg[i], 0);
- }
p->contextStack = 0;
p->contextStackDepth = 0;
p->contextStackTop = 0;
@@ -1145,7 +1017,8 @@ static int vdbeCommit(sqlite3 *db){
*/
zMainFile = sqlite3BtreeGetDirname(db->aDb[0].pBt);
rc = sqlite3OsOpenDirectory(zMainFile, &master);
- if( rc!=SQLITE_OK || (needSync && (rc=sqlite3OsSync(&master))!=SQLITE_OK) ){
+ if( rc!=SQLITE_OK ||
+ (needSync && (rc=sqlite3OsSync(&master,0))!=SQLITE_OK) ){
sqlite3OsClose(&master);
sqlite3OsDelete(zMaster);
sqliteFree(zMaster);
@@ -1489,17 +1362,7 @@ void sqlite3VdbeDelete(Vdbe *p){
if( p->aOp ){
for(i=0; i<p->nOp; i++){
Op *pOp = &p->aOp[i];
- if( pOp->p3type==P3_DYNAMIC || pOp->p3type==P3_KEYINFO ){
- sqliteFree(pOp->p3);
- }
- if( pOp->p3type==P3_VDBEFUNC ){
- VdbeFunc *pVdbeFunc = (VdbeFunc *)pOp->p3;
- sqlite3VdbeDeleteAuxData(pVdbeFunc, 0);
- sqliteFree(pVdbeFunc);
- }
- if( pOp->p3type==P3_MEM ){
- sqlite3ValueFree((sqlite3_value*)pOp->p3);
- }
+ freeP3(pOp->p3type, pOp->p3);
}
sqliteFree(p->aOp);
}
@@ -1714,8 +1577,18 @@ int sqlite3VdbeSerialGet(
}
case 6: /* 8-byte signed integer */
case 7: { /* IEEE floating point */
- u64 x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
- u32 y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
+ u64 x;
+ u32 y;
+#ifndef NDEBUG
+ /* Verify that integers and floating point values use the same
+ ** byte order. The byte order differs on some (broken) architectures.
+ */
+ static const u64 t1 = ((u64)0x3ff00000)<<32;
+ assert( 1.0==*(double*)&t1 );
+#endif
+
+ x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
+ y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
x = (x<<32) | y;
if( serial_type==6 ){
pMem->i = *(i64*)&x;
@@ -1853,7 +1726,7 @@ int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
sqlite3BtreeKeySize(pCur, &nCellKey);
if( nCellKey<=0 ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
rc = sqlite3VdbeMemFromBtree(pCur, 0, nCellKey, 1, &m);
if( rc ){
diff --git a/ext/pdo_sqlite/sqlite/src/vdbemem.c b/ext/pdo_sqlite/sqlite/src/vdbemem.c
index 416beb6c78..0b7e193bec 100644
--- a/ext/pdo_sqlite/sqlite/src/vdbemem.c
+++ b/ext/pdo_sqlite/sqlite/src/vdbemem.c
@@ -188,14 +188,44 @@ int sqlite3VdbeMemStringify(Mem *pMem, int enc){
}
/*
+** Memory cell pMem contains the context of an aggregate function.
+** This routine calls the finalize method for that function. The
+** result of the aggregate is stored back into pMem.
+*/
+void sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
+ if( pFunc && pFunc->xFinalize ){
+ sqlite3_context ctx;
+ assert( (pMem->flags & MEM_Null)!=0 || pFunc==*(FuncDef**)&pMem->i );
+ ctx.s.flags = MEM_Null;
+ ctx.s.z = pMem->zShort;
+ ctx.pMem = pMem;
+ ctx.pFunc = pFunc;
+ pFunc->xFinalize(&ctx);
+ if( pMem->z && pMem->z!=pMem->zShort ){
+ sqliteFree( pMem->z );
+ }
+ *pMem = ctx.s;
+ if( pMem->flags & MEM_Short ){
+ pMem->z = pMem->zShort;
+ }
+ }
+}
+
+/*
** Release any memory held by the Mem. This may leave the Mem in an
** inconsistent state, for example with (Mem.z==0) and
** (Mem.type==SQLITE_TEXT).
*/
void sqlite3VdbeMemRelease(Mem *p){
- if( p->flags & MEM_Dyn ){
+ if( p->flags & (MEM_Dyn|MEM_Agg) ){
if( p->xDel ){
- p->xDel((void *)p->z);
+ if( p->flags & MEM_Agg ){
+ sqlite3VdbeMemFinalize(p, *(FuncDef**)&p->i);
+ assert( (p->flags & MEM_Agg)==0 );
+ sqlite3VdbeMemRelease(p);
+ }else{
+ p->xDel((void *)p->z);
+ }
}else{
sqliteFree(p->z);
}
@@ -287,6 +317,7 @@ void sqlite3VdbeMemSetNull(Mem *pMem){
sqlite3VdbeMemRelease(pMem);
pMem->flags = MEM_Null;
pMem->type = SQLITE_NULL;
+ pMem->n = 0;
}
/*
@@ -699,7 +730,7 @@ const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){
/*
** Create a new sqlite3_value object.
*/
-sqlite3_value* sqlite3ValueNew(){
+sqlite3_value* sqlite3ValueNew(void){
Mem *p = sqliteMalloc(sizeof(*p));
if( p ){
p->flags = MEM_Null;
diff --git a/ext/pdo_sqlite/sqlite/src/where.c b/ext/pdo_sqlite/sqlite/src/where.c
index fddc1f0155..d057acd0fe 100644
--- a/ext/pdo_sqlite/sqlite/src/where.c
+++ b/ext/pdo_sqlite/sqlite/src/where.c
@@ -232,7 +232,7 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, int flags){
/*
** This routine identifies subexpressions in the WHERE clause where
-** each subexpression is separate by the AND operator or some other
+** each subexpression is separated by the AND operator or some other
** operator specified in the op parameter. The WhereClause structure
** is filled with pointers to subexpressions. For example:
**
@@ -281,7 +281,7 @@ static Bitmask getMask(ExprMaskSet *pMaskSet, int iCursor){
**
** There is one cursor per table in the FROM clause. The number of
** tables in the FROM clause is limited by a test early in the
-** sqlite3WhereBegin() routien. So we know that the pMaskSet->ix[]
+** sqlite3WhereBegin() routine. So we know that the pMaskSet->ix[]
** array will never overflow.
*/
static void createMask(ExprMaskSet *pMaskSet, int iCursor){
@@ -303,7 +303,8 @@ static void createMask(ExprMaskSet *pMaskSet, int iCursor){
** translate the cursor numbers into bitmask values and OR all
** the bitmasks together.
*/
-static Bitmask exprListTableUsage(ExprMaskSet *, ExprList *);
+static Bitmask exprListTableUsage(ExprMaskSet*, ExprList*);
+static Bitmask exprSelectTableUsage(ExprMaskSet*, Select*);
static Bitmask exprTableUsage(ExprMaskSet *pMaskSet, Expr *p){
Bitmask mask = 0;
if( p==0 ) return 0;
@@ -314,14 +315,7 @@ static Bitmask exprTableUsage(ExprMaskSet *pMaskSet, Expr *p){
mask = exprTableUsage(pMaskSet, p->pRight);
mask |= exprTableUsage(pMaskSet, p->pLeft);
mask |= exprListTableUsage(pMaskSet, p->pList);
- if( p->pSelect ){
- Select *pS = p->pSelect;
- mask |= exprListTableUsage(pMaskSet, pS->pEList);
- mask |= exprListTableUsage(pMaskSet, pS->pGroupBy);
- mask |= exprListTableUsage(pMaskSet, pS->pOrderBy);
- mask |= exprTableUsage(pMaskSet, pS->pWhere);
- mask |= exprTableUsage(pMaskSet, pS->pHaving);
- }
+ mask |= exprSelectTableUsage(pMaskSet, p->pSelect);
return mask;
}
static Bitmask exprListTableUsage(ExprMaskSet *pMaskSet, ExprList *pList){
@@ -334,6 +328,19 @@ static Bitmask exprListTableUsage(ExprMaskSet *pMaskSet, ExprList *pList){
}
return mask;
}
+static Bitmask exprSelectTableUsage(ExprMaskSet *pMaskSet, Select *pS){
+ Bitmask mask;
+ if( pS==0 ){
+ mask = 0;
+ }else{
+ mask = exprListTableUsage(pMaskSet, pS->pEList);
+ mask |= exprListTableUsage(pMaskSet, pS->pGroupBy);
+ mask |= exprListTableUsage(pMaskSet, pS->pOrderBy);
+ mask |= exprTableUsage(pMaskSet, pS->pWhere);
+ mask |= exprTableUsage(pMaskSet, pS->pHaving);
+ }
+ return mask;
+}
/*
** Return TRUE if the given operator is one of the operators that is
@@ -479,8 +486,11 @@ static int isLikeOrGlob(
Expr *pRight, *pLeft;
ExprList *pList;
int c, cnt;
+ int noCase;
char wc[3];
- if( !sqlite3IsLikeFunction(db, pExpr, wc) ){
+ CollSeq *pColl;
+
+ if( !sqlite3IsLikeFunction(db, pExpr, &noCase, wc) ){
return 0;
}
pList = pExpr->pList;
@@ -492,6 +502,14 @@ static int isLikeOrGlob(
if( pLeft->op!=TK_COLUMN ){
return 0;
}
+ pColl = pLeft->pColl;
+ if( pColl==0 ){
+ pColl = db->pDfltColl;
+ }
+ if( (pColl->type!=SQLITE_COLL_BINARY || noCase) &&
+ (pColl->type!=SQLITE_COLL_NOCASE || !noCase) ){
+ return 0;
+ }
sqlite3DequoteExpr(pRight);
z = pRight->token.z;
for(cnt=0; (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2]; cnt++){}
@@ -514,7 +532,7 @@ static int isLikeOrGlob(
** to the standard form of "X <op> <expr>". If the expression is of
** the form "X <op> Y" where both X and Y are columns, then the original
** expression is unchanged and a new virtual expression of the form
-** "Y <op> X" is added to the WHERE clause.
+** "Y <op> X" is added to the WHERE clause and analyzed separately.
*/
static void exprAnalyze(
SrcList *pSrc, /* the FROM clause */
@@ -526,18 +544,26 @@ static void exprAnalyze(
Expr *pExpr = pTerm->pExpr;
Bitmask prereqLeft;
Bitmask prereqAll;
- int idxRight;
int nPattern;
int isComplete;
if( sqlite3_malloc_failed ) return;
prereqLeft = exprTableUsage(pMaskSet, pExpr->pLeft);
- pTerm->prereqRight = exprTableUsage(pMaskSet, pExpr->pRight);
- pTerm->prereqAll = prereqAll = exprTableUsage(pMaskSet, pExpr);
+ if( pExpr->op==TK_IN ){
+ assert( pExpr->pRight==0 );
+ pTerm->prereqRight = exprListTableUsage(pMaskSet, pExpr->pList)
+ | exprSelectTableUsage(pMaskSet, pExpr->pSelect);
+ }else{
+ pTerm->prereqRight = exprTableUsage(pMaskSet, pExpr->pRight);
+ }
+ prereqAll = exprTableUsage(pMaskSet, pExpr);
+ if( ExprHasProperty(pExpr, EP_FromJoin) ){
+ prereqAll |= getMask(pMaskSet, pExpr->iRightJoinTable);
+ }
+ pTerm->prereqAll = prereqAll;
pTerm->leftCursor = -1;
pTerm->iParent = -1;
pTerm->operator = 0;
- idxRight = -1;
if( allowedOp(pExpr->op) && (pTerm->prereqRight & prereqLeft)==0 ){
Expr *pLeft = pExpr->pLeft;
Expr *pRight = pExpr->pRight;
@@ -599,7 +625,13 @@ static void exprAnalyze(
#ifndef SQLITE_OMIT_OR_OPTIMIZATION
/* Attempt to convert OR-connected terms into an IN operator so that
- ** they can make use of indices.
+ ** they can make use of indices. Example:
+ **
+ ** x = expr1 OR expr2 = x OR x = expr3
+ **
+ ** is converted into
+ **
+ ** x IN (expr1,expr2,expr3)
*/
else if( pExpr->op==TK_OR ){
int ok;
@@ -647,7 +679,11 @@ static void exprAnalyze(
pDup->iColumn = iColumn;
}
pNew = sqlite3Expr(TK_IN, pDup, 0, 0);
- if( pNew ) pNew->pList = pList;
+ if( pNew ){
+ pNew->pList = pList;
+ }else{
+ sqlite3ExprListDelete(pList);
+ }
pTerm->pExpr = pNew;
pTerm->flags |= TERM_DYNAMIC;
exprAnalyze(pSrc, pMaskSet, pWC, idxTerm);
@@ -725,10 +761,10 @@ static int isSortingIndex(
int nEqCol, /* Number of index columns with == constraints */
int *pbRev /* Set to 1 if ORDER BY is DESC */
){
- int i, j; /* Loop counters */
- int sortOrder; /* Which direction we are sorting */
- int nTerm; /* Number of ORDER BY terms */
- struct ExprList_item *pTerm; /* A term of the ORDER BY clause */
+ int i, j; /* Loop counters */
+ int sortOrder = SQLITE_SO_ASC; /* Which direction we are sorting */
+ int nTerm; /* Number of ORDER BY terms */
+ struct ExprList_item *pTerm; /* A term of the ORDER BY clause */
sqlite3 *db = pParse->db;
assert( pOrderBy!=0 );
@@ -802,7 +838,8 @@ static int sortableByRowid(
assert( pOrderBy!=0 );
assert( pOrderBy->nExpr>0 );
p = pOrderBy->a[0].pExpr;
- if( p->op==TK_COLUMN && p->iTable==base && p->iColumn==-1 ){
+ if( pOrderBy->nExpr==1 && p->op==TK_COLUMN && p->iTable==base
+ && p->iColumn==-1 ){
*pbRev = pOrderBy->a[0].sortOrder;
return 1;
}
@@ -810,7 +847,7 @@ static int sortableByRowid(
}
/*
-** Prepare a crude estimate of the logorithm of the input value.
+** Prepare a crude estimate of the logarithm of the input value.
** The results need not be exact. This is only used for estimating
** the total cost of performing operatings with O(logN) or O(NlogN)
** complexity. Because N is just a guess, it is no great tragedy if
@@ -1069,11 +1106,12 @@ static double bestIndex(
** of a LEFT OUTER JOIN. In (1), the term is not disabled.
**
** Disabling a term causes that term to not be tested in the inner loop
-** of the join. Disabling is an optimization. We would get the correct
-** results if nothing were ever disabled, but joins might run a little
-** slower. The trick is to disable as much as we can without disabling
-** too much. If we disabled in (1), we'd get the wrong answer.
-** See ticket #813.
+** of the join. Disabling is an optimization. When terms are satisfied
+** by indices, we disable them to prevent redundant tests in the inner
+** loop. We would get the correct results if nothing were ever disabled,
+** but joins might run a little slower. The trick is to disable as much
+** as we can without disabling too much. If we disabled in (1), we'd get
+** the wrong answer. See ticket #813.
*/
static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
if( pTerm
@@ -1142,8 +1180,9 @@ static void codeEqualityTerm(
sqlite3VdbeAddOp(v, OP_Rewind, iTab, brk);
VdbeComment((v, "# %.*s", pX->span.n, pX->span.z));
pLevel->nIn++;
- pLevel->aInLoop = aIn = sqliteRealloc(pLevel->aInLoop,
+ sqlite3ReallocOrFree((void**)&pLevel->aInLoop,
sizeof(pLevel->aInLoop[0])*3*pLevel->nIn);
+ aIn = pLevel->aInLoop;
if( aIn ){
aIn += pLevel->nIn*3 - 3;
aIn[0] = OP_Next;
@@ -1229,7 +1268,7 @@ static void codeAllEqualityTerms(
}
}
-#ifdef SQLITE_TEST
+#if defined(SQLITE_TEST)
/*
** The following variable holds a text description of query plan generated
** by the most recent call to sqlite3WhereBegin(). Each call to WhereBegin
@@ -1387,7 +1426,7 @@ WhereInfo *sqlite3WhereBegin(
/* Analyze all of the subexpressions. Note that exprAnalyze() might
** add new virtual terms onto the end of the WHERE clause. We do not
** want to analyze these virtual terms, so start analyzing at the end
- ** and work forward so that they added virtual terms are never processed.
+ ** and work forward so that the added virtual terms are never processed.
*/
for(i=0; i<pTabList->nSrc; i++){
createMask(&maskSet, pTabList->a[i].iCursor);
@@ -1415,6 +1454,7 @@ WhereInfo *sqlite3WhereBegin(
pTabItem = pTabList->a;
pLevel = pWInfo->a;
andFlags = ~0;
+ TRACE(("*** Optimizer Start ***\n"));
for(i=iFrom=0, pLevel=pWInfo->a; i<pTabList->nSrc; i++, pLevel++){
Index *pIdx; /* Index for FROM table at pTabItem */
int flags; /* Flags asssociated with pIdx */
@@ -1435,7 +1475,7 @@ WhereInfo *sqlite3WhereBegin(
continue;
}
cost = bestIndex(pParse, &wc, pTabItem, notReady,
- (j==0 && ppOrderBy) ? *ppOrderBy : 0,
+ (i==0 && ppOrderBy) ? *ppOrderBy : 0,
&pIdx, &flags, &nEq);
if( cost<lowestCost ){
lowestCost = cost;
@@ -1444,12 +1484,14 @@ WhereInfo *sqlite3WhereBegin(
bestNEq = nEq;
bestJ = j;
}
- if( (pTabItem->jointype & JT_LEFT)!=0
- || (j>0 && (pTabItem[-1].jointype & JT_LEFT)!=0)
+ if( (pTabItem->jointype & (JT_LEFT|JT_CROSS))!=0
+ || (j>0 && (pTabItem[-1].jointype & (JT_LEFT|JT_CROSS))!=0)
){
break;
}
}
+ TRACE(("*** Optimizer choose table %d for loop %d\n", bestJ,
+ pLevel-pWInfo->a));
if( (bestFlags & WHERE_ORDERBY)!=0 ){
*ppOrderBy = 0;
}
@@ -1467,6 +1509,7 @@ WhereInfo *sqlite3WhereBegin(
notReady &= ~getMask(&maskSet, pTabList->a[bestJ].iCursor);
pLevel->iFrom = bestJ;
}
+ TRACE(("*** Optimizer Finished ***\n"));
/* If the total query only selects a single row, then the ORDER BY
** clause is irrelevant.
@@ -1485,6 +1528,20 @@ WhereInfo *sqlite3WhereBegin(
Index *pIx;
int iIdxCur = pLevel->iIdxCur;
+#ifndef SQLITE_OMIT_EXPLAIN
+ if( pParse->explain==2 ){
+ char *zMsg;
+ struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
+ zMsg = sqlite3MPrintf("TABLE %s", pItem->zName);
+ if( pItem->zAlias ){
+ zMsg = sqlite3MPrintf("%z AS %s", zMsg, pItem->zAlias);
+ }
+ if( (pIx = pLevel->pIdx)!=0 ){
+ zMsg = sqlite3MPrintf("%z WITH INDEX %s", zMsg, pIx->zName);
+ }
+ sqlite3VdbeOp3(v, OP_Explain, i, pLevel->iFrom, zMsg, P3_DYNAMIC);
+ }
+#endif /* SQLITE_OMIT_EXPLAIN */
pTabItem = &pTabList->a[pLevel->iFrom];
pTab = pTabItem->pTab;
if( pTab->isTransient || pTab->pSelect ) continue;
@@ -1540,8 +1597,7 @@ WhereInfo *sqlite3WhereBegin(
if( pLevel->iFrom>0 && (pTabItem[-1].jointype & JT_LEFT)!=0 ){
if( !pParse->nMem ) pParse->nMem++;
pLevel->iLeftJoin = pParse->nMem++;
- sqlite3VdbeAddOp(v, OP_Null, 0, 0);
- sqlite3VdbeAddOp(v, OP_MemStore, pLevel->iLeftJoin, 1);
+ sqlite3VdbeAddOp(v, OP_MemInt, 0, pLevel->iLeftJoin);
VdbeComment((v, "# init LEFT JOIN no-match flag"));
}
@@ -1821,8 +1877,7 @@ WhereInfo *sqlite3WhereBegin(
*/
if( pLevel->iLeftJoin ){
pLevel->top = sqlite3VdbeCurrentAddr(v);
- sqlite3VdbeAddOp(v, OP_Integer, 1, 0);
- sqlite3VdbeAddOp(v, OP_MemStore, pLevel->iLeftJoin, 1);
+ sqlite3VdbeAddOp(v, OP_MemInt, 1, pLevel->iLeftJoin);
VdbeComment((v, "# record LEFT JOIN hit"));
for(pTerm=wc.a, j=0; j<wc.nTerm; j++, pTerm++){
if( pTerm->flags & (TERM_VIRTUAL|TERM_CODED) ) continue;
@@ -1924,13 +1979,13 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
}
if( pLevel->iLeftJoin ){
int addr;
- addr = sqlite3VdbeAddOp(v, OP_MemLoad, pLevel->iLeftJoin, 0);
- sqlite3VdbeAddOp(v, OP_NotNull, 1, addr+4 + (pLevel->iIdxCur>=0));
+ addr = sqlite3VdbeAddOp(v, OP_IfMemPos, pLevel->iLeftJoin, 0);
sqlite3VdbeAddOp(v, OP_NullRow, pTabList->a[i].iCursor, 0);
if( pLevel->iIdxCur>=0 ){
sqlite3VdbeAddOp(v, OP_NullRow, pLevel->iIdxCur, 0);
}
sqlite3VdbeAddOp(v, OP_Goto, 0, pLevel->top);
+ sqlite3VdbeJumpHere(v, addr);
}
}