System.Data.SQLite
Check-in [daf72d2d8e]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:3.3.12
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: daf72d2d8e8a077ffa5bae54f14d82a9a1b900a0
User & Date: rmsimpson 2007-01-30 15:20:47
Context
2007-04-22
23:23
1.0.41.0 check-in: 06c93533ad user: rmsimpson tags: sourceforge
2007-01-30
15:20
3.3.12 check-in: daf72d2d8e user: rmsimpson tags: sourceforge
2007-01-12
02:52
1.0.39.1 check-in: 908ab2479a user: rmsimpson tags: sourceforge
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SQLite.Interop/src/alter.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that used to generate VDBE code
** that implements the ALTER TABLE command.
**
** $Id: alter.c,v 1.25 2007/01/10 14:50:45 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** The code in this file only exists if we are not omitting the
** ALTER TABLE logic from the build.







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that used to generate VDBE code
** that implements the ALTER TABLE command.
**
** $Id: alter.c,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** The code in this file only exists if we are not omitting the
** ALTER TABLE logic from the build.

Changes to SQLite.Interop/src/analyze.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code associated with the ANALYZE command.
**
** @(#) $Id: analyze.c,v 1.18 2007/01/10 14:50:45 rmsimpson Exp $
*/
#ifndef SQLITE_OMIT_ANALYZE
#include "sqliteInt.h"

/*
** This routine generates code that opens the sqlite_stat1 table on cursor
** iStatCur.







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code associated with the ANALYZE command.
**
** @(#) $Id: analyze.c,v 1.19 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef SQLITE_OMIT_ANALYZE
#include "sqliteInt.h"

/*
** This routine generates code that opens the sqlite_stat1 table on cursor
** iStatCur.

Changes to SQLite.Interop/src/attach.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: attach.c,v 1.24 2007/01/10 14:50:45 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** Resolve an expression that was part of an ATTACH or DETACH statement. This
** is slightly different from resolving a normal SQL expression, because simple
** identifiers are treated as strings, not possible column names or aliases.







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: attach.c,v 1.25 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** Resolve an expression that was part of an ATTACH or DETACH statement. This
** is slightly different from resolving a normal SQL expression, because simple
** identifiers are treated as strings, not possible column names or aliases.

Changes to SQLite.Interop/src/auth.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains code used to implement the sqlite3_set_authorizer()
** API.  This facility is an optional feature of the library.  Embedded
** systems that do not need this facility may omit it by recompiling
** the library with -DSQLITE_OMIT_AUTHORIZATION=1
**
** $Id: auth.c,v 1.24 2007/01/10 14:50:45 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** All of the code in this file may be omitted by defining a single
** macro.
*/







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains code used to implement the sqlite3_set_authorizer()
** API.  This facility is an optional feature of the library.  Embedded
** systems that do not need this facility may omit it by recompiling
** the library with -DSQLITE_OMIT_AUTHORIZATION=1
**
** $Id: auth.c,v 1.25 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** All of the code in this file may be omitted by defining a single
** macro.
*/

Changes to SQLite.Interop/src/btree.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
....
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963

5964

5965
5966
5967
5968
5969
5970
5971
....
5972
5973
5974
5975
5976
5977
5978



5979
5980
5981
5982
5983
5984
5985
....
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
....
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
....
6282
6283
6284
6285
6286
6287
6288
6289






6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301



6302
6303
6304
6305
6306
6307
6308

6309
6310
6311
6312
6313
6314
6315
....
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
....
6364
6365
6366
6367
6368
6369
6370

6371
6372
6373
6374
6375
6376
6377
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.27 2007/01/10 14:50:45 rmsimpson Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
................................................................................
/*
** This structure is passed around through all the sanity checking routines
** in order to keep track of some global state information.
*/
typedef struct IntegrityCk IntegrityCk;
struct IntegrityCk {
  BtShared *pBt;    /* The tree being checked out */
  Pager *pPager; /* The associated pager.  Also accessible by pBt->pPager */
  int nPage;     /* Number of pages in the database */
  int *anRef;    /* Number of times each page is referenced */

  char *zErrMsg; /* An error message.  NULL of no errors seen. */

};

#ifndef SQLITE_OMIT_INTEGRITY_CHECK
/*
** Append a message to the error message string.
*/
static void checkAppendMsg(
................................................................................
  IntegrityCk *pCheck,
  char *zMsg1,
  const char *zFormat,
  ...
){
  va_list ap;
  char *zMsg2;



  va_start(ap, zFormat);
  zMsg2 = sqlite3VMPrintf(zFormat, ap);
  va_end(ap);
  if( zMsg1==0 ) zMsg1 = "";
  if( pCheck->zErrMsg ){
    char *zOld = pCheck->zErrMsg;
    pCheck->zErrMsg = 0;
................................................................................
  int iPage,            /* Page number for first page in the list */
  int N,                /* Expected number of pages in the list */
  char *zContext        /* Context for error messages */
){
  int i;
  int expected = N;
  int iFirst = iPage;
  while( N-- > 0 ){
    unsigned char *pOvfl;
    if( iPage<1 ){
      checkAppendMsg(pCheck, zContext,
         "%d of %d pages missing from overflow list starting at %d",
          N+1, expected, iFirst);
      break;
    }
................................................................................
    releasePage(pPage);
    return 0;
  }

  /* Check out all the cells.
  */
  depth = 0;
  for(i=0; i<pPage->nCell; i++){
    u8 *pCell;
    int sz;
    CellInfo info;

    /* Check payload overflow pages
    */
    sprintf(zContext, "On tree page %d cell %d: ", iPage, i);
................................................................................
** a table.  nRoot is the number of entries in aRoot.
**
** If everything checks out, this routine returns NULL.  If something is
** amiss, an error message is written into memory obtained from malloc()
** and a pointer to that error message is returned.  The calling function
** is responsible for freeing the error message when it is done.
*/
char *sqlite3BtreeIntegrityCheck(Btree *p, int *aRoot, int nRoot){






  int i;
  int nRef;
  IntegrityCk sCheck;
  BtShared *pBt = p->pBt;

  nRef = sqlite3pager_refcount(pBt->pPager);
  if( lockBtreeWithRetry(p)!=SQLITE_OK ){
    return sqliteStrDup("Unable to acquire a read lock on the database");
  }
  sCheck.pBt = pBt;
  sCheck.pPager = pBt->pPager;
  sCheck.nPage = sqlite3pager_pagecount(sCheck.pPager);



  if( sCheck.nPage==0 ){
    unlockBtreeIfUnused(pBt);
    return 0;
  }
  sCheck.anRef = sqliteMallocRaw( (sCheck.nPage+1)*sizeof(sCheck.anRef[0]) );
  if( !sCheck.anRef ){
    unlockBtreeIfUnused(pBt);

    return sqlite3MPrintf("Unable to malloc %d bytes", 
        (sCheck.nPage+1)*sizeof(sCheck.anRef[0]));
  }
  for(i=0; i<=sCheck.nPage; i++){ sCheck.anRef[i] = 0; }
  i = PENDING_BYTE_PAGE(pBt);
  if( i<=sCheck.nPage ){
    sCheck.anRef[i] = 1;
................................................................................
  /* Check the integrity of the freelist
  */
  checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
            get4byte(&pBt->pPage1->aData[36]), "Main freelist: ");

  /* Check all the tables.
  */
  for(i=0; i<nRoot; i++){
    if( aRoot[i]==0 ) continue;
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pBt->autoVacuum && aRoot[i]>1 ){
      checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0, 0);
    }
#endif
    checkTreePage(&sCheck, aRoot[i], 0, "List of tree roots: ");
  }

  /* Make sure every page in the file is referenced
  */
  for(i=1; i<=sCheck.nPage; i++){
#ifdef SQLITE_OMIT_AUTOVACUUM
    if( sCheck.anRef[i]==0 ){
      checkAppendMsg(&sCheck, 0, "Page %d is never used", i);
    }
#else
    /* If the database supports auto-vacuum, make sure no tables contain
    ** references to pointer-map pages.
................................................................................
      nRef, sqlite3pager_refcount(pBt->pPager)
    );
  }

  /* Clean  up and report errors.
  */
  sqliteFree(sCheck.anRef);

  return sCheck.zErrMsg;
}
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

/*
** Return the full pathname of the underlying database file.
*/







|







 







|
|
|
>
|
>







 







>
>
>







 







|







 







|







 







|
>
>
>
>
>
>












>
>
>







>







 







|











|







 







>







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
....
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
....
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
....
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
....
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
....
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
....
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
....
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.28 2007/01/30 15:20:47 rmsimpson Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
................................................................................
/*
** This structure is passed around through all the sanity checking routines
** in order to keep track of some global state information.
*/
typedef struct IntegrityCk IntegrityCk;
struct IntegrityCk {
  BtShared *pBt;    /* The tree being checked out */
  Pager *pPager;    /* The associated pager.  Also accessible by pBt->pPager */
  int nPage;        /* Number of pages in the database */
  int *anRef;       /* Number of times each page is referenced */
  int mxErr;        /* Stop accumulating errors when this reaches zero */
  char *zErrMsg;    /* An error message.  NULL if no errors seen. */
  int nErr;         /* Number of messages written to zErrMsg so far */
};

#ifndef SQLITE_OMIT_INTEGRITY_CHECK
/*
** Append a message to the error message string.
*/
static void checkAppendMsg(
................................................................................
  IntegrityCk *pCheck,
  char *zMsg1,
  const char *zFormat,
  ...
){
  va_list ap;
  char *zMsg2;
  if( !pCheck->mxErr ) return;
  pCheck->mxErr--;
  pCheck->nErr++;
  va_start(ap, zFormat);
  zMsg2 = sqlite3VMPrintf(zFormat, ap);
  va_end(ap);
  if( zMsg1==0 ) zMsg1 = "";
  if( pCheck->zErrMsg ){
    char *zOld = pCheck->zErrMsg;
    pCheck->zErrMsg = 0;
................................................................................
  int iPage,            /* Page number for first page in the list */
  int N,                /* Expected number of pages in the list */
  char *zContext        /* Context for error messages */
){
  int i;
  int expected = N;
  int iFirst = iPage;
  while( N-- > 0 && pCheck->mxErr ){
    unsigned char *pOvfl;
    if( iPage<1 ){
      checkAppendMsg(pCheck, zContext,
         "%d of %d pages missing from overflow list starting at %d",
          N+1, expected, iFirst);
      break;
    }
................................................................................
    releasePage(pPage);
    return 0;
  }

  /* Check out all the cells.
  */
  depth = 0;
  for(i=0; i<pPage->nCell && pCheck->mxErr; i++){
    u8 *pCell;
    int sz;
    CellInfo info;

    /* Check payload overflow pages
    */
    sprintf(zContext, "On tree page %d cell %d: ", iPage, i);
................................................................................
** a table.  nRoot is the number of entries in aRoot.
**
** If everything checks out, this routine returns NULL.  If something is
** amiss, an error message is written into memory obtained from malloc()
** and a pointer to that error message is returned.  The calling function
** is responsible for freeing the error message when it is done.
*/
char *sqlite3BtreeIntegrityCheck(
  Btree *p,     /* The btree to be checked */
  int *aRoot,   /* An array of root pages numbers for individual trees */
  int nRoot,    /* Number of entries in aRoot[] */
  int mxErr,    /* Stop reporting errors after this many */
  int *pnErr    /* Write number of errors seen to this variable */
){
  int i;
  int nRef;
  IntegrityCk sCheck;
  BtShared *pBt = p->pBt;

  nRef = sqlite3pager_refcount(pBt->pPager);
  if( lockBtreeWithRetry(p)!=SQLITE_OK ){
    return sqliteStrDup("Unable to acquire a read lock on the database");
  }
  sCheck.pBt = pBt;
  sCheck.pPager = pBt->pPager;
  sCheck.nPage = sqlite3pager_pagecount(sCheck.pPager);
  sCheck.mxErr = mxErr;
  sCheck.nErr = 0;
  *pnErr = 0;
  if( sCheck.nPage==0 ){
    unlockBtreeIfUnused(pBt);
    return 0;
  }
  sCheck.anRef = sqliteMallocRaw( (sCheck.nPage+1)*sizeof(sCheck.anRef[0]) );
  if( !sCheck.anRef ){
    unlockBtreeIfUnused(pBt);
    *pnErr = 1;
    return sqlite3MPrintf("Unable to malloc %d bytes", 
        (sCheck.nPage+1)*sizeof(sCheck.anRef[0]));
  }
  for(i=0; i<=sCheck.nPage; i++){ sCheck.anRef[i] = 0; }
  i = PENDING_BYTE_PAGE(pBt);
  if( i<=sCheck.nPage ){
    sCheck.anRef[i] = 1;
................................................................................
  /* Check the integrity of the freelist
  */
  checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
            get4byte(&pBt->pPage1->aData[36]), "Main freelist: ");

  /* Check all the tables.
  */
  for(i=0; i<nRoot && sCheck.mxErr; i++){
    if( aRoot[i]==0 ) continue;
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pBt->autoVacuum && aRoot[i]>1 ){
      checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0, 0);
    }
#endif
    checkTreePage(&sCheck, aRoot[i], 0, "List of tree roots: ");
  }

  /* Make sure every page in the file is referenced
  */
  for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
#ifdef SQLITE_OMIT_AUTOVACUUM
    if( sCheck.anRef[i]==0 ){
      checkAppendMsg(&sCheck, 0, "Page %d is never used", i);
    }
#else
    /* If the database supports auto-vacuum, make sure no tables contain
    ** references to pointer-map pages.
................................................................................
      nRef, sqlite3pager_refcount(pBt->pPager)
    );
  }

  /* Clean  up and report errors.
  */
  sqliteFree(sCheck.anRef);
  *pnErr = sCheck.nErr;
  return sCheck.zErrMsg;
}
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

/*
** Return the full pathname of the underlying database file.
*/

Changes to SQLite.Interop/src/btree.h.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite B-Tree file
** subsystem.  See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: btree.h,v 1.25 2007/01/10 14:50:45 rmsimpson Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_

/* TODO: This definition is just included so other modules compile. It
** needs to be revisited.
*/
................................................................................
int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt);
const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt);
int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);

char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot);
struct Pager *sqlite3BtreePager(Btree*);


#ifdef SQLITE_TEST
int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
void sqlite3BtreeCursorList(Btree*);
#endif







|







 







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite B-Tree file
** subsystem.  See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: btree.h,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_

/* TODO: This definition is just included so other modules compile. It
** needs to be revisited.
*/
................................................................................
int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt);
const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt);
int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);

char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
struct Pager *sqlite3BtreePager(Btree*);


#ifdef SQLITE_TEST
int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
void sqlite3BtreeCursorList(Btree*);
#endif

Changes to SQLite.Interop/src/build.c.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
**     CREATE INDEX
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**
** $Id: build.c,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Initialize the pParse structure as needed.







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
**     CREATE INDEX
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**
** $Id: build.c,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Initialize the pParse structure as needed.

Changes to SQLite.Interop/src/callback.c.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
** $Id: callback.c,v 1.20 2007/01/10 14:50:46 rmsimpson Exp $
*/

#include "sqliteInt.h"

/*
** Invoke the 'collation needed' callback to request a collation sequence
** in the database text encoding of name zName, length nName.







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
** $Id: callback.c,v 1.21 2007/01/30 15:20:47 rmsimpson Exp $
*/

#include "sqliteInt.h"

/*
** Invoke the 'collation needed' callback to request a collation sequence
** in the database text encoding of name zName, length nName.

Changes to SQLite.Interop/src/complete.c.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** An tokenizer for SQL
**
** This file contains C code that implements the sqlite3_complete() API.
** This code used to be part of the tokenizer.c source file.  But by
** separating it out, the code will be automatically omitted from
** static links that do not use it.
**
** $Id: complete.c,v 1.18 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#ifndef SQLITE_OMIT_COMPLETE

/*
** This is defined in tokenize.c.  We just have to import the definition.
*/







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** An tokenizer for SQL
**
** This file contains C code that implements the sqlite3_complete() API.
** This code used to be part of the tokenizer.c source file.  But by
** separating it out, the code will be automatically omitted from
** static links that do not use it.
**
** $Id: complete.c,v 1.19 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#ifndef SQLITE_OMIT_COMPLETE

/*
** This is defined in tokenize.c.  We just have to import the definition.
*/

Changes to SQLite.Interop/src/date.c.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This file contains the C functions that implement date and time
** functions for SQLite.  
**
** There is only one exported symbol in this file - the function
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: date.c,v 1.26 2007/01/10 14:50:46 rmsimpson Exp $
**
** NOTES:
**
** SQLite processes all times and dates as Julian Day numbers.  The
** dates and times are stored as the number of days since noon
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
** calendar system. 







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This file contains the C functions that implement date and time
** functions for SQLite.  
**
** There is only one exported symbol in this file - the function
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: date.c,v 1.27 2007/01/30 15:20:47 rmsimpson Exp $
**
** NOTES:
**
** SQLite processes all times and dates as Julian Day numbers.  The
** dates and times are stored as the number of days since noon
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
** calendar system. 

Changes to SQLite.Interop/src/delete.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** in order to generate code for DELETE FROM statements.
**
** $Id: delete.c,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** Look up every table that is named in pSrc.  If any table is not found,
** add an error message to pParse->zErrMsg and return NULL.  If all tables
** are found, return a pointer to the last table.







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** in order to generate code for DELETE FROM statements.
**
** $Id: delete.c,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** Look up every table that is named in pSrc.  If any table is not found,
** add an error message to pParse->zErrMsg and return NULL.  If all tables
** are found, return a pointer to the last table.

Changes to SQLite.Interop/src/expr.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.32 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Return the 'affinity' of the expression pExpr if any.
**







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.33 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Return the 'affinity' of the expression pExpr if any.
**

Changes to SQLite.Interop/src/fts1.c.

3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095

3096
3097
3098
3099
3100
3101
3102
3103
static int index_update(fulltext_vtab *v, sqlite_int64 iRow,
                        sqlite3_value **pValues, fts1Hash *pTerms){
  /* Generate an empty doclist for each term that previously appeared in this
   * row. */
  int rc = deleteTerms(v, pTerms, iRow);
  if( rc!=SQLITE_OK ) return rc;

  /* Now add positions for terms which appear in the updated row. */
  rc = insertTerms(v, pTerms, iRow, pValues);
  if( rc!=SQLITE_OK ) return rc;


  return content_update(v, pValues, iRow);  /* execute an SQL UPDATE */
}

/* This function implements the xUpdate callback; it's the top-level entry
 * point for inserting, deleting or updating a row in a full-text table. */
static int fulltextUpdate(sqlite3_vtab *pVtab, int nArg, sqlite3_value **ppArg,
                   sqlite_int64 *pRowid){
  fulltext_vtab *v = (fulltext_vtab *) pVtab;







|
<


>
|







3085
3086
3087
3088
3089
3090
3091
3092

3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
static int index_update(fulltext_vtab *v, sqlite_int64 iRow,
                        sqlite3_value **pValues, fts1Hash *pTerms){
  /* Generate an empty doclist for each term that previously appeared in this
   * row. */
  int rc = deleteTerms(v, pTerms, iRow);
  if( rc!=SQLITE_OK ) return rc;

  rc = content_update(v, pValues, iRow);  /* execute an SQL UPDATE */

  if( rc!=SQLITE_OK ) return rc;

  /* Now add positions for terms which appear in the updated row. */
  return insertTerms(v, pTerms, iRow, pValues);
}

/* This function implements the xUpdate callback; it's the top-level entry
 * point for inserting, deleting or updating a row in a full-text table. */
static int fulltextUpdate(sqlite3_vtab *pVtab, int nArg, sqlite3_value **ppArg,
                   sqlite_int64 *pRowid){
  fulltext_vtab *v = (fulltext_vtab *) pVtab;

Changes to SQLite.Interop/src/func.c.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This file contains the C functions that implement various SQL
** functions of SQLite.  
**
** There is only one exported symbol in this file - the function
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: func.c,v 1.27 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
/* #include <math.h> */
#include <stdlib.h>
#include <assert.h>
#include "vdbeInt.h"







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This file contains the C functions that implement various SQL
** functions of SQLite.  
**
** There is only one exported symbol in this file - the function
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: func.c,v 1.28 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
/* #include <math.h> */
#include <stdlib.h>
#include <assert.h>
#include "vdbeInt.h"

Changes to SQLite.Interop/src/hash.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the implementation of generic hash-tables
** used in SQLite.
**
** $Id: hash.c,v 1.24 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <assert.h>

/* Turn bulk memory into a hash table object by initializing the
** fields of the Hash structure.
**







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the implementation of generic hash-tables
** used in SQLite.
**
** $Id: hash.c,v 1.25 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <assert.h>

/* Turn bulk memory into a hash table object by initializing the
** fields of the Hash structure.
**

Changes to SQLite.Interop/src/hash.h.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the header file for the generic hash-table implemenation
** used in SQLite.
**
** $Id: hash.h,v 1.24 2007/01/10 14:50:46 rmsimpson Exp $
*/
#ifndef _SQLITE_HASH_H_
#define _SQLITE_HASH_H_

/* Forward declarations of structures. */
typedef struct Hash Hash;
typedef struct HashElem HashElem;







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the header file for the generic hash-table implemenation
** used in SQLite.
**
** $Id: hash.h,v 1.25 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef _SQLITE_HASH_H_
#define _SQLITE_HASH_H_

/* Forward declarations of structures. */
typedef struct Hash Hash;
typedef struct HashElem HashElem;

Changes to SQLite.Interop/src/insert.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** Set P3 of the most recently inserted opcode to a column affinity
** string for index pIdx. A column affinity string has one character
** for each column in the table, according to the affinity of the column:







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** Set P3 of the most recently inserted opcode to a column affinity
** string for index pIdx. A column affinity string has one character
** for each column in the table, according to the affinity of the column:

Changes to SQLite.Interop/src/legacy.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: legacy.c,v 1.24 2007/01/10 14:50:46 rmsimpson Exp $
*/

#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: legacy.c,v 1.25 2007/01/30 15:20:47 rmsimpson Exp $
*/

#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*

Changes to SQLite.Interop/src/loadext.c.

71
72
73
74
75
76
77














78
79
80
81
82
83
84
...
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#endif

#ifdef SQLITE_OMIT_VIRTUALTABLE
# define sqlite3_create_module 0
# define sqlite3_declare_vtab 0
#endif















/*
** The following structure contains pointers to all SQLite API routines.
** A pointer to this structure is passed into extensions when they are
** loaded so that the extension can make calls back into the SQLite
** library.
**
** When adding new APIs, add them to the bottom of this structure
................................................................................
  sqlite3_expired,
  sqlite3_finalize,
  sqlite3_free,
  sqlite3_free_table,
  sqlite3_get_autocommit,
  sqlite3_get_auxdata,
  sqlite3_get_table,
  sqlite3_global_recover,
  sqlite3_interrupt,
  sqlite3_last_insert_rowid,
  sqlite3_libversion,
  sqlite3_libversion_number,
  sqlite3_malloc,
  sqlite3_mprintf,
  sqlite3_open,







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#endif

#ifdef SQLITE_OMIT_VIRTUALTABLE
# define sqlite3_create_module 0
# define sqlite3_declare_vtab 0
#endif

#ifdef SQLITE_OMIT_SHARED_CACHE
# define sqlite3_enable_shared_cache 0
#endif

#ifdef SQLITE_OMIT_TRACE
# define sqlite3_profile       0
# define sqlite3_trace         0
#endif

#ifdef SQLITE_OMIT_GET_TABLE
# define sqlite3_free_table    0
# define sqlite3_get_table     0
#endif

/*
** The following structure contains pointers to all SQLite API routines.
** A pointer to this structure is passed into extensions when they are
** loaded so that the extension can make calls back into the SQLite
** library.
**
** When adding new APIs, add them to the bottom of this structure
................................................................................
  sqlite3_expired,
  sqlite3_finalize,
  sqlite3_free,
  sqlite3_free_table,
  sqlite3_get_autocommit,
  sqlite3_get_auxdata,
  sqlite3_get_table,
  0,     /* Was sqlite3_global_recover(), but that function is deprecated */
  sqlite3_interrupt,
  sqlite3_last_insert_rowid,
  sqlite3_libversion,
  sqlite3_libversion_number,
  sqlite3_malloc,
  sqlite3_mprintf,
  sqlite3_open,

Changes to SQLite.Interop/src/main.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.26 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** The following constant value is used by the SQLITE_BIGENDIAN and







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.27 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** The following constant value is used by the SQLITE_BIGENDIAN and

Changes to SQLite.Interop/src/os_win.c.

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

/*
** Determine if we are dealing with WindowsCE - which has a much
** reduced API.
*/
#if defined(_WIN32_WCE)
# define OS_WINCE 1
#define AreFileApisANSI() 1
#else
# define OS_WINCE 0
#endif

/*
** WinCE lacks native support for file locking so we have to fake it
** with some code of our own.







|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

/*
** Determine if we are dealing with WindowsCE - which has a much
** reduced API.
*/
#if defined(_WIN32_WCE)
# define OS_WINCE 1
# define AreFileApisANSI() 1
#else
# define OS_WINCE 0
#endif

/*
** WinCE lacks native support for file locking so we have to fake it
** with some code of our own.

Changes to SQLite.Interop/src/pager.c.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.26 2007/01/10 14:50:46 rmsimpson Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
#include "os.h"
#include "pager.h"
#include <assert.h>
#include <string.h>







|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.27 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
#include "os.h"
#include "pager.h"
#include <assert.h>
#include <string.h>

Changes to SQLite.Interop/src/pager.h.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite page cache
** subsystem.  The page cache subsystem reads and writes a file a page
** at a time and provides a journal for rollback.
**
** @(#) $Id: pager.h,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/

#ifndef _PAGER_H_
#define _PAGER_H_

/*
** The default size of a database page.







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite page cache
** subsystem.  The page cache subsystem reads and writes a file a page
** at a time and provides a journal for rollback.
**
** @(#) $Id: pager.h,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/

#ifndef _PAGER_H_
#define _PAGER_H_

/*
** The default size of a database page.

Changes to SQLite.Interop/src/parse.c.

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581


582
583
584
585
586
587
588
...
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
....
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125

1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
....
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
....
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
....
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761


1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783



1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
....
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855






1856
1857
1858

1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005

2006
2007

2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945


2946
2947
2948
2949
2950
2951
2952




2953
2954
2955

2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968

2969
2970

2971
2972
2973
2974
2975
2976
2977
2978
2979

2980
2981

2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998





2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017

3018
3019
3020
3021
3022

3023
3024
3025
3026
3027

3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124





3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155





3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
....
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
**    sqlite3ParserARG_FETCH     Code to extract %extra_argument from yypParser
**    YYNSTATE           the combined number of states.
**    YYNRULE            the number of rules in the grammar
**    YYERRORSYMBOL      is the code number of the error symbol.  If not
**                       defined, then do no error processing.
*/
#define YYCODETYPE unsigned char
#define YYNOCODE 248
#define YYACTIONTYPE unsigned short int
#define YYWILDCARD 60
#define sqlite3ParserTOKENTYPE Token
typedef union {
  sqlite3ParserTOKENTYPE yy0;
  int yy46;
  struct LikeOp yy72;
  Expr* yy172;
  ExprList* yy174;
  Select* yy219;
  struct LimitVal yy234;
  TriggerStep* yy243;
  struct TrigEvent yy370;
  SrcList* yy373;
  Expr * yy386;
  struct {int value; int mask;} yy405;
  Token yy410;
  IdList* yy432;
  int yy495;
} 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 586
#define YYNRULE 310
#define YYERRORSYMBOL 139
#define YYERRSYMDT yy495
#define YYFALLBACK 1
#define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
#define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)

/* Next are that tables used to determine what action to take based on the
** current state and lookahead token.  These tables are used to implement
................................................................................
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
**                     shifting non-terminals after a reduce.
**  yy_default[]       Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   290,   67,  300,   69,  150,  168,  205,  420,   61,   61,
 /*    10 */    61,   61,   66,   63,   63,   63,   63,   64,   64,   65,
 /*    20 */    65,   65,   66,  430,  322,  164,  433,  439,   68,   63,
 /*    30 */    63,   63,   63,   64,   64,   65,   65,   65,   66,   64,
 /*    40 */    64,   65,   65,   65,   66,   60,   58,  296,  443,  444,
 /*    50 */   440,  440,   62,   62,   61,   61,   61,   61,  487,   63,
 /*    60 */    63,   63,   63,   64,   64,   65,   65,   65,   66,  290,
 /*    70 */   318,   67,  420,   69,  150,   79,  160,  114,  240,  341,
 /*    80 */   245,  342,  172,  249,  897,  120,  585,  190,  522,    2,
 /*    90 */   250,  571,  411,   35,  223,  433,  439,  532,   20,   57,
 /*   100 */   388,  385,   63,   63,   63,   63,   64,   64,   65,   65,
 /*   110 */    65,   66,  290,  489,   60,   58,  296,  443,  444,  440,
 /*   120 */   440,   62,   62,   61,   61,   61,   61,  393,   63,   63,
 /*   130 */    63,   63,   64,   64,   65,   65,   65,   66,  433,  439,
 /*   140 */    91,  314,  389,  473,  230,  529,  504,  204,  168,   55,
 /*   150 */   420,  197,  528,  407,  196,  428,  208,   60,   58,  296,
 /*   160 */   443,  444,  440,  440,   62,   62,   61,   61,   61,   61,
 /*   170 */   170,   63,   63,   63,   63,   64,   64,   65,   65,   65,
 /*   180 */    66,  290,  479,  428,  208,  412,  109,   81,  412,  432,
 /*   190 */   406,  284,  394,  395,  430,  521,  164,  318,  517,   67,
 /*   200 */   530,   69,  150,  567,  412,  492,  493,  433,  439,  145,
 /*   210 */   146,  583,  888,  376,  888,  420,  171,  156,  488,  411,
 /*   220 */    40,  337,  415,   19,  290,  140,   60,   58,  296,  443,
 /*   230 */   444,  440,  440,   62,   62,   61,   61,   61,   61,  384,
 /*   240 */    63,   63,   63,   63,   64,   64,   65,   65,   65,   66,
 /*   250 */   433,  439,  580,  546,  493,  417,  417,  417,  549,  332,
 /*   260 */   234,   67,  460,   69,  150,  583,  887,  290,  887,   60,
 /*   270 */    58,  296,  443,  444,  440,  440,   62,   62,   61,   61,
 /*   280 */    61,   61,  318,   63,   63,   63,   63,   64,   64,   65,
 /*   290 */    65,   65,   66,  433,  439,  177,  548,  393,  343,  346,
 /*   300 */   347,  515,  490,  271,  411,   40,  580,  473,  432,  224,
 /*   310 */   348,  408,   60,   58,  296,  443,  444,  440,  440,   62,
 /*   320 */    62,   61,   61,   61,   61,  523,   63,   63,   63,   63,
 /*   330 */    64,   64,   65,   65,   65,   66,  303,  488,  300,  290,
 /*   340 */    75,  415,  274,  483,  272,  232,  236,  370,  267,  266,
 /*   350 */   318,   65,   65,   65,   66,  173,  393,  148,  205,  434,
 /*   360 */   435,  231,  394,  395,  177,  433,  439,  343,  346,  347,
 /*   370 */   293,  515,  411,   34,  417,  417,  417,  378,  477,  348,
 /*   380 */   248,  437,  438,   78,   60,   58,  296,  443,  444,  440,
 /*   390 */   440,   62,   62,   61,   61,   61,   61,  205,   63,   63,
 /*   400 */    63,   63,   64,   64,   65,   65,   65,   66,  290,  436,
 /*   410 */   377,  292,  486,  114,  240,  341,  245,  342,  172,  249,
 /*   420 */   318,  394,  395,  273,  318,  177,  250,  456,  343,  346,
 /*   430 */   347,  329,  151,  566,  433,  439,  295,  423,  424,  298,
 /*   440 */   348,  387,  411,   34,    2,  360,  411,   34,  469,  363,
 /*   450 */   247,  568,  569,   60,   58,  296,  443,  444,  440,  440,
 /*   460 */    62,   62,   61,   61,   61,   61,  412,   63,   63,   63,
 /*   470 */    63,   64,   64,   65,   65,   65,   66,  290,  522,  155,
 /*   480 */   515,  503,   21,  452,  318,  299,  420,  404,   20,  297,
 /*   490 */   321,  423,  424,  482,  318,  453,  318,  457,    1,  207,
 /*   500 */   335,  457,  393,  433,  439,    9,  411,   34,  454,  393,
 /*   510 */   494,  147,  531,  207,  543,  216,  411,   48,  411,   48,
 /*   520 */   495,  393,   60,   58,  296,  443,  444,  440,  440,   62,
 /*   530 */    62,   61,   61,   61,   61,  351,   63,   63,   63,   63,
 /*   540 */    64,   64,   65,   65,   65,   66,  290,  318,  447,  334,
 /*   550 */   253,  420,  371,  207,  452,  149,  448,  579,  289,  248,
 /*   560 */   393,  457,  173,  309,  235,  310,  453,  394,  395,  411,
 /*   570 */    27,  420,  433,  439,  394,  395,  405,  520,  367,  454,
 /*   580 */   324,  328,  446,  446,  509,  517,  394,  395,  473,  412,
 /*   590 */   545,   60,   58,  296,  443,  444,  440,  440,   62,   62,
 /*   600 */    61,   61,   61,   61,  510,   63,   63,   63,   63,   64,
 /*   610 */    64,   65,   65,   65,   66,  290,  192,  338,  292,  324,
 /*   620 */    90,  446,  446,  250,  522,  394,  395,  238,  319,  393,
 /*   630 */   822,  477,  318,  576,   20,  324,  420,  446,  446,  411,
 /*   640 */     3,  433,  439,  324,  217,  446,  446,  586,  388,  385,
 /*   650 */   412,  515,  470,  515,  411,   28,  515,  302,  290,  581,
 /*   660 */    60,   58,  296,  443,  444,  440,  440,   62,   62,   61,
 /*   670 */    61,   61,   61,  219,   63,   63,   63,   63,   64,   64,
 /*   680 */    65,   65,   65,   66,  433,  439,  304,  481,  305,  167,
 /*   690 */   156,  307,  358,  392,  394,  395,  396,  397,  398,  582,
 /*   700 */   188,  290,  339,   60,   58,  296,  443,  444,  440,  440,
 /*   710 */    62,   62,   61,   61,   61,   61,  318,   63,   63,   63,
 /*   720 */    63,   64,   64,   65,   65,   65,   66,  433,  439,  410,
 /*   730 */   248,  261,  248,  409,  412,  248,  367,  255,  411,   23,
 /*   740 */   539,  357,  539,  261,  290,  261,   60,   70,  296,  443,
 /*   750 */   444,  440,  440,   62,   62,   61,   61,   61,   61,  368,
 /*   760 */    63,   63,   63,   63,   64,   64,   65,   65,   65,   66,
 /*   770 */   433,  439,  381,  541,  115,  261,  259,  540,  257,  261,
 /*   780 */   364,  174,  175,  176,  262,  261,  556,  290,    5,  359,
 /*   790 */    58,  296,  443,  444,  440,  440,   62,   62,   61,   61,
 /*   800 */    61,   61,  218,   63,   63,   63,   63,   64,   64,   65,
 /*   810 */    65,   65,   66,  433,  439,  477,  558,  205,  466,  468,
 /*   820 */   559,  206,  383,  261,  261,  261,  560,  152,   54,  467,
 /*   830 */   369,  312,  119,  124,  296,  443,  444,  440,  440,   62,
 /*   840 */    62,   61,   61,   61,   61,  416,   63,   63,   63,   63,
 /*   850 */    64,   64,   65,   65,   65,   66,   71,  325,  318,    4,
 /*   860 */   318,  412,  318,  294,  275,  375,  277,  318,   74,  318,
 /*   870 */    76,  320,   71,  325,  318,    4,  308,  498,  499,  294,
 /*   880 */   411,   32,  411,   53,  411,   24,  154,  320,  327,  411,
 /*   890 */    51,  411,   96,  161,  410,  318,  411,   93,  409,  432,
 /*   900 */   318,  421,  318,   22,  327,  426,  426,  179,  318,  501,
 /*   910 */   143,  318,  468,  508,  507,  432,  318,  411,   98,   73,
 /*   920 */    72,  182,  411,   99,  411,  110,  323,   71,  316,  317,
 /*   930 */   411,  111,  415,  411,   16,   73,   72,  480,  411,   97,
 /*   940 */   318,  412,  330,   71,  316,  317,   71,  325,  415,    4,
 /*   950 */   318,  205,  318,  294,  318,  412,  455,  318,   12,  537,
 /*   960 */   538,  320,  411,   33,  462,  417,  417,  417,  418,  419,
 /*   970 */    11,  463,  411,   94,  411,   52,  411,  112,  327,  411,
 /*   980 */   113,  417,  417,  417,  418,  419,   11,  620,  241,  432,
 /*   990 */   158,  475,  318,  169,  429,  220,  221,  222,  101,  458,
 /*  1000 */   242,  318,  441,  318,  484,  318,   12,  318,  472,   73,
 /*  1010 */    72,  202,  476,  279,  411,   25,  246,   71,  316,  317,
 /*  1020 */   280,  318,  415,  411,   36,  411,   37,  411,   26,  411,
 /*  1030 */    38,  318,  199,  505,  548,  513,  252,  124,  124,  198,
 /*  1040 */   318,  506,  201,  411,   39,  318,  511,  350,  318,  124,
 /*  1050 */   544,  318,  124,  411,   41,  417,  417,  417,  418,  419,
 /*  1060 */    11,  512,  411,   42,  524,  254,  318,  411,   43,  200,
 /*  1070 */   411,   29,  318,  411,   30,  552,  318,  169,  553,  318,
 /*  1080 */    88,  318,  256,  318,  185,  374,  276,  266,  411,   44,
 /*  1090 */   258,  291,  318,  260,  411,   45,  205,  265,  411,   46,
 /*  1100 */   318,  411,   47,  411,   31,  411,   10,  563,  578,   88,
 /*  1110 */   288,  355,  362,  365,  411,   49,  366,  268,  269,   18,
 /*  1120 */   380,  270,  411,   50,  555,  565,  278,  379,  281,  282,
 /*  1130 */   575,  142,  225,  402,  425,  427,  326,  504,  551,  461,
 /*  1140 */   465,  562,  159,  391,  399,  243,  400,  514,  516,  401,
 /*  1150 */     8,  413,  226,  315,   81,  333,  227,   80,  331,  228,
 /*  1160 */   345,  229,   77,   56,  209,  166,  459,  233,  210,  407,
 /*  1170 */   464,  121,   82,  336,  340,  491,  496,  301,  244,  501,
 /*  1180 */   497,  500,  502,  102,  518,  519,  414,  285,  352,  525,
 /*  1190 */   180,  526,  527,  533,  237,  181,  474,  239,  354,  478,
 /*  1200 */   211,  286,  184,  214,  535,  183,  215,  356,   85,  361,
 /*  1210 */   117,  186,  128,  547,  189,  372,  554,  373,  311,  561,
 /*  1220 */   572,  129,  130,  131,  138,  573,   95,  132,  577,  263,
 /*  1230 */   137,  134,  574,  390,  403,  621,  536,  213,  622,  100,
 /*  1240 */   162,   59,  163,  422,  431,  442,  445,  139,   89,  449,
 /*  1250 */   153,  165,    6,  450,  451,  122,  471,   13,    7,   92,
 /*  1260 */   123,   12,  485,  157,  212,  108,   83,  103,  104,  116,
 /*  1270 */   344,  251,   84,  105,  349,   17,  178,  353,  242,  534,
 /*  1280 */   141,  125,  306,  187,  106,  169,  126,  287,  542,  264,
 /*  1290 */   118,  550,  127,  191,  313,   14,   86,  193,  194,  135,
 /*  1300 */   557,  195,  133,  564,  136,   15,  107,  570,  382,  283,
 /*  1310 */   144,  203,  386,   87,  584,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */    16,  218,   16,  220,  221,   21,  111,   23,   70,   71,
 /*    10 */    72,   73,   84,   75,   76,   77,   78,   79,   80,   81,
 /*    20 */    82,   83,   84,  162,  163,  164,   42,   43,   74,   75,
 /*    30 */    76,   77,   78,   79,   80,   81,   82,   83,   84,   79,
 /*    40 */    80,   81,   82,   83,   84,   61,   62,   63,   64,   65,
 /*    50 */    66,   67,   68,   69,   70,   71,   72,   73,  170,   75,
 /*    60 */    76,   77,   78,   79,   80,   81,   82,   83,   84,   16,
 /*    70 */   148,  218,   88,  220,  221,   22,   90,   91,   92,   93,
 /*    80 */    94,   95,   96,   97,  140,  141,  142,   22,  148,  145,
 /*    90 */   104,  238,  170,  171,  154,   42,   43,  157,  158,   46,
 /*   100 */     1,    2,   75,   76,   77,   78,   79,   80,   81,   82,
 /*   110 */    83,   84,   16,  170,   61,   62,   63,   64,   65,   66,
 /*   120 */    67,   68,   69,   70,   71,   72,   73,   23,   75,   76,
 /*   130 */    77,   78,   79,   80,   81,   82,   83,   84,   42,   43,
 /*   140 */    44,  143,  144,  162,  222,  177,  178,  149,   21,   19,
 /*   150 */    23,  156,  184,   23,  156,   79,   80,   61,   62,   63,
 /*   160 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,
 /*   170 */   156,   75,   76,   77,   78,   79,   80,   81,   82,   83,
 /*   180 */    84,   16,  201,   79,   80,  190,   21,  122,  190,   59,
 /*   190 */   169,  159,   88,   89,  162,  163,  164,  148,  177,  218,
 /*   200 */   182,  220,  221,   99,  190,  186,  187,   42,   43,   79,
 /*   210 */    80,   19,   20,  215,   22,   88,  202,  203,   88,  170,
 /*   220 */   171,  207,   92,   19,   16,   21,   61,   62,   63,   64,
 /*   230 */    65,   66,   67,   68,   69,   70,   71,   72,   73,  241,
 /*   240 */    75,   76,   77,   78,   79,   80,   81,   82,   83,   84,
 /*   250 */    42,   43,   60,  186,  187,  125,  126,  127,   11,  210,
 /*   260 */   211,  218,  219,  220,  221,   19,   20,   16,   22,   61,
 /*   270 */    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
 /*   280 */    72,   73,  148,   75,   76,   77,   78,   79,   80,   81,
 /*   290 */    82,   83,   84,   42,   43,   90,   49,   23,   93,   94,
 /*   300 */    95,  148,  161,   14,  170,  171,   60,  162,   59,  191,
 /*   310 */   105,  170,   61,   62,   63,   64,   65,   66,   67,   68,
 /*   320 */    69,   70,   71,   72,   73,  182,   75,   76,   77,   78,
 /*   330 */    79,   80,   81,   82,   83,   84,  183,   88,   16,   16,
 /*   340 */   132,   92,   53,   20,   55,  211,  201,  100,  101,  102,
 /*   350 */   148,   81,   82,   83,   84,   43,   23,   22,  111,   42,
 /*   360 */    43,  148,   88,   89,   90,   42,   43,   93,   94,   95,
 /*   370 */   151,  148,  170,  171,  125,  126,  127,   91,  148,  105,
 /*   380 */   227,   64,   65,  132,   61,   62,   63,   64,   65,   66,
 /*   390 */    67,   68,   69,   70,   71,   72,   73,  111,   75,   76,
 /*   400 */    77,   78,   79,   80,   81,   82,   83,   84,   16,   92,
 /*   410 */   124,   99,   20,   91,   92,   93,   94,   95,   96,   97,
 /*   420 */   148,   88,   89,  134,  148,   90,  104,  225,   93,   94,
 /*   430 */    95,  187,  156,  148,   42,   43,  165,  166,  167,  209,
 /*   440 */   105,  142,  170,  171,  145,  226,  170,  171,  115,  230,
 /*   450 */   227,  166,  167,   61,   62,   63,   64,   65,   66,   67,
 /*   460 */    68,   69,   70,   71,   72,   73,  190,   75,   76,   77,
 /*   470 */    78,   79,   80,   81,   82,   83,   84,   16,  148,  148,
 /*   480 */   148,   20,   19,   12,  148,  213,   23,  157,  158,  213,
 /*   490 */   165,  166,  167,   20,  148,   24,  148,  225,   19,  228,
 /*   500 */   148,  225,   23,   42,   43,   19,  170,  171,   37,   23,
 /*   510 */    39,  181,  182,  228,   18,  183,  170,  171,  170,  171,
 /*   520 */    49,   23,   61,   62,   63,   64,   65,   66,   67,   68,
 /*   530 */    69,   70,   71,   72,   73,   16,   75,   76,   77,   78,
 /*   540 */    79,   80,   81,   82,   83,   84,   16,  148,   20,  213,
 /*   550 */    20,   88,   56,  228,   12,  156,   20,  244,  245,  227,
 /*   560 */    23,  225,   43,  217,  148,  217,   24,   88,   89,  170,
 /*   570 */   171,   23,   42,   43,   88,   89,  168,  169,  148,   37,
 /*   580 */   107,   39,  109,  110,   30,  177,   88,   89,  162,  190,
 /*   590 */    94,   61,   62,   63,   64,   65,   66,   67,   68,   69,
 /*   600 */    70,   71,   72,   73,   50,   75,   76,   77,   78,   79,
 /*   610 */    80,   81,   82,   83,   84,   16,  156,  148,   99,  107,
 /*   620 */    21,  109,  110,  104,  148,   88,   89,  201,  148,   23,
 /*   630 */   134,  148,  148,  157,  158,  107,   88,  109,  110,  170,
 /*   640 */   171,   42,   43,  107,  214,  109,  110,    0,    1,    2,
 /*   650 */   190,  148,  115,  148,  170,  171,  148,  103,   16,   20,
 /*   660 */    61,   62,   63,   64,   65,   66,   67,   68,   69,   70,
 /*   670 */    71,   72,   73,  146,   75,   76,   77,   78,   79,   80,
 /*   680 */    81,   82,   83,   84,   42,   43,  183,   81,  183,  202,
 /*   690 */   203,  183,  209,  148,   88,   89,    7,    8,    9,   60,
 /*   700 */   156,   16,   81,   61,   62,   63,   64,   65,   66,   67,
 /*   710 */    68,   69,   70,   71,   72,   73,  148,   75,   76,   77,
 /*   720 */    78,   79,   80,   81,   82,   83,   84,   42,   43,  108,
 /*   730 */   227,  148,  227,  112,  190,  227,  148,   14,  170,  171,
 /*   740 */   100,  101,  102,  148,   16,  148,   61,   62,   63,   64,
 /*   750 */    65,   66,   67,   68,   69,   70,   71,   72,   73,  215,
 /*   760 */    75,   76,   77,   78,   79,   80,   81,   82,   83,   84,
 /*   770 */    42,   43,  189,   25,  148,  148,   53,   29,   55,  148,
 /*   780 */   236,  100,  101,  102,  189,  148,  189,   16,  192,   41,
 /*   790 */    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
 /*   800 */    72,   73,  214,   75,   76,   77,   78,   79,   80,   81,
 /*   810 */    82,   83,   84,   42,   43,  148,  189,  111,   22,   22,
 /*   820 */   189,  193,  239,  148,  148,  148,  189,  156,  200,  204,
 /*   830 */   124,  242,  243,   22,   63,   64,   65,   66,   67,   68,
 /*   840 */    69,   70,   71,   72,   73,  148,   75,   76,   77,   78,
 /*   850 */    79,   80,   81,   82,   83,   84,   16,   17,  148,   19,
 /*   860 */   148,  190,  148,   23,  189,  189,  189,  148,  131,  148,
 /*   870 */   133,   31,   16,   17,  148,   19,  209,    7,    8,   23,
 /*   880 */   170,  171,  170,  171,  170,  171,   89,   31,   48,  170,
 /*   890 */   171,  170,  171,   19,  108,  148,  170,  171,  112,   59,
 /*   900 */   148,   20,  148,   22,   48,  125,  126,  156,  148,   98,
 /*   910 */   114,  148,  115,   91,   92,   59,  148,  170,  171,   79,
 /*   920 */    80,  156,  170,  171,  170,  171,   16,   87,   88,   89,
 /*   930 */   170,  171,   92,  170,  171,   79,   80,   81,  170,  171,
 /*   940 */   148,  190,  148,   87,   88,   89,   16,   17,   92,   19,
 /*   950 */   148,  111,  148,   23,  148,  190,   20,  148,   22,   51,
 /*   960 */    52,   31,  170,  171,   27,  125,  126,  127,  128,  129,
 /*   970 */   130,   34,  170,  171,  170,  171,  170,  171,   48,  170,
 /*   980 */   171,  125,  126,  127,  128,  129,  130,  113,   92,   59,
 /*   990 */     5,   20,  148,   22,  162,   10,   11,   12,   13,  148,
 /*  1000 */   104,  148,   92,  148,   20,  148,   22,  148,  148,   79,
 /*  1010 */    80,   26,  148,   28,  170,  171,  148,   87,   88,   89,
 /*  1020 */    35,  148,   92,  170,  171,  170,  171,  170,  171,  170,
 /*  1030 */   171,  148,   47,  148,   49,   20,   20,   22,   22,   54,
 /*  1040 */   148,  179,   57,  170,  171,  148,  179,   20,  148,   22,
 /*  1050 */    20,  148,   22,  170,  171,  125,  126,  127,  128,  129,
 /*  1060 */   130,  179,  170,  171,  148,  148,  148,  170,  171,   19,
 /*  1070 */   170,  171,  148,  170,  171,   20,  148,   22,   20,  148,
 /*  1080 */    22,  148,  148,  148,  232,  100,  101,  102,  170,  171,
 /*  1090 */   148,  106,  148,  148,  170,  171,  111,  148,  170,  171,
 /*  1100 */   148,  170,  171,  170,  171,  170,  171,   20,   20,   22,
 /*  1110 */    22,  233,  148,  148,  170,  171,  148,  148,  148,   69,
 /*  1120 */   135,  148,  170,  171,  148,  148,  148,  148,  148,  148,
 /*  1130 */   148,  192,  194,  150,  229,  229,  224,  178,  195,  173,
 /*  1140 */   173,  195,    6,  147,  147,  173,  147,  173,  173,  147,
 /*  1150 */    22,  190,  195,  155,  122,  119,  196,  120,  117,  197,
 /*  1160 */   174,  198,  131,  121,  223,  113,  153,   97,  212,   23,
 /*  1170 */   161,  153,   99,  116,   99,  172,  172,   40,  172,   98,
 /*  1180 */   180,  174,  172,   19,  161,  180,  199,  175,   15,  172,
 /*  1190 */   152,  172,  172,  153,  205,  152,  206,  205,  153,  206,
 /*  1200 */   212,  175,  153,  212,  153,  152,  212,   38,  131,  153,
 /*  1210 */    61,  152,   19,  185,  185,  153,  195,   15,  153,  195,
 /*  1220 */    33,  188,  188,  188,  216,  153,  160,  188,  138,  234,
 /*  1230 */   216,  185,  153,    1,   20,  113,  235,  176,  113,  176,
 /*  1240 */   113,   19,  113,   20,   20,   92,  108,   19,  237,   11,
 /*  1250 */    19,   22,  118,   20,   20,   19,  115,   22,  118,  237,
 /*  1260 */    20,   22,   20,  113,   44,  240,   19,   19,   19,   32,
 /*  1270 */    44,   20,   19,   19,   44,  231,   96,   16,  104,   17,
 /*  1280 */    21,   99,   36,   99,   19,   22,   45,    5,   45,  134,
 /*  1290 */   243,    1,  103,  123,  246,   19,   69,  114,   14,  103,
 /*  1300 */    17,  116,  114,  124,  123,   19,   14,   20,   58,  137,
 /*  1310 */    19,  136,    3,   69,    4,
};
#define YY_SHIFT_USE_DFLT (-106)
#define YY_SHIFT_MAX 386
static const short yy_shift_ofst[] = {
 /*     0 */    99,  840,  985,  -16,  840,  930,  930,  930,  274, -105,
 /*    10 */    96,  930,  930,  930,  930,  930,  -46,  247,  104,  498,
 /*    20 */   548,   76,   76,   53,  165,  208,  251,  323,  392,  461,
 /*    30 */   530,  599,  642,  685,  642,  642,  642,  642,  642,  642,
 /*    40 */   642,  642,  642,  642,  642,  642,  642,  642,  642,  642,
 /*    50 */   642,  728,  771,  771,  856,  930,  930,  930,  930,  930,
 /*    60 */   930,  930,  930,  930,  930,  930,  930,  930,  930,  930,
 /*    70 */   930,  930,  930,  930,  930,  930,  930,  930,  930,  930,
 /*    80 */   930,  930,  930,  930,  930,  930,  930,  930,  930,  930,
 /*    90 */   930,  930,  930,  -62,  -62,  -14,   27,   27,  -40,  270,
 /*   100 */   519,  496,  498,  498,  498,  498,  498,  498,  498,  548,
 /*   110 */   -72, -106, -106, -106,  130,  322,  471,  471,  192,  246,
 /*   120 */   647,  127,  498,  127,  498,  498,  498,  498,  498,  498,
 /*   130 */   498,  498,  498,  498,  498,  498,  498,  286,  706, -105,
 /*   140 */  -105, -105, -106, -106, -106,  249,  249,  335,  205,  473,
 /*   150 */   479,  528,  536,  542,  333,  537,  486,  606,  689,  498,
 /*   160 */   498,  621,  498,  498,  463,  498,  498,  797,  498,  498,
 /*   170 */   512,  797,  498,  498,  554,  554,  554,  498,  498,  512,
 /*   180 */   498,  498,  512,  498,  748,  640,  498,  498,  512,  498,
 /*   190 */   498,  498,  512,  498,  498,  498,  512,  512,  498,  498,
 /*   200 */   498,  498,  498,  498,  204,  786,  796,  780,  780,  737,
 /*   210 */   937,  937,  937,  312,  937,  937,  811,   65,   65, 1136,
 /*   220 */  1136, 1136, 1136, 1128, -105, 1032, 1036, 1037, 1041, 1042,
 /*   230 */  1031, 1052, 1070, 1146, 1070, 1052, 1073, 1057, 1073, 1057,
 /*   240 */  1075, 1075, 1137, 1075, 1081, 1075, 1164, 1070, 1070, 1146,
 /*   250 */  1137, 1075, 1075, 1075, 1164, 1173, 1052, 1173, 1052, 1173,
 /*   260 */  1052, 1052, 1169, 1077, 1173, 1052, 1149, 1149, 1193, 1032,
 /*   270 */  1052, 1202, 1202, 1202, 1202, 1032, 1149, 1193, 1052, 1187,
 /*   280 */  1187, 1052, 1052, 1090, -106, -106, -106, -106, -106, -106,
 /*   290 */   317,  289,  681,  723,  874,  881,  910,  936,  971,  984,
 /*   300 */   896,  870,  822, 1015, 1016, 1027,  908, 1030, 1055, 1058,
 /*   310 */  1087, 1050, 1088,  639, 1232, 1214, 1122, 1125, 1127, 1129,
 /*   320 */  1222, 1223, 1224, 1153, 1138, 1228, 1238, 1231, 1233, 1229,
 /*   330 */  1234, 1134, 1235, 1140, 1239, 1141, 1236, 1240, 1150, 1242,
 /*   340 */  1237, 1220, 1247, 1226, 1248, 1251, 1249, 1253, 1230, 1254,
 /*   350 */  1180, 1174, 1261, 1262, 1259, 1182, 1246, 1241, 1263, 1243,
 /*   360 */  1155, 1184, 1265, 1282, 1290, 1189, 1227, 1244, 1170, 1276,
 /*   370 */  1183, 1284, 1185, 1283, 1188, 1196, 1181, 1286, 1179, 1287,
 /*   380 */  1292, 1250, 1175, 1172, 1291, 1309, 1310,
};
#define YY_REDUCE_USE_DFLT (-218)
#define YY_REDUCE_MAX 289
static const short yy_reduce_ofst[] = {
 /*     0 */   -56,  276,   -2,  -19,  399,  272,   49,  336,  330,   14,
 /*    10 */  -147,  -78,  202,  134,  346,  348,   43,  544,  285,  -60,
 /*    20 */    32,  271,  325, -217, -217, -217, -217, -217, -217, -217,
 /*    30 */  -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,
 /*    40 */  -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,
 /*    50 */  -217, -217, -217, -217,  469,  484,  568,  710,  712,  714,
 /*    60 */   719,  721,  726,  747,  752,  754,  760,  763,  768,  792,
 /*    70 */   802,  804,  806,  809,  844,  853,  855,  857,  859,  873,
 /*    80 */   883,  892,  897,  900,  903,  918,  924,  928,  931,  933,
 /*    90 */   935,  944,  952, -217, -217,  408, -217, -217, -217, -217,
 /*   100 */   -32,  219,  153,  332,  503,  505,  508,  583,  476, -139,
 /*   110 */  -217, -217, -217, -217,  141,   21,   19,   67,  313,  313,
 /*   120 */   299,  145,  230,  426,  223,  595,  483,  430,  667,  597,
 /*   130 */   627,  631,  637,  675,  676,  588,  677,   -5,  460,  671,
 /*   140 */   751,  765,  628,  487,  589, -112,  -57,   18,  143,  118,
 /*   150 */   213,  118,  118,  244,  331,  352,  416,  480,  527,  545,
 /*   160 */   626,  596,  480,  697,  832,  794,  851,  625,  860,  864,
 /*   170 */   118,  625,  868,  885,  862,  867,  882,  916,  917,  118,
 /*   180 */   934,  942,  118,  945,  852,  878,  949,  964,  118,  965,
 /*   190 */   968,  969,  118,  970,  973,  976,  118,  118,  977,  978,
 /*   200 */   979,  980,  981,  982,  983,  939,  938,  905,  906,  912,
 /*   210 */   966,  967,  972,  959,  974,  975,  986,  943,  946,  996,
 /*   220 */   997,  999, 1002,  998,  961,  957,  960,  962,  963,  987,
 /*   230 */   941, 1013,  956, 1009,  988, 1018,  989,  990,  992,  993,
 /*   240 */  1003, 1004, 1000, 1006, 1007, 1010, 1012,  991,  994, 1023,
 /*   250 */  1005, 1017, 1019, 1020, 1026, 1038, 1040, 1043, 1045, 1053,
 /*   260 */  1049, 1051,  995, 1001, 1059, 1056, 1028, 1029, 1008, 1021,
 /*   270 */  1062, 1033, 1034, 1035, 1039, 1024, 1046, 1014, 1065, 1011,
 /*   280 */  1022, 1072, 1079, 1025, 1066, 1061, 1063, 1044, 1047, 1048,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */   592,  819,  896,  707,  896,  819,  896,  819,  896,  711,
 /*    10 */   870,  815,  819,  896,  896,  896,  790,  896,  841,  896,
 /*    20 */   623,  841,  841,  742,  896,  896,  896,  896,  896,  896,
 /*    30 */   896,  896,  743,  896,  818,  814,  810,  812,  811,  744,
 /*    40 */   731,  740,  747,  723,  855,  749,  750,  756,  757,  871,
 /*    50 */   874,  778,  796,  777,  896,  896,  896,  896,  896,  896,
 /*    60 */   896,  896,  896,  896,  896,  896,  896,  896,  896,  896,
 /*    70 */   896,  896,  896,  896,  896,  896,  896,  896,  896,  896,
 /*    80 */   896,  896,  896,  896,  896,  896,  896,  896,  896,  896,
 /*    90 */   896,  896,  896,  780,  801,  616,  779,  789,  781,  782,
 /*   100 */   676,  611,  896,  896,  896,  896,  896,  896,  896,  896,
 /*   110 */   783,  784,  797,  798,  896,  896,  896,  896,  896,  896,
 /*   120 */   592,  707,  896,  707,  896,  896,  896,  896,  896,  896,
 /*   130 */   896,  896,  896,  896,  896,  896,  896,  896,  896,  896,
 /*   140 */   896,  896,  701,  711,  889,  896,  896,  667,  896,  896,
 /*   150 */   896,  896,  896,  896,  896,  896,  896,  896,  599,  597,
 /*   160 */   896,  699,  896,  896,  625,  896,  896,  709,  896,  896,
 /*   170 */   714,  715,  896,  896,  896,  896,  896,  896,  896,  613,
 /*   180 */   896,  896,  688,  896,  847,  896,  896,  896,  862,  896,
 /*   190 */   896,  896,  860,  896,  896,  896,  690,  752,  829,  896,
 /*   200 */   896,  875,  877,  896,  896,  699,  708,  896,  896,  813,
 /*   210 */   734,  734,  734,  646,  734,  734,  649,  746,  746,  596,
 /*   220 */   596,  596,  596,  666,  896,  746,  737,  739,  727,  741,
 /*   230 */   896,  716,  735,  896,  735,  716,  724,  726,  724,  726,
 /*   240 */   678,  678,  663,  678,  649,  678,  823,  735,  735,  896,
 /*   250 */   663,  678,  678,  678,  823,  608,  716,  608,  716,  608,
 /*   260 */   716,  716,  851,  854,  608,  716,  680,  680,  758,  746,
 /*   270 */   716,  687,  687,  687,  687,  746,  680,  758,  716,  873,
 /*   280 */   873,  716,  716,  882,  633,  651,  651,  857,  889,  894,
 /*   290 */   896,  896,  896,  896,  765,  896,  896,  896,  896,  896,
 /*   300 */   896,  896,  896,  896,  896,  896,  896,  896,  896,  896,
 /*   310 */   896,  836,  896,  896,  896,  896,  770,  766,  896,  767,
 /*   320 */   896,  896,  896,  896,  693,  896,  896,  896,  896,  896,
 /*   330 */   896,  896,  728,  896,  738,  896,  896,  896,  896,  896,
 /*   340 */   896,  896,  896,  896,  896,  896,  896,  896,  896,  896,
 /*   350 */   896,  896,  896,  896,  896,  896,  896,  849,  850,  896,
 /*   360 */   896,  896,  896,  896,  896,  896,  896,  896,  896,  896,
 /*   370 */   896,  896,  896,  896,  896,  896,  896,  896,  896,  896,
 /*   380 */   896,  881,  896,  896,  884,  593,  896,  587,  590,  589,
 /*   390 */   591,  595,  598,  620,  621,  622,  600,  601,  602,  603,
 /*   400 */   604,  605,  606,  612,  614,  632,  634,  618,  636,  697,
 /*   410 */   698,  762,  691,  692,  696,  764,  768,  769,  771,  772,
 /*   420 */   619,  626,  627,  630,  631,  837,  839,  838,  840,  629,
 /*   430 */   628,  773,  776,  785,  786,  788,  794,  800,  803,  787,
 /*   440 */   792,  793,  795,  799,  802,  694,  695,  806,  808,  809,
 /*   450 */   863,  864,  865,  866,  867,  804,  816,  817,  717,  807,
 /*   460 */   791,  729,  732,  733,  736,  730,  700,  710,  719,  720,
 /*   470 */   721,  722,  705,  706,  712,  725,  760,  761,  713,  702,
 /*   480 */   703,  704,  805,  763,  774,  775,  637,  638,  770,  639,
 /*   490 */   640,  641,  679,  682,  683,  684,  642,  661,  664,  665,
 /*   500 */   643,  650,  644,  645,  652,  653,  654,  657,  658,  659,
 /*   510 */   660,  655,  656,  824,  825,  827,  826,  647,  648,  662,
 /*   520 */   635,  624,  617,  668,  671,  672,  673,  674,  675,  677,
 /*   530 */   669,  670,  615,  607,  609,  718,  843,  852,  853,  848,
 /*   540 */   844,  845,  846,  610,  820,  821,  681,  754,  755,  842,
 /*   550 */   856,  858,  759,  859,  861,  886,  685,  686,  689,  828,
 /*   560 */   868,  745,  748,  751,  753,  830,  831,  832,  833,  834,
 /*   570 */   835,  869,  872,  876,  878,  879,  880,  883,  885,  890,
 /*   580 */   891,  892,  895,  893,  594,  588,


};
#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))

/* The next table maps tokens into fallback tokens.  If a construct
** like the following:
** 
**      %fallback ID X Y Z.
................................................................................
  "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",  "create_vtab",   "vtabarglist",   "vtabarg",     
  "vtabargtoken",  "lp",            "anylist",     
};
#endif /* NDEBUG */

#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
................................................................................
 /* 238 */ "idxlist_opt ::= LP idxlist RP",
 /* 239 */ "idxlist ::= idxlist COMMA idxitem collate sortorder",
 /* 240 */ "idxlist ::= idxitem collate sortorder",
 /* 241 */ "idxitem ::= nm",
 /* 242 */ "cmd ::= DROP INDEX ifexists fullname",
 /* 243 */ "cmd ::= VACUUM",
 /* 244 */ "cmd ::= VACUUM nm",
 /* 245 */ "cmd ::= PRAGMA nm dbnm EQ nm",
 /* 246 */ "cmd ::= PRAGMA nm dbnm EQ ON",
 /* 247 */ "cmd ::= PRAGMA nm dbnm EQ plus_num",
 /* 248 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
 /* 249 */ "cmd ::= PRAGMA nm dbnm LP nm RP",
 /* 250 */ "cmd ::= PRAGMA nm dbnm",

 /* 251 */ "plus_num ::= plus_opt number",
 /* 252 */ "minus_num ::= MINUS number",
 /* 253 */ "number ::= INTEGER|FLOAT",
 /* 254 */ "plus_opt ::= PLUS",
 /* 255 */ "plus_opt ::=",
 /* 256 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END",
 /* 257 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
 /* 258 */ "trigger_time ::= BEFORE",
 /* 259 */ "trigger_time ::= AFTER",
 /* 260 */ "trigger_time ::= INSTEAD OF",
 /* 261 */ "trigger_time ::=",
 /* 262 */ "trigger_event ::= DELETE|INSERT",
 /* 263 */ "trigger_event ::= UPDATE",
 /* 264 */ "trigger_event ::= UPDATE OF inscollist",
 /* 265 */ "foreach_clause ::=",
 /* 266 */ "foreach_clause ::= FOR EACH ROW",
 /* 267 */ "foreach_clause ::= FOR EACH STATEMENT",
 /* 268 */ "when_clause ::=",
 /* 269 */ "when_clause ::= WHEN expr",
 /* 270 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
 /* 271 */ "trigger_cmd_list ::=",
 /* 272 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt",
 /* 273 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP",
 /* 274 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select",
 /* 275 */ "trigger_cmd ::= DELETE FROM nm where_opt",
 /* 276 */ "trigger_cmd ::= select",
 /* 277 */ "expr ::= RAISE LP IGNORE RP",
 /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP",
 /* 279 */ "raisetype ::= ROLLBACK",
 /* 280 */ "raisetype ::= ABORT",
 /* 281 */ "raisetype ::= FAIL",
 /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname",
 /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
 /* 284 */ "key_opt ::=",
 /* 285 */ "key_opt ::= KEY expr",
 /* 286 */ "database_kw_opt ::= DATABASE",
 /* 287 */ "database_kw_opt ::=",
 /* 288 */ "cmd ::= DETACH database_kw_opt expr",
 /* 289 */ "cmd ::= REINDEX",
 /* 290 */ "cmd ::= REINDEX nm dbnm",
 /* 291 */ "cmd ::= ANALYZE",
 /* 292 */ "cmd ::= ANALYZE nm dbnm",
 /* 293 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
 /* 294 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
 /* 295 */ "add_column_fullname ::= fullname",
 /* 296 */ "kwcolumn_opt ::=",
 /* 297 */ "kwcolumn_opt ::= COLUMNKW",
 /* 298 */ "cmd ::= create_vtab",
 /* 299 */ "cmd ::= create_vtab LP vtabarglist RP",
 /* 300 */ "create_vtab ::= CREATE VIRTUAL TABLE nm dbnm USING nm",
 /* 301 */ "vtabarglist ::= vtabarg",
 /* 302 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
 /* 303 */ "vtabarg ::=",
 /* 304 */ "vtabarg ::= vtabarg vtabargtoken",
 /* 305 */ "vtabargtoken ::= ANY",
 /* 306 */ "vtabargtoken ::= lp anylist RP",
 /* 307 */ "lp ::= LP",
 /* 308 */ "anylist ::=",
 /* 309 */ "anylist ::= anylist ANY",
};
#endif /* NDEBUG */

/*
** This function returns the symbolic name associated with a token
** value.
*/
................................................................................
    ** which appear on the RHS of the rule, but which are not used
    ** inside the C code.
    */
    case 156:
    case 190:
    case 207:
#line 374 "parse.y"
{sqlite3SelectDelete((yypminor->yy219));}
#line 1249 "parse.c"
      break;
    case 170:
    case 171:
    case 195:
    case 197:
    case 205:
    case 211:
    case 219:
    case 222:
    case 224:
    case 225:
    case 235:
#line 618 "parse.y"
{sqlite3ExprDelete((yypminor->yy172));}
#line 1264 "parse.c"
      break;
    case 175:
    case 183:
    case 193:
    case 196:
    case 198:
    case 200:
    case 210:
    case 213:
    case 214:
    case 217:
    case 223:
#line 855 "parse.y"
{sqlite3ExprListDelete((yypminor->yy174));}
#line 1279 "parse.c"
      break;
    case 189:
    case 194:
    case 202:
    case 203:
#line 487 "parse.y"
{sqlite3SrcListDelete((yypminor->yy373));}
#line 1287 "parse.c"
      break;
    case 199:
#line 548 "parse.y"
{
  sqlite3ExprDelete((yypminor->yy234).pLimit);
  sqlite3ExprDelete((yypminor->yy234).pOffset);
}
#line 1295 "parse.c"
      break;
    case 206:
    case 209:
    case 216:
#line 504 "parse.y"
{sqlite3IdListDelete((yypminor->yy432));}
#line 1302 "parse.c"
      break;
    case 231:
    case 236:
#line 951 "parse.y"
{sqlite3DeleteTriggerStep((yypminor->yy243));}
#line 1308 "parse.c"
      break;
    case 233:
#line 935 "parse.y"
{sqlite3IdListDelete((yypminor->yy370).b);}
#line 1313 "parse.c"
      break;
    case 238:
#line 1019 "parse.y"
{sqlite3ExprDelete((yypminor->yy386));}
#line 1318 "parse.c"
      break;
    default:  break;   /* If no destructor action specified: do nothing */
  }
}

/*
** Pop the parser's stack once.
................................................................................
     while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
     /* Here code is inserted which will execute if the parser
     ** stack every overflows */
#line 44 "parse.y"

  sqlite3ErrorMsg(pParse, "parser stack overflow");
  pParse->parseError = 1;
#line 1487 "parse.c"
     sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
     return;
  }
  yytos = &yypParser->yystack[yypParser->yyidx];
  yytos->stateno = yyNewState;
  yytos->major = yyMajor;
  yytos->minor = *yypMinor;
................................................................................
  { 227, 1 },
  { 144, 4 },
  { 144, 1 },
  { 144, 2 },
  { 144, 5 },
  { 144, 5 },
  { 144, 5 },
  { 144, 5 },
  { 144, 6 },
  { 144, 3 },


  { 166, 2 },
  { 167, 2 },
  { 229, 1 },
  { 228, 1 },
  { 228, 0 },
  { 144, 5 },
  { 230, 11 },
  { 232, 1 },
  { 232, 1 },
  { 232, 2 },
  { 232, 0 },
  { 233, 1 },
  { 233, 1 },
  { 233, 3 },
  { 234, 0 },
  { 234, 3 },
  { 234, 3 },
  { 235, 0 },
  { 235, 2 },
  { 231, 3 },
  { 231, 0 },
  { 236, 6 },



  { 236, 8 },
  { 236, 5 },
  { 236, 4 },
  { 236, 1 },
  { 171, 4 },
  { 171, 6 },
  { 187, 1 },
  { 187, 1 },
  { 187, 1 },
  { 144, 4 },
  { 144, 6 },
  { 238, 0 },
  { 238, 2 },
  { 237, 1 },
  { 237, 0 },
  { 144, 3 },
  { 144, 1 },
  { 144, 3 },
  { 144, 1 },
  { 144, 3 },
  { 144, 6 },
  { 144, 6 },
  { 239, 1 },
  { 240, 0 },
  { 240, 1 },
  { 144, 1 },
  { 144, 4 },
  { 241, 7 },
  { 242, 1 },
  { 242, 3 },
  { 243, 0 },
  { 243, 2 },
  { 244, 1 },
  { 244, 3 },
  { 245, 1 },
  { 246, 0 },
  { 246, 2 },
};

static void yy_accept(yyParser*);  /* Forward Declaration */

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
................................................................................
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

#ifndef NDEBUG
  /* Silence complaints from purify about yygotominor being uninitialized
  ** in some cases when it is copied into the stack after the following
  ** switch.  yygotominor is uninitialized when a rule reduces that does
  ** not set the value of its left-hand side nonterminal.  Leaving the
  ** value of the nonterminal uninitialized is utterly harmless as long
  ** as the value is never used.  So really the only thing this code
  ** accomplishes is to quieten purify.  






  */
  memset(&yygotominor, 0, sizeof(yygotominor));
#endif


  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 3:
#line 100 "parse.y"
{ sqlite3FinishCoding(pParse); }
#line 1875 "parse.c"
        break;
      case 6:
#line 103 "parse.y"
{ sqlite3BeginParse(pParse, 0); }
#line 1880 "parse.c"
        break;
      case 7:
#line 105 "parse.y"
{ sqlite3BeginParse(pParse, 1); }
#line 1885 "parse.c"
        break;
      case 8:
#line 106 "parse.y"
{ sqlite3BeginParse(pParse, 2); }
#line 1890 "parse.c"
        break;
      case 9:
#line 112 "parse.y"
{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy46);}
#line 1895 "parse.c"
        break;
      case 13:
#line 117 "parse.y"
{yygotominor.yy46 = TK_DEFERRED;}
#line 1900 "parse.c"
        break;
      case 14:
      case 15:
      case 16:
      case 107:
      case 109:
#line 118 "parse.y"
{yygotominor.yy46 = yymsp[0].major;}
#line 1909 "parse.c"
        break;
      case 17:
      case 18:
#line 121 "parse.y"
{sqlite3CommitTransaction(pParse);}
#line 1915 "parse.c"
        break;
      case 19:
#line 123 "parse.y"
{sqlite3RollbackTransaction(pParse);}
#line 1920 "parse.c"
        break;
      case 21:
#line 128 "parse.y"
{
   sqlite3StartTable(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410,yymsp[-4].minor.yy46,0,0,yymsp[-2].minor.yy46);
}
#line 1927 "parse.c"
        break;
      case 22:
      case 25:
      case 63:
      case 77:
      case 79:
      case 90:
      case 101:
      case 112:
      case 113:
      case 213:
      case 216:
#line 132 "parse.y"
{yygotominor.yy46 = 0;}
#line 1942 "parse.c"
        break;
      case 23:
      case 24:
      case 64:
      case 78:
      case 100:
      case 111:
      case 214:
      case 217:
#line 133 "parse.y"
{yygotominor.yy46 = 1;}
#line 1954 "parse.c"
        break;
      case 26:
#line 139 "parse.y"
{
  sqlite3EndTable(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy0,0);
}
#line 1961 "parse.c"
        break;
      case 27:
#line 142 "parse.y"
{
  sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy219);
  sqlite3SelectDelete(yymsp[0].minor.yy219);
}
#line 1969 "parse.c"
        break;
      case 30:
#line 154 "parse.y"
{
  yygotominor.yy410.z = yymsp[-2].minor.yy410.z;
  yygotominor.yy410.n = (pParse->sLastToken.z-yymsp[-2].minor.yy410.z) + pParse->sLastToken.n;
}
#line 1977 "parse.c"
        break;
      case 31:
#line 158 "parse.y"
{
  sqlite3AddColumn(pParse,&yymsp[0].minor.yy410);
  yygotominor.yy410 = yymsp[0].minor.yy410;
}
#line 1985 "parse.c"
        break;
      case 32:
      case 33:
      case 34:
      case 35:
      case 36:
      case 253:
#line 168 "parse.y"
{yygotominor.yy410 = yymsp[0].minor.yy0;}
#line 1995 "parse.c"
        break;
      case 38:
#line 228 "parse.y"
{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy410);}
#line 2000 "parse.c"
        break;
      case 39:
      case 42:
      case 119:
      case 120:
      case 131:
      case 150:
      case 241:

      case 251:
      case 252:

#line 229 "parse.y"
{yygotominor.yy410 = yymsp[0].minor.yy410;}
#line 2013 "parse.c"
        break;
      case 40:
#line 230 "parse.y"
{
  yygotominor.yy410.z = yymsp[-3].minor.yy410.z;
  yygotominor.yy410.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy410.z;
}
#line 2021 "parse.c"
        break;
      case 41:
#line 234 "parse.y"
{
  yygotominor.yy410.z = yymsp[-5].minor.yy410.z;
  yygotominor.yy410.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy410.z;
}
#line 2029 "parse.c"
        break;
      case 43:
#line 240 "parse.y"
{yygotominor.yy410.z=yymsp[-1].minor.yy410.z; yygotominor.yy410.n=yymsp[0].minor.yy410.n+(yymsp[0].minor.yy410.z-yymsp[-1].minor.yy410.z);}
#line 2034 "parse.c"
        break;
      case 44:
#line 242 "parse.y"
{ yygotominor.yy46 = atoi((char*)yymsp[0].minor.yy410.z); }
#line 2039 "parse.c"
        break;
      case 45:
#line 243 "parse.y"
{ yygotominor.yy46 = -atoi((char*)yymsp[0].minor.yy410.z); }
#line 2044 "parse.c"
        break;
      case 50:
      case 52:
#line 252 "parse.y"
{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy172);}
#line 2050 "parse.c"
        break;
      case 51:
#line 253 "parse.y"
{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy172);}
#line 2055 "parse.c"
        break;
      case 53:
#line 255 "parse.y"
{
  Expr *p = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy172, 0, 0);
  sqlite3AddDefaultValue(pParse,p);
}
#line 2063 "parse.c"
        break;
      case 54:
#line 259 "parse.y"
{
  Expr *p = sqlite3Expr(TK_STRING, 0, 0, &yymsp[0].minor.yy410);
  sqlite3AddDefaultValue(pParse,p);
}
#line 2071 "parse.c"
        break;
      case 56:
#line 268 "parse.y"
{sqlite3AddNotNull(pParse, yymsp[0].minor.yy46);}
#line 2076 "parse.c"
        break;
      case 57:
#line 270 "parse.y"
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy46,yymsp[0].minor.yy46,yymsp[-2].minor.yy46);}
#line 2081 "parse.c"
        break;
      case 58:
#line 271 "parse.y"
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy46,0,0,0,0);}
#line 2086 "parse.c"
        break;
      case 59:
#line 272 "parse.y"
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy172);}
#line 2091 "parse.c"
        break;
      case 60:
#line 274 "parse.y"
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy410,yymsp[-1].minor.yy174,yymsp[0].minor.yy46);}
#line 2096 "parse.c"
        break;
      case 61:
#line 275 "parse.y"
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy46);}
#line 2101 "parse.c"
        break;
      case 62:
#line 276 "parse.y"
{sqlite3AddCollateType(pParse, (char*)yymsp[0].minor.yy410.z, yymsp[0].minor.yy410.n);}
#line 2106 "parse.c"
        break;
      case 65:
#line 289 "parse.y"
{ yygotominor.yy46 = OE_Restrict * 0x010101; }
#line 2111 "parse.c"
        break;
      case 66:
#line 290 "parse.y"
{ yygotominor.yy46 = (yymsp[-1].minor.yy46 & yymsp[0].minor.yy405.mask) | yymsp[0].minor.yy405.value; }
#line 2116 "parse.c"
        break;
      case 67:
#line 292 "parse.y"
{ yygotominor.yy405.value = 0;     yygotominor.yy405.mask = 0x000000; }
#line 2121 "parse.c"
        break;
      case 68:
#line 293 "parse.y"
{ yygotominor.yy405.value = yymsp[0].minor.yy46;     yygotominor.yy405.mask = 0x0000ff; }
#line 2126 "parse.c"
        break;
      case 69:
#line 294 "parse.y"
{ yygotominor.yy405.value = yymsp[0].minor.yy46<<8;  yygotominor.yy405.mask = 0x00ff00; }
#line 2131 "parse.c"
        break;
      case 70:
#line 295 "parse.y"
{ yygotominor.yy405.value = yymsp[0].minor.yy46<<16; yygotominor.yy405.mask = 0xff0000; }
#line 2136 "parse.c"
        break;
      case 71:
#line 297 "parse.y"
{ yygotominor.yy46 = OE_SetNull; }
#line 2141 "parse.c"
        break;
      case 72:
#line 298 "parse.y"
{ yygotominor.yy46 = OE_SetDflt; }
#line 2146 "parse.c"
        break;
      case 73:
#line 299 "parse.y"
{ yygotominor.yy46 = OE_Cascade; }
#line 2151 "parse.c"
        break;
      case 74:
#line 300 "parse.y"
{ yygotominor.yy46 = OE_Restrict; }
#line 2156 "parse.c"
        break;
      case 75:
      case 76:
      case 91:
      case 93:
      case 95:
      case 96:
      case 168:
#line 302 "parse.y"
{yygotominor.yy46 = yymsp[0].minor.yy46;}
#line 2167 "parse.c"
        break;
      case 80:
#line 312 "parse.y"
{yygotominor.yy410.n = 0; yygotominor.yy410.z = 0;}
#line 2172 "parse.c"
        break;
      case 81:
#line 313 "parse.y"
{yygotominor.yy410 = yymsp[-1].minor.yy0;}
#line 2177 "parse.c"
        break;
      case 86:
#line 319 "parse.y"
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy174,yymsp[0].minor.yy46,yymsp[-2].minor.yy46,0);}
#line 2182 "parse.c"
        break;
      case 87:
#line 321 "parse.y"
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy174,yymsp[0].minor.yy46,0,0,0,0);}
#line 2187 "parse.c"
        break;
      case 88:
#line 322 "parse.y"
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy172);}
#line 2192 "parse.c"
        break;
      case 89:
#line 324 "parse.y"
{
    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy174, &yymsp[-3].minor.yy410, yymsp[-2].minor.yy174, yymsp[-1].minor.yy46);
    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy46);
}
#line 2200 "parse.c"
        break;
      case 92:
      case 94:
#line 338 "parse.y"
{yygotominor.yy46 = OE_Default;}
#line 2206 "parse.c"
        break;
      case 97:
#line 343 "parse.y"
{yygotominor.yy46 = OE_Ignore;}
#line 2211 "parse.c"
        break;
      case 98:
      case 169:
#line 344 "parse.y"
{yygotominor.yy46 = OE_Replace;}
#line 2217 "parse.c"
        break;
      case 99:
#line 348 "parse.y"
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy373, 0, yymsp[-1].minor.yy46);
}
#line 2224 "parse.c"
        break;
      case 102:
#line 358 "parse.y"
{
  sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy410, &yymsp[-2].minor.yy410, yymsp[0].minor.yy219, yymsp[-6].minor.yy46, yymsp[-4].minor.yy46);
}
#line 2231 "parse.c"
        break;
      case 103:
#line 361 "parse.y"
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy373, 1, yymsp[-1].minor.yy46);
}
#line 2238 "parse.c"
        break;
      case 104:
#line 368 "parse.y"
{
  sqlite3Select(pParse, yymsp[0].minor.yy219, SRT_Callback, 0, 0, 0, 0, 0);
  sqlite3SelectDelete(yymsp[0].minor.yy219);
}
#line 2246 "parse.c"
        break;
      case 105:
      case 128:
#line 378 "parse.y"
{yygotominor.yy219 = yymsp[0].minor.yy219;}
#line 2252 "parse.c"
        break;
      case 106:
#line 380 "parse.y"
{
  if( yymsp[0].minor.yy219 ){
    yymsp[0].minor.yy219->op = yymsp[-1].minor.yy46;
    yymsp[0].minor.yy219->pPrior = yymsp[-2].minor.yy219;
  }
  yygotominor.yy219 = yymsp[0].minor.yy219;
}
#line 2263 "parse.c"
        break;
      case 108:
#line 389 "parse.y"
{yygotominor.yy46 = TK_ALL;}
#line 2268 "parse.c"
        break;
      case 110:
#line 393 "parse.y"
{
  yygotominor.yy219 = sqlite3SelectNew(yymsp[-6].minor.yy174,yymsp[-5].minor.yy373,yymsp[-4].minor.yy172,yymsp[-3].minor.yy174,yymsp[-2].minor.yy172,yymsp[-1].minor.yy174,yymsp[-7].minor.yy46,yymsp[0].minor.yy234.pLimit,yymsp[0].minor.yy234.pOffset);
}
#line 2275 "parse.c"
        break;
      case 114:
      case 238:
#line 414 "parse.y"
{yygotominor.yy174 = yymsp[-1].minor.yy174;}
#line 2281 "parse.c"
        break;
      case 115:
      case 141:
      case 151:
      case 237:
#line 415 "parse.y"
{yygotominor.yy174 = 0;}
#line 2289 "parse.c"
        break;
      case 116:
#line 416 "parse.y"
{
   yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-2].minor.yy174,yymsp[-1].minor.yy172,yymsp[0].minor.yy410.n?&yymsp[0].minor.yy410:0);
}
#line 2296 "parse.c"
        break;
      case 117:
#line 419 "parse.y"
{
  yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-1].minor.yy174, sqlite3Expr(TK_ALL, 0, 0, 0), 0);
}
#line 2303 "parse.c"
        break;
      case 118:
#line 422 "parse.y"
{
  Expr *pRight = sqlite3Expr(TK_ALL, 0, 0, 0);
  Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy410);
  yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-3].minor.yy174, sqlite3Expr(TK_DOT, pLeft, pRight, 0), 0);
}
#line 2312 "parse.c"
        break;
      case 121:
#line 434 "parse.y"
{yygotominor.yy410.n = 0;}
#line 2317 "parse.c"
        break;
      case 122:
#line 446 "parse.y"
{yygotominor.yy373 = sqliteMalloc(sizeof(*yygotominor.yy373));}
#line 2322 "parse.c"
        break;
      case 123:
#line 447 "parse.y"
{
  yygotominor.yy373 = yymsp[0].minor.yy373;
  sqlite3SrcListShiftJoinType(yygotominor.yy373);
}
#line 2330 "parse.c"
        break;
      case 124:
#line 455 "parse.y"
{
   yygotominor.yy373 = yymsp[-1].minor.yy373;
   if( yygotominor.yy373 && yygotominor.yy373->nSrc>0 ) yygotominor.yy373->a[yygotominor.yy373->nSrc-1].jointype = yymsp[0].minor.yy46;
}
#line 2338 "parse.c"
        break;
      case 125:
#line 459 "parse.y"
{yygotominor.yy373 = 0;}
#line 2343 "parse.c"
        break;
      case 126:
#line 460 "parse.y"
{
  yygotominor.yy373 = sqlite3SrcListAppendFromTerm(yymsp[-5].minor.yy373,&yymsp[-4].minor.yy410,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,0,yymsp[-1].minor.yy172,yymsp[0].minor.yy432);
}
#line 2350 "parse.c"
        break;
      case 127:
#line 465 "parse.y"
{
    yygotominor.yy373 = sqlite3SrcListAppendFromTerm(yymsp[-6].minor.yy373,0,0,&yymsp[-2].minor.yy410,yymsp[-4].minor.yy219,yymsp[-1].minor.yy172,yymsp[0].minor.yy432);
  }
#line 2357 "parse.c"
        break;
      case 129:
#line 476 "parse.y"
{
     sqlite3SrcListShiftJoinType(yymsp[0].minor.yy373);
     yygotominor.yy219 = sqlite3SelectNew(0,yymsp[0].minor.yy373,0,0,0,0,0,0,0);
  }
#line 2365 "parse.c"
        break;
      case 130:
#line 483 "parse.y"
{yygotominor.yy410.z=0; yygotominor.yy410.n=0;}
#line 2370 "parse.c"
        break;
      case 132:
#line 488 "parse.y"
{yygotominor.yy373 = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410);}
#line 2375 "parse.c"
        break;
      case 133:
#line 492 "parse.y"
{ yygotominor.yy46 = JT_INNER; }
#line 2380 "parse.c"
        break;
      case 134:
#line 493 "parse.y"
{ yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
#line 2385 "parse.c"
        break;
      case 135:
#line 494 "parse.y"
{ yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy410,0); }
#line 2390 "parse.c"
        break;
      case 136:
#line 496 "parse.y"
{ yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy410,&yymsp[-1].minor.yy410); }
#line 2395 "parse.c"
        break;
      case 137:
      case 145:
      case 154:
      case 161:
      case 176:
      case 203:
      case 226:
      case 228:
      case 232:
#line 500 "parse.y"
{yygotominor.yy172 = yymsp[0].minor.yy172;}
#line 2408 "parse.c"
        break;
      case 138:
      case 153:
      case 160:
      case 204:
      case 227:
      case 229:
      case 233:
#line 501 "parse.y"
{yygotominor.yy172 = 0;}
#line 2419 "parse.c"
        break;
      case 139:
      case 173:
#line 505 "parse.y"
{yygotominor.yy432 = yymsp[-1].minor.yy432;}
#line 2425 "parse.c"
        break;
      case 140:
      case 172:
#line 506 "parse.y"
{yygotominor.yy432 = 0;}
#line 2431 "parse.c"
        break;
      case 142:
      case 152:
#line 517 "parse.y"
{yygotominor.yy174 = yymsp[0].minor.yy174;}
#line 2437 "parse.c"
        break;
      case 143:
#line 518 "parse.y"
{
  yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-4].minor.yy174,yymsp[-2].minor.yy172,yymsp[-1].minor.yy410.n>0?&yymsp[-1].minor.yy410:0);
  if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
}
#line 2445 "parse.c"
        break;
      case 144:
#line 522 "parse.y"
{
  yygotominor.yy174 = sqlite3ExprListAppend(0,yymsp[-2].minor.yy172,yymsp[-1].minor.yy410.n>0?&yymsp[-1].minor.yy410:0);
  if( yygotominor.yy174 && yygotominor.yy174->a ) yygotominor.yy174->a[0].sortOrder = yymsp[0].minor.yy46;
}
#line 2453 "parse.c"
        break;
      case 146:
      case 148:
#line 531 "parse.y"
{yygotominor.yy46 = SQLITE_SO_ASC;}
#line 2459 "parse.c"
        break;
      case 147:
#line 532 "parse.y"
{yygotominor.yy46 = SQLITE_SO_DESC;}
#line 2464 "parse.c"
        break;
      case 149:
#line 534 "parse.y"
{yygotominor.yy410.z = 0; yygotominor.yy410.n = 0;}
#line 2469 "parse.c"
        break;
      case 155:
#line 552 "parse.y"
{yygotominor.yy234.pLimit = 0; yygotominor.yy234.pOffset = 0;}
#line 2474 "parse.c"
        break;
      case 156:
#line 553 "parse.y"
{yygotominor.yy234.pLimit = yymsp[0].minor.yy172; yygotominor.yy234.pOffset = 0;}
#line 2479 "parse.c"
        break;
      case 157:
#line 555 "parse.y"
{yygotominor.yy234.pLimit = yymsp[-2].minor.yy172; yygotominor.yy234.pOffset = yymsp[0].minor.yy172;}
#line 2484 "parse.c"
        break;
      case 158:
#line 557 "parse.y"
{yygotominor.yy234.pOffset = yymsp[-2].minor.yy172; yygotominor.yy234.pLimit = yymsp[0].minor.yy172;}
#line 2489 "parse.c"
        break;
      case 159:
#line 561 "parse.y"
{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy373,yymsp[0].minor.yy172);}
#line 2494 "parse.c"
        break;
      case 162:
#line 572 "parse.y"
{sqlite3Update(pParse,yymsp[-3].minor.yy373,yymsp[-1].minor.yy174,yymsp[0].minor.yy172,yymsp[-4].minor.yy46);}
#line 2499 "parse.c"
        break;
      case 163:
#line 578 "parse.y"
{yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-4].minor.yy174,yymsp[0].minor.yy172,&yymsp[-2].minor.yy410);}
#line 2504 "parse.c"
        break;
      case 164:
#line 579 "parse.y"
{yygotominor.yy174 = sqlite3ExprListAppend(0,yymsp[0].minor.yy172,&yymsp[-2].minor.yy410);}
#line 2509 "parse.c"
        break;
      case 165:
#line 585 "parse.y"
{sqlite3Insert(pParse, yymsp[-5].minor.yy373, yymsp[-1].minor.yy174, 0, yymsp[-4].minor.yy432, yymsp[-7].minor.yy46);}
#line 2514 "parse.c"
        break;
      case 166:
#line 587 "parse.y"
{sqlite3Insert(pParse, yymsp[-2].minor.yy373, 0, yymsp[0].minor.yy219, yymsp[-1].minor.yy432, yymsp[-4].minor.yy46);}
#line 2519 "parse.c"
        break;
      case 167:
#line 589 "parse.y"
{sqlite3Insert(pParse, yymsp[-3].minor.yy373, 0, 0, yymsp[-2].minor.yy432, yymsp[-5].minor.yy46);}
#line 2524 "parse.c"
        break;
      case 170:
      case 230:
#line 599 "parse.y"
{yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-2].minor.yy174,yymsp[0].minor.yy172,0);}
#line 2530 "parse.c"
        break;
      case 171:
      case 231:
#line 600 "parse.y"
{yygotominor.yy174 = sqlite3ExprListAppend(0,yymsp[0].minor.yy172,0);}
#line 2536 "parse.c"
        break;
      case 174:
#line 609 "parse.y"
{yygotominor.yy432 = sqlite3IdListAppend(yymsp[-2].minor.yy432,&yymsp[0].minor.yy410);}
#line 2541 "parse.c"
        break;
      case 175:
#line 610 "parse.y"
{yygotominor.yy432 = sqlite3IdListAppend(0,&yymsp[0].minor.yy410);}
#line 2546 "parse.c"
        break;
      case 177:
#line 621 "parse.y"
{yygotominor.yy172 = yymsp[-1].minor.yy172; sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
#line 2551 "parse.c"
        break;
      case 178:
      case 183:
      case 184:
#line 622 "parse.y"
{yygotominor.yy172 = sqlite3Expr(yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
#line 2558 "parse.c"
        break;
      case 179:
      case 180:
#line 623 "parse.y"
{yygotominor.yy172 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy0);}
#line 2564 "parse.c"
        break;
      case 181:
#line 625 "parse.y"
{
  Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy410);
  Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy410);
  yygotominor.yy172 = sqlite3Expr(TK_DOT, temp1, temp2, 0);
}
#line 2573 "parse.c"
        break;
      case 182:
#line 630 "parse.y"
{
  Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-4].minor.yy410);
  Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy410);
  Expr *temp3 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy410);
  Expr *temp4 = sqlite3Expr(TK_DOT, temp2, temp3, 0);
  yygotominor.yy172 = sqlite3Expr(TK_DOT, temp1, temp4, 0);
}
#line 2584 "parse.c"
        break;
      case 185:
#line 639 "parse.y"
{yygotominor.yy172 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);}
#line 2589 "parse.c"
        break;
      case 186:
#line 640 "parse.y"
{
  Token *pToken = &yymsp[0].minor.yy0;
  Expr *pExpr = yygotominor.yy172 = sqlite3Expr(TK_VARIABLE, 0, 0, pToken);
  sqlite3ExprAssignVarNumber(pParse, pExpr);
}
#line 2598 "parse.c"
        break;
      case 187:
#line 646 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(TK_CAST, yymsp[-3].minor.yy172, 0, &yymsp[-1].minor.yy410);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
}
#line 2606 "parse.c"
        break;
      case 188:
#line 651 "parse.y"
{
  yygotominor.yy172 = sqlite3ExprFunction(yymsp[-1].minor.yy174, &yymsp[-4].minor.yy0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
  if( yymsp[-2].minor.yy46 && yygotominor.yy172 ){
    yygotominor.yy172->flags |= EP_Distinct;
  }
}
#line 2617 "parse.c"
        break;
      case 189:
#line 658 "parse.y"
{
  yygotominor.yy172 = sqlite3ExprFunction(0, &yymsp[-3].minor.yy0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
}
#line 2625 "parse.c"
        break;
      case 190:
#line 662 "parse.y"
{
  /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
  ** treated as functions that return constants */
  yygotominor.yy172 = sqlite3ExprFunction(0,&yymsp[0].minor.yy0);
  if( yygotominor.yy172 ){
    yygotominor.yy172->op = TK_CONST_FUNC;  
    yygotominor.yy172->span = yymsp[0].minor.yy0;
  }
}
#line 2638 "parse.c"
        break;
      case 191:
      case 192:
      case 193:
      case 194:
      case 195:
      case 196:
      case 197:
      case 198:
#line 671 "parse.y"
{yygotominor.yy172 = sqlite3Expr(yymsp[-1].major, yymsp[-2].minor.yy172, yymsp[0].minor.yy172, 0);}
#line 2650 "parse.c"
        break;
      case 199:
      case 201:
#line 681 "parse.y"
{yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 0;}
#line 2656 "parse.c"
        break;
      case 200:
      case 202:
#line 682 "parse.y"
{yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 1;}
#line 2662 "parse.c"
        break;
      case 205:
#line 689 "parse.y"
{
  ExprList *pList;
  pList = sqlite3ExprListAppend(0, yymsp[-1].minor.yy172, 0);
  pList = sqlite3ExprListAppend(pList, yymsp[-3].minor.yy172, 0);
  if( yymsp[0].minor.yy172 ){
    pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy172, 0);
  }
  yygotominor.yy172 = sqlite3ExprFunction(pList, &yymsp[-2].minor.yy72.eOperator);
  if( yymsp[-2].minor.yy72.not ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy172->span, &yymsp[-1].minor.yy172->span);
  if( yygotominor.yy172 ) yygotominor.yy172->flags |= EP_InfixFunc;
}
#line 2678 "parse.c"
        break;
      case 206:
#line 702 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(yymsp[0].major, yymsp[-1].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy172->span,&yymsp[0].minor.yy0);
}
#line 2686 "parse.c"
        break;
      case 207:
#line 706 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(TK_ISNULL, yymsp[-2].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0);
}
#line 2694 "parse.c"
        break;
      case 208:
#line 710 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(TK_NOTNULL, yymsp[-2].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0);
}
#line 2702 "parse.c"
        break;
      case 209:
#line 714 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(TK_NOTNULL, yymsp[-3].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,&yymsp[0].minor.yy0);
}
#line 2710 "parse.c"
        break;
      case 210:
#line 718 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(yymsp[-1].major, yymsp[0].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
}
#line 2718 "parse.c"
        break;
      case 211:
#line 722 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
}
#line 2726 "parse.c"
        break;
      case 212:
#line 726 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(TK_UPLUS, yymsp[0].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
}
#line 2734 "parse.c"
        break;
      case 215:
#line 733 "parse.y"
{
  ExprList *pList = sqlite3ExprListAppend(0, yymsp[-2].minor.yy172, 0);
  pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy172, 0);
  yygotominor.yy172 = sqlite3Expr(TK_BETWEEN, yymsp[-4].minor.yy172, 0, 0);
  if( yygotominor.yy172 ){
    yygotominor.yy172->pList = pList;
  }else{
    sqlite3ExprListDelete(pList);
  } 
  if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy172->span);
}
#line 2750 "parse.c"
        break;
      case 218:
#line 749 "parse.y"
{
    yygotominor.yy172 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy172, 0, 0);
    if( yygotominor.yy172 ){
      yygotominor.yy172->pList = yymsp[-1].minor.yy174;
    }else{
      sqlite3ExprListDelete(yymsp[-1].minor.yy174);
    }
    if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0);
    sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0);
  }
#line 2764 "parse.c"
        break;
      case 219:
#line 759 "parse.y"
{
    yygotominor.yy172 = sqlite3Expr(TK_SELECT, 0, 0, 0);
    if( yygotominor.yy172 ){
      yygotominor.yy172->pSelect = yymsp[-1].minor.yy219;
    }else{
      sqlite3SelectDelete(yymsp[-1].minor.yy219);
    }
    sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
  }
#line 2777 "parse.c"
        break;
      case 220:
#line 768 "parse.y"
{
    yygotominor.yy172 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy172, 0, 0);
    if( yygotominor.yy172 ){
      yygotominor.yy172->pSelect = yymsp[-1].minor.yy219;
    }else{
      sqlite3SelectDelete(yymsp[-1].minor.yy219);
    }
    if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0);
    sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0);
  }
#line 2791 "parse.c"
        break;
      case 221:
#line 778 "parse.y"
{
    SrcList *pSrc = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410);
    yygotominor.yy172 = sqlite3Expr(TK_IN, yymsp[-3].minor.yy172, 0, 0);
    if( yygotominor.yy172 ){
      yygotominor.yy172->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0);
    }else{
      sqlite3SrcListDelete(pSrc);
    }
    if( yymsp[-2].minor.yy46 ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0);
    sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,yymsp[0].minor.yy410.z?&yymsp[0].minor.yy410:&yymsp[-1].minor.yy410);
  }
#line 2806 "parse.c"
        break;
      case 222:
#line 789 "parse.y"
{
    Expr *p = yygotominor.yy172 = sqlite3Expr(TK_EXISTS, 0, 0, 0);
    if( p ){
      p->pSelect = yymsp[-1].minor.yy219;
      sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
    }else{
      sqlite3SelectDelete(yymsp[-1].minor.yy219);
    }
  }
#line 2819 "parse.c"
        break;
      case 223:
#line 801 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(TK_CASE, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, 0);
  if( yygotominor.yy172 ){
    yygotominor.yy172->pList = yymsp[-2].minor.yy174;
  }else{
    sqlite3ExprListDelete(yymsp[-2].minor.yy174);
  }
  sqlite3ExprSpan(yygotominor.yy172, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
}
#line 2832 "parse.c"
        break;
      case 224:
#line 812 "parse.y"
{
  yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-4].minor.yy174, yymsp[-2].minor.yy172, 0);
  yygotominor.yy174 = sqlite3ExprListAppend(yygotominor.yy174, yymsp[0].minor.yy172, 0);
}
#line 2840 "parse.c"
        break;
      case 225:
#line 816 "parse.y"
{
  yygotominor.yy174 = sqlite3ExprListAppend(0, yymsp[-2].minor.yy172, 0);
  yygotominor.yy174 = sqlite3ExprListAppend(yygotominor.yy174, yymsp[0].minor.yy172, 0);
}
#line 2848 "parse.c"
        break;
      case 234:
#line 843 "parse.y"
{
  sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy410, &yymsp[-5].minor.yy410, sqlite3SrcListAppend(0,&yymsp[-3].minor.yy410,0), yymsp[-1].minor.yy174, yymsp[-9].minor.yy46,
                      &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy46);
}
#line 2856 "parse.c"
        break;
      case 235:
      case 280:
#line 849 "parse.y"
{yygotominor.yy46 = OE_Abort;}
#line 2862 "parse.c"
        break;
      case 236:
#line 850 "parse.y"
{yygotominor.yy46 = OE_None;}
#line 2867 "parse.c"
        break;
      case 239:
#line 860 "parse.y"
{
  Expr *p = 0;
  if( yymsp[-1].minor.yy410.n>0 ){
    p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char*)yymsp[-1].minor.yy410.z, yymsp[-1].minor.yy410.n);
  }
  yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-4].minor.yy174, p, &yymsp[-2].minor.yy410);
  if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
}
#line 2880 "parse.c"
        break;
      case 240:
#line 869 "parse.y"
{
  Expr *p = 0;
  if( yymsp[-1].minor.yy410.n>0 ){
    p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char*)yymsp[-1].minor.yy410.z, yymsp[-1].minor.yy410.n);
  }
  yygotominor.yy174 = sqlite3ExprListAppend(0, p, &yymsp[-2].minor.yy410);
  if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
}
#line 2893 "parse.c"
        break;
      case 242:
#line 883 "parse.y"
{sqlite3DropIndex(pParse, yymsp[0].minor.yy373, yymsp[-1].minor.yy46);}
#line 2898 "parse.c"
        break;
      case 243:
      case 244:
#line 888 "parse.y"
{sqlite3Vacuum(pParse);}
#line 2904 "parse.c"
        break;
      case 245:
      case 247:
#line 895 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy410,0);}
#line 2910 "parse.c"
        break;
      case 246:
#line 896 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy0,0);}
#line 2915 "parse.c"
        break;
      case 248:
#line 898 "parse.y"
{
  sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy410,1);
}
#line 2922 "parse.c"
        break;
      case 249:
#line 901 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy410,&yymsp[-3].minor.yy410,&yymsp[-1].minor.yy410,0);}
#line 2927 "parse.c"
        break;
      case 250:
#line 902 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410,0,0);}
#line 2932 "parse.c"
        break;
      case 256:
#line 914 "parse.y"
{
  Token all;
  all.z = yymsp[-3].minor.yy410.z;
  all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy410.z) + yymsp[0].minor.yy0.n;
  sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy243, &all);
}
#line 2942 "parse.c"
        break;
      case 257:
#line 923 "parse.y"
{
  sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy410, &yymsp[-6].minor.yy410, yymsp[-5].minor.yy46, yymsp[-4].minor.yy370.a, yymsp[-4].minor.yy370.b, yymsp[-2].minor.yy373, yymsp[-1].minor.yy46, yymsp[0].minor.yy172, yymsp[-10].minor.yy46, yymsp[-8].minor.yy46);
  yygotominor.yy410 = (yymsp[-6].minor.yy410.n==0?yymsp[-7].minor.yy410:yymsp[-6].minor.yy410);


}
#line 2950 "parse.c"
        break;
      case 258:
      case 261:
#line 929 "parse.y"
{ yygotominor.yy46 = TK_BEFORE; }




#line 2956 "parse.c"
        break;
      case 259:

#line 930 "parse.y"
{ yygotominor.yy46 = TK_AFTER;  }
#line 2961 "parse.c"
        break;
      case 260:
#line 931 "parse.y"
{ yygotominor.yy46 = TK_INSTEAD;}
#line 2966 "parse.c"
        break;
      case 262:
      case 263:
#line 936 "parse.y"
{yygotominor.yy370.a = yymsp[0].major; yygotominor.yy370.b = 0;}

#line 2972 "parse.c"
        break;

      case 264:
#line 938 "parse.y"
{yygotominor.yy370.a = TK_UPDATE; yygotominor.yy370.b = yymsp[0].minor.yy432;}
#line 2977 "parse.c"
        break;
      case 265:
      case 266:
#line 941 "parse.y"
{ yygotominor.yy46 = TK_ROW; }

#line 2983 "parse.c"
        break;

      case 267:
#line 943 "parse.y"
{ yygotominor.yy46 = TK_STATEMENT; }
#line 2988 "parse.c"
        break;
      case 268:
#line 947 "parse.y"
{ yygotominor.yy172 = 0; }
#line 2993 "parse.c"
        break;
      case 269:
#line 948 "parse.y"
{ yygotominor.yy172 = yymsp[0].minor.yy172; }
#line 2998 "parse.c"
        break;
      case 270:
#line 952 "parse.y"





{
  if( yymsp[-2].minor.yy243 ){
    yymsp[-2].minor.yy243->pLast->pNext = yymsp[-1].minor.yy243;
  }else{
    yymsp[-2].minor.yy243 = yymsp[-1].minor.yy243;
  }
  yymsp[-2].minor.yy243->pLast = yymsp[-1].minor.yy243;
  yygotominor.yy243 = yymsp[-2].minor.yy243;
}
#line 3011 "parse.c"
        break;
      case 271:
#line 961 "parse.y"
{ yygotominor.yy243 = 0; }
#line 3016 "parse.c"
        break;
      case 272:
#line 967 "parse.y"
{ yygotominor.yy243 = sqlite3TriggerUpdateStep(&yymsp[-3].minor.yy410, yymsp[-1].minor.yy174, yymsp[0].minor.yy172, yymsp[-4].minor.yy46); }

#line 3021 "parse.c"
        break;
      case 273:
#line 972 "parse.y"
{yygotominor.yy243 = sqlite3TriggerInsertStep(&yymsp[-5].minor.yy410, yymsp[-4].minor.yy432, yymsp[-1].minor.yy174, 0, yymsp[-7].minor.yy46);}

#line 3026 "parse.c"
        break;
      case 274:
#line 975 "parse.y"
{yygotominor.yy243 = sqlite3TriggerInsertStep(&yymsp[-2].minor.yy410, yymsp[-1].minor.yy432, 0, yymsp[0].minor.yy219, yymsp[-4].minor.yy46);}

#line 3031 "parse.c"
        break;
      case 275:
#line 979 "parse.y"
{yygotominor.yy243 = sqlite3TriggerDeleteStep(&yymsp[-1].minor.yy410, yymsp[0].minor.yy172);}
#line 3036 "parse.c"
        break;
      case 276:
#line 982 "parse.y"
{yygotominor.yy243 = sqlite3TriggerSelectStep(yymsp[0].minor.yy219); }
#line 3041 "parse.c"
        break;
      case 277:
#line 985 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(TK_RAISE, 0, 0, 0); 
  if( yygotominor.yy172 ){
    yygotominor.yy172->iColumn = OE_Ignore;
    sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
  }
}
#line 3052 "parse.c"
        break;
      case 278:
#line 992 "parse.y"
{
  yygotominor.yy172 = sqlite3Expr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy410); 
  if( yygotominor.yy172 ) {
    yygotominor.yy172->iColumn = yymsp[-3].minor.yy46;
    sqlite3ExprSpan(yygotominor.yy172, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
  }
}
#line 3063 "parse.c"
        break;
      case 279:
#line 1002 "parse.y"
{yygotominor.yy46 = OE_Rollback;}
#line 3068 "parse.c"
        break;
      case 281:
#line 1004 "parse.y"
{yygotominor.yy46 = OE_Fail;}
#line 3073 "parse.c"
        break;
      case 282:
#line 1009 "parse.y"
{
  sqlite3DropTrigger(pParse,yymsp[0].minor.yy373,yymsp[-1].minor.yy46);
}
#line 3080 "parse.c"
        break;
      case 283:
#line 1015 "parse.y"
{
  sqlite3Attach(pParse, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, yymsp[0].minor.yy386);
}
#line 3087 "parse.c"
        break;
      case 284:
#line 1020 "parse.y"
{ yygotominor.yy386 = 0; }
#line 3092 "parse.c"
        break;
      case 285:
#line 1021 "parse.y"
{ yygotominor.yy386 = yymsp[0].minor.yy172; }
#line 3097 "parse.c"
        break;
      case 288:
#line 1027 "parse.y"
{
  sqlite3Detach(pParse, yymsp[0].minor.yy172);
}
#line 3104 "parse.c"
        break;
      case 289:
#line 1033 "parse.y"
{sqlite3Reindex(pParse, 0, 0);}
#line 3109 "parse.c"
        break;
      case 290:
#line 1034 "parse.y"
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy410, &yymsp[0].minor.yy410);}
#line 3114 "parse.c"
        break;
      case 291:
#line 1039 "parse.y"
{sqlite3Analyze(pParse, 0, 0);}
#line 3119 "parse.c"
        break;
      case 292:
#line 1040 "parse.y"
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy410, &yymsp[0].minor.yy410);}
#line 3124 "parse.c"
        break;
      case 293:
#line 1045 "parse.y"





{
  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy373,&yymsp[0].minor.yy410);
}
#line 3131 "parse.c"
        break;
      case 294:
#line 1048 "parse.y"
{
  sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy410);
}
#line 3138 "parse.c"
        break;
      case 295:
#line 1051 "parse.y"
{
  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy373);
}
#line 3145 "parse.c"
        break;
      case 298:
#line 1060 "parse.y"
{sqlite3VtabFinishParse(pParse,0);}
#line 3150 "parse.c"
        break;
      case 299:
#line 1061 "parse.y"
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
#line 3155 "parse.c"
        break;
      case 300:
#line 1062 "parse.y"





{
    sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy410, &yymsp[-2].minor.yy410, &yymsp[0].minor.yy410);
}
#line 3162 "parse.c"
        break;
      case 303:
#line 1067 "parse.y"
{sqlite3VtabArgInit(pParse);}
#line 3167 "parse.c"
        break;
      case 305:
      case 306:
      case 307:
      case 309:
#line 1069 "parse.y"
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
#line 3175 "parse.c"
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
  if( yyact < YYNSTATE ){
................................................................................
    if( TOKEN.z[0] ){
      sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
    }else{
      sqlite3ErrorMsg(pParse, "incomplete SQL statement");
    }
    pParse->parseError = 1;
  }
#line 3243 "parse.c"
  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following is executed when the parser accepts
*/
static void yy_accept(







|





|
|
|
|
|
|
|
|
|
|
|
|
|
|






|
|

|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>







 







|
|
|
|
|







 







|

|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|
|











|

|
|













|
|






|
|




|
|

|





|
|

|
|
|
|
|

|
|
|
|

|
|
|
|







 







|







 







<


>
>


|
|
|

|
|
<
<
<

|
|
|
|


|
|
|
|
>
>
>
|
|
|
|







|
|
|
|







|
|
|


|
|
|
|
|
|
|
|
|
|







 







<







>
>
>
>
>
>


<
>













|




|




|




|



|
|



|
|







|
|





|




|




|

|













|
|










|
|




|

|




|
|

|




|
|

|




|
|

|






|

|
|



|
|








>


>

|
|




|
|

|




|
|

|



|
|



|
|



|
|




|
|



|
|




|


|




|


|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|









|
|



|
|



|
|



|
|



|
|



|
|




|
|

|




|
|



|
|




|
|




|

|




|

|




|

|




|
|

|




|
|




|
|
|

|

|



|
|




|

|




|
|






|
|




|

|




|

|





|
|

|



|
|



|
|




|
|

|




|
|

|



|
|




|

|




|

|




|
|

|



|
|



|
|



|
|



|
|



|
|



|
|











|
|









|
|




|
|




|
|




|
|




|
|

|




|
|

|




|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|



|
|




|
|




|
|



|
|



|
|



|
|





|
|




|
|




|
|
|

|




|
|
|

|

|



|
|





|


|




|
|

|




|
|
|
|


|




|
|

|






|
|
|
|


|










|
|




|
|




|
|





|
|
|
|

|
|
|
|

|




|
|

|




|
|

|




|
|

|




|
|

|




|
|

|




|
|

|




|
|

|




|
|
|
|
|



|
|

|




|
|
|

|

|
|

|




|
|
|

|

|

|




|
|
|

|

|
|

|




|
|
|
|



|
|

|




|

|


|


|




|
|
|

|

|

|




|
|

|




|
|

|




|
|

|


|

|
|



|
|





|

|

|
|

|





|

|

|
|

|



|
|





|


<

|
|



|
|

|
|

|

|

|
|
|
|

|
|
|
<
<
<
<
<
<
<
<
<
<



|

|
|
>
>

|


<
|
<
>
>
>
>
|


>

|
|



|
|

|
<
|
<
>
|

>

|
|
|


<
|
<
>
|

>

|
|
|


|
|
|



|
|


|
>
>
>
>
>

|
|

|

|
|

|

|
|
|
|

|
|
<
>
|

|
|
<
>
|

|
|
<
>
|

|
|
|
|

|
|
|
|

|
|

|
|
|
|


|

|
|

|
|
|
|


|

|
|
|
|

|
|
|
|

|
|

|

|

|
|

|

|
<
<
<
<
<



|
|
|
|
|
|
|
|
|
|
|
|
|
|



|
|


|
|
|



|
|


|
>
>
>
>
>

|

|

|
|

|

|

|
|

|

<
<
<
<
<
|



|
|



>
>
>
>
>

|

|

|
|

|

|
|
|
|
|

|







 







|







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
...
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
....
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
....
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
....
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
....
1755
1756
1757
1758
1759
1760
1761

1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773



1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
....
1845
1846
1847
1848
1849
1850
1851

1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866

1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914

2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938










2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951

2952

2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970

2971

2972
2973
2974
2975
2976
2977
2978
2979
2980
2981

2982

2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026

3027
3028
3029
3030
3031

3032
3033
3034
3035
3036

3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094





3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151





3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
....
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
**    sqlite3ParserARG_FETCH     Code to extract %extra_argument from yypParser
**    YYNSTATE           the combined number of states.
**    YYNRULE            the number of rules in the grammar
**    YYERRORSYMBOL      is the code number of the error symbol.  If not
**                       defined, then do no error processing.
*/
#define YYCODETYPE unsigned char
#define YYNOCODE 249
#define YYACTIONTYPE unsigned short int
#define YYWILDCARD 60
#define sqlite3ParserTOKENTYPE Token
typedef union {
  sqlite3ParserTOKENTYPE yy0;
  Select* yy43;
  TriggerStep* yy75;
  struct LimitVal yy84;
  struct LikeOp yy86;
  Expr * yy158;
  Token yy178;
  struct {int value; int mask;} yy207;
  ExprList* yy242;
  int yy316;
  IdList* yy352;
  struct TrigEvent yy354;
  SrcList* yy419;
  Expr* yy450;
  int yy497;
} 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 587
#define YYNRULE 311
#define YYERRORSYMBOL 139
#define YYERRSYMDT yy497
#define YYFALLBACK 1
#define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
#define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)

/* Next are that tables used to determine what action to take based on the
** current state and lookahead token.  These tables are used to implement
................................................................................
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
**                     shifting non-terminals after a reduce.
**  yy_default[]       Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   290,   68,  300,   70,  151,  169,  570,  420,   62,   62,
 /*    10 */    62,   62,  205,   64,   64,   64,   64,   65,   65,   66,
 /*    20 */    66,   66,   67,  477,  569,  568,  433,  439,   69,   64,
 /*    30 */    64,   64,   64,   65,   65,   66,   66,   66,   67,   65,
 /*    40 */    65,   66,   66,   66,   67,   61,   59,  296,  443,  444,
 /*    50 */   440,  440,   63,   63,   62,   62,   62,   62,  582,   64,
 /*    60 */    64,   64,   64,   65,   65,   66,   66,   66,   67,  290,
 /*    70 */   570,  387,  420,  149,    2,   80,  161,  115,  240,  341,
 /*    80 */   245,  342,  173,  249,  298,    1,  566,  207,  569,  393,
 /*    90 */   250,  522,  899,  121,  586,  433,  439,    2,  583,   58,
 /*   100 */   577,   21,   64,   64,   64,   64,   65,   65,   66,   66,
 /*   110 */    66,   67,  290,  473,   61,   59,  296,  443,  444,  440,
 /*   120 */   440,   63,   63,   62,   62,   62,   62,  393,   64,   64,
 /*   130 */    64,   64,   65,   65,   66,   66,   66,   67,  433,  439,
 /*   140 */    92,  178,   67,  473,  343,  346,  347,  388,  385,   56,
 /*   150 */   379,  207,  236,  407,  394,  395,  348,   61,   59,  296,
 /*   160 */   443,  444,  440,  440,   63,   63,   62,   62,   62,   62,
 /*   170 */   171,   64,   64,   64,   64,   65,   65,   66,   66,   66,
 /*   180 */    67,  290,  479,  428,  208,  522,  110,  490,  452,  432,
 /*   190 */   406,  223,  394,  395,  532,   21,  408,  318,  517,   68,
 /*   200 */   453,   70,  151,  567,  412,  150,  487,  433,  439,  146,
 /*   210 */   147,  584,  890,  454,  890,  494,  172,  157,  488,  411,
 /*   220 */    28,  337,  415,  261,  290,  495,   61,   59,  296,  443,
 /*   230 */   444,  440,  440,   63,   63,   62,   62,   62,   62,  412,
 /*   240 */    64,   64,   64,   64,   65,   65,   66,   66,   66,   67,
 /*   250 */   433,  439,  581,  314,  389,  417,  417,  417,  549,  204,
 /*   260 */    68,  460,   70,  151,  262,  261,  197,  290,  339,   61,
 /*   270 */    59,  296,  443,  444,  440,  440,   63,   63,   62,   62,
 /*   280 */    62,   62,  318,   64,   64,   64,   64,   65,   65,   66,
 /*   290 */    66,   66,   67,  433,  439,  410,  548,  393,  284,  409,
 /*   300 */   412,  430,  521,  165,  411,   41,  381,  473,  432,  295,
 /*   310 */   423,  424,   61,   59,  296,  443,  444,  440,  440,   63,
 /*   320 */    63,   62,   62,   62,   62,  376,   64,   64,   64,   64,
 /*   330 */    65,   65,   66,   66,   66,   67,  477,  488,  300,  290,
 /*   340 */    76,  415,  205,  483,  332,  234,  238,  370,  267,  266,
 /*   350 */   489,   68,  384,   70,  151,  369,  393,  383,  205,  434,
 /*   360 */   435,  367,  394,  395,  178,  433,  439,  343,  346,  347,
 /*   370 */   529,  504,  572,  207,  417,  417,  417,  528,  169,  348,
 /*   380 */   420,  437,  438,   79,   61,   59,  296,  443,  444,  440,
 /*   390 */   440,   63,   63,   62,   62,   62,   62,  358,   64,   64,
 /*   400 */    64,   64,   65,   65,   66,   66,   66,   67,  290,  436,
 /*   410 */   428,  208,  486,  115,  240,  341,  245,  342,  173,  249,
 /*   420 */   318,  394,  395,  530,  318,  393,  250,  217,  318,  509,
 /*   430 */   405,  520,  152,  224,  433,  439,  321,  423,  424,  517,
 /*   440 */   492,  493,  411,   35,  231,  420,  411,   35,  469,  510,
 /*   450 */   411,   35,  477,   61,   59,  296,  443,  444,  440,  440,
 /*   460 */    63,   63,   62,   62,   62,   62,  412,   64,   64,   64,
 /*   470 */    64,   65,   65,   66,   66,   66,   67,  290,  522,  178,
 /*   480 */   351,  503,  343,  346,  347,  299,  318,  404,   21,  297,
 /*   490 */   394,  395,  318,  334,  348,  482,  318,  457,  318,  393,
 /*   500 */   207,  457,  302,  433,  439,  457,   22,  174,  411,   36,
 /*   510 */   420,  148,  531,  308,  411,   35,  523,  470,  411,   41,
 /*   520 */   411,   49,   61,   59,  296,  443,  444,  440,  440,   63,
 /*   530 */    63,   62,   62,   62,   62,  318,   64,   64,   64,   64,
 /*   540 */    65,   65,   66,   66,   66,   67,  290,  447,  338,  452,
 /*   550 */   253,   66,   66,   66,   67,  428,  448,  411,   49,  232,
 /*   560 */   230,  453,   10,  292,  394,  395,  393,  309,  250,  456,
 /*   570 */   411,    3,  433,  439,  454,  420,  328,   20,  543,  141,
 /*   580 */   584,  889,  324,  889,  446,  446,  393,  430,  322,  165,
 /*   590 */   393,   61,   59,  296,  443,  444,  440,  440,   63,   63,
 /*   600 */    62,   62,   62,   62,  310,   64,   64,   64,   64,   65,
 /*   610 */    65,   66,   66,   66,   67,  290,  371,  318,  271,  541,
 /*   620 */    91,  581,  293,  540,  466,  318,  206,  318,  587,  388,
 /*   630 */   385,  394,  395,   55,  324,  359,  446,  446,  329,  411,
 /*   640 */    29,  433,  439,  324,  481,  446,  446,  411,   24,  411,
 /*   650 */    33,  394,  395,  515,  545,  394,  395,  274,  290,  272,
 /*   660 */    61,   59,  296,  443,  444,  440,  440,   63,   63,   62,
 /*   670 */    62,   62,   62,  318,   64,   64,   64,   64,   65,   65,
 /*   680 */    66,   66,   66,   67,  433,  439,  546,  493,  303,  396,
 /*   690 */   397,  398,  580,  289,  823,  411,   54,  360,  515,  515,
 /*   700 */   189,  290,  363,   61,   59,  296,  443,  444,  440,  440,
 /*   710 */    63,   63,   62,   62,   62,   62,  144,   64,   64,   64,
 /*   720 */    64,   65,   65,   66,   66,   66,   67,  433,  439,  539,
 /*   730 */   357,  539,  248,  216,  412,  468,  168,  157,  273,  515,
 /*   740 */   515,  515,  312,  120,  290,  198,   61,   71,  296,  443,
 /*   750 */   444,  440,  440,   63,   63,   62,   62,   62,   62,  368,
 /*   760 */    64,   64,   64,   64,   65,   65,   66,   66,   66,   67,
 /*   770 */   433,  439,  426,  426,  304,  305,  307,  248,  247,  412,
 /*   780 */   324,  364,  446,  446,  175,  176,  177,  290,  261,  261,
 /*   790 */    59,  296,  443,  444,  440,  440,   63,   63,   62,   62,
 /*   800 */    62,   62,  155,   64,   64,   64,   64,   65,   65,   66,
 /*   810 */    66,   66,   67,  433,  439,  462,  156,  125,  248,  248,
 /*   820 */   248,  420,  463,  367,  261,  255,  335,  193,  468,  556,
 /*   830 */   558,   75,  162,   77,  296,  443,  444,  440,  440,   63,
 /*   840 */    63,   62,   62,   62,   62,  318,   64,   64,   64,   64,
 /*   850 */    65,   65,   66,   66,   66,   67,   72,  325,  318,    4,
 /*   860 */   318,  412,  318,  294,  259,  559,  257,  411,   25,  318,
 /*   870 */   219,  320,   72,  325,  318,    4,  153,  235,  180,  294,
 /*   880 */   411,   52,  411,   97,  411,   94,  420,  320,  327,  218,
 /*   890 */   410,  411,   99,  501,  409,  318,  411,  100,  319,  432,
 /*   900 */   318,  261,  318,  174,  327,  392,  191,  183,  318,  116,
 /*   910 */   412,  318,  412,  416,  261,  432,  318,  411,  111,   74,
 /*   920 */    73,  429,  411,  112,  411,   17,  621,   72,  316,  317,
 /*   930 */   411,   98,  415,  411,   34,   74,   73,  480,  411,   95,
 /*   940 */   318,  412,  560,   72,  316,  317,   72,  325,  415,    4,
 /*   950 */   318,  205,  318,  294,  318,  275,    5,  318,  261,  292,
 /*   960 */   323,  320,  411,   53,  330,  417,  417,  417,  418,  419,
 /*   970 */    12,  378,  411,  113,  411,  114,  411,   26,  327,  411,
 /*   980 */    37,  417,  417,  417,  418,  419,   12,  508,  507,  432,
 /*   990 */   159,  205,  318,  458,  261,  220,  221,  222,  102,  375,
 /*  1000 */   421,  318,   23,  318,  377,  318,   82,  318,  506,   74,
 /*  1010 */    73,  202,  467,  279,  411,   38,  472,   72,  316,  317,
 /*  1020 */   280,  318,  415,  411,   27,  411,   39,  411,   40,  411,
 /*  1030 */    42,  318,  200,  476,  548,  277,  441,  246,  505,  199,
 /*  1040 */   318,  511,  201,  411,   43,  318,  512,  455,  318,   13,
 /*  1050 */   475,  318,  170,  411,   44,  417,  417,  417,  418,  419,
 /*  1060 */    12,  524,  411,   30,  498,  499,  318,  411,   31,   19,
 /*  1070 */   411,   45,  318,  411,   46,  484,  318,   13,  241,  318,
 /*  1080 */   513,  318,  125,  318,  254,  374,  276,  266,  411,   47,
 /*  1090 */   242,  291,  537,  538,  411,   48,  205,  256,  411,   32,
 /*  1100 */   258,  411,   11,  411,   50,  411,   51,  252,  350,  125,
 /*  1110 */   125,  544,  552,  125,  170,  553,  563,   89,   89,    9,
 /*  1120 */   380,  260,  579,  265,  288,  355,  186,  362,  402,  365,
 /*  1130 */   366,  268,  269,  143,  225,  270,  555,  565,  278,  281,
 /*  1140 */   282,  576,  425,  326,  427,  461,  504,  465,  551,  243,
 /*  1150 */   514,  562,  160,  391,  399,  400,  401,    8,  315,  413,
 /*  1160 */    82,  226,  333,  227,   81,  331,   57,  516,  228,  345,
 /*  1170 */    78,  209,  167,  459,  233,  210,  407,  464,  122,   83,
 /*  1180 */   336,  340,  211,  491,  496,  301,  244,  501,  103,  500,
 /*  1190 */   497,  502,  285,  518,  229,  525,  414,  286,  519,  352,
 /*  1200 */   526,  527,  533,  237,  181,  474,  239,  354,  478,  185,
 /*  1210 */   182,  356,  214,  184,   86,  535,  215,  187,  118,  361,
 /*  1220 */   547,  190,  129,  372,  373,  130,  554,  311,  131,  561,
 /*  1230 */   132,  573,  135,   96,  133,  578,  390,  139,  574,  575,
 /*  1240 */   263,  403,  138,  213,  101,  622,  623,  163,   60,  536,
 /*  1250 */   164,  422,  431,  442,  449,  445,  140,  154,  166,  450,
 /*  1260 */   451,    6,   90,   14,   13,  471,    7,  123,  158,  124,
 /*  1270 */   485,   93,  212,   84,  344,  104,  117,  251,  105,   85,
 /*  1280 */   106,  179,  242,  353,  142,   18,  534,  126,  306,  349,
 /*  1290 */   170,  127,  109,  264,  188,  107,  542,  287,  550,  128,
 /*  1300 */   192,   15,   87,   88,  194,  195,  557,  119,  196,  136,
 /*  1310 */   137,  134,   16,  564,  571,  108,  313,  203,  145,  283,
 /*  1320 */   382,  386,  900,  585,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */    16,  218,   16,  220,  221,   21,  148,   23,   70,   71,
 /*    10 */    72,   73,  111,   75,   76,   77,   78,   79,   80,   81,
 /*    20 */    82,   83,   84,  148,  166,  167,   42,   43,   74,   75,
 /*    30 */    76,   77,   78,   79,   80,   81,   82,   83,   84,   79,
 /*    40 */    80,   81,   82,   83,   84,   61,   62,   63,   64,   65,
 /*    50 */    66,   67,   68,   69,   70,   71,   72,   73,   20,   75,
 /*    60 */    76,   77,   78,   79,   80,   81,   82,   83,   84,   16,
 /*    70 */   148,  142,   88,   22,  145,   22,   90,   91,   92,   93,
 /*    80 */    94,   95,   96,   97,  209,   19,  228,  229,  166,   23,
 /*    90 */   104,  148,  140,  141,  142,   42,   43,  145,   60,   46,
 /*   100 */   157,  158,   75,   76,   77,   78,   79,   80,   81,   82,
 /*   110 */    83,   84,   16,  162,   61,   62,   63,   64,   65,   66,
 /*   120 */    67,   68,   69,   70,   71,   72,   73,   23,   75,   76,
 /*   130 */    77,   78,   79,   80,   81,   82,   83,   84,   42,   43,
 /*   140 */    44,   90,   84,  162,   93,   94,   95,    1,    2,   19,
 /*   150 */   228,  229,  201,   23,   88,   89,  105,   61,   62,   63,
 /*   160 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,
 /*   170 */   156,   75,   76,   77,   78,   79,   80,   81,   82,   83,
 /*   180 */    84,   16,  201,   79,   80,  148,   21,  161,   12,   59,
 /*   190 */   169,  154,   88,   89,  157,  158,  170,  148,  177,  218,
 /*   200 */    24,  220,  221,   99,  190,  156,  170,   42,   43,   79,
 /*   210 */    80,   19,   20,   37,   22,   39,  202,  203,   88,  170,
 /*   220 */   171,  207,   92,  148,   16,   49,   61,   62,   63,   64,
 /*   230 */    65,   66,   67,   68,   69,   70,   71,   72,   73,  190,
 /*   240 */    75,   76,   77,   78,   79,   80,   81,   82,   83,   84,
 /*   250 */    42,   43,   60,  143,  144,  125,  126,  127,   11,  149,
 /*   260 */   218,  219,  220,  221,  189,  148,  156,   16,   81,   61,
 /*   270 */    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
 /*   280 */    72,   73,  148,   75,   76,   77,   78,   79,   80,   81,
 /*   290 */    82,   83,   84,   42,   43,  108,   49,   23,  159,  112,
 /*   300 */   190,  162,  163,  164,  170,  171,  189,  162,   59,  165,
 /*   310 */   166,  167,   61,   62,   63,   64,   65,   66,   67,   68,
 /*   320 */    69,   70,   71,   72,   73,  215,   75,   76,   77,   78,
 /*   330 */    79,   80,   81,   82,   83,   84,  148,   88,   16,   16,
 /*   340 */   132,   92,  111,   20,  210,  211,  201,  100,  101,  102,
 /*   350 */   170,  218,  242,  220,  221,  124,   23,  240,  111,   42,
 /*   360 */    43,  148,   88,   89,   90,   42,   43,   93,   94,   95,
 /*   370 */   177,  178,  239,  229,  125,  126,  127,  184,   21,  105,
 /*   380 */    23,   64,   65,  132,   61,   62,   63,   64,   65,   66,
 /*   390 */    67,   68,   69,   70,   71,   72,   73,  209,   75,   76,
 /*   400 */    77,   78,   79,   80,   81,   82,   83,   84,   16,   92,
 /*   410 */    79,   80,   20,   91,   92,   93,   94,   95,   96,   97,
 /*   420 */   148,   88,   89,  182,  148,   23,  104,  214,  148,   30,
 /*   430 */   168,  169,  156,  191,   42,   43,  165,  166,  167,  177,
 /*   440 */   186,  187,  170,  171,  148,   88,  170,  171,  115,   50,
 /*   450 */   170,  171,  148,   61,   62,   63,   64,   65,   66,   67,
 /*   460 */    68,   69,   70,   71,   72,   73,  190,   75,   76,   77,
 /*   470 */    78,   79,   80,   81,   82,   83,   84,   16,  148,   90,
 /*   480 */    16,   20,   93,   94,   95,  213,  148,  157,  158,  213,
 /*   490 */    88,   89,  148,  213,  105,   20,  148,  225,  148,   23,
 /*   500 */   229,  225,  103,   42,   43,  225,   19,   43,  170,  171,
 /*   510 */    23,  181,  182,  209,  170,  171,  182,  115,  170,  171,
 /*   520 */   170,  171,   61,   62,   63,   64,   65,   66,   67,   68,
 /*   530 */    69,   70,   71,   72,   73,  148,   75,   76,   77,   78,
 /*   540 */    79,   80,   81,   82,   83,   84,   16,   20,  148,   12,
 /*   550 */    20,   81,   82,   83,   84,   79,   20,  170,  171,  211,
 /*   560 */   222,   24,   19,   99,   88,   89,   23,  217,  104,  225,
 /*   570 */   170,  171,   42,   43,   37,   88,   39,   19,   18,   21,
 /*   580 */    19,   20,  107,   22,  109,  110,   23,  162,  163,  164,
 /*   590 */    23,   61,   62,   63,   64,   65,   66,   67,   68,   69,
 /*   600 */    70,   71,   72,   73,  217,   75,   76,   77,   78,   79,
 /*   610 */    80,   81,   82,   83,   84,   16,   56,  148,   14,   25,
 /*   620 */    21,   60,  151,   29,   22,  148,  193,  148,    0,    1,
 /*   630 */     2,   88,   89,  200,  107,   41,  109,  110,  187,  170,
 /*   640 */   171,   42,   43,  107,   81,  109,  110,  170,  171,  170,
 /*   650 */   171,   88,   89,  148,   94,   88,   89,   53,   16,   55,
 /*   660 */    61,   62,   63,   64,   65,   66,   67,   68,   69,   70,
 /*   670 */    71,   72,   73,  148,   75,   76,   77,   78,   79,   80,
 /*   680 */    81,   82,   83,   84,   42,   43,  186,  187,  183,    7,
 /*   690 */     8,    9,  245,  246,  134,  170,  171,  226,  148,  148,
 /*   700 */   156,   16,  231,   61,   62,   63,   64,   65,   66,   67,
 /*   710 */    68,   69,   70,   71,   72,   73,  114,   75,   76,   77,
 /*   720 */    78,   79,   80,   81,   82,   83,   84,   42,   43,  100,
 /*   730 */   101,  102,  227,  183,  190,   22,  202,  203,  134,  148,
 /*   740 */   148,  148,  243,  244,   16,  156,   61,   62,   63,   64,
 /*   750 */    65,   66,   67,   68,   69,   70,   71,   72,   73,  215,
 /*   760 */    75,   76,   77,   78,   79,   80,   81,   82,   83,   84,
 /*   770 */    42,   43,  125,  126,  183,  183,  183,  227,  227,  190,
 /*   780 */   107,  237,  109,  110,  100,  101,  102,   16,  148,  148,
 /*   790 */    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
 /*   800 */    72,   73,   89,   75,   76,   77,   78,   79,   80,   81,
 /*   810 */    82,   83,   84,   42,   43,   27,  148,   22,  227,  227,
 /*   820 */   227,   23,   34,  148,  148,   14,  148,  156,  115,  189,
 /*   830 */   189,  131,   19,  133,   63,   64,   65,   66,   67,   68,
 /*   840 */    69,   70,   71,   72,   73,  148,   75,   76,   77,   78,
 /*   850 */    79,   80,   81,   82,   83,   84,   16,   17,  148,   19,
 /*   860 */   148,  190,  148,   23,   53,  189,   55,  170,  171,  148,
 /*   870 */   146,   31,   16,   17,  148,   19,  156,  148,  156,   23,
 /*   880 */   170,  171,  170,  171,  170,  171,   88,   31,   48,  214,
 /*   890 */   108,  170,  171,   98,  112,  148,  170,  171,  148,   59,
 /*   900 */   148,  148,  148,   43,   48,  148,   22,  156,  148,  148,
 /*   910 */   190,  148,  190,  148,  148,   59,  148,  170,  171,   79,
 /*   920 */    80,  162,  170,  171,  170,  171,  113,   87,   88,   89,
 /*   930 */   170,  171,   92,  170,  171,   79,   80,   81,  170,  171,
 /*   940 */   148,  190,  189,   87,   88,   89,   16,   17,   92,   19,
 /*   950 */   148,  111,  148,   23,  148,  189,  192,  148,  148,   99,
 /*   960 */    16,   31,  170,  171,  148,  125,  126,  127,  128,  129,
 /*   970 */   130,   91,  170,  171,  170,  171,  170,  171,   48,  170,
 /*   980 */   171,  125,  126,  127,  128,  129,  130,   91,   92,   59,
 /*   990 */     5,  111,  148,  148,  148,   10,   11,   12,   13,  189,
 /*  1000 */    20,  148,   22,  148,  124,  148,  122,  148,  179,   79,
 /*  1010 */    80,   26,  204,   28,  170,  171,  148,   87,   88,   89,
 /*  1020 */    35,  148,   92,  170,  171,  170,  171,  170,  171,  170,
 /*  1030 */   171,  148,   47,  148,   49,  189,   92,  148,  148,   54,
 /*  1040 */   148,  179,   57,  170,  171,  148,  179,   20,  148,   22,
 /*  1050 */    20,  148,   22,  170,  171,  125,  126,  127,  128,  129,
 /*  1060 */   130,  148,  170,  171,    7,    8,  148,  170,  171,   19,
 /*  1070 */   170,  171,  148,  170,  171,   20,  148,   22,   92,  148,
 /*  1080 */    20,  148,   22,  148,  148,  100,  101,  102,  170,  171,
 /*  1090 */   104,  106,   51,   52,  170,  171,  111,  148,  170,  171,
 /*  1100 */   148,  170,  171,  170,  171,  170,  171,   20,   20,   22,
 /*  1110 */    22,   20,   20,   22,   22,   20,   20,   22,   22,   69,
 /*  1120 */   135,  148,   20,  148,   22,  234,  233,  148,  150,  148,
 /*  1130 */   148,  148,  148,  192,  194,  148,  148,  148,  148,  148,
 /*  1140 */   148,  148,  230,  224,  230,  173,  178,  173,  195,  173,
 /*  1150 */   173,  195,    6,  147,  147,  147,  147,   22,  155,  190,
 /*  1160 */   122,  195,  119,  196,  120,  117,  121,  173,  197,  174,
 /*  1170 */   131,  223,  113,  153,   97,  212,   23,  161,  153,   99,
 /*  1180 */   116,   99,  212,  172,  172,   40,  172,   98,   19,  174,
 /*  1190 */   180,  172,  175,  161,  198,  172,  199,  175,  180,   15,
 /*  1200 */   172,  172,  153,  205,  152,  206,  205,  153,  206,  153,
 /*  1210 */   152,   38,  212,  152,  131,  153,  212,  152,   61,  153,
 /*  1220 */   185,  185,   19,  153,   15,  188,  195,  153,  188,  195,
 /*  1230 */   188,   33,  185,  160,  188,  138,    1,  216,  153,  153,
 /*  1240 */   235,   20,  216,  176,  176,  113,  113,  113,   19,  236,
 /*  1250 */   113,   20,   20,   92,   11,  108,   19,   19,   22,   20,
 /*  1260 */    20,  118,  238,   22,   22,  115,  118,   19,  113,   20,
 /*  1270 */    20,  238,   44,   19,   44,   19,   32,   20,   19,   19,
 /*  1280 */    19,   96,  104,   16,   21,  232,   17,   99,   36,   44,
 /*  1290 */    22,   45,  241,  134,   99,   19,   45,    5,    1,  103,
 /*  1300 */   123,   19,   69,   69,  114,   14,   17,  244,  116,  103,
 /*  1310 */   123,  114,   19,  124,   20,   14,  247,  136,   19,  137,
 /*  1320 */    58,    3,  248,    4,
};
#define YY_SHIFT_USE_DFLT (-100)
#define YY_SHIFT_MAX 386
static const short yy_shift_ofst[] = {
 /*     0 */   146,  840,  985,  -16,  840,  930,  930,  930,  274,  104,
 /*    10 */   -99,   96,  930,  930,  930,  930,  930,  -46,  247,  476,
 /*    20 */   567,  798,  331,  331,   53,  165,  208,  251,  323,  392,
 /*    30 */   461,  530,  599,  642,  685,  642,  642,  642,  642,  642,
 /*    40 */   642,  642,  642,  642,  642,  642,  642,  642,  642,  642,
 /*    50 */   642,  642,  728,  771,  771,  856,  930,  930,  930,  930,
 /*    60 */   930,  930,  930,  930,  930,  930,  930,  930,  930,  930,
 /*    70 */   930,  930,  930,  930,  930,  930,  930,  930,  930,  930,
 /*    80 */   930,  930,  930,  930,  930,  930,  930,  930,  930,  930,
 /*    90 */   930,  930,  930,  930,  -62,  -62,  -14,   27,   27,  -40,
 /*   100 */   470,  464,  560,  567,  567,  567,  567,  567,  567,  567,
 /*   110 */   798,   58, -100, -100, -100,  130,  322,  176,  176,  192,
 /*   120 */   561,  628,  357,  567,  357,  567,  567,  567,  567,  567,
 /*   130 */   567,  567,  567,  567,  567,  567,  567,  567,  880,  231,
 /*   140 */   -99,  -99,  -99, -100, -100, -100,  249,  249,   51,  389,
 /*   150 */   475,   66,  527,  536,  537,  333,  402,  543,  563,  682,
 /*   160 */   567,  567,  187,  567,  567,  487,  567,  567,  713,  567,
 /*   170 */   567,  673,  713,  567,  567,  399,  399,  399,  567,  567,
 /*   180 */   673,  567,  567,  673,  567,  594,  629,  567,  567,  673,
 /*   190 */   567,  567,  567,  673,  567,  567,  567,  673,  673,  567,
 /*   200 */   567,  567,  567,  567,  558,  782,  602,  647,  647,  700,
 /*   210 */   788,  788,  788,  860,  788,  788,  795,  884,  884, 1146,
 /*   220 */  1146, 1146, 1146, 1135,  -99, 1038, 1043, 1044, 1048, 1045,
 /*   230 */  1039, 1059, 1077, 1153, 1077, 1059, 1080, 1064, 1080, 1064,
 /*   240 */  1082, 1082, 1145, 1082, 1089, 1082, 1169, 1077, 1077, 1153,
 /*   250 */  1145, 1082, 1082, 1082, 1169, 1184, 1059, 1184, 1059, 1184,
 /*   260 */  1059, 1059, 1173, 1083, 1184, 1059, 1157, 1157, 1203, 1038,
 /*   270 */  1059, 1209, 1209, 1209, 1209, 1038, 1157, 1203, 1059, 1198,
 /*   280 */  1198, 1059, 1059, 1097, -100, -100, -100, -100, -100, -100,
 /*   290 */   317,  604,  684,  811,  813,  980,  944, 1027, 1030, 1055,
 /*   300 */   986, 1057,  896, 1060, 1087, 1088, 1041, 1091, 1092, 1095,
 /*   310 */  1096, 1050, 1102,   38, 1235, 1221, 1132, 1133, 1134, 1137,
 /*   320 */  1229, 1231, 1232, 1161, 1147, 1237, 1243, 1238, 1239, 1236,
 /*   330 */  1240, 1143, 1241, 1148, 1242, 1150, 1248, 1249, 1155, 1250,
 /*   340 */  1244, 1228, 1254, 1230, 1256, 1257, 1259, 1260, 1245, 1261,
 /*   350 */  1185, 1178, 1267, 1269, 1263, 1188, 1252, 1246, 1268, 1251,
 /*   360 */  1159, 1195, 1276, 1292, 1297, 1196, 1233, 1234, 1177, 1282,
 /*   370 */  1190, 1291, 1192, 1289, 1197, 1206, 1187, 1293, 1189, 1294,
 /*   380 */  1301, 1262, 1181, 1182, 1299, 1318, 1319,
};
#define YY_REDUCE_USE_DFLT (-218)
#define YY_REDUCE_MAX 289
static const short yy_reduce_ofst[] = {
 /*     0 */   -48,  276,  110,  -19,   49,  272,  134,  280,  330, -142,
 /*    10 */    14,  133,  338,  344,  348,  350,  387,   42,  544,  -78,
 /*    20 */    37,  139,  144,  271, -217, -217, -217, -217, -217, -217,
 /*    30 */  -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,
 /*    40 */  -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,
 /*    50 */  -217, -217, -217, -217, -217,  400,  469,  477,  479,  525,
 /*    60 */   697,  710,  712,  714,  721,  726,  747,  752,  754,  760,
 /*    70 */   763,  768,  792,  802,  804,  806,  809,  844,  853,  855,
 /*    80 */   857,  859,  873,  883,  892,  897,  900,  903,  918,  924,
 /*    90 */   928,  931,  933,  935, -217, -217,  262, -217, -217, -217,
 /*   100 */  -217,  193,  471,  505,  550,  591,  592,  593,  117,  -57,
 /*   110 */   425, -217, -217, -217, -217,   26,   21,  254,  500,  447,
 /*   120 */   447,  -71,  -49, -125,  145,  551,   75,  188,  213,  304,
 /*   130 */   640,  641,  676,  753,  766,  810,  675,  846,  589,  671,
 /*   140 */   720,  722,  751,  433,  534,  499,   36,  180,  241,  334,
 /*   150 */   242,  296,  242,  242,  451,  668,  678,  729,  750,  724,
 /*   160 */   757,  761,  764,  750,  765,  759,  816,  845,  808,  868,
 /*   170 */   885,  242,  808,  889,  890,  829,  862,  867,  913,  936,
 /*   180 */   242,  949,  952,  242,  973,  893,  891,  975,  979,  242,
 /*   190 */   981,  982,  983,  242,  984,  987,  988,  242,  242,  989,
 /*   200 */   990,  991,  992,  993,  978,  941,  940,  912,  914,  919,
 /*   210 */   972,  974,  976,  968,  977,  994,  995,  953,  956, 1006,
 /*   220 */  1007, 1008, 1009, 1003,  969,  966,  967,  971,  996,  997,
 /*   230 */   948, 1020,  963, 1016,  970, 1025,  998,  999, 1001, 1002,
 /*   240 */  1011, 1012, 1010, 1014, 1015, 1019, 1017, 1000, 1004, 1032,
 /*   250 */  1018, 1023, 1028, 1029, 1022, 1052, 1049, 1058, 1054, 1061,
 /*   260 */  1056, 1062, 1005, 1013, 1065, 1066, 1035, 1036, 1021, 1031,
 /*   270 */  1070, 1037, 1040, 1042, 1046, 1034, 1047, 1026, 1074, 1024,
 /*   280 */  1033, 1085, 1086, 1051, 1073, 1067, 1068, 1053, 1063, 1069,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */   593,  820,  898,  708,  898,  820,  898,  820,  898,  843,
 /*    10 */   712,  872,  816,  820,  898,  898,  898,  791,  898,  843,
 /*    20 */   898,  624,  843,  843,  743,  898,  898,  898,  898,  898,
 /*    30 */   898,  898,  898,  744,  898,  819,  815,  811,  813,  812,
 /*    40 */   745,  732,  741,  748,  724,  857,  750,  751,  757,  758,
 /*    50 */   873,  876,  779,  797,  778,  898,  898,  898,  898,  898,
 /*    60 */   898,  898,  898,  898,  898,  898,  898,  898,  898,  898,
 /*    70 */   898,  898,  898,  898,  898,  898,  898,  898,  898,  898,
 /*    80 */   898,  898,  898,  898,  898,  898,  898,  898,  898,  898,
 /*    90 */   898,  898,  898,  898,  781,  802,  617,  780,  790,  782,
 /*   100 */   783,  677,  612,  898,  898,  898,  898,  898,  898,  898,
 /*   110 */   898,  784,  785,  798,  799,  898,  898,  898,  898,  898,
 /*   120 */   898,  593,  708,  898,  708,  898,  898,  898,  898,  898,
 /*   130 */   898,  898,  898,  898,  898,  898,  898,  898,  898,  898,
 /*   140 */   898,  898,  898,  702,  712,  891,  898,  898,  668,  898,
 /*   150 */   898,  898,  898,  898,  898,  898,  898,  898,  898,  600,
 /*   160 */   598,  898,  700,  898,  898,  626,  898,  898,  710,  898,
 /*   170 */   898,  715,  716,  898,  898,  898,  898,  898,  898,  898,
 /*   180 */   614,  898,  898,  689,  898,  849,  898,  898,  898,  864,
 /*   190 */   898,  898,  898,  862,  898,  898,  898,  691,  753,  830,
 /*   200 */   898,  877,  879,  898,  898,  700,  709,  898,  898,  814,
 /*   210 */   735,  735,  735,  647,  735,  735,  650,  747,  747,  597,
 /*   220 */   597,  597,  597,  667,  898,  747,  738,  740,  728,  742,
 /*   230 */   898,  717,  736,  898,  736,  717,  725,  727,  725,  727,
 /*   240 */   679,  679,  664,  679,  650,  679,  824,  736,  736,  898,
 /*   250 */   664,  679,  679,  679,  824,  609,  717,  609,  717,  609,
 /*   260 */   717,  717,  853,  856,  609,  717,  681,  681,  759,  747,
 /*   270 */   717,  688,  688,  688,  688,  747,  681,  759,  717,  875,
 /*   280 */   875,  717,  717,  884,  634,  652,  652,  859,  891,  896,
 /*   290 */   898,  898,  898,  898,  766,  898,  898,  898,  898,  898,
 /*   300 */   898,  898,  898,  898,  898,  898,  898,  898,  898,  898,
 /*   310 */   898,  836,  898,  898,  898,  898,  771,  767,  898,  768,
 /*   320 */   898,  898,  898,  898,  694,  898,  898,  898,  898,  898,
 /*   330 */   898,  898,  729,  898,  739,  898,  898,  898,  898,  898,
 /*   340 */   898,  898,  898,  898,  898,  898,  898,  898,  898,  898,
 /*   350 */   898,  898,  898,  898,  898,  898,  898,  851,  852,  898,
 /*   360 */   898,  898,  898,  898,  898,  898,  898,  898,  898,  898,
 /*   370 */   898,  898,  898,  898,  898,  898,  898,  898,  898,  898,
 /*   380 */   898,  883,  898,  898,  886,  594,  898,  588,  591,  590,
 /*   390 */   592,  596,  599,  621,  622,  623,  601,  602,  603,  604,
 /*   400 */   605,  606,  607,  613,  615,  633,  635,  619,  637,  698,
 /*   410 */   699,  763,  692,  693,  697,  765,  769,  770,  772,  773,
 /*   420 */   620,  627,  628,  631,  632,  839,  841,  840,  842,  630,
 /*   430 */   629,  774,  777,  786,  787,  789,  795,  801,  804,  788,
 /*   440 */   793,  794,  796,  800,  803,  695,  696,  807,  809,  810,
 /*   450 */   865,  866,  867,  868,  869,  805,  817,  818,  718,  808,
 /*   460 */   792,  730,  733,  734,  737,  731,  701,  711,  720,  721,
 /*   470 */   722,  723,  706,  707,  713,  726,  761,  762,  714,  703,
 /*   480 */   704,  705,  806,  764,  775,  776,  638,  639,  771,  640,
 /*   490 */   641,  642,  680,  683,  684,  685,  643,  662,  665,  666,
 /*   500 */   644,  651,  645,  646,  653,  654,  655,  658,  659,  660,
 /*   510 */   661,  656,  657,  825,  826,  828,  827,  648,  649,  663,
 /*   520 */   636,  625,  618,  669,  672,  673,  674,  675,  676,  678,
 /*   530 */   670,  671,  616,  608,  610,  719,  845,  854,  855,  850,
 /*   540 */   846,  847,  848,  611,  821,  822,  682,  755,  756,  844,
 /*   550 */   858,  860,  760,  861,  863,  888,  686,  687,  690,  829,
 /*   560 */   870,  746,  749,  752,  754,  831,  832,  833,  834,  837,
 /*   570 */   838,  835,  871,  874,  878,  880,  881,  882,  885,  887,
 /*   580 */   892,  893,  894,  897,  895,  595,  589,
};
#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))

/* The next table maps tokens into fallback tokens.  If a construct
** like the following:
** 
**      %fallback ID X Y Z.
................................................................................
  "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",     
  "nmnum",         "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",  "create_vtab",   "vtabarglist", 
  "vtabarg",       "vtabargtoken",  "lp",            "anylist",     
};
#endif /* NDEBUG */

#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
................................................................................
 /* 238 */ "idxlist_opt ::= LP idxlist RP",
 /* 239 */ "idxlist ::= idxlist COMMA idxitem collate sortorder",
 /* 240 */ "idxlist ::= idxitem collate sortorder",
 /* 241 */ "idxitem ::= nm",
 /* 242 */ "cmd ::= DROP INDEX ifexists fullname",
 /* 243 */ "cmd ::= VACUUM",
 /* 244 */ "cmd ::= VACUUM nm",
 /* 245 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
 /* 246 */ "cmd ::= PRAGMA nm dbnm EQ ON",
 /* 247 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
 /* 248 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
 /* 249 */ "cmd ::= PRAGMA nm dbnm",
 /* 250 */ "nmnum ::= plus_num",
 /* 251 */ "nmnum ::= nm",
 /* 252 */ "plus_num ::= plus_opt number",
 /* 253 */ "minus_num ::= MINUS number",
 /* 254 */ "number ::= INTEGER|FLOAT",
 /* 255 */ "plus_opt ::= PLUS",
 /* 256 */ "plus_opt ::=",
 /* 257 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END",
 /* 258 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
 /* 259 */ "trigger_time ::= BEFORE",
 /* 260 */ "trigger_time ::= AFTER",
 /* 261 */ "trigger_time ::= INSTEAD OF",
 /* 262 */ "trigger_time ::=",
 /* 263 */ "trigger_event ::= DELETE|INSERT",
 /* 264 */ "trigger_event ::= UPDATE",
 /* 265 */ "trigger_event ::= UPDATE OF inscollist",
 /* 266 */ "foreach_clause ::=",
 /* 267 */ "foreach_clause ::= FOR EACH ROW",
 /* 268 */ "foreach_clause ::= FOR EACH STATEMENT",
 /* 269 */ "when_clause ::=",
 /* 270 */ "when_clause ::= WHEN expr",
 /* 271 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
 /* 272 */ "trigger_cmd_list ::=",
 /* 273 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt",
 /* 274 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP",
 /* 275 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select",
 /* 276 */ "trigger_cmd ::= DELETE FROM nm where_opt",
 /* 277 */ "trigger_cmd ::= select",
 /* 278 */ "expr ::= RAISE LP IGNORE RP",
 /* 279 */ "expr ::= RAISE LP raisetype COMMA nm RP",
 /* 280 */ "raisetype ::= ROLLBACK",
 /* 281 */ "raisetype ::= ABORT",
 /* 282 */ "raisetype ::= FAIL",
 /* 283 */ "cmd ::= DROP TRIGGER ifexists fullname",
 /* 284 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
 /* 285 */ "key_opt ::=",
 /* 286 */ "key_opt ::= KEY expr",
 /* 287 */ "database_kw_opt ::= DATABASE",
 /* 288 */ "database_kw_opt ::=",
 /* 289 */ "cmd ::= DETACH database_kw_opt expr",
 /* 290 */ "cmd ::= REINDEX",
 /* 291 */ "cmd ::= REINDEX nm dbnm",
 /* 292 */ "cmd ::= ANALYZE",
 /* 293 */ "cmd ::= ANALYZE nm dbnm",
 /* 294 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
 /* 295 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
 /* 296 */ "add_column_fullname ::= fullname",
 /* 297 */ "kwcolumn_opt ::=",
 /* 298 */ "kwcolumn_opt ::= COLUMNKW",
 /* 299 */ "cmd ::= create_vtab",
 /* 300 */ "cmd ::= create_vtab LP vtabarglist RP",
 /* 301 */ "create_vtab ::= CREATE VIRTUAL TABLE nm dbnm USING nm",
 /* 302 */ "vtabarglist ::= vtabarg",
 /* 303 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
 /* 304 */ "vtabarg ::=",
 /* 305 */ "vtabarg ::= vtabarg vtabargtoken",
 /* 306 */ "vtabargtoken ::= ANY",
 /* 307 */ "vtabargtoken ::= lp anylist RP",
 /* 308 */ "lp ::= LP",
 /* 309 */ "anylist ::=",
 /* 310 */ "anylist ::= anylist ANY",
};
#endif /* NDEBUG */

/*
** This function returns the symbolic name associated with a token
** value.
*/
................................................................................
    ** which appear on the RHS of the rule, but which are not used
    ** inside the C code.
    */
    case 156:
    case 190:
    case 207:
#line 374 "parse.y"
{sqlite3SelectDelete((yypminor->yy43));}
#line 1252 "parse.c"
      break;
    case 170:
    case 171:
    case 195:
    case 197:
    case 205:
    case 211:
    case 219:
    case 222:
    case 224:
    case 225:
    case 236:
#line 618 "parse.y"
{sqlite3ExprDelete((yypminor->yy450));}
#line 1267 "parse.c"
      break;
    case 175:
    case 183:
    case 193:
    case 196:
    case 198:
    case 200:
    case 210:
    case 213:
    case 214:
    case 217:
    case 223:
#line 855 "parse.y"
{sqlite3ExprListDelete((yypminor->yy242));}
#line 1282 "parse.c"
      break;
    case 189:
    case 194:
    case 202:
    case 203:
#line 487 "parse.y"
{sqlite3SrcListDelete((yypminor->yy419));}
#line 1290 "parse.c"
      break;
    case 199:
#line 548 "parse.y"
{
  sqlite3ExprDelete((yypminor->yy84).pLimit);
  sqlite3ExprDelete((yypminor->yy84).pOffset);
}
#line 1298 "parse.c"
      break;
    case 206:
    case 209:
    case 216:
#line 504 "parse.y"
{sqlite3IdListDelete((yypminor->yy352));}
#line 1305 "parse.c"
      break;
    case 232:
    case 237:
#line 952 "parse.y"
{sqlite3DeleteTriggerStep((yypminor->yy75));}
#line 1311 "parse.c"
      break;
    case 234:
#line 936 "parse.y"
{sqlite3IdListDelete((yypminor->yy354).b);}
#line 1316 "parse.c"
      break;
    case 239:
#line 1020 "parse.y"
{sqlite3ExprDelete((yypminor->yy158));}
#line 1321 "parse.c"
      break;
    default:  break;   /* If no destructor action specified: do nothing */
  }
}

/*
** Pop the parser's stack once.
................................................................................
     while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
     /* Here code is inserted which will execute if the parser
     ** stack every overflows */
#line 44 "parse.y"

  sqlite3ErrorMsg(pParse, "parser stack overflow");
  pParse->parseError = 1;
#line 1490 "parse.c"
     sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
     return;
  }
  yytos = &yypParser->yystack[yypParser->yyidx];
  yytos->stateno = yyNewState;
  yytos->major = yyMajor;
  yytos->minor = *yypMinor;
................................................................................
  { 227, 1 },
  { 144, 4 },
  { 144, 1 },
  { 144, 2 },
  { 144, 5 },
  { 144, 5 },
  { 144, 5 },

  { 144, 6 },
  { 144, 3 },
  { 228, 1 },
  { 228, 1 },
  { 166, 2 },
  { 167, 2 },
  { 230, 1 },
  { 229, 1 },
  { 229, 0 },
  { 144, 5 },
  { 231, 11 },
  { 233, 1 },



  { 233, 1 },
  { 233, 2 },
  { 233, 0 },
  { 234, 1 },
  { 234, 1 },
  { 234, 3 },
  { 235, 0 },
  { 235, 3 },
  { 235, 3 },
  { 236, 0 },
  { 236, 2 },
  { 232, 3 },
  { 232, 0 },
  { 237, 6 },
  { 237, 8 },
  { 237, 5 },
  { 237, 4 },
  { 237, 1 },
  { 171, 4 },
  { 171, 6 },
  { 187, 1 },
  { 187, 1 },
  { 187, 1 },
  { 144, 4 },
  { 144, 6 },
  { 239, 0 },
  { 239, 2 },
  { 238, 1 },
  { 238, 0 },
  { 144, 3 },
  { 144, 1 },
  { 144, 3 },
  { 144, 1 },
  { 144, 3 },
  { 144, 6 },
  { 144, 6 },
  { 240, 1 },
  { 241, 0 },
  { 241, 1 },
  { 144, 1 },
  { 144, 4 },
  { 242, 7 },
  { 243, 1 },
  { 243, 3 },
  { 244, 0 },
  { 244, 2 },
  { 245, 1 },
  { 245, 3 },
  { 246, 1 },
  { 247, 0 },
  { 247, 2 },
};

static void yy_accept(yyParser*);  /* Forward Declaration */

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
................................................................................
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */


  /* Silence complaints from purify about yygotominor being uninitialized
  ** in some cases when it is copied into the stack after the following
  ** switch.  yygotominor is uninitialized when a rule reduces that does
  ** not set the value of its left-hand side nonterminal.  Leaving the
  ** value of the nonterminal uninitialized is utterly harmless as long
  ** as the value is never used.  So really the only thing this code
  ** accomplishes is to quieten purify.  
  **
  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
  ** without this code, their parser segfaults.  I'm not sure what there
  ** parser is doing to make this happen.  This is the second bug report
  ** from wireshark this week.  Clearly they are stressing Lemon in ways
  ** that it has not been previously stressed...  (SQLite ticket #2172)
  */
  memset(&yygotominor, 0, sizeof(yygotominor));



  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 3:
#line 100 "parse.y"
{ sqlite3FinishCoding(pParse); }
#line 1884 "parse.c"
        break;
      case 6:
#line 103 "parse.y"
{ sqlite3BeginParse(pParse, 0); }
#line 1889 "parse.c"
        break;
      case 7:
#line 105 "parse.y"
{ sqlite3BeginParse(pParse, 1); }
#line 1894 "parse.c"
        break;
      case 8:
#line 106 "parse.y"
{ sqlite3BeginParse(pParse, 2); }
#line 1899 "parse.c"
        break;
      case 9:
#line 112 "parse.y"
{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy316);}
#line 1904 "parse.c"
        break;
      case 13:
#line 117 "parse.y"
{yygotominor.yy316 = TK_DEFERRED;}
#line 1909 "parse.c"
        break;
      case 14:
      case 15:
      case 16:
      case 107:
      case 109:
#line 118 "parse.y"
{yygotominor.yy316 = yymsp[0].major;}
#line 1918 "parse.c"
        break;
      case 17:
      case 18:
#line 121 "parse.y"
{sqlite3CommitTransaction(pParse);}
#line 1924 "parse.c"
        break;
      case 19:
#line 123 "parse.y"
{sqlite3RollbackTransaction(pParse);}
#line 1929 "parse.c"
        break;
      case 21:
#line 128 "parse.y"
{
   sqlite3StartTable(pParse,&yymsp[-1].minor.yy178,&yymsp[0].minor.yy178,yymsp[-4].minor.yy316,0,0,yymsp[-2].minor.yy316);
}
#line 1936 "parse.c"
        break;
      case 22:
      case 25:
      case 63:
      case 77:
      case 79:
      case 90:
      case 101:
      case 112:
      case 113:
      case 213:
      case 216:
#line 132 "parse.y"
{yygotominor.yy316 = 0;}
#line 1951 "parse.c"
        break;
      case 23:
      case 24:
      case 64:
      case 78:
      case 100:
      case 111:
      case 214:
      case 217:
#line 133 "parse.y"
{yygotominor.yy316 = 1;}
#line 1963 "parse.c"
        break;
      case 26:
#line 139 "parse.y"
{
  sqlite3EndTable(pParse,&yymsp[-1].minor.yy178,&yymsp[0].minor.yy0,0);
}
#line 1970 "parse.c"
        break;
      case 27:
#line 142 "parse.y"
{
  sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy43);
  sqlite3SelectDelete(yymsp[0].minor.yy43);
}
#line 1978 "parse.c"
        break;
      case 30:
#line 154 "parse.y"
{
  yygotominor.yy178.z = yymsp[-2].minor.yy178.z;
  yygotominor.yy178.n = (pParse->sLastToken.z-yymsp[-2].minor.yy178.z) + pParse->sLastToken.n;
}
#line 1986 "parse.c"
        break;
      case 31:
#line 158 "parse.y"
{
  sqlite3AddColumn(pParse,&yymsp[0].minor.yy178);
  yygotominor.yy178 = yymsp[0].minor.yy178;
}
#line 1994 "parse.c"
        break;
      case 32:
      case 33:
      case 34:
      case 35:
      case 36:
      case 254:
#line 168 "parse.y"
{yygotominor.yy178 = yymsp[0].minor.yy0;}
#line 2004 "parse.c"
        break;
      case 38:
#line 228 "parse.y"
{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy178);}
#line 2009 "parse.c"
        break;
      case 39:
      case 42:
      case 119:
      case 120:
      case 131:
      case 150:
      case 241:
      case 250:
      case 251:
      case 252:
      case 253:
#line 229 "parse.y"
{yygotominor.yy178 = yymsp[0].minor.yy178;}
#line 2024 "parse.c"
        break;
      case 40:
#line 230 "parse.y"
{
  yygotominor.yy178.z = yymsp[-3].minor.yy178.z;
  yygotominor.yy178.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy178.z;
}
#line 2032 "parse.c"
        break;
      case 41:
#line 234 "parse.y"
{
  yygotominor.yy178.z = yymsp[-5].minor.yy178.z;
  yygotominor.yy178.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy178.z;
}
#line 2040 "parse.c"
        break;
      case 43:
#line 240 "parse.y"
{yygotominor.yy178.z=yymsp[-1].minor.yy178.z; yygotominor.yy178.n=yymsp[0].minor.yy178.n+(yymsp[0].minor.yy178.z-yymsp[-1].minor.yy178.z);}
#line 2045 "parse.c"
        break;
      case 44:
#line 242 "parse.y"
{ yygotominor.yy316 = atoi((char*)yymsp[0].minor.yy178.z); }
#line 2050 "parse.c"
        break;
      case 45:
#line 243 "parse.y"
{ yygotominor.yy316 = -atoi((char*)yymsp[0].minor.yy178.z); }
#line 2055 "parse.c"
        break;
      case 50:
      case 52:
#line 252 "parse.y"
{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy450);}
#line 2061 "parse.c"
        break;
      case 51:
#line 253 "parse.y"
{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy450);}
#line 2066 "parse.c"
        break;
      case 53:
#line 255 "parse.y"
{
  Expr *p = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy450, 0, 0);
  sqlite3AddDefaultValue(pParse,p);
}
#line 2074 "parse.c"
        break;
      case 54:
#line 259 "parse.y"
{
  Expr *p = sqlite3Expr(TK_STRING, 0, 0, &yymsp[0].minor.yy178);
  sqlite3AddDefaultValue(pParse,p);
}
#line 2082 "parse.c"
        break;
      case 56:
#line 268 "parse.y"
{sqlite3AddNotNull(pParse, yymsp[0].minor.yy316);}
#line 2087 "parse.c"
        break;
      case 57:
#line 270 "parse.y"
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy316,yymsp[0].minor.yy316,yymsp[-2].minor.yy316);}
#line 2092 "parse.c"
        break;
      case 58:
#line 271 "parse.y"
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy316,0,0,0,0);}
#line 2097 "parse.c"
        break;
      case 59:
#line 272 "parse.y"
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy450);}
#line 2102 "parse.c"
        break;
      case 60:
#line 274 "parse.y"
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy178,yymsp[-1].minor.yy242,yymsp[0].minor.yy316);}
#line 2107 "parse.c"
        break;
      case 61:
#line 275 "parse.y"
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy316);}
#line 2112 "parse.c"
        break;
      case 62:
#line 276 "parse.y"
{sqlite3AddCollateType(pParse, (char*)yymsp[0].minor.yy178.z, yymsp[0].minor.yy178.n);}
#line 2117 "parse.c"
        break;
      case 65:
#line 289 "parse.y"
{ yygotominor.yy316 = OE_Restrict * 0x010101; }
#line 2122 "parse.c"
        break;
      case 66:
#line 290 "parse.y"
{ yygotominor.yy316 = (yymsp[-1].minor.yy316 & yymsp[0].minor.yy207.mask) | yymsp[0].minor.yy207.value; }
#line 2127 "parse.c"
        break;
      case 67:
#line 292 "parse.y"
{ yygotominor.yy207.value = 0;     yygotominor.yy207.mask = 0x000000; }
#line 2132 "parse.c"
        break;
      case 68:
#line 293 "parse.y"
{ yygotominor.yy207.value = yymsp[0].minor.yy316;     yygotominor.yy207.mask = 0x0000ff; }
#line 2137 "parse.c"
        break;
      case 69:
#line 294 "parse.y"
{ yygotominor.yy207.value = yymsp[0].minor.yy316<<8;  yygotominor.yy207.mask = 0x00ff00; }
#line 2142 "parse.c"
        break;
      case 70:
#line 295 "parse.y"
{ yygotominor.yy207.value = yymsp[0].minor.yy316<<16; yygotominor.yy207.mask = 0xff0000; }
#line 2147 "parse.c"
        break;
      case 71:
#line 297 "parse.y"
{ yygotominor.yy316 = OE_SetNull; }
#line 2152 "parse.c"
        break;
      case 72:
#line 298 "parse.y"
{ yygotominor.yy316 = OE_SetDflt; }
#line 2157 "parse.c"
        break;
      case 73:
#line 299 "parse.y"
{ yygotominor.yy316 = OE_Cascade; }
#line 2162 "parse.c"
        break;
      case 74:
#line 300 "parse.y"
{ yygotominor.yy316 = OE_Restrict; }
#line 2167 "parse.c"
        break;
      case 75:
      case 76:
      case 91:
      case 93:
      case 95:
      case 96:
      case 168:
#line 302 "parse.y"
{yygotominor.yy316 = yymsp[0].minor.yy316;}
#line 2178 "parse.c"
        break;
      case 80:
#line 312 "parse.y"
{yygotominor.yy178.n = 0; yygotominor.yy178.z = 0;}
#line 2183 "parse.c"
        break;
      case 81:
#line 313 "parse.y"
{yygotominor.yy178 = yymsp[-1].minor.yy0;}
#line 2188 "parse.c"
        break;
      case 86:
#line 319 "parse.y"
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy242,yymsp[0].minor.yy316,yymsp[-2].minor.yy316,0);}
#line 2193 "parse.c"
        break;
      case 87:
#line 321 "parse.y"
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy242,yymsp[0].minor.yy316,0,0,0,0);}
#line 2198 "parse.c"
        break;
      case 88:
#line 322 "parse.y"
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy450);}
#line 2203 "parse.c"
        break;
      case 89:
#line 324 "parse.y"
{
    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy242, &yymsp[-3].minor.yy178, yymsp[-2].minor.yy242, yymsp[-1].minor.yy316);
    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy316);
}
#line 2211 "parse.c"
        break;
      case 92:
      case 94:
#line 338 "parse.y"
{yygotominor.yy316 = OE_Default;}
#line 2217 "parse.c"
        break;
      case 97:
#line 343 "parse.y"
{yygotominor.yy316 = OE_Ignore;}
#line 2222 "parse.c"
        break;
      case 98:
      case 169:
#line 344 "parse.y"
{yygotominor.yy316 = OE_Replace;}
#line 2228 "parse.c"
        break;
      case 99:
#line 348 "parse.y"
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy419, 0, yymsp[-1].minor.yy316);
}
#line 2235 "parse.c"
        break;
      case 102:
#line 358 "parse.y"
{
  sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy178, &yymsp[-2].minor.yy178, yymsp[0].minor.yy43, yymsp[-6].minor.yy316, yymsp[-4].minor.yy316);
}
#line 2242 "parse.c"
        break;
      case 103:
#line 361 "parse.y"
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy419, 1, yymsp[-1].minor.yy316);
}
#line 2249 "parse.c"
        break;
      case 104:
#line 368 "parse.y"
{
  sqlite3Select(pParse, yymsp[0].minor.yy43, SRT_Callback, 0, 0, 0, 0, 0);
  sqlite3SelectDelete(yymsp[0].minor.yy43);
}
#line 2257 "parse.c"
        break;
      case 105:
      case 128:
#line 378 "parse.y"
{yygotominor.yy43 = yymsp[0].minor.yy43;}
#line 2263 "parse.c"
        break;
      case 106:
#line 380 "parse.y"
{
  if( yymsp[0].minor.yy43 ){
    yymsp[0].minor.yy43->op = yymsp[-1].minor.yy316;
    yymsp[0].minor.yy43->pPrior = yymsp[-2].minor.yy43;
  }
  yygotominor.yy43 = yymsp[0].minor.yy43;
}
#line 2274 "parse.c"
        break;
      case 108:
#line 389 "parse.y"
{yygotominor.yy316 = TK_ALL;}
#line 2279 "parse.c"
        break;
      case 110:
#line 393 "parse.y"
{
  yygotominor.yy43 = sqlite3SelectNew(yymsp[-6].minor.yy242,yymsp[-5].minor.yy419,yymsp[-4].minor.yy450,yymsp[-3].minor.yy242,yymsp[-2].minor.yy450,yymsp[-1].minor.yy242,yymsp[-7].minor.yy316,yymsp[0].minor.yy84.pLimit,yymsp[0].minor.yy84.pOffset);
}
#line 2286 "parse.c"
        break;
      case 114:
      case 238:
#line 414 "parse.y"
{yygotominor.yy242 = yymsp[-1].minor.yy242;}
#line 2292 "parse.c"
        break;
      case 115:
      case 141:
      case 151:
      case 237:
#line 415 "parse.y"
{yygotominor.yy242 = 0;}
#line 2300 "parse.c"
        break;
      case 116:
#line 416 "parse.y"
{
   yygotominor.yy242 = sqlite3ExprListAppend(yymsp[-2].minor.yy242,yymsp[-1].minor.yy450,yymsp[0].minor.yy178.n?&yymsp[0].minor.yy178:0);
}
#line 2307 "parse.c"
        break;
      case 117:
#line 419 "parse.y"
{
  yygotominor.yy242 = sqlite3ExprListAppend(yymsp[-1].minor.yy242, sqlite3Expr(TK_ALL, 0, 0, 0), 0);
}
#line 2314 "parse.c"
        break;
      case 118:
#line 422 "parse.y"
{
  Expr *pRight = sqlite3Expr(TK_ALL, 0, 0, 0);
  Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy178);
  yygotominor.yy242 = sqlite3ExprListAppend(yymsp[-3].minor.yy242, sqlite3Expr(TK_DOT, pLeft, pRight, 0), 0);
}
#line 2323 "parse.c"
        break;
      case 121:
#line 434 "parse.y"
{yygotominor.yy178.n = 0;}
#line 2328 "parse.c"
        break;
      case 122:
#line 446 "parse.y"
{yygotominor.yy419 = sqliteMalloc(sizeof(*yygotominor.yy419));}
#line 2333 "parse.c"
        break;
      case 123:
#line 447 "parse.y"
{
  yygotominor.yy419 = yymsp[0].minor.yy419;
  sqlite3SrcListShiftJoinType(yygotominor.yy419);
}
#line 2341 "parse.c"
        break;
      case 124:
#line 455 "parse.y"
{
   yygotominor.yy419 = yymsp[-1].minor.yy419;
   if( yygotominor.yy419 && yygotominor.yy419->nSrc>0 ) yygotominor.yy419->a[yygotominor.yy419->nSrc-1].jointype = yymsp[0].minor.yy316;
}
#line 2349 "parse.c"
        break;
      case 125:
#line 459 "parse.y"
{yygotominor.yy419 = 0;}
#line 2354 "parse.c"
        break;
      case 126:
#line 460 "parse.y"
{
  yygotominor.yy419 = sqlite3SrcListAppendFromTerm(yymsp[-5].minor.yy419,&yymsp[-4].minor.yy178,&yymsp[-3].minor.yy178,&yymsp[-2].minor.yy178,0,yymsp[-1].minor.yy450,yymsp[0].minor.yy352);
}
#line 2361 "parse.c"
        break;
      case 127:
#line 465 "parse.y"
{
    yygotominor.yy419 = sqlite3SrcListAppendFromTerm(yymsp[-6].minor.yy419,0,0,&yymsp[-2].minor.yy178,yymsp[-4].minor.yy43,yymsp[-1].minor.yy450,yymsp[0].minor.yy352);
  }
#line 2368 "parse.c"
        break;
      case 129:
#line 476 "parse.y"
{
     sqlite3SrcListShiftJoinType(yymsp[0].minor.yy419);
     yygotominor.yy43 = sqlite3SelectNew(0,yymsp[0].minor.yy419,0,0,0,0,0,0,0);
  }
#line 2376 "parse.c"
        break;
      case 130:
#line 483 "parse.y"
{yygotominor.yy178.z=0; yygotominor.yy178.n=0;}
#line 2381 "parse.c"
        break;
      case 132:
#line 488 "parse.y"
{yygotominor.yy419 = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy178,&yymsp[0].minor.yy178);}
#line 2386 "parse.c"
        break;
      case 133:
#line 492 "parse.y"
{ yygotominor.yy316 = JT_INNER; }
#line 2391 "parse.c"
        break;
      case 134:
#line 493 "parse.y"
{ yygotominor.yy316 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
#line 2396 "parse.c"
        break;
      case 135:
#line 494 "parse.y"
{ yygotominor.yy316 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy178,0); }
#line 2401 "parse.c"
        break;
      case 136:
#line 496 "parse.y"
{ yygotominor.yy316 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy178,&yymsp[-1].minor.yy178); }
#line 2406 "parse.c"
        break;
      case 137:
      case 145:
      case 154:
      case 161:
      case 176:
      case 203:
      case 226:
      case 228:
      case 232:
#line 500 "parse.y"
{yygotominor.yy450 = yymsp[0].minor.yy450;}
#line 2419 "parse.c"
        break;
      case 138:
      case 153:
      case 160:
      case 204:
      case 227:
      case 229:
      case 233:
#line 501 "parse.y"
{yygotominor.yy450 = 0;}
#line 2430 "parse.c"
        break;
      case 139:
      case 173:
#line 505 "parse.y"
{yygotominor.yy352 = yymsp[-1].minor.yy352;}
#line 2436 "parse.c"
        break;
      case 140:
      case 172:
#line 506 "parse.y"
{yygotominor.yy352 = 0;}
#line 2442 "parse.c"
        break;
      case 142:
      case 152:
#line 517 "parse.y"
{yygotominor.yy242 = yymsp[0].minor.yy242;}
#line 2448 "parse.c"
        break;
      case 143:
#line 518 "parse.y"
{
  yygotominor.yy242 = sqlite3ExprListAppend(yymsp[-4].minor.yy242,yymsp[-2].minor.yy450,yymsp[-1].minor.yy178.n>0?&yymsp[-1].minor.yy178:0);
  if( yygotominor.yy242 ) yygotominor.yy242->a[yygotominor.yy242->nExpr-1].sortOrder = yymsp[0].minor.yy316;
}
#line 2456 "parse.c"
        break;
      case 144:
#line 522 "parse.y"
{
  yygotominor.yy242 = sqlite3ExprListAppend(0,yymsp[-2].minor.yy450,yymsp[-1].minor.yy178.n>0?&yymsp[-1].minor.yy178:0);
  if( yygotominor.yy242 && yygotominor.yy242->a ) yygotominor.yy242->a[0].sortOrder = yymsp[0].minor.yy316;
}
#line 2464 "parse.c"
        break;
      case 146:
      case 148:
#line 531 "parse.y"
{yygotominor.yy316 = SQLITE_SO_ASC;}
#line 2470 "parse.c"
        break;
      case 147:
#line 532 "parse.y"
{yygotominor.yy316 = SQLITE_SO_DESC;}
#line 2475 "parse.c"
        break;
      case 149:
#line 534 "parse.y"
{yygotominor.yy178.z = 0; yygotominor.yy178.n = 0;}
#line 2480 "parse.c"
        break;
      case 155:
#line 552 "parse.y"
{yygotominor.yy84.pLimit = 0; yygotominor.yy84.pOffset = 0;}
#line 2485 "parse.c"
        break;
      case 156:
#line 553 "parse.y"
{yygotominor.yy84.pLimit = yymsp[0].minor.yy450; yygotominor.yy84.pOffset = 0;}
#line 2490 "parse.c"
        break;
      case 157:
#line 555 "parse.y"
{yygotominor.yy84.pLimit = yymsp[-2].minor.yy450; yygotominor.yy84.pOffset = yymsp[0].minor.yy450;}
#line 2495 "parse.c"
        break;
      case 158:
#line 557 "parse.y"
{yygotominor.yy84.pOffset = yymsp[-2].minor.yy450; yygotominor.yy84.pLimit = yymsp[0].minor.yy450;}
#line 2500 "parse.c"
        break;
      case 159:
#line 561 "parse.y"
{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy419,yymsp[0].minor.yy450);}
#line 2505 "parse.c"
        break;
      case 162:
#line 572 "parse.y"
{sqlite3Update(pParse,yymsp[-3].minor.yy419,yymsp[-1].minor.yy242,yymsp[0].minor.yy450,yymsp[-4].minor.yy316);}
#line 2510 "parse.c"
        break;
      case 163:
#line 578 "parse.y"
{yygotominor.yy242 = sqlite3ExprListAppend(yymsp[-4].minor.yy242,yymsp[0].minor.yy450,&yymsp[-2].minor.yy178);}
#line 2515 "parse.c"
        break;
      case 164:
#line 579 "parse.y"
{yygotominor.yy242 = sqlite3ExprListAppend(0,yymsp[0].minor.yy450,&yymsp[-2].minor.yy178);}
#line 2520 "parse.c"
        break;
      case 165:
#line 585 "parse.y"
{sqlite3Insert(pParse, yymsp[-5].minor.yy419, yymsp[-1].minor.yy242, 0, yymsp[-4].minor.yy352, yymsp[-7].minor.yy316);}
#line 2525 "parse.c"
        break;
      case 166:
#line 587 "parse.y"
{sqlite3Insert(pParse, yymsp[-2].minor.yy419, 0, yymsp[0].minor.yy43, yymsp[-1].minor.yy352, yymsp[-4].minor.yy316);}
#line 2530 "parse.c"
        break;
      case 167:
#line 589 "parse.y"
{sqlite3Insert(pParse, yymsp[-3].minor.yy419, 0, 0, yymsp[-2].minor.yy352, yymsp[-5].minor.yy316);}
#line 2535 "parse.c"
        break;
      case 170:
      case 230:
#line 599 "parse.y"
{yygotominor.yy242 = sqlite3ExprListAppend(yymsp[-2].minor.yy242,yymsp[0].minor.yy450,0);}
#line 2541 "parse.c"
        break;
      case 171:
      case 231:
#line 600 "parse.y"
{yygotominor.yy242 = sqlite3ExprListAppend(0,yymsp[0].minor.yy450,0);}
#line 2547 "parse.c"
        break;
      case 174:
#line 609 "parse.y"
{yygotominor.yy352 = sqlite3IdListAppend(yymsp[-2].minor.yy352,&yymsp[0].minor.yy178);}
#line 2552 "parse.c"
        break;
      case 175:
#line 610 "parse.y"
{yygotominor.yy352 = sqlite3IdListAppend(0,&yymsp[0].minor.yy178);}
#line 2557 "parse.c"
        break;
      case 177:
#line 621 "parse.y"
{yygotominor.yy450 = yymsp[-1].minor.yy450; sqlite3ExprSpan(yygotominor.yy450,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
#line 2562 "parse.c"
        break;
      case 178:
      case 183:
      case 184:
#line 622 "parse.y"
{yygotominor.yy450 = sqlite3Expr(yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
#line 2569 "parse.c"
        break;
      case 179:
      case 180:
#line 623 "parse.y"
{yygotominor.yy450 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy0);}
#line 2575 "parse.c"
        break;
      case 181:
#line 625 "parse.y"
{
  Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy178);
  Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy178);
  yygotominor.yy450 = sqlite3Expr(TK_DOT, temp1, temp2, 0);
}
#line 2584 "parse.c"
        break;
      case 182:
#line 630 "parse.y"
{
  Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-4].minor.yy178);
  Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy178);
  Expr *temp3 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy178);
  Expr *temp4 = sqlite3Expr(TK_DOT, temp2, temp3, 0);
  yygotominor.yy450 = sqlite3Expr(TK_DOT, temp1, temp4, 0);
}
#line 2595 "parse.c"
        break;
      case 185:
#line 639 "parse.y"
{yygotominor.yy450 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);}
#line 2600 "parse.c"
        break;
      case 186:
#line 640 "parse.y"
{
  Token *pToken = &yymsp[0].minor.yy0;
  Expr *pExpr = yygotominor.yy450 = sqlite3Expr(TK_VARIABLE, 0, 0, pToken);
  sqlite3ExprAssignVarNumber(pParse, pExpr);
}
#line 2609 "parse.c"
        break;
      case 187:
#line 646 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(TK_CAST, yymsp[-3].minor.yy450, 0, &yymsp[-1].minor.yy178);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
}
#line 2617 "parse.c"
        break;
      case 188:
#line 651 "parse.y"
{
  yygotominor.yy450 = sqlite3ExprFunction(yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
  if( yymsp[-2].minor.yy316 && yygotominor.yy450 ){
    yygotominor.yy450->flags |= EP_Distinct;
  }
}
#line 2628 "parse.c"
        break;
      case 189:
#line 658 "parse.y"
{
  yygotominor.yy450 = sqlite3ExprFunction(0, &yymsp[-3].minor.yy0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
}
#line 2636 "parse.c"
        break;
      case 190:
#line 662 "parse.y"
{
  /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
  ** treated as functions that return constants */
  yygotominor.yy450 = sqlite3ExprFunction(0,&yymsp[0].minor.yy0);
  if( yygotominor.yy450 ){
    yygotominor.yy450->op = TK_CONST_FUNC;  
    yygotominor.yy450->span = yymsp[0].minor.yy0;
  }
}
#line 2649 "parse.c"
        break;
      case 191:
      case 192:
      case 193:
      case 194:
      case 195:
      case 196:
      case 197:
      case 198:
#line 671 "parse.y"
{yygotominor.yy450 = sqlite3Expr(yymsp[-1].major, yymsp[-2].minor.yy450, yymsp[0].minor.yy450, 0);}
#line 2661 "parse.c"
        break;
      case 199:
      case 201:
#line 681 "parse.y"
{yygotominor.yy86.eOperator = yymsp[0].minor.yy0; yygotominor.yy86.not = 0;}
#line 2667 "parse.c"
        break;
      case 200:
      case 202:
#line 682 "parse.y"
{yygotominor.yy86.eOperator = yymsp[0].minor.yy0; yygotominor.yy86.not = 1;}
#line 2673 "parse.c"
        break;
      case 205:
#line 689 "parse.y"
{
  ExprList *pList;
  pList = sqlite3ExprListAppend(0, yymsp[-1].minor.yy450, 0);
  pList = sqlite3ExprListAppend(pList, yymsp[-3].minor.yy450, 0);
  if( yymsp[0].minor.yy450 ){
    pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy450, 0);
  }
  yygotominor.yy450 = sqlite3ExprFunction(pList, &yymsp[-2].minor.yy86.eOperator);
  if( yymsp[-2].minor.yy86.not ) yygotominor.yy450 = sqlite3Expr(TK_NOT, yygotominor.yy450, 0, 0);
  sqlite3ExprSpan(yygotominor.yy450, &yymsp[-3].minor.yy450->span, &yymsp[-1].minor.yy450->span);
  if( yygotominor.yy450 ) yygotominor.yy450->flags |= EP_InfixFunc;
}
#line 2689 "parse.c"
        break;
      case 206:
#line 702 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(yymsp[0].major, yymsp[-1].minor.yy450, 0, 0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-1].minor.yy450->span,&yymsp[0].minor.yy0);
}
#line 2697 "parse.c"
        break;
      case 207:
#line 706 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(TK_ISNULL, yymsp[-2].minor.yy450, 0, 0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-2].minor.yy450->span,&yymsp[0].minor.yy0);
}
#line 2705 "parse.c"
        break;
      case 208:
#line 710 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(TK_NOTNULL, yymsp[-2].minor.yy450, 0, 0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-2].minor.yy450->span,&yymsp[0].minor.yy0);
}
#line 2713 "parse.c"
        break;
      case 209:
#line 714 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(TK_NOTNULL, yymsp[-3].minor.yy450, 0, 0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-3].minor.yy450->span,&yymsp[0].minor.yy0);
}
#line 2721 "parse.c"
        break;
      case 210:
#line 718 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(yymsp[-1].major, yymsp[0].minor.yy450, 0, 0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy450->span);
}
#line 2729 "parse.c"
        break;
      case 211:
#line 722 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy450, 0, 0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy450->span);
}
#line 2737 "parse.c"
        break;
      case 212:
#line 726 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(TK_UPLUS, yymsp[0].minor.yy450, 0, 0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy450->span);
}
#line 2745 "parse.c"
        break;
      case 215:
#line 733 "parse.y"
{
  ExprList *pList = sqlite3ExprListAppend(0, yymsp[-2].minor.yy450, 0);
  pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy450, 0);
  yygotominor.yy450 = sqlite3Expr(TK_BETWEEN, yymsp[-4].minor.yy450, 0, 0);
  if( yygotominor.yy450 ){
    yygotominor.yy450->pList = pList;
  }else{
    sqlite3ExprListDelete(pList);
  } 
  if( yymsp[-3].minor.yy316 ) yygotominor.yy450 = sqlite3Expr(TK_NOT, yygotominor.yy450, 0, 0);
  sqlite3ExprSpan(yygotominor.yy450,&yymsp[-4].minor.yy450->span,&yymsp[0].minor.yy450->span);
}
#line 2761 "parse.c"
        break;
      case 218:
#line 749 "parse.y"
{
    yygotominor.yy450 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy450, 0, 0);
    if( yygotominor.yy450 ){
      yygotominor.yy450->pList = yymsp[-1].minor.yy242;
    }else{
      sqlite3ExprListDelete(yymsp[-1].minor.yy242);
    }
    if( yymsp[-3].minor.yy316 ) yygotominor.yy450 = sqlite3Expr(TK_NOT, yygotominor.yy450, 0, 0);
    sqlite3ExprSpan(yygotominor.yy450,&yymsp[-4].minor.yy450->span,&yymsp[0].minor.yy0);
  }
#line 2775 "parse.c"
        break;
      case 219:
#line 759 "parse.y"
{
    yygotominor.yy450 = sqlite3Expr(TK_SELECT, 0, 0, 0);
    if( yygotominor.yy450 ){
      yygotominor.yy450->pSelect = yymsp[-1].minor.yy43;
    }else{
      sqlite3SelectDelete(yymsp[-1].minor.yy43);
    }
    sqlite3ExprSpan(yygotominor.yy450,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
  }
#line 2788 "parse.c"
        break;
      case 220:
#line 768 "parse.y"
{
    yygotominor.yy450 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy450, 0, 0);
    if( yygotominor.yy450 ){
      yygotominor.yy450->pSelect = yymsp[-1].minor.yy43;
    }else{
      sqlite3SelectDelete(yymsp[-1].minor.yy43);
    }
    if( yymsp[-3].minor.yy316 ) yygotominor.yy450 = sqlite3Expr(TK_NOT, yygotominor.yy450, 0, 0);
    sqlite3ExprSpan(yygotominor.yy450,&yymsp[-4].minor.yy450->span,&yymsp[0].minor.yy0);
  }
#line 2802 "parse.c"
        break;
      case 221:
#line 778 "parse.y"
{
    SrcList *pSrc = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy178,&yymsp[0].minor.yy178);
    yygotominor.yy450 = sqlite3Expr(TK_IN, yymsp[-3].minor.yy450, 0, 0);
    if( yygotominor.yy450 ){
      yygotominor.yy450->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0);
    }else{
      sqlite3SrcListDelete(pSrc);
    }
    if( yymsp[-2].minor.yy316 ) yygotominor.yy450 = sqlite3Expr(TK_NOT, yygotominor.yy450, 0, 0);
    sqlite3ExprSpan(yygotominor.yy450,&yymsp[-3].minor.yy450->span,yymsp[0].minor.yy178.z?&yymsp[0].minor.yy178:&yymsp[-1].minor.yy178);
  }
#line 2817 "parse.c"
        break;
      case 222:
#line 789 "parse.y"
{
    Expr *p = yygotominor.yy450 = sqlite3Expr(TK_EXISTS, 0, 0, 0);
    if( p ){
      p->pSelect = yymsp[-1].minor.yy43;
      sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
    }else{
      sqlite3SelectDelete(yymsp[-1].minor.yy43);
    }
  }
#line 2830 "parse.c"
        break;
      case 223:
#line 801 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(TK_CASE, yymsp[-3].minor.yy450, yymsp[-1].minor.yy450, 0);
  if( yygotominor.yy450 ){
    yygotominor.yy450->pList = yymsp[-2].minor.yy242;
  }else{
    sqlite3ExprListDelete(yymsp[-2].minor.yy242);
  }
  sqlite3ExprSpan(yygotominor.yy450, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
}
#line 2843 "parse.c"
        break;
      case 224:
#line 812 "parse.y"
{
  yygotominor.yy242 = sqlite3ExprListAppend(yymsp[-4].minor.yy242, yymsp[-2].minor.yy450, 0);
  yygotominor.yy242 = sqlite3ExprListAppend(yygotominor.yy242, yymsp[0].minor.yy450, 0);
}
#line 2851 "parse.c"
        break;
      case 225:
#line 816 "parse.y"
{
  yygotominor.yy242 = sqlite3ExprListAppend(0, yymsp[-2].minor.yy450, 0);
  yygotominor.yy242 = sqlite3ExprListAppend(yygotominor.yy242, yymsp[0].minor.yy450, 0);
}
#line 2859 "parse.c"
        break;
      case 234:
#line 843 "parse.y"
{
  sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy178, &yymsp[-5].minor.yy178, sqlite3SrcListAppend(0,&yymsp[-3].minor.yy178,0), yymsp[-1].minor.yy242, yymsp[-9].minor.yy316,
                      &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy316);
}
#line 2867 "parse.c"
        break;
      case 235:
      case 281:
#line 849 "parse.y"
{yygotominor.yy316 = OE_Abort;}
#line 2873 "parse.c"
        break;
      case 236:
#line 850 "parse.y"
{yygotominor.yy316 = OE_None;}
#line 2878 "parse.c"
        break;
      case 239:
#line 860 "parse.y"
{
  Expr *p = 0;
  if( yymsp[-1].minor.yy178.n>0 ){
    p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char*)yymsp[-1].minor.yy178.z, yymsp[-1].minor.yy178.n);
  }
  yygotominor.yy242 = sqlite3ExprListAppend(yymsp[-4].minor.yy242, p, &yymsp[-2].minor.yy178);
  if( yygotominor.yy242 ) yygotominor.yy242->a[yygotominor.yy242->nExpr-1].sortOrder = yymsp[0].minor.yy316;
}
#line 2891 "parse.c"
        break;
      case 240:
#line 869 "parse.y"
{
  Expr *p = 0;
  if( yymsp[-1].minor.yy178.n>0 ){
    p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char*)yymsp[-1].minor.yy178.z, yymsp[-1].minor.yy178.n);
  }
  yygotominor.yy242 = sqlite3ExprListAppend(0, p, &yymsp[-2].minor.yy178);
  if( yygotominor.yy242 ) yygotominor.yy242->a[yygotominor.yy242->nExpr-1].sortOrder = yymsp[0].minor.yy316;
}
#line 2904 "parse.c"
        break;
      case 242:
#line 883 "parse.y"
{sqlite3DropIndex(pParse, yymsp[0].minor.yy419, yymsp[-1].minor.yy316);}
#line 2909 "parse.c"
        break;
      case 243:
      case 244:
#line 888 "parse.y"
{sqlite3Vacuum(pParse);}
#line 2915 "parse.c"
        break;
      case 245:

#line 895 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy178,&yymsp[-2].minor.yy178,&yymsp[0].minor.yy178,0);}
#line 2920 "parse.c"
        break;
      case 246:
#line 896 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy178,&yymsp[-2].minor.yy178,&yymsp[0].minor.yy0,0);}
#line 2925 "parse.c"
        break;
      case 247:
#line 897 "parse.y"
{
  sqlite3Pragma(pParse,&yymsp[-3].minor.yy178,&yymsp[-2].minor.yy178,&yymsp[0].minor.yy178,1);
}
#line 2932 "parse.c"
        break;
      case 248:
#line 900 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy178,&yymsp[-3].minor.yy178,&yymsp[-1].minor.yy178,0);}
#line 2937 "parse.c"
        break;
      case 249:
#line 901 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy178,&yymsp[0].minor.yy178,0,0);}










#line 2942 "parse.c"
        break;
      case 257:
#line 915 "parse.y"
{
  Token all;
  all.z = yymsp[-3].minor.yy178.z;
  all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy178.z) + yymsp[0].minor.yy0.n;
  sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy75, &all);
}
#line 2952 "parse.c"
        break;
      case 258:

#line 924 "parse.y"

{
  sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy178, &yymsp[-6].minor.yy178, yymsp[-5].minor.yy316, yymsp[-4].minor.yy354.a, yymsp[-4].minor.yy354.b, yymsp[-2].minor.yy419, yymsp[-1].minor.yy316, yymsp[0].minor.yy450, yymsp[-10].minor.yy316, yymsp[-8].minor.yy316);
  yygotominor.yy178 = (yymsp[-6].minor.yy178.n==0?yymsp[-7].minor.yy178:yymsp[-6].minor.yy178);
}
#line 2960 "parse.c"
        break;
      case 259:
      case 262:
#line 930 "parse.y"
{ yygotominor.yy316 = TK_BEFORE; }
#line 2966 "parse.c"
        break;
      case 260:
#line 931 "parse.y"
{ yygotominor.yy316 = TK_AFTER;  }
#line 2971 "parse.c"
        break;
      case 261:

#line 932 "parse.y"

{ yygotominor.yy316 = TK_INSTEAD;}
#line 2976 "parse.c"
        break;
      case 263:
      case 264:
#line 937 "parse.y"
{yygotominor.yy354.a = yymsp[0].major; yygotominor.yy354.b = 0;}
#line 2982 "parse.c"
        break;
      case 265:

#line 939 "parse.y"

{yygotominor.yy354.a = TK_UPDATE; yygotominor.yy354.b = yymsp[0].minor.yy352;}
#line 2987 "parse.c"
        break;
      case 266:
      case 267:
#line 942 "parse.y"
{ yygotominor.yy316 = TK_ROW; }
#line 2993 "parse.c"
        break;
      case 268:
#line 944 "parse.y"
{ yygotominor.yy316 = TK_STATEMENT; }
#line 2998 "parse.c"
        break;
      case 269:
#line 948 "parse.y"
{ yygotominor.yy450 = 0; }
#line 3003 "parse.c"
        break;
      case 270:
#line 949 "parse.y"
{ yygotominor.yy450 = yymsp[0].minor.yy450; }
#line 3008 "parse.c"
        break;
      case 271:
#line 953 "parse.y"
{
  if( yymsp[-2].minor.yy75 ){
    yymsp[-2].minor.yy75->pLast->pNext = yymsp[-1].minor.yy75;
  }else{
    yymsp[-2].minor.yy75 = yymsp[-1].minor.yy75;
  }
  yymsp[-2].minor.yy75->pLast = yymsp[-1].minor.yy75;
  yygotominor.yy75 = yymsp[-2].minor.yy75;
}
#line 3021 "parse.c"
        break;
      case 272:
#line 962 "parse.y"
{ yygotominor.yy75 = 0; }
#line 3026 "parse.c"
        break;
      case 273:
#line 968 "parse.y"

{ yygotominor.yy75 = sqlite3TriggerUpdateStep(&yymsp[-3].minor.yy178, yymsp[-1].minor.yy242, yymsp[0].minor.yy450, yymsp[-4].minor.yy316); }
#line 3031 "parse.c"
        break;
      case 274:
#line 973 "parse.y"

{yygotominor.yy75 = sqlite3TriggerInsertStep(&yymsp[-5].minor.yy178, yymsp[-4].minor.yy352, yymsp[-1].minor.yy242, 0, yymsp[-7].minor.yy316);}
#line 3036 "parse.c"
        break;
      case 275:
#line 976 "parse.y"

{yygotominor.yy75 = sqlite3TriggerInsertStep(&yymsp[-2].minor.yy178, yymsp[-1].minor.yy352, 0, yymsp[0].minor.yy43, yymsp[-4].minor.yy316);}
#line 3041 "parse.c"
        break;
      case 276:
#line 980 "parse.y"
{yygotominor.yy75 = sqlite3TriggerDeleteStep(&yymsp[-1].minor.yy178, yymsp[0].minor.yy450);}
#line 3046 "parse.c"
        break;
      case 277:
#line 983 "parse.y"
{yygotominor.yy75 = sqlite3TriggerSelectStep(yymsp[0].minor.yy43); }
#line 3051 "parse.c"
        break;
      case 278:
#line 986 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(TK_RAISE, 0, 0, 0); 
  if( yygotominor.yy450 ){
    yygotominor.yy450->iColumn = OE_Ignore;
    sqlite3ExprSpan(yygotominor.yy450, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
  }
}
#line 3062 "parse.c"
        break;
      case 279:
#line 993 "parse.y"
{
  yygotominor.yy450 = sqlite3Expr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy178); 
  if( yygotominor.yy450 ) {
    yygotominor.yy450->iColumn = yymsp[-3].minor.yy316;
    sqlite3ExprSpan(yygotominor.yy450, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
  }
}
#line 3073 "parse.c"
        break;
      case 280:
#line 1003 "parse.y"
{yygotominor.yy316 = OE_Rollback;}
#line 3078 "parse.c"
        break;
      case 282:
#line 1005 "parse.y"
{yygotominor.yy316 = OE_Fail;}
#line 3083 "parse.c"
        break;
      case 283:
#line 1010 "parse.y"
{
  sqlite3DropTrigger(pParse,yymsp[0].minor.yy419,yymsp[-1].minor.yy316);
}
#line 3090 "parse.c"
        break;
      case 284:
#line 1016 "parse.y"
{
  sqlite3Attach(pParse, yymsp[-3].minor.yy450, yymsp[-1].minor.yy450, yymsp[0].minor.yy158);
}
#line 3097 "parse.c"





        break;
      case 285:
#line 1021 "parse.y"
{ yygotominor.yy158 = 0; }
#line 3102 "parse.c"
        break;
      case 286:
#line 1022 "parse.y"
{ yygotominor.yy158 = yymsp[0].minor.yy450; }
#line 3107 "parse.c"
        break;
      case 289:
#line 1028 "parse.y"
{
  sqlite3Detach(pParse, yymsp[0].minor.yy450);
}
#line 3114 "parse.c"
        break;
      case 290:
#line 1034 "parse.y"
{sqlite3Reindex(pParse, 0, 0);}
#line 3119 "parse.c"
        break;
      case 291:
#line 1035 "parse.y"
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy178, &yymsp[0].minor.yy178);}
#line 3124 "parse.c"
        break;
      case 292:
#line 1040 "parse.y"
{sqlite3Analyze(pParse, 0, 0);}
#line 3129 "parse.c"
        break;
      case 293:
#line 1041 "parse.y"
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy178, &yymsp[0].minor.yy178);}
#line 3134 "parse.c"
        break;
      case 294:
#line 1046 "parse.y"
{
  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy419,&yymsp[0].minor.yy178);
}
#line 3141 "parse.c"
        break;
      case 295:
#line 1049 "parse.y"
{
  sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy178);
}
#line 3148 "parse.c"
        break;
      case 296:
#line 1052 "parse.y"
{
  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy419);
}





#line 3155 "parse.c"
        break;
      case 299:
#line 1061 "parse.y"
{sqlite3VtabFinishParse(pParse,0);}
#line 3160 "parse.c"
        break;
      case 300:
#line 1062 "parse.y"
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
#line 3165 "parse.c"
        break;
      case 301:
#line 1063 "parse.y"
{
    sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy178, &yymsp[-2].minor.yy178, &yymsp[0].minor.yy178);
}
#line 3172 "parse.c"
        break;
      case 304:
#line 1068 "parse.y"
{sqlite3VtabArgInit(pParse);}
#line 3177 "parse.c"
        break;
      case 306:
      case 307:
      case 308:
      case 310:
#line 1070 "parse.y"
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
#line 3185 "parse.c"
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
  if( yyact < YYNSTATE ){
................................................................................
    if( TOKEN.z[0] ){
      sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
    }else{
      sqlite3ErrorMsg(pParse, "incomplete SQL statement");
    }
    pParse->parseError = 1;
  }
#line 3253 "parse.c"
  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following is executed when the parser accepts
*/
static void yy_accept(

Changes to SQLite.Interop/src/pragma.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
635
636
637
638
639
640
641




642
643
644
645
646
647
648
649
650
651
652
...
656
657
658
659
660
661
662









663
664
665
666
667
668
669
670
671
672
673



674
675
676
677
678
679
680
...
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709



710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
...
735
736
737
738
739
740
741
742
743
744
745
746
747
748



749
750
751
752
753
754
755
756
757
758
759

760
761
762
763
764
765
766
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/* Ignore this whole file if pragmas are disabled
*/
................................................................................
  ** used will be case sensitive or not depending on the RHS.
  */
  if( sqlite3StrICmp(zLeft, "case_sensitive_like")==0 ){
    if( zRight ){
      sqlite3RegisterLikeFunctions(db, getBoolean(zRight));
    }
  }else





#ifndef SQLITE_OMIT_INTEGRITY_CHECK
  if( sqlite3StrICmp(zLeft, "integrity_check")==0 ){
    int i, j, addr;

    /* Code that appears at the end of the integrity check.  If no error
    ** messages have been generated, output OK.  Otherwise output the
    ** error message
    */
    static const VdbeOpList endCode[] = {
      { OP_MemLoad,     0, 0,        0},
................................................................................
      { OP_Callback,    1, 0,        0},
    };

    /* Initialize the VDBE program */
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "integrity_check", P3_STATIC);









    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++){
      HashElem *x;
      Hash *pTbls;
      int cnt = 0;

      if( OMIT_TEMPDB && i==1 ) continue;

      sqlite3CodeVerifySchema(pParse, i);




      /* Do an integrity check of the B-Tree
      */
      pTbls = &db->aDb[i].pSchema->tblHash;
      for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
        Table *pTab = sqliteHashData(x);
        Index *pIdx;
................................................................................
        sqlite3VdbeAddOp(v, OP_Integer, pTab->tnum, 0);
        cnt++;
        for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
          sqlite3VdbeAddOp(v, OP_Integer, pIdx->tnum, 0);
          cnt++;
        }
      }
      assert( cnt>0 );
      sqlite3VdbeAddOp(v, OP_IntegrityCk, cnt, i);
      sqlite3VdbeAddOp(v, OP_Dup, 0, 1);
      addr = sqlite3VdbeOp3(v, OP_String8, 0, 0, "ok", P3_STATIC);
      sqlite3VdbeAddOp(v, OP_Eq, 0, addr+7);
      sqlite3VdbeOp3(v, OP_String8, 0, 0,
         sqlite3MPrintf("*** in database %s ***\n", db->aDb[i].zName),
         P3_DYNAMIC);
      sqlite3VdbeAddOp(v, OP_Pull, 1, 0);
      sqlite3VdbeAddOp(v, OP_Concat, 0, 1);
      sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
      sqlite3VdbeAddOp(v, OP_MemIncr, 1, 0);

      /* Make sure all the indices are constructed correctly.
      */
      sqlite3CodeVerifySchema(pParse, i);
      for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
        Table *pTab = sqliteHashData(x);
        Index *pIdx;
        int loopTop;

        if( pTab->pIndex==0 ) continue;



        sqlite3OpenTableAndIndices(pParse, pTab, 1, OP_OpenRead);
        sqlite3VdbeAddOp(v, OP_MemInt, 0, 1);
        loopTop = sqlite3VdbeAddOp(v, OP_Rewind, 1, 0);
        sqlite3VdbeAddOp(v, OP_MemIncr, 1, 1);
        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
          int jmp2;
          static const VdbeOpList idxErr[] = {
            { OP_MemIncr,     1,  0,  0},
            { OP_String8,     0,  0,  "rowid "},
            { OP_Rowid,       1,  0,  0},
            { OP_String8,     0,  0,  " missing from index "},
            { OP_String8,     0,  0,  0},    /* 4 */
            { OP_Concat,      2,  0,  0},
            { OP_Callback,    1,  0,  0},
          };
................................................................................
             { OP_MemInt,       0,  2,  0},
             { OP_Rewind,       0,  0,  0},  /* 1 */
             { OP_MemIncr,      1,  2,  0},
             { OP_Next,         0,  0,  0},  /* 3 */
             { OP_MemLoad,      1,  0,  0},
             { OP_MemLoad,      2,  0,  0},
             { OP_Eq,           0,  0,  0},  /* 6 */
             { OP_MemIncr,      1,  0,  0},
             { OP_String8,      0,  0,  "wrong # of entries in index "},
             { 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+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);

    sqlite3VdbeJumpHere(v, addr+2);
  }else
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

#ifndef SQLITE_OMIT_UTF16
  /*
  **   PRAGMA encoding







|







 







>
>
>
>



|







 







>
>
>
>
>
>
>
>
>
|










>
>
>







 







|
|
|
<
<




|

|



<






>
>
>







|







 







|






>
>
>











>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
...
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
...
697
698
699
700
701
702
703
704
705
706


707
708
709
710
711
712
713
714
715
716

717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
...
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/* Ignore this whole file if pragmas are disabled
*/
................................................................................
  ** used will be case sensitive or not depending on the RHS.
  */
  if( sqlite3StrICmp(zLeft, "case_sensitive_like")==0 ){
    if( zRight ){
      sqlite3RegisterLikeFunctions(db, getBoolean(zRight));
    }
  }else

#ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
# define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
#endif

#ifndef SQLITE_OMIT_INTEGRITY_CHECK
  if( sqlite3StrICmp(zLeft, "integrity_check")==0 ){
    int i, j, addr, mxErr;

    /* Code that appears at the end of the integrity check.  If no error
    ** messages have been generated, output OK.  Otherwise output the
    ** error message
    */
    static const VdbeOpList endCode[] = {
      { OP_MemLoad,     0, 0,        0},
................................................................................
      { OP_Callback,    1, 0,        0},
    };

    /* Initialize the VDBE program */
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "integrity_check", P3_STATIC);

    /* Set the maximum error count */
    mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
    if( zRight ){
      mxErr = atoi(zRight);
      if( mxErr<=0 ){
        mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
      }
    }
    sqlite3VdbeAddOp(v, OP_MemInt, mxErr, 0);

    /* Do an integrity check on each database file */
    for(i=0; i<db->nDb; i++){
      HashElem *x;
      Hash *pTbls;
      int cnt = 0;

      if( OMIT_TEMPDB && i==1 ) continue;

      sqlite3CodeVerifySchema(pParse, i);
      addr = sqlite3VdbeAddOp(v, OP_IfMemPos, 0, 0);
      sqlite3VdbeAddOp(v, OP_Halt, 0, 0);
      sqlite3VdbeJumpHere(v, addr);

      /* Do an integrity check of the B-Tree
      */
      pTbls = &db->aDb[i].pSchema->tblHash;
      for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
        Table *pTab = sqliteHashData(x);
        Index *pIdx;
................................................................................
        sqlite3VdbeAddOp(v, OP_Integer, pTab->tnum, 0);
        cnt++;
        for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
          sqlite3VdbeAddOp(v, OP_Integer, pIdx->tnum, 0);
          cnt++;
        }
      }
      if( cnt==0 ) continue;
      sqlite3VdbeAddOp(v, OP_IntegrityCk, 0, i);
      addr = sqlite3VdbeAddOp(v, OP_IsNull, -1, 0);


      sqlite3VdbeOp3(v, OP_String8, 0, 0,
         sqlite3MPrintf("*** in database %s ***\n", db->aDb[i].zName),
         P3_DYNAMIC);
      sqlite3VdbeAddOp(v, OP_Pull, 1, 0);
      sqlite3VdbeAddOp(v, OP_Concat, 0, 0);
      sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
      sqlite3VdbeJumpHere(v, addr);

      /* Make sure all the indices are constructed correctly.
      */

      for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
        Table *pTab = sqliteHashData(x);
        Index *pIdx;
        int loopTop;

        if( pTab->pIndex==0 ) continue;
        addr = sqlite3VdbeAddOp(v, OP_IfMemPos, 0, 0);
        sqlite3VdbeAddOp(v, OP_Halt, 0, 0);
        sqlite3VdbeJumpHere(v, addr);
        sqlite3OpenTableAndIndices(pParse, pTab, 1, OP_OpenRead);
        sqlite3VdbeAddOp(v, OP_MemInt, 0, 1);
        loopTop = sqlite3VdbeAddOp(v, OP_Rewind, 1, 0);
        sqlite3VdbeAddOp(v, OP_MemIncr, 1, 1);
        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
          int jmp2;
          static const VdbeOpList idxErr[] = {
            { OP_MemIncr,    -1,  0,  0},
            { OP_String8,     0,  0,  "rowid "},
            { OP_Rowid,       1,  0,  0},
            { OP_String8,     0,  0,  " missing from index "},
            { OP_String8,     0,  0,  0},    /* 4 */
            { OP_Concat,      2,  0,  0},
            { OP_Callback,    1,  0,  0},
          };
................................................................................
             { OP_MemInt,       0,  2,  0},
             { OP_Rewind,       0,  0,  0},  /* 1 */
             { OP_MemIncr,      1,  2,  0},
             { OP_Next,         0,  0,  0},  /* 3 */
             { OP_MemLoad,      1,  0,  0},
             { OP_MemLoad,      2,  0,  0},
             { OP_Eq,           0,  0,  0},  /* 6 */
             { OP_MemIncr,     -1,  0,  0},
             { OP_String8,      0,  0,  "wrong # of entries in index "},
             { OP_String8,      0,  0,  0},  /* 9 */
             { OP_Concat,       0,  0,  0},
             { OP_Callback,     1,  0,  0},
          };
          if( pIdx->tnum==0 ) continue;
          addr = sqlite3VdbeAddOp(v, OP_IfMemPos, 0, 0);
          sqlite3VdbeAddOp(v, OP_Halt, 0, 0);
          sqlite3VdbeJumpHere(v, addr);
          addr = sqlite3VdbeAddOpList(v, ArraySize(cntIdx), cntIdx);
          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);
    sqlite3VdbeChangeP1(v, addr+1, mxErr);
    sqlite3VdbeJumpHere(v, addr+2);
  }else
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

#ifndef SQLITE_OMIT_UTF16
  /*
  **   PRAGMA encoding

Changes to SQLite.Interop/src/prepare.c.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the implementation of the sqlite3_prepare()
** interface, and routines that contribute to loading the database schema
** from disk.
**
** $Id: prepare.c,v 1.21 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** Fill the InitData structure with an error message that indicates







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the implementation of the sqlite3_prepare()
** interface, and routines that contribute to loading the database schema
** from disk.
**
** $Id: prepare.c,v 1.22 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** Fill the InitData structure with an error message that indicates

Changes to SQLite.Interop/src/printf.c.

853
854
855
856
857
858
859
860
861
862
863
void sqlite3DebugPrintf(const char *zFormat, ...){
  extern int getpid(void);
  va_list ap;
  char zBuf[500];
  va_start(ap, zFormat);
  base_vprintf(0, 0, zBuf, sizeof(zBuf), zFormat, ap);
  va_end(ap);
  fprintf(stdout,"%d: %s", getpid(), zBuf);
  fflush(stdout);
}
#endif







|



853
854
855
856
857
858
859
860
861
862
863
void sqlite3DebugPrintf(const char *zFormat, ...){
  extern int getpid(void);
  va_list ap;
  char zBuf[500];
  va_start(ap, zFormat);
  base_vprintf(0, 0, zBuf, sizeof(zBuf), zFormat, ap);
  va_end(ap);
  fprintf(stdout,"%s", zBuf);
  fflush(stdout);
}
#endif

Changes to SQLite.Interop/src/random.c.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** This file contains code to implement a pseudo-random number
** generator (PRNG) for SQLite.
**
** Random numbers are used by some of the database backends in order
** to generate random integer keys for tables or random filenames.
**
** $Id: random.c,v 1.24 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"


/*
** Get a single 8-bit random value from the RC4 PRNG.  The Mutex







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** This file contains code to implement a pseudo-random number
** generator (PRNG) for SQLite.
**
** Random numbers are used by some of the database backends in order
** to generate random integer keys for tables or random filenames.
**
** $Id: random.c,v 1.25 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"


/*
** Get a single 8-bit random value from the RC4 PRNG.  The Mutex

Changes to SQLite.Interop/src/select.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1932
1933
1934
1935
1936
1937
1938

1939
1940
1941
1942
1943
1944
1945
....
3295
3296
3297
3298
3299
3300
3301
































































































**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.26 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"


/*
** Delete all the content of a Select structure but do not deallocate
** the select structure itself.
................................................................................
          /* 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->addrOpenEphm[1]<0 );
          break;
        }
        sqlite3VdbeChangeP2(v, addr, nCol);
        sqlite3VdbeChangeP3(v, addr, (char*)pKeyInfo, P3_KEYINFO);

      }
    }

    if( pOrderBy ){
      struct ExprList_item *pOTerm = pOrderBy->a;
      int nOrderByExpr = pOrderBy->nExpr;
      int addr;
................................................................................
    generateColumnNames(pParse, pTabList, pEList);
  }

  sqliteFree(sAggInfo.aCol);
  sqliteFree(sAggInfo.aFunc);
  return rc;
}







































































































|







 







>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
....
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.27 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"


/*
** Delete all the content of a Select structure but do not deallocate
** the select structure itself.
................................................................................
          /* 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->addrOpenEphm[1]<0 );
          break;
        }
        sqlite3VdbeChangeP2(v, addr, nCol);
        sqlite3VdbeChangeP3(v, addr, (char*)pKeyInfo, P3_KEYINFO);
        pLoop->addrOpenEphm[i] = -1;
      }
    }

    if( pOrderBy ){
      struct ExprList_item *pOTerm = pOrderBy->a;
      int nOrderByExpr = pOrderBy->nExpr;
      int addr;
................................................................................
    generateColumnNames(pParse, pTabList, pEList);
  }

  sqliteFree(sAggInfo.aCol);
  sqliteFree(sAggInfo.aFunc);
  return rc;
}

#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
/*
*******************************************************************************
** The following code is used for testing and debugging only.  The code
** that follows does not appear in normal builds.
**
** These routines are used to print out the content of all or part of a 
** parse structures such as Select or Expr.  Such printouts are useful
** for helping to understand what is happening inside the code generator
** during the execution of complex SELECT statements.
**
** These routine are not called anywhere from within the normal
** code base.  Then are intended to be called from within the debugger
** or from temporary "printf" statements inserted for debugging.
*/
void sqlite3PrintExpr(Expr *p){
  if( p->token.z && p->token.n>0 ){
    sqlite3DebugPrintf("(%.*s", p->token.n, p->token.z);
  }else{
    sqlite3DebugPrintf("(%d", p->op);
  }
  if( p->pLeft ){
    sqlite3DebugPrintf(" ");
    sqlite3PrintExpr(p->pLeft);
  }
  if( p->pRight ){
    sqlite3DebugPrintf(" ");
    sqlite3PrintExpr(p->pRight);
  }
  sqlite3DebugPrintf(")");
}
void sqlite3PrintExprList(ExprList *pList){
  int i;
  for(i=0; i<pList->nExpr; i++){
    sqlite3PrintExpr(pList->a[i].pExpr);
    if( i<pList->nExpr-1 ){
      sqlite3DebugPrintf(", ");
    }
  }
}
void sqlite3PrintSelect(Select *p, int indent){
  sqlite3DebugPrintf("%*sSELECT(%p) ", indent, "", p);
  sqlite3PrintExprList(p->pEList);
  sqlite3DebugPrintf("\n");
  if( p->pSrc ){
    char *zPrefix;
    int i;
    zPrefix = "FROM";
    for(i=0; i<p->pSrc->nSrc; i++){
      struct SrcList_item *pItem = &p->pSrc->a[i];
      sqlite3DebugPrintf("%*s ", indent+6, zPrefix);
      zPrefix = "";
      if( pItem->pSelect ){
        sqlite3DebugPrintf("(\n");
        sqlite3PrintSelect(pItem->pSelect, indent+10);
        sqlite3DebugPrintf("%*s)", indent+8, "");
      }else if( pItem->zName ){
        sqlite3DebugPrintf("%s", pItem->zName);
      }
      if( pItem->pTab ){
        sqlite3DebugPrintf("(table: %s)", pItem->pTab->zName);
      }
      if( pItem->zAlias ){
        sqlite3DebugPrintf(" AS %s", pItem->zAlias);
      }
      if( i<p->pSrc->nSrc-1 ){
        sqlite3DebugPrintf(",");
      }
      sqlite3DebugPrintf("\n");
    }
  }
  if( p->pWhere ){
    sqlite3DebugPrintf("%*s WHERE ", indent, "");
    sqlite3PrintExpr(p->pWhere);
    sqlite3DebugPrintf("\n");
  }
  if( p->pGroupBy ){
    sqlite3DebugPrintf("%*s GROUP BY ", indent, "");
    sqlite3PrintExprList(p->pGroupBy);
    sqlite3DebugPrintf("\n");
  }
  if( p->pHaving ){
    sqlite3DebugPrintf("%*s HAVING ", indent, "");
    sqlite3PrintExpr(p->pHaving);
    sqlite3DebugPrintf("\n");
  }
  if( p->pOrderBy ){
    sqlite3DebugPrintf("%*s ORDER BY ", indent, "");
    sqlite3PrintExprList(p->pOrderBy);
    sqlite3DebugPrintf("\n");
  }
}
/* End of the structure debug printing code
*****************************************************************************/
#endif /* defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */

Changes to SQLite.Interop/src/shell.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>

Changes to SQLite.Interop/src/sqlite3.h.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
....
1181
1182
1183
1184
1185
1186
1187



1188

1189
1190
1191
1192
1193
1194
1195
1196
1197
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the SQLite library
** presents to client programs.
**
** @(#) $Id: sqlite3.h,v 1.26 2007/01/10 14:50:46 rmsimpson Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.
................................................................................

/*
** The version of the SQLite library.
*/
#ifdef SQLITE_VERSION
# undef SQLITE_VERSION
#endif
#define SQLITE_VERSION         "3.3.10"

/*
** The format of the version string is "X.Y.Z<trailing string>", where
** X is the major version number, Y is the minor version number and Z
** is the release number. The trailing string is often "alpha" or "beta".
** For example "3.1.1beta".
**
................................................................................
** SQLITE_VERSION_NUMBER is set to 3001001. To detect if they are using 
** version 3.1.1 or greater at compile time, programs may use the test 
** (SQLITE_VERSION_NUMBER>=3001001).
*/
#ifdef SQLITE_VERSION_NUMBER
# undef SQLITE_VERSION_NUMBER
#endif
#define SQLITE_VERSION_NUMBER 3003010

/*
** The version string is also compiled into the library so that a program
** can check to make sure that the lib*.a file and the *.h file are from
** the same version.  The sqlite3_libversion() function returns a pointer
** to the sqlite3_version variable - useful in DLLs which cannot access
** global variables.
................................................................................
** These are special value for the destructor that is passed in as the
** final argument to routines like sqlite3_result_blob().  If the destructor
** argument is SQLITE_STATIC, it means that the content pointer is constant
** and will never change.  It does not need to be destroyed.  The 
** SQLITE_TRANSIENT value means that the content will likely change in
** the near future and that SQLite should make its own private copy of
** the content before returning.



*/

#define SQLITE_STATIC      ((void(*)(void *))0)
#define SQLITE_TRANSIENT   ((void(*)(void *))-1)

/*
** User-defined functions invoke the following routines in order to
** set their return value.
*/
void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
void sqlite3_result_double(sqlite3_context*, double);







|







 







|







 







|







 







>
>
>

>
|
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
....
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the SQLite library
** presents to client programs.
**
** @(#) $Id: sqlite3.h,v 1.27 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.
................................................................................

/*
** The version of the SQLite library.
*/
#ifdef SQLITE_VERSION
# undef SQLITE_VERSION
#endif
#define SQLITE_VERSION         "3.3.12"

/*
** The format of the version string is "X.Y.Z<trailing string>", where
** X is the major version number, Y is the minor version number and Z
** is the release number. The trailing string is often "alpha" or "beta".
** For example "3.1.1beta".
**
................................................................................
** SQLITE_VERSION_NUMBER is set to 3001001. To detect if they are using 
** version 3.1.1 or greater at compile time, programs may use the test 
** (SQLITE_VERSION_NUMBER>=3001001).
*/
#ifdef SQLITE_VERSION_NUMBER
# undef SQLITE_VERSION_NUMBER
#endif
#define SQLITE_VERSION_NUMBER 3003012

/*
** The version string is also compiled into the library so that a program
** can check to make sure that the lib*.a file and the *.h file are from
** the same version.  The sqlite3_libversion() function returns a pointer
** to the sqlite3_version variable - useful in DLLs which cannot access
** global variables.
................................................................................
** These are special value for the destructor that is passed in as the
** final argument to routines like sqlite3_result_blob().  If the destructor
** argument is SQLITE_STATIC, it means that the content pointer is constant
** and will never change.  It does not need to be destroyed.  The 
** SQLITE_TRANSIENT value means that the content will likely change in
** the near future and that SQLite should make its own private copy of
** the content before returning.
**
** The typedef is necessary to work around problems in certain
** C++ compilers.  See ticket #2191.
*/
typedef void (*sqlite3_destructor_type)(void*);
#define SQLITE_STATIC      ((sqlite3_destructor_type)0)
#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)

/*
** User-defined functions invoke the following routines in order to
** set their return value.
*/
void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
void sqlite3_result_double(sqlite3_context*, double);

Changes to SQLite.Interop/src/sqlite3ext.h.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** This header file defines the SQLite interface for use by
** shared libraries that want to be imported as extensions into
** an SQLite instance.  Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of 
** sqlite3.h.
**
** @(#) $Id: sqlite3ext.h,v 1.3 2007/01/10 14:50:46 rmsimpson Exp $
*/
#ifndef _SQLITE3EXT_H_
#define _SQLITE3EXT_H_
#include "sqlite3.h"

typedef struct sqlite3_api_routines sqlite3_api_routines;








|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** This header file defines the SQLite interface for use by
** shared libraries that want to be imported as extensions into
** an SQLite instance.  Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of 
** sqlite3.h.
**
** @(#) $Id: sqlite3ext.h,v 1.4 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef _SQLITE3EXT_H_
#define _SQLITE3EXT_H_
#include "sqlite3.h"

typedef struct sqlite3_api_routines sqlite3_api_routines;

Changes to SQLite.Interop/src/sqliteInt.h.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
....
1087
1088
1089
1090
1091
1092
1093





1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_

/*
** Extra interface definitions for those who need them
*/
................................................................................
** the SrcList.a[] array.
**
** With the addition of multiple database support, the following structure
** can also be used to describe a particular table such as the table that
** is modified by an INSERT, DELETE, or UPDATE statement.  In standard SQL,
** such a table must be a simple name: ID.  But in SQLite, the table can
** now be identified by a database name, a dot, then the table name: ID.ID.





*/
struct SrcList {
  i16 nSrc;        /* Number of tables or subqueries in the FROM clause */
  i16 nAlloc;      /* Number of entries allocated in a[] below */
  struct SrcList_item {
    char *zDatabase;  /* Name of database holding this table */
    char *zName;      /* Name of the table */
    char *zAlias;     /* The "B" part of a "A AS B" phrase.  zName is the "A" */
    Table *pTab;      /* An SQL table corresponding to zName */
    Select *pSelect;  /* A SELECT statement used in place of a table name */
    u8 isPopulated;   /* Temporary table associated with SELECT is populated */
    u8 jointype;      /* Type of join between this table and the next */
    i16 iCursor;      /* The VDBE cursor number used to access this table */
    Expr *pOn;        /* The ON clause of a join */
    IdList *pUsing;   /* The USING clause of a join */
    Bitmask colUsed;  /* Bit N (1<<N) set if column N or pTab is used */
  } a[1];             /* One entry for each identifier on the list */
};








|







 







>
>
>
>
>











|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
....
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_

/*
** Extra interface definitions for those who need them
*/
................................................................................
** the SrcList.a[] array.
**
** With the addition of multiple database support, the following structure
** can also be used to describe a particular table such as the table that
** is modified by an INSERT, DELETE, or UPDATE statement.  In standard SQL,
** such a table must be a simple name: ID.  But in SQLite, the table can
** now be identified by a database name, a dot, then the table name: ID.ID.
**
** The jointype starts out showing the join type between the current table
** and the next table on the list.  The parser builds the list this way.
** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each
** jointype expresses the join between the table and the previous table.
*/
struct SrcList {
  i16 nSrc;        /* Number of tables or subqueries in the FROM clause */
  i16 nAlloc;      /* Number of entries allocated in a[] below */
  struct SrcList_item {
    char *zDatabase;  /* Name of database holding this table */
    char *zName;      /* Name of the table */
    char *zAlias;     /* The "B" part of a "A AS B" phrase.  zName is the "A" */
    Table *pTab;      /* An SQL table corresponding to zName */
    Select *pSelect;  /* A SELECT statement used in place of a table name */
    u8 isPopulated;   /* Temporary table associated with SELECT is populated */
    u8 jointype;      /* Type of join between this able and the previous */
    i16 iCursor;      /* The VDBE cursor number used to access this table */
    Expr *pOn;        /* The ON clause of a join */
    IdList *pUsing;   /* The USING clause of a join */
    Bitmask colUsed;  /* Bit N (1<<N) set if column N or pTab is used */
  } a[1];             /* One entry for each identifier on the list */
};

Changes to SQLite.Interop/src/tclsqlite.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** A TCL Interface to SQLite
**
** $Id: tclsqlite.c,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */

#include "sqliteInt.h"
#include "hash.h"
#include "tcl.h"
#include <stdlib.h>







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** A TCL Interface to SQLite
**
** $Id: tclsqlite.c,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */

#include "sqliteInt.h"
#include "hash.h"
#include "tcl.h"
#include <stdlib.h>

Changes to SQLite.Interop/src/tokenize.c.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
*************************************************************************
** An tokenizer for SQL
**
** This file contains C code that splits an SQL input string up into
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.28 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include <stdlib.h>

/*
................................................................................
int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
  int nErr = 0;
  int i;
  void *pEngine;
  int tokenType;
  int lastTokenParsed = -1;
  sqlite3 *db = pParse->db;
  extern void *sqlite3ParserAlloc(void*(*)(int));
  extern void sqlite3ParserFree(void*, void(*)(void*));
  extern int sqlite3Parser(void*, int, Token, Parse*);

  if( db->activeVdbeCnt==0 ){
    db->u1.isInterrupted = 0;
  }
  pParse->rc = SQLITE_OK;
  i = 0;
  pEngine = sqlite3ParserAlloc((void*(*)(int))sqlite3MallocX);
  if( pEngine==0 ){
    return SQLITE_NOMEM;
  }
  assert( pParse->sLastToken.dyn==0 );
  assert( pParse->pNewTable==0 );
  assert( pParse->pNewTrigger==0 );
  assert( pParse->nVar==0 );







|







 







|

|






|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
*************************************************************************
** An tokenizer for SQL
**
** This file contains C code that splits an SQL input string up into
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.29 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include <stdlib.h>

/*
................................................................................
int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
  int nErr = 0;
  int i;
  void *pEngine;
  int tokenType;
  int lastTokenParsed = -1;
  sqlite3 *db = pParse->db;
  extern void *sqlite3ParserAlloc(void*(*)(size_t));
  extern void sqlite3ParserFree(void*, void(*)(void*));
  extern void sqlite3Parser(void*, int, Token, Parse*);

  if( db->activeVdbeCnt==0 ){
    db->u1.isInterrupted = 0;
  }
  pParse->rc = SQLITE_OK;
  i = 0;
  pEngine = sqlite3ParserAlloc((void*(*)(size_t))sqlite3MallocX);
  if( pEngine==0 ){
    return SQLITE_NOMEM;
  }
  assert( pParse->sLastToken.dyn==0 );
  assert( pParse->pNewTable==0 );
  assert( pParse->pNewTrigger==0 );
  assert( pParse->nVar==0 );

Changes to SQLite.Interop/src/update.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Forward declaration */
static void updateVirtualTable(
  Parse *pParse,       /* The parsing context */







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Forward declaration */
static void updateVirtualTable(
  Parse *pParse,       /* The parsing context */

Changes to SQLite.Interop/src/utf.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used to translate between UTF-8, 
** UTF-16, UTF-16BE, and UTF-16LE.
**
** $Id: utf.c,v 1.24 2007/01/10 14:50:46 rmsimpson Exp $
**
** Notes on UTF-8:
**
**   Byte-0    Byte-1    Byte-2    Byte-3    Value
**  0xxxxxxx                                 00000000 00000000 0xxxxxxx
**  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx
**  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used to translate between UTF-8, 
** UTF-16, UTF-16BE, and UTF-16LE.
**
** $Id: utf.c,v 1.25 2007/01/30 15:20:47 rmsimpson Exp $
**
** Notes on UTF-8:
**
**   Byte-0    Byte-1    Byte-2    Byte-3    Value
**  0xxxxxxx                                 00000000 00000000 0xxxxxxx
**  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx
**  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx

Changes to SQLite.Interop/src/util.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.26 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <stdarg.h>
#include <ctype.h>

/*







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.27 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <stdarg.h>
#include <ctype.h>

/*

Changes to SQLite.Interop/src/vacuum.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains code used to implement the VACUUM command.
**
** Most of the code in this file may be omitted by defining the
** SQLITE_OMIT_VACUUM macro.
**
** $Id: vacuum.c,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
#include "os.h"

#ifndef SQLITE_OMIT_VACUUM
/*







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains code used to implement the VACUUM command.
**
** Most of the code in this file may be omitted by defining the
** SQLITE_OMIT_VACUUM macro.
**
** $Id: vacuum.c,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
#include "os.h"

#ifndef SQLITE_OMIT_VACUUM
/*

Changes to SQLite.Interop/src/vdbe.c.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
2513
2514
2515
2516
2517
2518
2519


2520
2521
2522
2523
2524
2525
2526
....
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
....
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125





4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139

4140

4141
4142
4143
4144
4145
4146
4147




4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.27 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
................................................................................
    rc = sqlite3BtreeGetMeta(pBt, 1, (u32 *)&iMeta);
  }else{
    rc = SQLITE_OK;
    iMeta = 0;
  }
  if( rc==SQLITE_OK && iMeta!=pOp->p2 ){
    sqlite3SetString(&p->zErrMsg, "database schema has changed", (char*)0);


    rc = SQLITE_SCHEMA;
  }
  break;
}

/* Opcode: OpenRead P1 P2 P3
**
................................................................................
**
** See also: Distinct, NotFound, MoveTo, IsUnique, NotExists
*/
/* Opcode: NotFound P1 P2 *
**
** The top of the stack holds a blob constructed by MakeRecord.  P1 is
** an index.  If no entry exists in P1 that matches the blob then jump
** to P1.  If an entry does existing, fall through.  The cursor is left
** pointing to the entry that matches.  The blob is popped from the stack.
**
** The difference between this operation and Distinct is that
** Distinct does not pop the key from the stack.
**
** See also: Distinct, Found, MoveTo, NotExists, IsUnique
*/
................................................................................
case OP_DropTrigger: {        /* no-push */
  sqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p3);
  break;
}


#ifndef SQLITE_OMIT_INTEGRITY_CHECK
/* Opcode: IntegrityCk * P2 *
**
** Do an analysis of the currently open database.  Push onto the
** stack the text of an error message describing any problems.
** If there are no errors, push a "ok" onto the stack.





**
** The root page numbers of all tables in the database are integer
** values on the stack.  This opcode pulls as many integers as it
** can off of the stack and uses those numbers as the root pages.
**
** If P2 is not zero, the check is done on the auxiliary database
** file, not the main database file.
**
** This opcode is used for testing purposes only.
*/
case OP_IntegrityCk: {
  int nRoot;
  int *aRoot;
  int j;

  char *z;


  for(nRoot=0; &pTos[-nRoot]>=p->aStack; nRoot++){
    if( (pTos[-nRoot].flags & MEM_Int)==0 ) break;
  }
  assert( nRoot>0 );
  aRoot = sqliteMallocRaw( sizeof(int*)*(nRoot+1) );
  if( aRoot==0 ) goto no_mem;




  for(j=0; j<nRoot; j++){
    Mem *pMem = &pTos[-j];
    aRoot[j] = pMem->i;
  }
  aRoot[j] = 0;
  popStack(&pTos, nRoot);
  pTos++;
  z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p2].pBt, aRoot, nRoot);
  if( z==0 || z[0]==0 ){
    if( z ) sqliteFree(z);
    pTos->z = "ok";
    pTos->n = 2;
    pTos->flags = MEM_Str | MEM_Static | MEM_Term;
  }else{
    pTos->z = z;
    pTos->n = strlen(z);
    pTos->flags = MEM_Str | MEM_Dyn | MEM_Term;
    pTos->xDel = 0;
  }
  pTos->enc = SQLITE_UTF8;







|







 







>
>







 







|







 







|



|
>
>
>
>
>








|





>

>







>
>
>
>







|
|
|
|
|
|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
....
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
....
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.28 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
................................................................................
    rc = sqlite3BtreeGetMeta(pBt, 1, (u32 *)&iMeta);
  }else{
    rc = SQLITE_OK;
    iMeta = 0;
  }
  if( rc==SQLITE_OK && iMeta!=pOp->p2 ){
    sqlite3SetString(&p->zErrMsg, "database schema has changed", (char*)0);
    sqlite3ResetInternalSchema(db, pOp->p1);
    sqlite3ExpirePreparedStatements(db);
    rc = SQLITE_SCHEMA;
  }
  break;
}

/* Opcode: OpenRead P1 P2 P3
**
................................................................................
**
** See also: Distinct, NotFound, MoveTo, IsUnique, NotExists
*/
/* Opcode: NotFound P1 P2 *
**
** The top of the stack holds a blob constructed by MakeRecord.  P1 is
** an index.  If no entry exists in P1 that matches the blob then jump
** to P2.  If an entry does existing, fall through.  The cursor is left
** pointing to the entry that matches.  The blob is popped from the stack.
**
** The difference between this operation and Distinct is that
** Distinct does not pop the key from the stack.
**
** See also: Distinct, Found, MoveTo, NotExists, IsUnique
*/
................................................................................
case OP_DropTrigger: {        /* no-push */
  sqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p3);
  break;
}


#ifndef SQLITE_OMIT_INTEGRITY_CHECK
/* Opcode: IntegrityCk P1 P2 *
**
** Do an analysis of the currently open database.  Push onto the
** stack the text of an error message describing any problems.
** If no problems are found, push a NULL onto the stack.
**
** P1 is the address of a memory cell that contains the maximum
** number of allowed errors.  At most mem[P1] errors will be reported.
** In other words, the analysis stops as soon as mem[P1] errors are 
** seen.  Mem[P1] is updated with the number of errors remaining.
**
** The root page numbers of all tables in the database are integer
** values on the stack.  This opcode pulls as many integers as it
** can off of the stack and uses those numbers as the root pages.
**
** If P2 is not zero, the check is done on the auxiliary database
** file, not the main database file.
**
** This opcode is used to implement the integrity_check pragma.
*/
case OP_IntegrityCk: {
  int nRoot;
  int *aRoot;
  int j;
  int nErr;
  char *z;
  Mem *pnErr;

  for(nRoot=0; &pTos[-nRoot]>=p->aStack; nRoot++){
    if( (pTos[-nRoot].flags & MEM_Int)==0 ) break;
  }
  assert( nRoot>0 );
  aRoot = sqliteMallocRaw( sizeof(int*)*(nRoot+1) );
  if( aRoot==0 ) goto no_mem;
  j = pOp->p1;
  assert( j>=0 && j<p->nMem );
  pnErr = &p->aMem[j];
  assert( (pnErr->flags & MEM_Int)!=0 );
  for(j=0; j<nRoot; j++){
    Mem *pMem = &pTos[-j];
    aRoot[j] = pMem->i;
  }
  aRoot[j] = 0;
  popStack(&pTos, nRoot);
  pTos++;
  z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p2].pBt, aRoot, nRoot,
                                 pnErr->i, &nErr);
  pnErr->i -= nErr;
  if( nErr==0 ){
    assert( z==0 );
    pTos->flags = MEM_Null;
  }else{
    pTos->z = z;
    pTos->n = strlen(z);
    pTos->flags = MEM_Str | MEM_Dyn | MEM_Term;
    pTos->xDel = 0;
  }
  pTos->enc = SQLITE_UTF8;

Changes to SQLite.Interop/src/vdbe.h.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** Header file for the Virtual DataBase Engine (VDBE)
**
** This header defines the interface to the virtual database engine
** or VDBE.  The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
** $Id: vdbe.h,v 1.25 2007/01/10 14:50:46 rmsimpson Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
#include <stdio.h>

/*
** A single VDBE is an opaque structure named "Vdbe".  Only routines







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** Header file for the Virtual DataBase Engine (VDBE)
**
** This header defines the interface to the virtual database engine
** or VDBE.  The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
** $Id: vdbe.h,v 1.26 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
#include <stdio.h>

/*
** A single VDBE is an opaque structure named "Vdbe".  Only routines

Changes to SQLite.Interop/src/vdbeInt.h.

11
12
13
14
15
16
17


18
19
20
21
22
23
24
...
399
400
401
402
403
404
405


*************************************************************************
** This is the header file for information that is private to the
** VDBE.  This information used to all be at the top of the single
** source code file "vdbe.c".  When that file became too big (over
** 6000 lines long) it was split up into several smaller files and
** this header information was factored out.
*/



/*
** intToKey() and keyToInt() used to transform the rowid.  But with
** the latest versions of the design they are no-ops.
*/
#define keyToInt(X)   (X)
#define intToKey(X)   (X)
................................................................................
int sqlite3VdbeMemTranslate(Mem*, u8);
void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
int sqlite3VdbeMemHandleBom(Mem *pMem);
void sqlite3VdbeFifoInit(Fifo*);
int sqlite3VdbeFifoPush(Fifo*, i64);
int sqlite3VdbeFifoPop(Fifo*, i64*);
void sqlite3VdbeFifoClear(Fifo*);









>
>







 







>
>
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
401
402
403
404
405
406
407
408
409
*************************************************************************
** This is the header file for information that is private to the
** VDBE.  This information used to all be at the top of the single
** source code file "vdbe.c".  When that file became too big (over
** 6000 lines long) it was split up into several smaller files and
** this header information was factored out.
*/
#ifndef _VDBEINT_H_
#define _VDBEINT_H_

/*
** intToKey() and keyToInt() used to transform the rowid.  But with
** the latest versions of the design they are no-ops.
*/
#define keyToInt(X)   (X)
#define intToKey(X)   (X)
................................................................................
int sqlite3VdbeMemTranslate(Mem*, u8);
void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
int sqlite3VdbeMemHandleBom(Mem *pMem);
void sqlite3VdbeFifoInit(Fifo*);
int sqlite3VdbeFifoPush(Fifo*, i64);
int sqlite3VdbeFifoPop(Fifo*, i64*);
void sqlite3VdbeFifoClear(Fifo*);

#endif /* !defined(_VDBEINT_H_) */

Changes to SQLite.Interop/src/vtab.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to help implement virtual tables.
**
** $Id: vtab.c,v 1.3 2007/01/10 14:50:46 rmsimpson Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"

/*
** External API function used to create a new virtual-table module.
*/







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to help implement virtual tables.
**
** $Id: vtab.c,v 1.4 2007/01/30 15:20:47 rmsimpson Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"

/*
** External API function used to create a new virtual-table module.
*/

Changes to SQLite.Interop/src/where.c.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
156
157
158
159
160
161
162
163








164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
....
1271
1272
1273
1274
1275
1276
1277

1278
1279
1280
1281
1282
1283
1284
....
1361
1362
1363
1364
1365
1366
1367











1368
1369
1370
1371
1372
1373
1374
....
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
....
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
....
1632
1633
1634
1635
1636
1637
1638
1639

1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements.  This module is reponsible for
** generating the code that loops through a table looking for applicable
** rows.  Indices are selected and used to speed the search when doing
** so is applicable.  Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.27 2007/01/10 14:50:46 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** The number of bits in a Bitmask.  "BMS" means "BitMask Size".
*/
#define BMS  (sizeof(Bitmask)*8)
................................................................................
#define WO_LE     (WO_EQ<<(TK_LE-TK_EQ))
#define WO_GT     (WO_EQ<<(TK_GT-TK_EQ))
#define WO_GE     (WO_EQ<<(TK_GE-TK_EQ))
#define WO_MATCH  64
#define WO_ISNULL 128

/*
** Value for flags returned by bestIndex()








*/
#define WHERE_ROWID_EQ       0x0001   /* rowid=EXPR or rowid IN (...) */
#define WHERE_ROWID_RANGE    0x0002   /* rowid<EXPR and/or rowid>EXPR */
#define WHERE_COLUMN_EQ      0x0010   /* x=EXPR or x IN (...) */
#define WHERE_COLUMN_RANGE   0x0020   /* x<EXPR and/or x>EXPR */
#define WHERE_COLUMN_IN      0x0040   /* x IN (...) */
#define WHERE_TOP_LIMIT      0x0100   /* x<EXPR or x<=EXPR constraint */
#define WHERE_BTM_LIMIT      0x0200   /* x>EXPR or x>=EXPR constraint */
#define WHERE_IDX_ONLY       0x0800   /* Use index only - omit table */
#define WHERE_ORDERBY        0x1000   /* Output will appear in correct order */
#define WHERE_REVERSE        0x2000   /* Scan in reverse order */
#define WHERE_UNIQUE         0x4000   /* Selects no more than one row */
#define WHERE_VIRTUALTABLE   0x8000   /* Use virtual-table processing */

/*
** Initialize a preallocated WhereClause structure.
*/
static void whereClauseInit(WhereClause *pWC, Parse *pParse){
  pWC->pParse = pParse;
  pWC->nTerm = 0;
................................................................................
  int bestFlags = 0;          /* Flags associated with bestIdx */
  int bestNEq = 0;            /* Best value for nEq */
  int iCur = pSrc->iCursor;   /* The cursor of the table to be accessed */
  Index *pProbe;              /* An index we are evaluating */
  int rev;                    /* True to scan in reverse order */
  int flags;                  /* Flags associated with pProbe */
  int nEq;                    /* Number of == or IN constraints */

  double cost;                /* Cost of using pProbe */

  TRACE(("bestIndex: tbl=%s notReady=%x\n", pSrc->pTab->zName, notReady));
  lowestCost = SQLITE_BIG_DBL;
  pProbe = pSrc->pTab->pIndex;

  /* If the table has no indices and there are no terms in the where
................................................................................
      TRACE(("... sorting increases cost to %.9g\n", cost));
    }
  }
  if( cost<lowestCost ){
    lowestCost = cost;
    bestFlags = flags;
  }












  /* Look at each index.
  */
  for(; pProbe; pProbe=pProbe->pNext){
    int i;                       /* Loop counter */
    double inMultiplier = 1;

................................................................................

    /* Count the number of columns in the index that are satisfied
    ** by x=EXPR constraints or x IN (...) constraints.
    */
    flags = 0;
    for(i=0; i<pProbe->nColumn; i++){
      int j = pProbe->aiColumn[i];
      pTerm = findTerm(pWC, iCur, j, notReady, WO_EQ|WO_IN|WO_ISNULL, pProbe);
      if( pTerm==0 ) break;
      flags |= WHERE_COLUMN_EQ;
      if( pTerm->eOperator & WO_IN ){
        Expr *pExpr = pTerm->pExpr;
        flags |= WHERE_COLUMN_IN;
        if( pExpr->pSelect!=0 ){
          inMultiplier *= 25;
................................................................................
  }

  /* Report the best result
  */
  *ppIndex = bestIdx;
  TRACE(("best index is %s, cost=%.9g, flags=%x, nEq=%d\n",
        bestIdx ? bestIdx->zName : "(none)", lowestCost, bestFlags, bestNEq));
  *pFlags = bestFlags;
  *pnEq = bestNEq;
  return lowestCost;
}


/*
** Disable a term in the WHERE clause.  Except, do not disable the term
................................................................................
  if( pLevel->flags & WHERE_COLUMN_IN ){
    pParse->nMem += pLevel->nEq;
    termsInMem = 1;
  }

  /* Evaluate the equality constraints
  */
  for(j=0; j<pIdx->nColumn; j++){

    int k = pIdx->aiColumn[j];
    pTerm = findTerm(pWC, iCur, k, notReady, WO_EQ|WO_IN|WO_ISNULL, pIdx);
    if( pTerm==0 ) break;
    assert( (pTerm->flags & TERM_CODED)==0 );
    codeEqualityTerm(pParse, pTerm, brk, pLevel);
    if( (pTerm->eOperator & WO_ISNULL)==0 ){
      sqlite3VdbeAddOp(v, OP_IsNull, termsInMem ? -1 : -(j+1), brk);
    }
    if( termsInMem ){
      sqlite3VdbeAddOp(v, OP_MemStore, pLevel->iMem+j+1, 1);
    }
  }
  assert( j==nEq );

  /* Make sure all the constraint values are on the top of the stack
  */
  if( termsInMem ){
    for(j=0; j<nEq; j++){
      sqlite3VdbeAddOp(v, OP_MemLoad, pLevel->iMem+j+1, 0);
    }







|







 







|
>
>
>
>
>
>
>
>

|
|
|
|
|
|
|
|
|
|
|
|







 







>







 







>
>
>
>
>
>
>
>
>
>
>







 







|







 







|







 







|
>

|










<







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
....
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
....
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
....
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
....
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
....
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672

1673
1674
1675
1676
1677
1678
1679
** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements.  This module is reponsible for
** generating the code that loops through a table looking for applicable
** rows.  Indices are selected and used to speed the search when doing
** so is applicable.  Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.28 2007/01/30 15:20:47 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** The number of bits in a Bitmask.  "BMS" means "BitMask Size".
*/
#define BMS  (sizeof(Bitmask)*8)
................................................................................
#define WO_LE     (WO_EQ<<(TK_LE-TK_EQ))
#define WO_GT     (WO_EQ<<(TK_GT-TK_EQ))
#define WO_GE     (WO_EQ<<(TK_GE-TK_EQ))
#define WO_MATCH  64
#define WO_ISNULL 128

/*
** Value for flags returned by bestIndex().  
**
** The least significant byte is reserved as a mask for WO_ values above.
** The WhereLevel.flags field is usually set to WO_IN|WO_EQ|WO_ISNULL.
** But if the table is the right table of a left join, WhereLevel.flags
** is set to WO_IN|WO_EQ.  The WhereLevel.flags field can then be used as
** the "op" parameter to findTerm when we are resolving equality constraints.
** ISNULL constraints will then not be used on the right table of a left
** join.  Tickets #2177 and #2189.
*/
#define WHERE_ROWID_EQ     0x000100   /* rowid=EXPR or rowid IN (...) */
#define WHERE_ROWID_RANGE  0x000200   /* rowid<EXPR and/or rowid>EXPR */
#define WHERE_COLUMN_EQ    0x001000   /* x=EXPR or x IN (...) */
#define WHERE_COLUMN_RANGE 0x002000   /* x<EXPR and/or x>EXPR */
#define WHERE_COLUMN_IN    0x004000   /* x IN (...) */
#define WHERE_TOP_LIMIT    0x010000   /* x<EXPR or x<=EXPR constraint */
#define WHERE_BTM_LIMIT    0x020000   /* x>EXPR or x>=EXPR constraint */
#define WHERE_IDX_ONLY     0x080000   /* Use index only - omit table */
#define WHERE_ORDERBY      0x100000   /* Output will appear in correct order */
#define WHERE_REVERSE      0x200000   /* Scan in reverse order */
#define WHERE_UNIQUE       0x400000   /* Selects no more than one row */
#define WHERE_VIRTUALTABLE 0x800000   /* Use virtual-table processing */

/*
** Initialize a preallocated WhereClause structure.
*/
static void whereClauseInit(WhereClause *pWC, Parse *pParse){
  pWC->pParse = pParse;
  pWC->nTerm = 0;
................................................................................
  int bestFlags = 0;          /* Flags associated with bestIdx */
  int bestNEq = 0;            /* Best value for nEq */
  int iCur = pSrc->iCursor;   /* The cursor of the table to be accessed */
  Index *pProbe;              /* An index we are evaluating */
  int rev;                    /* True to scan in reverse order */
  int flags;                  /* Flags associated with pProbe */
  int nEq;                    /* Number of == or IN constraints */
  int eqTermMask;             /* Mask of valid equality operators */
  double cost;                /* Cost of using pProbe */

  TRACE(("bestIndex: tbl=%s notReady=%x\n", pSrc->pTab->zName, notReady));
  lowestCost = SQLITE_BIG_DBL;
  pProbe = pSrc->pTab->pIndex;

  /* If the table has no indices and there are no terms in the where
................................................................................
      TRACE(("... sorting increases cost to %.9g\n", cost));
    }
  }
  if( cost<lowestCost ){
    lowestCost = cost;
    bestFlags = flags;
  }

  /* If the pSrc table is the right table of a LEFT JOIN then we may not
  ** use an index to satisfy IS NULL constraints on that table.  This is
  ** because columns might end up being NULL if the table does not match -
  ** a circumstance which the index cannot help us discover.  Ticket #2177.
  */
  if( (pSrc->jointype & JT_LEFT)!=0 ){
    eqTermMask = WO_EQ|WO_IN;
  }else{
    eqTermMask = WO_EQ|WO_IN|WO_ISNULL;
  }

  /* Look at each index.
  */
  for(; pProbe; pProbe=pProbe->pNext){
    int i;                       /* Loop counter */
    double inMultiplier = 1;

................................................................................

    /* Count the number of columns in the index that are satisfied
    ** by x=EXPR constraints or x IN (...) constraints.
    */
    flags = 0;
    for(i=0; i<pProbe->nColumn; i++){
      int j = pProbe->aiColumn[i];
      pTerm = findTerm(pWC, iCur, j, notReady, eqTermMask, pProbe);
      if( pTerm==0 ) break;
      flags |= WHERE_COLUMN_EQ;
      if( pTerm->eOperator & WO_IN ){
        Expr *pExpr = pTerm->pExpr;
        flags |= WHERE_COLUMN_IN;
        if( pExpr->pSelect!=0 ){
          inMultiplier *= 25;
................................................................................
  }

  /* Report the best result
  */
  *ppIndex = bestIdx;
  TRACE(("best index is %s, cost=%.9g, flags=%x, nEq=%d\n",
        bestIdx ? bestIdx->zName : "(none)", lowestCost, bestFlags, bestNEq));
  *pFlags = bestFlags | eqTermMask;
  *pnEq = bestNEq;
  return lowestCost;
}


/*
** Disable a term in the WHERE clause.  Except, do not disable the term
................................................................................
  if( pLevel->flags & WHERE_COLUMN_IN ){
    pParse->nMem += pLevel->nEq;
    termsInMem = 1;
  }

  /* Evaluate the equality constraints
  */
  assert( pIdx->nColumn>=nEq );
  for(j=0; j<nEq; j++){
    int k = pIdx->aiColumn[j];
    pTerm = findTerm(pWC, iCur, k, notReady, pLevel->flags, pIdx);
    if( pTerm==0 ) break;
    assert( (pTerm->flags & TERM_CODED)==0 );
    codeEqualityTerm(pParse, pTerm, brk, pLevel);
    if( (pTerm->eOperator & WO_ISNULL)==0 ){
      sqlite3VdbeAddOp(v, OP_IsNull, termsInMem ? -1 : -(j+1), brk);
    }
    if( termsInMem ){
      sqlite3VdbeAddOp(v, OP_MemStore, pLevel->iMem+j+1, 1);
    }
  }


  /* Make sure all the constraint values are on the top of the stack
  */
  if( termsInMem ){
    for(j=0; j<nEq; j++){
      sqlite3VdbeAddOp(v, OP_MemLoad, pLevel->iMem+j+1, 0);
    }