System.Data.SQLite
Check-in [79fe5ae73a]
Not logged in

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

Overview
Comment:3.2.3 code merge
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 79fe5ae73a51272c9eb1cbf530999c9884cd3cf0
User & Date: rmsimpson 2005-08-22 18:22:12
Context
2005-08-23
22:11
added new schemas IndexColumns, ViewColumns, ForeignKeys check-in: 91fab4183e user: rmsimpson tags: sourceforge
2005-08-22
18:22
3.2.3 code merge check-in: 79fe5ae73a user: rmsimpson tags: sourceforge
18:20
1.0.15 check-in: 36c2575662 user: rmsimpson tags: sourceforge
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

     1      1   #pragma unmanaged
     2      2   extern "C"
     3      3   {
     4         -
     5      4   /*
     6      5   ** 2005 February 15
     7      6   **
     8      7   ** The author disclaims copyright to this source code.  In place of
     9      8   ** a legal notice, here is a blessing:
    10      9   **
    11     10   **    May you do good and not evil.
................................................................................
    12     11   **    May you find forgiveness for yourself and forgive others.
    13     12   **    May you share freely, never taking more than you give.
    14     13   **
    15     14   *************************************************************************
    16     15   ** This file contains C code routines that used to generate VDBE code
    17     16   ** that implements the ALTER TABLE command.
    18     17   **
    19         -** $Id: alter.c,v 1.6 2005/08/01 19:32:08 rmsimpson Exp $
           18  +** $Id: alter.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    20     19   */
    21     20   #include "sqliteInt.h"
    22     21   #include <ctype.h>
    23     22   
    24     23   /*
    25     24   ** The code in this file only exists if we are not omitting the
    26     25   ** ALTER TABLE logic from the build.
................................................................................
   258    257     char *zName = 0;          /* NULL-terminated version of pName */ 
   259    258     sqlite3 *db = pParse->db; /* Database connection */
   260    259     Vdbe *v;
   261    260   #ifndef SQLITE_OMIT_TRIGGER
   262    261     char *zWhere = 0;         /* Where clause to locate temp triggers */
   263    262   #endif
   264    263     
          264  +  if( sqlite3_malloc_failed ) goto exit_rename_table;
   265    265     assert( pSrc->nSrc==1 );
   266    266   
   267    267     pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase);
   268    268     if( !pTab ) goto exit_rename_table;
   269    269     iDb = pTab->iDb;
   270    270     zDb = db->aDb[iDb].zName;
   271    271   
................................................................................
   499    499   void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){
   500    500     Table *pNew;
   501    501     Table *pTab;
   502    502     Vdbe *v;
   503    503     int iDb;
   504    504     int i;
   505    505     int nAlloc;
          506  +
   506    507   
   507    508     /* Look up the table being altered. */
   508         -  assert( !pParse->pNewTable );
          509  +  assert( pParse->pNewTable==0 );
          510  +  if( sqlite3_malloc_failed ) goto exit_begin_add_column;
   509    511     pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase);
   510    512     if( !pTab ) goto exit_begin_add_column;
   511    513   
   512    514     /* Make sure this is not an attempt to ALTER a view. */
   513    515     if( pTab->pSelect ){
   514    516       sqlite3ErrorMsg(pParse, "Cannot add a column to a view");
   515    517       goto exit_begin_add_column;
................................................................................
   520    522   
   521    523     /* Put a copy of the Table struct in Parse.pNewTable for the
   522    524     ** sqlite3AddColumn() function and friends to modify.
   523    525     */
   524    526     pNew = (Table *)sqliteMalloc(sizeof(Table));
   525    527     if( !pNew ) goto exit_begin_add_column;
   526    528     pParse->pNewTable = pNew;
          529  +  pNew->nRef = 1;
   527    530     pNew->nCol = pTab->nCol;
   528    531     assert( pNew->nCol>0 );
   529    532     nAlloc = (((pNew->nCol-1)/8)*8)+8;
   530    533     assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 );
   531    534     pNew->aCol = (Column *)sqliteMalloc(sizeof(Column)*nAlloc);
   532    535     pNew->zName = sqliteStrDup(pTab->zName);
   533    536     if( !pNew->aCol || !pNew->zName ){
................................................................................
   551    554     sqlite3ChangeCookie(pParse->db, v, iDb);
   552    555   
   553    556   exit_begin_add_column:
   554    557     sqlite3SrcListDelete(pSrc);
   555    558     return;
   556    559   }
   557    560   #endif  /* SQLITE_ALTER_TABLE */
   558         -
   559    561   }

Added SQLite.Interop/src/analyze.c.

            1  +#pragma unmanaged
            2  +extern "C"
            3  +{
            4  +/*
            5  +** 2005 July 8
            6  +**
            7  +** The author disclaims copyright to this source code.  In place of
            8  +** a legal notice, here is a blessing:
            9  +**
           10  +**    May you do good and not evil.
           11  +**    May you find forgiveness for yourself and forgive others.
           12  +**    May you share freely, never taking more than you give.
           13  +**
           14  +*************************************************************************
           15  +** This file contains code associated with the ANALYZE command.
           16  +**
           17  +** @(#) $Id: analyze.c,v 1.1 2005/08/22 18:22:12 rmsimpson Exp $
           18  +*/
           19  +#ifndef SQLITE_OMIT_ANALYZE
           20  +#include "sqliteInt.h"
           21  +
           22  +/*
           23  +** This routine generates code that opens the sqlite_stat1 table on cursor
           24  +** iStatCur.
           25  +**
           26  +** If the sqlite_stat1 tables does not previously exist, it is created.
           27  +** If it does previously exist, all entires associated with table zWhere
           28  +** are removed.  If zWhere==0 then all entries are removed.
           29  +*/
           30  +static void openStatTable(
           31  +  Parse *pParse,          /* Parsing context */
           32  +  int iDb,                /* The database we are looking in */
           33  +  int iStatCur,           /* Open the sqlite_stat1 table on this cursor */
           34  +  const char *zWhere      /* Delete entries associated with this table */
           35  +){
           36  +  sqlite3 *db = pParse->db;
           37  +  Db *pDb;
           38  +  int iRootPage;
           39  +  Table *pStat;
           40  +  Vdbe *v = sqlite3GetVdbe(pParse);
           41  +
           42  +  pDb = &db->aDb[iDb];
           43  +  if( (pStat = sqlite3FindTable(db, "sqlite_stat1", pDb->zName))==0 ){
           44  +    /* The sqlite_stat1 tables does not exist.  Create it.  
           45  +    ** Note that a side-effect of the CREATE TABLE statement is to leave
           46  +    ** the rootpage of the new table on the top of the stack.  This is
           47  +    ** important because the OpenWrite opcode below will be needing it. */
           48  +    sqlite3NestedParse(pParse,
           49  +      "CREATE TABLE %Q.sqlite_stat1(tbl,idx,stat)",
           50  +      pDb->zName
           51  +    );
           52  +    iRootPage = 0;  /* Cause rootpage to be taken from top of stack */
           53  +  }else if( zWhere ){
           54  +    /* The sqlite_stat1 table exists.  Delete all entries associated with
           55  +    ** the table zWhere. */
           56  +    sqlite3NestedParse(pParse,
           57  +       "DELETE FROM %Q.sqlite_stat1 WHERE tbl=%Q",
           58  +       pDb->zName, zWhere
           59  +    );
           60  +    iRootPage = pStat->tnum;
           61  +  }else{
           62  +    /* The sqlite_stat1 table already exists.  Delete all rows. */
           63  +    iRootPage = pStat->tnum;
           64  +    sqlite3VdbeAddOp(v, OP_Clear, pStat->tnum, iDb);
           65  +  }
           66  +
           67  +  /* Open the sqlite_stat1 table for writing.
           68  +  */
           69  +  sqlite3VdbeAddOp(v, OP_Integer, iDb, 0);
           70  +  sqlite3VdbeAddOp(v, OP_OpenWrite, iStatCur, iRootPage);
           71  +  sqlite3VdbeAddOp(v, OP_SetNumColumns, iStatCur, 3);
           72  +}
           73  +
           74  +/*
           75  +** Generate code to do an analysis of all indices associated with
           76  +** a single table.
           77  +*/
           78  +static void analyzeOneTable(
           79  +  Parse *pParse,   /* Parser context */
           80  +  Table *pTab,     /* Table whose indices are to be analyzed */
           81  +  int iStatCur,    /* Cursor that writes to the sqlite_stat1 table */
           82  +  int iMem         /* Available memory locations begin here */
           83  +){
           84  +  Index *pIdx;     /* An index to being analyzed */
           85  +  int iIdxCur;     /* Cursor number for index being analyzed */
           86  +  int nCol;        /* Number of columns in the index */
           87  +  Vdbe *v;         /* The virtual machine being built up */
           88  +  int i;           /* Loop counter */
           89  +  int topOfLoop;   /* The top of the loop */
           90  +  int endOfLoop;   /* The end of the loop */
           91  +  int addr;        /* The address of an instruction */
           92  +
           93  +  v = sqlite3GetVdbe(pParse);
           94  +  if( pTab==0 || pTab->pIndex==0 || pTab->pIndex->pNext==0 ){
           95  +    /* Do no analysis for tables with fewer than 2 indices */
           96  +    return;
           97  +  }
           98  +
           99  +#ifndef SQLITE_OMIT_AUTHORIZATION
          100  +  if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0,
          101  +      pParse->db->aDb[pTab->iDb].zName ) ){
          102  +    return;
          103  +  }
          104  +#endif
          105  +
          106  +  iIdxCur = pParse->nTab;
          107  +  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
          108  +    /* Open a cursor to the index to be analyzed
          109  +    */
          110  +    sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
          111  +    VdbeComment((v, "# %s", pIdx->zName));
          112  +    sqlite3VdbeOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum,
          113  +                     (char*)&pIdx->keyInfo, P3_KEYINFO);
          114  +    nCol = pIdx->nColumn;
          115  +    if( iMem+nCol*2>=pParse->nMem ){
          116  +      pParse->nMem = iMem+nCol*2+1;
          117  +    }
          118  +    sqlite3VdbeAddOp(v, OP_SetNumColumns, iIdxCur, nCol+1);
          119  +
          120  +    /* Memory cells are used as follows:
          121  +    **
          122  +    **    mem[iMem]:             The total number of rows in the table.
          123  +    **    mem[iMem+1]:           Number of distinct values in column 1
          124  +    **    ...
          125  +    **    mem[iMem+nCol]:        Number of distinct values in column N
          126  +    **    mem[iMem+nCol+1]       Last observed value of column 1
          127  +    **    ...
          128  +    **    mem[iMem+nCol+nCol]:   Last observed value of column N
          129  +    **
          130  +    ** Cells iMem through iMem+nCol are initialized to 0.  The others
          131  +    ** are initialized to NULL.
          132  +    */
          133  +    sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
          134  +    for(i=0; i<=nCol; i++){
          135  +      sqlite3VdbeAddOp(v, OP_MemStore, iMem+i, i==nCol);
          136  +    }
          137  +    sqlite3VdbeAddOp(v, OP_Null, 0, 0);
          138  +    for(i=0; i<nCol; i++){
          139  +      sqlite3VdbeAddOp(v, OP_MemStore, iMem+nCol+i+1, i==nCol-1);
          140  +    }
          141  +
          142  +    /* Do the analysis.
          143  +    */
          144  +    endOfLoop = sqlite3VdbeMakeLabel(v);
          145  +    sqlite3VdbeAddOp(v, OP_Rewind, iIdxCur, endOfLoop);
          146  +    topOfLoop = sqlite3VdbeCurrentAddr(v);
          147  +    sqlite3VdbeAddOp(v, OP_MemIncr, iMem, 0);
          148  +    for(i=0; i<nCol; i++){
          149  +      sqlite3VdbeAddOp(v, OP_Column, iIdxCur, i);
          150  +      sqlite3VdbeAddOp(v, OP_MemLoad, iMem+nCol+i+1, 0);
          151  +      sqlite3VdbeAddOp(v, OP_Ne, 0x100, 0);
          152  +    }
          153  +    sqlite3VdbeAddOp(v, OP_Goto, 0, endOfLoop);
          154  +    for(i=0; i<nCol; i++){
          155  +      addr = sqlite3VdbeAddOp(v, OP_MemIncr, iMem+i+1, 0);
          156  +      sqlite3VdbeChangeP2(v, topOfLoop + 3*i + 3, addr);
          157  +      sqlite3VdbeAddOp(v, OP_Column, iIdxCur, i);
          158  +      sqlite3VdbeAddOp(v, OP_MemStore, iMem+nCol+i+1, 1);
          159  +    }
          160  +    sqlite3VdbeResolveLabel(v, endOfLoop);
          161  +    sqlite3VdbeAddOp(v, OP_Next, iIdxCur, topOfLoop);
          162  +    sqlite3VdbeAddOp(v, OP_Close, iIdxCur, 0);
          163  +
          164  +    /* Store the results.  
          165  +    **
          166  +    ** The result is a single row of the sqlite_stmt1 table.  The first
          167  +    ** two columns are the names of the table and index.  The third column
          168  +    ** is a string composed of a list of integer statistics about the
          169  +    ** index.  The first integer in the list is the total number of entires
          170  +    ** in the index.  There is one additional integer in the list for each
          171  +    ** column of the table.  This additional integer is a guess of how many
          172  +    ** rows of the table the index will select.  If D is the count of distinct
          173  +    ** values and K is the total number of rows, then the integer is computed
          174  +    ** as:
          175  +    **
          176  +    **        I = (K+D-1)/D
          177  +    **
          178  +    ** If K==0 then no entry is made into the sqlite_stat1 table.  
          179  +    ** If K>0 then it is always the case the D>0 so division by zero
          180  +    ** is never possible.
          181  +    */
          182  +    sqlite3VdbeAddOp(v, OP_MemLoad, iMem, 0);
          183  +    addr = sqlite3VdbeAddOp(v, OP_IfNot, 0, 0);
          184  +    sqlite3VdbeAddOp(v, OP_NewRowid, iStatCur, 0);
          185  +    sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0);
          186  +    sqlite3VdbeOp3(v, OP_String8, 0, 0, pIdx->zName, 0);
          187  +    sqlite3VdbeAddOp(v, OP_MemLoad, iMem, 0);
          188  +    sqlite3VdbeOp3(v, OP_String8, 0, 0, " ", 0);
          189  +    for(i=0; i<nCol; i++){
          190  +      sqlite3VdbeAddOp(v, OP_MemLoad, iMem, 0);
          191  +      sqlite3VdbeAddOp(v, OP_MemLoad, iMem+i+1, 0);
          192  +      sqlite3VdbeAddOp(v, OP_Add, 0, 0);
          193  +      sqlite3VdbeAddOp(v, OP_AddImm, -1, 0);
          194  +      sqlite3VdbeAddOp(v, OP_MemLoad, iMem+i+1, 0);
          195  +      sqlite3VdbeAddOp(v, OP_Divide, 0, 0);
          196  +      if( i==nCol-1 ){
          197  +        sqlite3VdbeAddOp(v, OP_Concat, nCol*2-1, 0);
          198  +      }else{
          199  +        sqlite3VdbeAddOp(v, OP_Dup, 1, 0);
          200  +      }
          201  +    }
          202  +    sqlite3VdbeOp3(v, OP_MakeRecord, 3, 0, "ttt", 0);
          203  +    sqlite3VdbeAddOp(v, OP_Insert, iStatCur, 0);
          204  +    sqlite3VdbeChangeP2(v, addr, sqlite3VdbeCurrentAddr(v));
          205  +  }
          206  +}
          207  +
          208  +/*
          209  +** Generate code that will cause the most recent index analysis to
          210  +** be laoded into internal hash tables where is can be used.
          211  +*/
          212  +static void loadAnalysis(Parse *pParse, int iDb){
          213  +  Vdbe *v = sqlite3GetVdbe(pParse);
          214  +  sqlite3VdbeAddOp(v, OP_LoadAnalysis, iDb, 0);
          215  +}
          216  +
          217  +/*
          218  +** Generate code that will do an analysis of an entire database
          219  +*/
          220  +static void analyzeDatabase(Parse *pParse, int iDb){
          221  +  sqlite3 *db = pParse->db;
          222  +  HashElem *k;
          223  +  int iStatCur;
          224  +  int iMem;
          225  +
          226  +  sqlite3BeginWriteOperation(pParse, 0, iDb);
          227  +  iStatCur = pParse->nTab++;
          228  +  openStatTable(pParse, iDb, iStatCur, 0);
          229  +  iMem = pParse->nMem;
          230  +  for(k=sqliteHashFirst(&db->aDb[iDb].tblHash);  k; k=sqliteHashNext(k)){
          231  +    Table *pTab = (Table*)sqliteHashData(k);
          232  +    analyzeOneTable(pParse, pTab, iStatCur, iMem);
          233  +  }
          234  +  loadAnalysis(pParse, iDb);
          235  +}
          236  +
          237  +/*
          238  +** Generate code that will do an analysis of a single table in
          239  +** a database.
          240  +*/
          241  +static void analyzeTable(Parse *pParse, Table *pTab){
          242  +  int iDb;
          243  +  int iStatCur;
          244  +
          245  +  assert( pTab!=0 );
          246  +  iDb = pTab->iDb;
          247  +  sqlite3BeginWriteOperation(pParse, 0, iDb);
          248  +  iStatCur = pParse->nTab++;
          249  +  openStatTable(pParse, iDb, iStatCur, pTab->zName);
          250  +  analyzeOneTable(pParse, pTab, iStatCur, pParse->nMem);
          251  +  loadAnalysis(pParse, iDb);
          252  +}
          253  +
          254  +/*
          255  +** Generate code for the ANALYZE command.  The parser calls this routine
          256  +** when it recognizes an ANALYZE command.
          257  +**
          258  +**        ANALYZE                            -- 1
          259  +**        ANALYZE  <database>                -- 2
          260  +**        ANALYZE  ?<database>.?<tablename>  -- 3
          261  +**
          262  +** Form 1 causes all indices in all attached databases to be analyzed.
          263  +** Form 2 analyzes all indices the single database named.
          264  +** Form 3 analyzes all indices associated with the named table.
          265  +*/
          266  +void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){
          267  +  sqlite3 *db = pParse->db;
          268  +  int iDb;
          269  +  int i;
          270  +  char *z, *zDb;
          271  +  Table *pTab;
          272  +  Token *pTableName;
          273  +
          274  +  /* Read the database schema. If an error occurs, leave an error message
          275  +  ** and code in pParse and return NULL. */
          276  +  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
          277  +    return;
          278  +  }
          279  +
          280  +  if( pName1==0 ){
          281  +    /* Form 1:  Analyze everything */
          282  +    for(i=0; i<db->nDb; i++){
          283  +      if( i==1 ) continue;  /* Do not analyze the TEMP database */
          284  +      analyzeDatabase(pParse, i);
          285  +    }
          286  +  }else if( pName2==0 || pName2->n==0 ){
          287  +    /* Form 2:  Analyze the database or table named */
          288  +    iDb = sqlite3FindDb(db, pName1);
          289  +    if( iDb>=0 ){
          290  +      analyzeDatabase(pParse, iDb);
          291  +    }else{
          292  +      z = sqlite3NameFromToken(pName1);
          293  +      pTab = sqlite3LocateTable(pParse, z, 0);
          294  +      sqliteFree(z);
          295  +      if( pTab ){
          296  +        analyzeTable(pParse, pTab);
          297  +      }
          298  +    }
          299  +  }else{
          300  +    /* Form 3: Analyze the fully qualified table name */
          301  +    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName);
          302  +    if( iDb>=0 ){
          303  +      zDb = db->aDb[iDb].zName;
          304  +      z = sqlite3NameFromToken(pTableName);
          305  +      pTab = sqlite3LocateTable(pParse, z, zDb);
          306  +      sqliteFree(z);
          307  +      if( pTab ){
          308  +        analyzeTable(pParse, pTab);
          309  +      }
          310  +    }   
          311  +  }
          312  +}
          313  +
          314  +/*
          315  +** Used to pass information from the analyzer reader through to the
          316  +** callback routine.
          317  +*/
          318  +typedef struct analysisInfo analysisInfo;
          319  +struct analysisInfo {
          320  +  sqlite3 *db;
          321  +  const char *zDatabase;
          322  +};
          323  +
          324  +/*
          325  +** This callback is invoked once for each index when reading the
          326  +** sqlite_stat1 table.  
          327  +**
          328  +**     argv[0] = name of the index
          329  +**     argv[1] = results of analysis - on integer for each column
          330  +*/
          331  +static int analysisLoader(void *pData, int argc, char **argv, char **azNotUsed){
          332  +  analysisInfo *pInfo = (analysisInfo*)pData;
          333  +  Index *pIndex;
          334  +  int i, c;
          335  +  unsigned int v;
          336  +  const char *z;
          337  +
          338  +  assert( argc==2 );
          339  +  if( argv[0]==0 || argv[1]==0 ){
          340  +    return 0;
          341  +  }
          342  +  pIndex = sqlite3FindIndex(pInfo->db, argv[0], pInfo->zDatabase);
          343  +  if( pIndex==0 ){
          344  +    return 0;
          345  +  }
          346  +  z = argv[1];
          347  +  for(i=0; *z && i<=pIndex->nColumn; i++){
          348  +    v = 0;
          349  +    while( (c=z[0])>='0' && c<='9' ){
          350  +      v = v*10 + c - '0';
          351  +      z++;
          352  +    }
          353  +    pIndex->aiRowEst[i] = v;
          354  +    if( *z==' ' ) z++;
          355  +  }
          356  +  return 0;
          357  +}
          358  +
          359  +/*
          360  +** Load the content of the sqlite_stat1 table into the index hash tables.
          361  +*/
          362  +void sqlite3AnalysisLoad(sqlite3 *db, int iDb){
          363  +  analysisInfo sInfo;
          364  +  HashElem *i;
          365  +  char *zSql;
          366  +
          367  +  /* Clear any prior statistics */
          368  +  for(i=sqliteHashFirst(&db->aDb[iDb].idxHash); i; i=sqliteHashNext(i)){
          369  +    Index *pIdx = (Index *)sqliteHashData(i);
          370  +    sqlite3DefaultRowEst(pIdx);
          371  +  }
          372  +
          373  +  /* Check to make sure the sqlite_stat1 table existss */
          374  +  sInfo.db = db;
          375  +  sInfo.zDatabase = db->aDb[iDb].zName;
          376  +  if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)==0 ){
          377  +     return;
          378  +  }
          379  +
          380  +
          381  +  /* Load new statistics out of the sqlite_stat1 table */
          382  +  zSql = sqlite3MPrintf("SELECT idx, stat FROM %Q.sqlite_stat1",
          383  +                        sInfo.zDatabase);
          384  +  sqlite3SafetyOff(db);
          385  +  sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0);
          386  +  sqlite3SafetyOn(db);
          387  +  sqliteFree(zSql);
          388  +}
          389  +
          390  +
          391  +#endif /* SQLITE_OMIT_ANALYZE */
          392  +}

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

     1      1   #pragma unmanaged
     2      2   extern "C"
     3      3   {
     4         -  /*
            4  +/*
     5      5   ** 2003 April 6
     6      6   **
     7      7   ** The author disclaims copyright to this source code.  In place of
     8      8   ** a legal notice, here is a blessing:
     9      9   **
    10     10   **    May you do good and not evil.
    11     11   **    May you find forgiveness for yourself and forgive others.
    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15     15   ** This file contains code used to implement the ATTACH and DETACH commands.
    16     16   **
    17         -** $Id: attach.c,v 1.6 2005/08/01 19:32:08 rmsimpson Exp $
           17  +** $Id: attach.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   
    21     21   /*
    22     22   ** This routine is called by the parser to process an ATTACH statement:
    23     23   **
    24     24   **     ATTACH DATABASE filename AS dbname
................................................................................
   145    145       int i = db->nDb - 1;
   146    146       assert( i>=2 );
   147    147       if( db->aDb[i].pBt ){
   148    148         sqlite3BtreeClose(db->aDb[i].pBt);
   149    149         db->aDb[i].pBt = 0;
   150    150       }
   151    151       sqlite3ResetInternalSchema(db, 0);
   152         -    if( 0==pParse->nErr ){
   153         -      pParse->nErr++;
          152  +    assert( pParse->nErr>0 );  /* Always set by sqlite3ReadSchema() */
          153  +    if( pParse->rc==SQLITE_OK ){
   154    154         pParse->rc = SQLITE_ERROR;
   155    155       }
   156    156     }
   157    157   
   158    158   attach_end:
   159    159     sqliteFree(zFile);
   160    160     sqliteFree(zName);
................................................................................
   349    349         return 1;
   350    350       }
   351    351       pStep = pStep->pNext;
   352    352     }
   353    353     return 0;
   354    354   }
   355    355   #endif
   356         -
   357    356   }

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

     1      1   #pragma unmanaged
     2      2   extern "C"
     3      3   {
     4         -  /*
            4  +/*
     5      5   ** 2003 January 11
     6      6   **
     7      7   ** The author disclaims copyright to this source code.  In place of
     8      8   ** a legal notice, here is a blessing:
     9      9   **
    10     10   **    May you do good and not evil.
    11     11   **    May you find forgiveness for yourself and forgive others.
................................................................................
    13     13   **
    14     14   *************************************************************************
    15     15   ** This file contains code used to implement the sqlite3_set_authorizer()
    16     16   ** API.  This facility is an optional feature of the library.  Embedded
    17     17   ** systems that do not need this facility may omit it by recompiling
    18     18   ** the library with -DSQLITE_OMIT_AUTHORIZATION=1
    19     19   **
    20         -** $Id: auth.c,v 1.6 2005/08/01 19:32:09 rmsimpson Exp $
           20  +** $Id: auth.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    21     21   */
    22     22   #include "sqliteInt.h"
    23     23   
    24     24   /*
    25     25   ** All of the code in this file may be omitted by defining a single
    26     26   ** macro.
    27     27   */
................................................................................
   113    113     Table *pTab;          /* The table being read */
   114    114     const char *zCol;     /* Name of the column of the table */
   115    115     int iSrc;             /* Index in pTabList->a[] of table being read */
   116    116     const char *zDBase;   /* Name of database being accessed */
   117    117     TriggerStack *pStack; /* The stack of current triggers */
   118    118   
   119    119     if( db->xAuth==0 ) return;
          120  +  if( pExpr->op==TK_AS ) return;
   120    121     assert( pExpr->op==TK_COLUMN );
   121    122     for(iSrc=0; pTabList && iSrc<pTabList->nSrc; iSrc++){
   122    123       if( pExpr->iTable==pTabList->a[iSrc].iCursor ) break;
   123    124     }
   124    125     if( iSrc>=0 && pTabList && iSrc<pTabList->nSrc ){
   125    126       pTab = pTabList->a[iSrc].pTab;
   126    127     }else if( (pStack = pParse->trigStack)!=0 ){
................................................................................
   221    222     if( pContext->pParse ){
   222    223       pContext->pParse->zAuthContext = pContext->zAuthContext;
   223    224       pContext->pParse = 0;
   224    225     }
   225    226   }
   226    227   
   227    228   #endif /* SQLITE_OMIT_AUTHORIZATION */
   228         -
   229    229   }

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

     1      1   #pragma unmanaged
     2      2   extern "C"
     3      3   {
     4         -  /*
            4  +/*
     5      5   ** 2004 April 6
     6      6   **
     7      7   ** The author disclaims copyright to this source code.  In place of
     8      8   ** a legal notice, here is a blessing:
     9      9   **
    10     10   **    May you do good and not evil.
    11     11   **    May you find forgiveness for yourself and forgive others.
    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15         -** $Id: btree.c,v 1.7 2005/08/03 06:43:44 rmsimpson Exp $
           15  +** $Id: btree.c,v 1.8 2005/08/22 18:22:12 rmsimpson Exp $
    16     16   **
    17     17   ** This file implements a external (disk-based) database using BTrees.
    18     18   ** For a detailed discussion of BTrees, refer to
    19     19   **
    20     20   **     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
    21     21   **     "Sorting And Searching", pages 473-480. Addison-Wesley
    22     22   **     Publishing Company, Reading, Massachusetts.
................................................................................
   233    233   
   234    234   /* Forward declarations */
   235    235   typedef struct MemPage MemPage;
   236    236   
   237    237   /*
   238    238   ** This is a magic string that appears at the beginning of every
   239    239   ** SQLite database in order to identify the file as a real database.
   240         -**                                  123456789 123456 */
   241         -static const char zMagicHeader[] = "SQLite format 3";
          240  +**
          241  +** You can change this value at compile-time by specifying a
          242  +** -DSQLITE_FILE_HEADER="..." on the compiler command-line.  The
          243  +** header must be exactly 16 bytes including the zero-terminator so
          244  +** the string itself should be 15 characters long.  If you change
          245  +** the header, then your custom library will not be able to read 
          246  +** databases generated by the standard tools and the standard tools
          247  +** will not be able to read databases created by your custom library.
          248  +*/
          249  +#ifndef SQLITE_FILE_HEADER /* 123456789 123456 */
          250  +#  define SQLITE_FILE_HEADER "SQLite format 3"
          251  +#endif
          252  +static const char zMagicHeader[] = SQLITE_FILE_HEADER;
   242    253   
   243    254   /*
   244    255   ** Page type flags.  An ORed combination of these flags appear as the
   245    256   ** first byte of every BTree page.
   246    257   */
   247    258   #define PTF_INTKEY    0x01
   248    259   #define PTF_ZERODATA  0x02
................................................................................
   556    567   ** This a more complex version of findCell() that works for
   557    568   ** pages that do contain overflow cells.  See insert
   558    569   */
   559    570   static u8 *findOverflowCell(MemPage *pPage, int iCell){
   560    571     int i;
   561    572     for(i=pPage->nOverflow-1; i>=0; i--){
   562    573       int k;
   563         -	struct MemPage::_OvflCell *pOvfl;
          574  +    struct MemPage::_OvflCell *pOvfl;
   564    575       pOvfl = &pPage->aOvfl[i];
   565    576       k = pOvfl->idx;
   566    577       if( k<=iCell ){
   567    578         if( k==iCell ){
   568    579           return pOvfl->pCell;
   569    580         }
   570    581         iCell--;
................................................................................
  1594   1605   ** One or the other of the two processes must give way or there can be
  1595   1606   ** no progress.  By returning SQLITE_BUSY and not invoking the busy callback
  1596   1607   ** when A already has a read lock, we encourage A to give up and let B
  1597   1608   ** proceed.
  1598   1609   */
  1599   1610   int sqlite3BtreeBeginTrans(Btree *pBt, int wrflag){
  1600   1611     int rc = SQLITE_OK;
  1601         -  int busy = 0;
  1602         -  BusyHandler *pH;
  1603   1612   
  1604   1613     /* If the btree is already in a write-transaction, or it
  1605   1614     ** is already in a read-transaction and a read-transaction
  1606   1615     ** is requested, this is a no-op.
  1607   1616     */
  1608   1617     if( pBt->inTrans==TRANS_WRITE || (pBt->inTrans==TRANS_READ && !wrflag) ){
  1609   1618       return SQLITE_OK;
................................................................................
  1629   1638       if( rc==SQLITE_OK ){
  1630   1639         pBt->inTrans = (wrflag?TRANS_WRITE:TRANS_READ);
  1631   1640         if( wrflag ) pBt->inStmt = 0;
  1632   1641       }else{
  1633   1642         unlockBtreeIfUnused(pBt);
  1634   1643       }
  1635   1644     }while( rc==SQLITE_BUSY && pBt->inTrans==TRANS_NONE &&
  1636         -      (pH = pBt->pBusyHandler)!=0 && 
  1637         -      pH->xFunc && pH->xFunc(pH->pArg, busy++)
  1638         -  );
         1645  +          sqlite3InvokeBusyHandler(pBt->pBusyHandler) );
  1639   1646     return rc;
  1640   1647   }
  1641   1648   
  1642   1649   #ifndef SQLITE_OMIT_AUTOVACUUM
  1643   1650   
  1644   1651   /*
  1645   1652   ** Set the pointer-map entries for all children of page pPage. Also, if
................................................................................
  3594   3601     }
  3595   3602     assert( totalSize+2*nCell<=pPage->nFree );
  3596   3603     assert( pPage->nCell==0 );
  3597   3604     cellptr = pPage->cellOffset;
  3598   3605     data = pPage->aData;
  3599   3606     hdr = pPage->hdrOffset;
  3600   3607     put2byte(&data[hdr+3], nCell);
  3601         -  cellbody = allocateSpace(pPage, totalSize);
  3602         -  assert( cellbody>0 );
  3603         -  assert( pPage->nFree >= 2*nCell );
  3604         -  pPage->nFree -= 2*nCell;
  3605         -  for(i=0; i<nCell; i++){
  3606         -    put2byte(&data[cellptr], cellbody);
  3607         -    memcpy(&data[cellbody], apCell[i], aSize[i]);
  3608         -    cellptr += 2;
  3609         -    cellbody += aSize[i];
         3608  +  if( nCell ){
         3609  +    cellbody = allocateSpace(pPage, totalSize);
         3610  +    assert( cellbody>0 );
         3611  +    assert( pPage->nFree >= 2*nCell );
         3612  +    pPage->nFree -= 2*nCell;
         3613  +    for(i=0; i<nCell; i++){
         3614  +      put2byte(&data[cellptr], cellbody);
         3615  +      memcpy(&data[cellbody], apCell[i], aSize[i]);
         3616  +      cellptr += 2;
         3617  +      cellbody += aSize[i];
         3618  +    }
         3619  +    assert( cellbody==pPage->pBt->usableSize );
  3610   3620     }
  3611         -  assert( cellbody==pPage->pBt->usableSize );
  3612   3621     pPage->nCell = nCell;
  3613   3622   }
  3614   3623   
  3615   3624   /*
  3616   3625   ** The following parameters determine how many adjacent pages get involved
  3617   3626   ** in a balancing operation.  NN is the number of neighbors on either side
  3618   3627   ** of the page that participate in the balancing operation.  NB is the
................................................................................
  3808   3817     assert( pParent );
  3809   3818     TRACE(("BALANCE: begin page %d child of %d\n", pPage->pgno, pParent->pgno));
  3810   3819   
  3811   3820   #ifndef SQLITE_OMIT_QUICKBALANCE
  3812   3821     /*
  3813   3822     ** A special case:  If a new entry has just been inserted into a
  3814   3823     ** table (that is, a btree with integer keys and all data at the leaves)
  3815         -  ** an the new entry is the right-most entry in the tree (it has the
         3824  +  ** and the new entry is the right-most entry in the tree (it has the
  3816   3825     ** largest key) then use the special balance_quick() routine for
  3817   3826     ** balancing.  balance_quick() is much faster and results in a tighter
  3818   3827     ** packing of data in the common case.
  3819   3828     */
  3820   3829     if( pPage->leaf &&
  3821   3830         pPage->intKey &&
  3822   3831         pPage->leafData &&
................................................................................
  4081   4090         cntNew[i-1]--;
  4082   4091         r = cntNew[i-1] - 1;
  4083   4092         d = r + 1 - leafData;
  4084   4093       }
  4085   4094       szNew[i] = szRight;
  4086   4095       szNew[i-1] = szLeft;
  4087   4096     }
  4088         -  assert( cntNew[0]>0 );
         4097  +
         4098  +  /* Either we found one or more cells (cntnew[0])>0) or we are the
         4099  +  ** a virtual root page.  A virtual root page is when the real root
         4100  +  ** page is page 1 and we are the only child of that page.
         4101  +  */
         4102  +  assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) );
  4089   4103   
  4090   4104     /*
  4091   4105     ** Allocate k new pages.  Reuse old pages where possible.
  4092   4106     */
  4093   4107     assert( pPage->pgno>1 );
  4094   4108     pageFlags = pPage->aData[0];
  4095   4109     for(i=0; i<k; i++){
................................................................................
  4170   4184     j = 0;
  4171   4185     for(i=0; i<nNew; i++){
  4172   4186       /* Assemble the new sibling page. */
  4173   4187       MemPage *pNew = apNew[i];
  4174   4188       assert( j<nMaxCells );
  4175   4189       assert( pNew->pgno==pgnoNew[i] );
  4176   4190       assemblePage(pNew, cntNew[i]-j, &apCell[j], &szCell[j]);
  4177         -    assert( pNew->nCell>0 );
         4191  +    assert( pNew->nCell>0 || (nNew==1 && cntNew[0]==0) );
  4178   4192       assert( pNew->nOverflow==0 );
  4179   4193   
  4180   4194   #ifndef SQLITE_OMIT_AUTOVACUUM
  4181   4195       /* If this is an auto-vacuum database, update the pointer map entries
  4182   4196       ** that point to the siblings that were rearranged. These can be: left
  4183   4197       ** children of cells, the right-child of the page, or overflow pages
  4184   4198       ** pointed to by cells.
................................................................................
  4882   4896     int rc;
  4883   4897     BtCursor *pCur;
  4884   4898     if( pBt->inTrans!=TRANS_WRITE ){
  4885   4899       return pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
  4886   4900     }
  4887   4901     for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){
  4888   4902       if( pCur->pgnoRoot==(Pgno)iTable ){
  4889         -      if( pCur->wrFlag==0 ) 
  4890         -        return SQLITE_LOCKED;
         4903  +      if( pCur->wrFlag==0 ) return SQLITE_LOCKED;
  4891   4904         moveToRoot(pCur);
  4892   4905       }
  4893   4906     }
  4894   4907     rc = clearDatabasePage(pBt, (Pgno)iTable, 0, 0);
  4895   4908     if( rc ){
  4896   4909       sqlite3BtreeRollback(pBt);
  4897   4910     }
................................................................................
  5810   5823   int sqlite3BtreeReset(Btree *pBt){
  5811   5824     if( pBt->pCursor ) return SQLITE_BUSY;
  5812   5825     pBt->inTrans = TRANS_NONE;
  5813   5826     unlockBtreeIfUnused(pBt);
  5814   5827     return sqlite3pager_reset(pBt->pPager);
  5815   5828   }
  5816   5829   #endif
  5817         -
  5818   5830   }

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

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This header file defines the interface that the sqlite B-Tree file
    13     13   ** subsystem.  See comments in the source code for a detailed description
    14     14   ** of what each interface routine does.
    15     15   **
    16         -** @(#) $Id: btree.h,v 1.6 2005/08/01 19:32:09 rmsimpson Exp $
           16  +** @(#) $Id: btree.h,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    17     17   */
    18     18   #ifndef _BTREE_H_
    19     19   #define _BTREE_H_
    20     20   
    21     21   /* TODO: This definition is just included so other modules compile. It
    22     22   ** needs to be revisited.
    23     23   */

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

     1      1   #pragma unmanaged
     2      2   extern "C"
     3      3   {
     4         -  /*
            4  +/*
     5      5   ** 2001 September 15
     6      6   **
     7      7   ** The author disclaims copyright to this source code.  In place of
     8      8   ** a legal notice, here is a blessing:
     9      9   **
    10     10   **    May you do good and not evil.
    11     11   **    May you find forgiveness for yourself and forgive others.
................................................................................
    21     21   **     CREATE INDEX
    22     22   **     DROP INDEX
    23     23   **     creating ID lists
    24     24   **     BEGIN TRANSACTION
    25     25   **     COMMIT
    26     26   **     ROLLBACK
    27     27   **
    28         -** $Id: build.c,v 1.6 2005/08/01 19:32:09 rmsimpson Exp $
           28  +** $Id: build.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    29     29   */
    30     30   #include "sqliteInt.h"
    31     31   #include <ctype.h>
    32     32   
    33     33   /*
    34     34   ** This routine is called when a new SQL statement is beginning to
    35     35   ** be parsed.  Initialize the pParse structure as needed.
................................................................................
   199    199       return 0;
   200    200     }
   201    201   
   202    202     p = sqlite3FindTable(pParse->db, zName, zDbase);
   203    203     if( p==0 ){
   204    204       if( zDbase ){
   205    205         sqlite3ErrorMsg(pParse, "no such table: %s.%s", zDbase, zName);
   206         -    }else if( sqlite3FindTable(pParse->db, zName, 0)!=0 ){
   207         -      sqlite3ErrorMsg(pParse, "table \"%s\" is not in database \"%s\"",
   208         -         zName, zDbase);
   209    206       }else{
   210    207         sqlite3ErrorMsg(pParse, "no such table: %s", zName);
   211    208       }
   212    209       pParse->checkSchema = 1;
   213    210     }
   214    211     return p;
   215    212   }
................................................................................
   257    254   */
   258    255   static void sqliteDeleteIndex(sqlite3 *db, Index *p){
   259    256     Index *pOld;
   260    257   
   261    258     assert( db!=0 && p->zName!=0 );
   262    259     pOld = (Index *)sqlite3HashInsert(&db->aDb[p->iDb].idxHash, p->zName,
   263    260                             strlen(p->zName)+1, 0);
   264         -  if( pOld!=0 && pOld!=p ){
   265         -    sqlite3HashInsert(&db->aDb[p->iDb].idxHash, pOld->zName,
   266         -                     strlen(pOld->zName)+1, pOld);
   267         -  }
          261  +  assert( pOld==0 || pOld==p );
   268    262     freeIndex(p);
   269    263   }
   270    264   
   271    265   /*
   272    266   ** For the index called zIdxName which is found in the database iDb,
   273    267   ** unlike that index from its Table then remove the index from
   274    268   ** the index hash table and free all memory structures associated
................................................................................
   534    528   
   535    529   /*
   536    530   ** The token *pName contains the name of a database (either "main" or
   537    531   ** "temp" or the name of an attached db). This routine returns the
   538    532   ** index of the named database in db->aDb[], or -1 if the named db 
   539    533   ** does not exist.
   540    534   */
   541         -static int findDb(sqlite3 *db, Token *pName){
          535  +int sqlite3FindDb(sqlite3 *db, Token *pName){
   542    536     int i = -1;    /* Database number */
   543    537     int n;         /* Number of characters in the name */
   544    538     Db *pDb;       /* A database whose name space is being searched */
   545    539     char *zName;   /* Name we are searching for */
   546    540   
   547    541     zName = sqlite3NameFromToken(pName);
   548    542     if( zName ){
................................................................................
   582    576   ){
   583    577     int iDb;                    /* Database holding the object */
   584    578     sqlite3 *db = pParse->db;
   585    579   
   586    580     if( pName2 && pName2->n>0 ){
   587    581       assert( !db->init.busy );
   588    582       *pUnqual = pName2;
   589         -    iDb = findDb(db, pName1);
          583  +    iDb = sqlite3FindDb(db, pName1);
   590    584       if( iDb<0 ){
   591    585         sqlite3ErrorMsg(pParse, "unknown database %T", pName1);
   592    586         pParse->nErr++;
   593    587         return -1;
   594    588       }
   595    589     }else{
   596    590       assert( db->init.iDb==0 || db->init.busy );
................................................................................
   744    738     pParse->pNewTable = pTable;
   745    739   
   746    740     /* If this is the magic sqlite_sequence table used by autoincrement,
   747    741     ** then record a pointer to this table in the main database structure
   748    742     ** so that INSERT can find the table easily.
   749    743     */
   750    744   #ifndef SQLITE_OMIT_AUTOINCREMENT
   751         -  if( strcmp(zName, "sqlite_sequence")==0 ){
          745  +  if( !pParse->nested && strcmp(zName, "sqlite_sequence")==0 ){
   752    746       db->aDb[iDb].pSeqTab = pTable;
   753    747     }
   754    748   #endif
   755    749   
   756    750     /* Begin generating the code that will insert the table record into
   757    751     ** the SQLITE_MASTER table.  Note in particular that we must go ahead
   758    752     ** and allocate the record number for the table entry now.  Before any
................................................................................
   901    895   ** 'CLOB'        | SQLITE_AFF_TEXT
   902    896   ** 'TEXT'        | SQLITE_AFF_TEXT
   903    897   ** 'BLOB'        | SQLITE_AFF_NONE
   904    898   **
   905    899   ** If none of the substrings in the above table are found,
   906    900   ** SQLITE_AFF_NUMERIC is returned.
   907    901   */
   908         -static char sqlite3AffinityType(const char *zType, int nType){
          902  +char sqlite3AffinityType(const Token *pType){
   909    903     u32 h = 0;
   910    904     char aff = SQLITE_AFF_NUMERIC;
   911         -  const unsigned char *zIn = (const unsigned char *)zType;
   912         -  const unsigned char *zEnd = (zIn+nType);
          905  +  const unsigned char *zIn = pType->z;
          906  +  const unsigned char *zEnd = &pType->z[pType->n];
   913    907   
   914    908     while( zIn!=zEnd ){
   915    909       h = (h<<8) + sqlite3UpperToLower[*zIn];
   916    910       zIn++;
   917    911       if( h==(('c'<<24)+('h'<<16)+('a'<<8)+'r') ){             /* CHAR */
   918    912         aff = SQLITE_AFF_TEXT; 
   919    913       }else if( h==(('c'<<24)+('l'<<16)+('o'<<8)+'b') ){       /* CLOB */
................................................................................
   937    931   ** parsing a CREATE TABLE statement.  The pFirst token is the first
   938    932   ** token in the sequence of tokens that describe the type of the
   939    933   ** column currently under construction.   pLast is the last token
   940    934   ** in the sequence.  Use this information to construct a string
   941    935   ** that contains the typename of the column and store that string
   942    936   ** in zType.
   943    937   */ 
   944         -void sqlite3AddColumnType(Parse *pParse, Token *pFirst, Token *pLast){
          938  +void sqlite3AddColumnType(Parse *pParse, Token *pType){
   945    939     Table *p;
   946         -  int i, j;
   947         -  int n;
   948         -  char *z;
   949         -  const unsigned char *zIn;
   950         -
          940  +  int i;
   951    941     Column *pCol;
          942  +
   952    943     if( (p = pParse->pNewTable)==0 ) return;
   953    944     i = p->nCol-1;
   954    945     if( i<0 ) return;
   955    946     pCol = &p->aCol[i];
   956         -  zIn = pFirst->z;
   957         -  n = pLast->n + (pLast->z - zIn);
   958    947     assert( pCol->zType==0 );
   959         -  z = pCol->zType = (char *)sqliteMallocRaw(n+1);
   960         -  if( z==0 ) return;
   961         -  for(i=j=0; i<n; i++){
   962         -    int c = zIn[i];
   963         -    if( isspace(c) ) continue;
   964         -    z[j++] = c;
   965         -  }
   966         -  z[j] = 0;
   967         -  pCol->affinity = sqlite3AffinityType(z, n);
          948  +  pCol->zType = sqlite3NameFromToken(pType);
          949  +  pCol->affinity = sqlite3AffinityType(pType);
   968    950   }
   969    951   
   970    952   /*
   971    953   ** The expression is the default value for the most recently added column
   972    954   ** of the table currently under construction.
   973    955   **
   974    956   ** Default value expressions must be constant.  Raise an exception if this
................................................................................
   976    958   **
   977    959   ** This routine is called by the parser while in the middle of
   978    960   ** parsing a CREATE TABLE statement.
   979    961   */
   980    962   void sqlite3AddDefaultValue(Parse *pParse, Expr *pExpr){
   981    963     Table *p;
   982    964     Column *pCol;
   983         -  if( (p = pParse->pNewTable)==0 ) return;
   984         -  pCol = &(p->aCol[p->nCol-1]);
   985         -  if( !sqlite3ExprIsConstant(pExpr) ){
   986         -    sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant",
   987         -        pCol->zName);
   988         -  }else{
   989         -    sqlite3ExprDelete(pCol->pDflt);
   990         -    pCol->pDflt = sqlite3ExprDup(pExpr);
          965  +  if( (p = pParse->pNewTable)!=0 ){
          966  +    pCol = &(p->aCol[p->nCol-1]);
          967  +    if( !sqlite3ExprIsConstantOrFunction(pExpr) ){
          968  +      sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant",
          969  +          pCol->zName);
          970  +    }else{
          971  +      sqlite3ExprDelete(pCol->pDflt);
          972  +      pCol->pDflt = sqlite3ExprDup(pExpr);
          973  +    }
   991    974     }
   992    975     sqlite3ExprDelete(pExpr);
   993    976   }
   994    977   
   995    978   /*
   996    979   ** Designate the PRIMARY KEY for the table.  pList is a list of names 
   997    980   ** of columns that form the primary key.  If pList is NULL, then the
................................................................................
  1316   1299   
  1317   1300       /* Create the rootpage for the new table and push it onto the stack.
  1318   1301       ** A view has no rootpage, so just push a zero onto the stack for
  1319   1302       ** views.  Initialize zType at the same time.
  1320   1303       */
  1321   1304       if( p->pSelect==0 ){
  1322   1305         /* A regular table */
  1323         -      /* sqlite3VdbeAddOp(v, OP_CreateTable, p->iDb, 0); */
  1324   1306         zType = "table";
  1325   1307         zType2 = "TABLE";
  1326   1308   #ifndef SQLITE_OMIT_VIEW
  1327   1309       }else{
  1328   1310         /* A view */
  1329         -    /*  sqlite3VdbeAddOp(v, OP_Integer, 0, 0); */
  1330   1311         zType = "view";
  1331   1312         zType2 = "VIEW";
  1332   1313   #endif
  1333   1314       }
  1334   1315   
  1335   1316       /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT
  1336   1317       ** statement to populate the new table. The root-page number for the
................................................................................
  1534   1515     **
  1535   1516     **     CREATE VIEW one AS SELECT * FROM two;
  1536   1517     **     CREATE VIEW two AS SELECT * FROM one;
  1537   1518     **
  1538   1519     ** Actually, this error is caught previously and so the following test
  1539   1520     ** should always fail.  But we will leave it in place just to be safe.
  1540   1521     */
         1522  +#if 0
  1541   1523     if( pTable->nCol<0 ){
  1542   1524       sqlite3ErrorMsg(pParse, "view %s is circularly defined", pTable->zName);
  1543   1525       return 1;
  1544   1526     }
         1527  +#endif
         1528  +  assert( pTable->nCol>=0 );
  1545   1529   
  1546   1530     /* If we get this far, it means we need to compute the table names.
  1547   1531     ** Note that the call to sqlite3ResultSetOfSelect() will expand any
  1548   1532     ** "*" elements in the results set of the view and will assign cursors
  1549   1533     ** to the elements of the FROM clause.  But we do not want these changes
  1550   1534     ** to be permanent.  So the computation is done on a copy of the SELECT
  1551   1535     ** statement that defines the view.
................................................................................
  1972   1956   static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
  1973   1957     Table *pTab = pIndex->pTable;  /* The table that is indexed */
  1974   1958     int iTab = pParse->nTab;       /* Btree cursor used for pTab */
  1975   1959     int iIdx = pParse->nTab+1;     /* Btree cursor used for pIndex */
  1976   1960     int addr1;                     /* Address of top of loop */
  1977   1961     int tnum;                      /* Root page of index */
  1978   1962     Vdbe *v;                       /* Generate code into this virtual machine */
  1979         -  int isUnique;                  /* True for a unique index */
  1980   1963   
  1981   1964   #ifndef SQLITE_OMIT_AUTHORIZATION
  1982   1965     if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,
  1983   1966         pParse->db->aDb[pIndex->iDb].zName ) ){
  1984   1967       return;
  1985   1968     }
  1986   1969   #endif
................................................................................
  2001   1984     }else{
  2002   1985       tnum = pIndex->tnum;
  2003   1986       sqlite3VdbeAddOp(v, OP_Clear, tnum, pIndex->iDb);
  2004   1987     }
  2005   1988     sqlite3VdbeAddOp(v, OP_Integer, pIndex->iDb, 0);
  2006   1989     sqlite3VdbeOp3(v, OP_OpenWrite, iIdx, tnum,
  2007   1990                       (char*)&pIndex->keyInfo, P3_KEYINFO);
  2008         -  sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
  2009         -  sqlite3VdbeAddOp(v, OP_OpenRead, iTab, pTab->tnum);
  2010         -  sqlite3VdbeAddOp(v, OP_SetNumColumns, iTab, pTab->nCol);
         1991  +  sqlite3OpenTableForReading(v, iTab, pTab);
  2011   1992     addr1 = sqlite3VdbeAddOp(v, OP_Rewind, iTab, 0);
  2012   1993     sqlite3GenerateIndexKey(v, pIndex, iTab);
  2013         -  isUnique = pIndex->onError!=OE_None;
  2014         -  sqlite3VdbeAddOp(v, OP_IdxInsert, iIdx, isUnique);
  2015         -  if( isUnique ){
  2016         -    sqlite3VdbeChangeP3(v, -1, "indexed columns are not unique", P3_STATIC);
         1994  +  if( pIndex->onError!=OE_None ){
         1995  +    int curaddr = sqlite3VdbeCurrentAddr(v);
         1996  +    int addr2 = curaddr+4;
         1997  +    sqlite3VdbeChangeP2(v, curaddr-1, addr2);
         1998  +    sqlite3VdbeAddOp(v, OP_Rowid, iTab, 0);
         1999  +    sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
         2000  +    sqlite3VdbeAddOp(v, OP_IsUnique, iIdx, addr2);
         2001  +    sqlite3VdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, OE_Abort,
         2002  +                    "indexed columns are not unique", P3_STATIC);
         2003  +    assert( addr2==sqlite3VdbeCurrentAddr(v) );
  2017   2004     }
         2005  +  sqlite3VdbeAddOp(v, OP_IdxInsert, iIdx, 0);
  2018   2006     sqlite3VdbeAddOp(v, OP_Next, iTab, addr1+1);
  2019   2007     sqlite3VdbeChangeP2(v, addr1, sqlite3VdbeCurrentAddr(v));
  2020   2008     sqlite3VdbeAddOp(v, OP_Close, iTab, 0);
  2021   2009     sqlite3VdbeAddOp(v, OP_Close, iIdx, 0);
  2022   2010   }
  2023   2011   
  2024   2012   /*
................................................................................
  2078   2066         iDb = 1;
  2079   2067       }
  2080   2068   #endif
  2081   2069   
  2082   2070       if( sqlite3FixInit(&sFix, pParse, iDb, "index", pName) &&
  2083   2071           sqlite3FixSrcList(&sFix, pTblName)
  2084   2072       ){
  2085         -      goto exit_create_index;
         2073  +      /* Because the parser constructs pTblName from a single identifier,
         2074  +      ** sqlite3FixSrcList can never fail. */
         2075  +      assert(0);
  2086   2076       }
  2087   2077       pTab = sqlite3LocateTable(pParse, pTblName->a[0].zName, 
  2088   2078           pTblName->a[0].zDatabase);
  2089   2079       if( !pTab ) goto exit_create_index;
  2090   2080       assert( iDb==pTab->iDb );
  2091   2081     }else{
  2092   2082       assert( pName==0 );
................................................................................
  2167   2157   #endif
  2168   2158   
  2169   2159     /* If pList==0, it means this routine was called to make a primary
  2170   2160     ** key out of the last column added to the table under construction.
  2171   2161     ** So create a fake list to simulate this.
  2172   2162     */
  2173   2163     if( pList==0 ){
  2174         -    nullId.z = (const unsigned char *)pTab->aCol[pTab->nCol-1].zName;
         2164  +    nullId.z = (unsigned char *)pTab->aCol[pTab->nCol-1].zName;
  2175   2165       nullId.n = strlen((const char *)nullId.z);
  2176   2166       pList = sqlite3ExprListAppend(0, 0, &nullId);
  2177   2167       if( pList==0 ) goto exit_create_index;
  2178   2168     }
  2179   2169   
  2180   2170     /* 
  2181   2171     ** Allocate the index structure. 
  2182   2172     */
  2183         -  pIndex = (Index *)sqliteMalloc( sizeof(Index) + strlen(zName) + 1 +
  2184         -                        (sizeof(int) + sizeof(CollSeq*))*pList->nExpr );
         2173  +  pIndex = (Index *)sqliteMalloc( sizeof(Index) + strlen(zName) + 1 + sizeof(int) +
         2174  +                        (sizeof(int)*2 + sizeof(CollSeq*))*pList->nExpr );
  2185   2175     if( sqlite3_malloc_failed ) goto exit_create_index;
  2186   2176     pIndex->aiColumn = (int*)&pIndex->keyInfo.aColl[pList->nExpr];
  2187         -  pIndex->zName = (char*)&pIndex->aiColumn[pList->nExpr];
         2177  +  pIndex->aiRowEst = (unsigned int *)&pIndex->aiColumn[pList->nExpr];
         2178  +  pIndex->zName = (char*)&pIndex->aiRowEst[pList->nExpr+1];
  2188   2179     strcpy(pIndex->zName, zName);
  2189   2180     pIndex->pTable = pTab;
  2190   2181     pIndex->nColumn = pList->nExpr;
  2191   2182     pIndex->onError = onError;
  2192   2183     pIndex->autoIndex = pName==0;
  2193   2184     pIndex->iDb = iDb;
  2194   2185   
................................................................................
  2216   2207       if( !db->init.busy && 
  2217   2208           sqlite3CheckCollSeq(pParse, pIndex->keyInfo.aColl[i]) 
  2218   2209       ){
  2219   2210         goto exit_create_index;
  2220   2211       }
  2221   2212     }
  2222   2213     pIndex->keyInfo.nField = pList->nExpr;
         2214  +  sqlite3DefaultRowEst(pIndex);
  2223   2215   
  2224   2216     if( pTab==pParse->pNewTable ){
  2225   2217       /* This routine has been called to create an automatic index as a
  2226   2218       ** result of a PRIMARY KEY or UNIQUE clause on a column definition, or
  2227   2219       ** a PRIMARY KEY or UNIQUE clause following the column definitions.
  2228   2220       ** i.e. one of:
  2229   2221       **
................................................................................
  2381   2373       freeIndex(pIndex);
  2382   2374     }
  2383   2375     sqlite3ExprListDelete(pList);
  2384   2376     sqlite3SrcListDelete(pTblName);
  2385   2377     sqliteFree(zName);
  2386   2378     return;
  2387   2379   }
         2380  +
         2381  +/*
         2382  +** Fill the Index.aiRowEst[] array with default information - information
         2383  +** to be used when we have not run the ANALYZE command.
         2384  +**
         2385  +** aiRowEst[0] is suppose to contain the number of elements in the index.
         2386  +** Since we do not know, guess 1 million.  aiRowEst[1] is an estimate of the
         2387  +** number of rows in the table that match any particular value of the
         2388  +** first column of the index.  aiRowEst[2] is an estimate of the number
         2389  +** of rows that match any particular combiniation of the first 2 columns
         2390  +** of the index.  And so forth.  It must always be the case that
         2391  +*
         2392  +**           aiRowEst[N]<=aiRowEst[N-1]
         2393  +**           aiRowEst[N]>=1
         2394  +**
         2395  +** Apart from that, we have little to go on besides intuition as to
         2396  +** how aiRowEst[] should be initialized.  The numbers generated here
         2397  +** are based on typical values found in actual indices.
         2398  +*/
         2399  +void sqlite3DefaultRowEst(Index *pIdx){
         2400  +  int *a = (int *)pIdx->aiRowEst;
         2401  +  int i;
         2402  +  assert( a!=0 );
         2403  +  a[0] = 1000000;
         2404  +  for(i=pIdx->nColumn; i>=1; i--){
         2405  +    a[i] = 10;
         2406  +  }
         2407  +  if( pIdx->onError!=OE_None ){
         2408  +    a[pIdx->nColumn] = 1;
         2409  +  }
         2410  +}
  2388   2411   
  2389   2412   /*
  2390   2413   ** This routine will drop an existing named index.  This routine
  2391   2414   ** implements the DROP INDEX statement.
  2392   2415   */
  2393   2416   void sqlite3DropIndex(Parse *pParse, SrcList *pName){
  2394   2417     Index *pIndex;
................................................................................
  2456   2479   IdList *sqlite3IdListAppend(IdList *pList, Token *pToken){
  2457   2480     if( pList==0 ){
  2458   2481       pList = (IdList *)sqliteMalloc( sizeof(IdList) );
  2459   2482       if( pList==0 ) return 0;
  2460   2483       pList->nAlloc = 0;
  2461   2484     }
  2462   2485     if( pList->nId>=pList->nAlloc ){
  2463         -	  struct IdList::IdList_item *a;
         2486  +    struct IdList::IdList_item *a;
  2464   2487       pList->nAlloc = pList->nAlloc*2 + 5;
  2465         -	a = (IdList::IdList_item *)sqliteRealloc(pList->a, pList->nAlloc*sizeof(pList->a[0]) );
         2488  +    a = (IdList::IdList_item *)sqliteRealloc(pList->a, pList->nAlloc*sizeof(pList->a[0]) );
  2466   2489       if( a==0 ){
  2467   2490         sqlite3IdListDelete(pList);
  2468   2491         return 0;
  2469   2492       }
  2470   2493       pList->a = a;
  2471   2494     }
  2472   2495     memset(&pList->a[pList->nId], 0, sizeof(pList->a[0]));
  2473   2496     pList->a[pList->nId].zName = sqlite3NameFromToken(pToken);
  2474   2497     pList->nId++;
  2475   2498     return pList;
  2476   2499   }
         2500  +
         2501  +/*
         2502  +** Delete an IdList.
         2503  +*/
         2504  +void sqlite3IdListDelete(IdList *pList){
         2505  +  int i;
         2506  +  if( pList==0 ) return;
         2507  +  for(i=0; i<pList->nId; i++){
         2508  +    sqliteFree(pList->a[i].zName);
         2509  +  }
         2510  +  sqliteFree(pList->a);
         2511  +  sqliteFree(pList);
         2512  +}
         2513  +
         2514  +/*
         2515  +** Return the index in pList of the identifier named zId.  Return -1
         2516  +** if not found.
         2517  +*/
         2518  +int sqlite3IdListIndex(IdList *pList, const char *zName){
         2519  +  int i;
         2520  +  if( pList==0 ) return -1;
         2521  +  for(i=0; i<pList->nId; i++){
         2522  +    if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i;
         2523  +  }
         2524  +  return -1;
         2525  +}
  2477   2526   
  2478   2527   /*
  2479   2528   ** Append a new table name to the given SrcList.  Create a new SrcList if
  2480   2529   ** need be.  A new entry is created in the SrcList even if pToken is NULL.
  2481   2530   **
  2482   2531   ** A new SrcList is returned, or NULL if malloc() fails.
  2483   2532   **
................................................................................
  2497   2546   ** like this:
  2498   2547   **
  2499   2548   **         sqlite3SrcListAppend(A,B,C);
  2500   2549   **
  2501   2550   ** Then C is the table name and B is the database name.
  2502   2551   */
  2503   2552   SrcList *sqlite3SrcListAppend(SrcList *pList, Token *pTable, Token *pDatabase){
  2504         -	struct SrcList::SrcList_item *pItem;
         2553  +  struct SrcList::SrcList_item *pItem;
  2505   2554     if( pList==0 ){
  2506   2555       pList = (SrcList *)sqliteMalloc( sizeof(SrcList) );
  2507   2556       if( pList==0 ) return 0;
  2508   2557       pList->nAlloc = 1;
  2509   2558     }
  2510   2559     if( pList->nSrc>=pList->nAlloc ){
  2511   2560       SrcList *pNew;
................................................................................
  2514   2563                  sizeof(*pList) + (pList->nAlloc-1)*sizeof(pList->a[0]) );
  2515   2564       if( pNew==0 ){
  2516   2565         sqlite3SrcListDelete(pList);
  2517   2566         return 0;
  2518   2567       }
  2519   2568       pList = pNew;
  2520   2569     }
  2521         -  pItem = &pList->a[pList->nSrc];
         2570  +  pItem = (SrcList::SrcList_item *)&pList->a[pList->nSrc];
  2522   2571     memset(pItem, 0, sizeof(pList->a[0]));
  2523   2572     if( pDatabase && pDatabase->z==0 ){
  2524   2573       pDatabase = 0;
  2525   2574     }
  2526   2575     if( pDatabase && pTable ){
  2527   2576       Token *pTemp = pDatabase;
  2528   2577       pDatabase = pTable;
................................................................................
  2555   2604   */
  2556   2605   void sqlite3SrcListAddAlias(SrcList *pList, Token *pToken){
  2557   2606     if( pList && pList->nSrc>0 ){
  2558   2607       pList->a[pList->nSrc-1].zAlias = sqlite3NameFromToken(pToken);
  2559   2608     }
  2560   2609   }
  2561   2610   
  2562         -/*
  2563         -** Delete an IdList.
  2564         -*/
  2565         -void sqlite3IdListDelete(IdList *pList){
  2566         -  int i;
  2567         -  if( pList==0 ) return;
  2568         -  for(i=0; i<pList->nId; i++){
  2569         -    sqliteFree(pList->a[i].zName);
  2570         -  }
  2571         -  sqliteFree(pList->a);
  2572         -  sqliteFree(pList);
  2573         -}
  2574         -
  2575         -/*
  2576         -** Return the index in pList of the identifier named zId.  Return -1
  2577         -** if not found.
  2578         -*/
  2579         -int sqlite3IdListIndex(IdList *pList, const char *zName){
  2580         -  int i;
  2581         -  if( pList==0 ) return -1;
  2582         -  for(i=0; i<pList->nId; i++){
  2583         -    if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i;
  2584         -  }
  2585         -  return -1;
  2586         -}
  2587         -
  2588   2611   /*
  2589   2612   ** Delete an entire SrcList including all its substructure.
  2590   2613   */
  2591   2614   void sqlite3SrcListDelete(SrcList *pList){
  2592   2615     int i;
  2593   2616     struct SrcList::SrcList_item *pItem;
  2594   2617     if( pList==0 ) return;
................................................................................
  2783   2806   #endif
  2784   2807   
  2785   2808   /*
  2786   2809   ** Recompute all indices of pTab that use the collating sequence pColl.
  2787   2810   ** If pColl==0 then recompute all indices of pTab.
  2788   2811   */
  2789   2812   #ifndef SQLITE_OMIT_REINDEX
  2790         -void reindexTable(Parse *pParse, Table *pTab, CollSeq *pColl){
         2813  +static void reindexTable(Parse *pParse, Table *pTab, CollSeq *pColl){
  2791   2814     Index *pIndex;              /* An index associated with pTab */
  2792   2815   
  2793   2816     for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
  2794   2817       if( pColl==0 || collationMatch(pColl,pIndex) ){
  2795   2818         sqlite3BeginWriteOperation(pParse, 0, pTab->iDb);
  2796   2819         sqlite3RefillIndex(pParse, pIndex, -1);
  2797   2820       }
................................................................................
  2801   2824   
  2802   2825   /*
  2803   2826   ** Recompute all indices of all tables in all databases where the
  2804   2827   ** indices use the collating sequence pColl.  If pColl==0 then recompute
  2805   2828   ** all indices everywhere.
  2806   2829   */
  2807   2830   #ifndef SQLITE_OMIT_REINDEX
  2808         -void reindexDatabases(Parse *pParse, CollSeq *pColl){
         2831  +static void reindexDatabases(Parse *pParse, CollSeq *pColl){
  2809   2832     Db *pDb;                    /* A single database */
  2810   2833     int iDb;                    /* The database index number */
  2811   2834     sqlite3 *db = pParse->db;   /* The database connection */
  2812   2835     HashElem *k;                /* For looping over tables in pDb */
  2813   2836     Table *pTab;                /* A table in the database */
  2814   2837   
  2815   2838     for(iDb=0, pDb=db->aDb; iDb<db->nDb; iDb++, pDb++){
  2816   2839       if( pDb==0 ) continue;
  2817         -      for(k=sqliteHashFirst(&pDb->tblHash);  k; k=sqliteHashNext(k)){
         2840  +    for(k=sqliteHashFirst(&pDb->tblHash);  k; k=sqliteHashNext(k)){
  2818   2841         pTab = (Table*)sqliteHashData(k);
  2819   2842         reindexTable(pParse, pTab, pColl);
  2820   2843       }
  2821   2844     }
  2822   2845   }
  2823   2846   #endif
  2824   2847   
................................................................................
  2878   2901       sqlite3BeginWriteOperation(pParse, 0, iDb);
  2879   2902       sqlite3RefillIndex(pParse, pIndex, -1);
  2880   2903       return;
  2881   2904     }
  2882   2905     sqlite3ErrorMsg(pParse, "unable to identify the object to be reindexed");
  2883   2906   }
  2884   2907   #endif
  2885         -
  2886   2908   }

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

     1      1   #pragma unmanaged
     2      2   extern "C"
     3      3   {
     4         -  /*
            4  +/*
     5      5   ** 2005 May 23 
     6      6   **
     7      7   ** The author disclaims copyright to this source code.  In place of
     8      8   ** a legal notice, here is a blessing:
     9      9   **
    10     10   **    May you do good and not evil.
    11     11   **    May you find forgiveness for yourself and forgive others.
................................................................................
    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15     15   **
    16     16   ** This file contains functions used to access the internal hash tables
    17     17   ** of user defined functions and collation sequences.
    18     18   **
    19         -** $Id: callback.c,v 1.2 2005/08/01 19:32:09 rmsimpson Exp $
           19  +** $Id: callback.c,v 1.3 2005/08/22 18:22:12 rmsimpson Exp $
    20     20   */
    21     21   
    22     22   #include "sqliteInt.h"
    23     23   
    24     24   /*
    25     25   ** Invoke the 'collation needed' callback to request a collation sequence
    26     26   ** in the database text encoding of name zName, length nName.
................................................................................
   146    146   ** array of three CollSeq structures. The first is the collation sequence
   147    147   ** prefferred for UTF-8, the second UTF-16le, and the third UTF-16be.
   148    148   **
   149    149   ** Stored immediately after the three collation sequences is a copy of
   150    150   ** the collation sequence name. A pointer to this string is stored in
   151    151   ** each collation sequence structure.
   152    152   */
   153         -static CollSeq * findCollSeqEntry(
          153  +static CollSeq *findCollSeqEntry(
   154    154     sqlite3 *db,
   155    155     const char *zName,
   156    156     int nName,
   157    157     int create
   158    158   ){
   159    159     CollSeq *pColl;
   160    160     if( nName<0 ) nName = strlen(zName);
................................................................................
   285    285     }
   286    286   
   287    287     /* If the createFlag parameter is true, and the seach did not reveal an
   288    288     ** exact match for the name, number of arguments and encoding, then add a
   289    289     ** new entry to the hash table and return it.
   290    290     */
   291    291     if( createFlag && bestmatch<6 && 
   292         -      (pBest = (FuncDef *)sqliteMalloc(sizeof(*pBest)+nName+1)) ){
          292  +      (pBest = (FuncDef *)sqliteMalloc(sizeof(*pBest)+nName)) ){
   293    293       pBest->nArg = nArg;
   294    294       pBest->pNext = pFirst;
   295         -    pBest->zName = (char*)&pBest[1];
   296    295       pBest->iPrefEnc = enc;
   297    296       memcpy(pBest->zName, zName, nName);
   298    297       pBest->zName[nName] = 0;
   299    298       if( pBest==sqlite3HashInsert(&db->aFunc,pBest->zName,nName,(void*)pBest) ){
   300    299         sqliteFree(pBest);
   301    300         return 0;
   302    301       }
................................................................................
   303    302     }
   304    303   
   305    304     if( pBest && (pBest->xStep || pBest->xFunc || createFlag) ){
   306    305       return pBest;
   307    306     }
   308    307     return 0;
   309    308   }
   310         -
   311    309   }

Added SQLite.Interop/src/complete.c.

            1  +#pragma unmanaged
            2  +extern "C"
            3  +{
            4  +/*
            5  +** 2001 September 15
            6  +**
            7  +** The author disclaims copyright to this source code.  In place of
            8  +** a legal notice, here is a blessing:
            9  +**
           10  +**    May you do good and not evil.
           11  +**    May you find forgiveness for yourself and forgive others.
           12  +**    May you share freely, never taking more than you give.
           13  +**
           14  +*************************************************************************
           15  +** An tokenizer for SQL
           16  +**
           17  +** This file contains C code that implements the sqlite3_complete() API.
           18  +** This code used to be part of the tokenizer.c source file.  But by
           19  +** separating it out, the code will be automatically omitted from
           20  +** static links that do not use it.
           21  +**
           22  +** $Id: complete.c,v 1.1 2005/08/22 18:22:12 rmsimpson Exp $
           23  +*/
           24  +#include "sqliteInt.h"
           25  +#ifndef SQLITE_OMIT_COMPLETE
           26  +
           27  +/*
           28  +** This is defined in tokenize.c.  We just have to import the definition.
           29  +*/
           30  +extern const char sqlite3IsIdChar[];
           31  +#define IdChar(C)  (((c=C)&0x80)!=0 || (c>0x1f && sqlite3IsIdChar[c-0x20]))
           32  +
           33  +
           34  +/*
           35  +** Token types used by the sqlite3_complete() routine.  See the header
           36  +** comments on that procedure for additional information.
           37  +*/
           38  +#define tkSEMI    0
           39  +#define tkWS      1
           40  +#define tkOTHER   2
           41  +#define tkEXPLAIN 3
           42  +#define tkCREATE  4
           43  +#define tkTEMP    5
           44  +#define tkTRIGGER 6
           45  +#define tkEND     7
           46  +
           47  +/*
           48  +** Return TRUE if the given SQL string ends in a semicolon.
           49  +**
           50  +** Special handling is require for CREATE TRIGGER statements.
           51  +** Whenever the CREATE TRIGGER keywords are seen, the statement
           52  +** must end with ";END;".
           53  +**
           54  +** This implementation uses a state machine with 7 states:
           55  +**
           56  +**   (0) START     At the beginning or end of an SQL statement.  This routine
           57  +**                 returns 1 if it ends in the START state and 0 if it ends
           58  +**                 in any other state.
           59  +**
           60  +**   (1) NORMAL    We are in the middle of statement which ends with a single
           61  +**                 semicolon.
           62  +**
           63  +**   (2) EXPLAIN   The keyword EXPLAIN has been seen at the beginning of 
           64  +**                 a statement.
           65  +**
           66  +**   (3) CREATE    The keyword CREATE has been seen at the beginning of a
           67  +**                 statement, possibly preceeded by EXPLAIN and/or followed by
           68  +**                 TEMP or TEMPORARY
           69  +**
           70  +**   (4) TRIGGER   We are in the middle of a trigger definition that must be
           71  +**                 ended by a semicolon, the keyword END, and another semicolon.
           72  +**
           73  +**   (5) SEMI      We've seen the first semicolon in the ";END;" that occurs at
           74  +**                 the end of a trigger definition.
           75  +**
           76  +**   (6) END       We've seen the ";END" of the ";END;" that occurs at the end
           77  +**                 of a trigger difinition.
           78  +**
           79  +** Transitions between states above are determined by tokens extracted
           80  +** from the input.  The following tokens are significant:
           81  +**
           82  +**   (0) tkSEMI      A semicolon.
           83  +**   (1) tkWS        Whitespace
           84  +**   (2) tkOTHER     Any other SQL token.
           85  +**   (3) tkEXPLAIN   The "explain" keyword.
           86  +**   (4) tkCREATE    The "create" keyword.
           87  +**   (5) tkTEMP      The "temp" or "temporary" keyword.
           88  +**   (6) tkTRIGGER   The "trigger" keyword.
           89  +**   (7) tkEND       The "end" keyword.
           90  +**
           91  +** Whitespace never causes a state transition and is always ignored.
           92  +**
           93  +** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed
           94  +** to recognize the end of a trigger can be omitted.  All we have to do
           95  +** is look for a semicolon that is not part of an string or comment.
           96  +*/
           97  +int sqlite3_complete(const char *zSql){
           98  +  u8 state = 0;   /* Current state, using numbers defined in header comment */
           99  +  u8 token;       /* Value of the next token */
          100  +
          101  +#ifndef SQLITE_OMIT_TRIGGER
          102  +  /* A complex statement machine used to detect the end of a CREATE TRIGGER
          103  +  ** statement.  This is the normal case.
          104  +  */
          105  +  static const u8 trans[7][8] = {
          106  +                     /* Token:                                                */
          107  +     /* State:       **  SEMI  WS  OTHER EXPLAIN  CREATE  TEMP  TRIGGER  END  */
          108  +     /* 0   START: */ {    0,  0,     1,      2,      3,    1,       1,   1,  },
          109  +     /* 1  NORMAL: */ {    0,  1,     1,      1,      1,    1,       1,   1,  },
          110  +     /* 2 EXPLAIN: */ {    0,  2,     1,      1,      3,    1,       1,   1,  },
          111  +     /* 3  CREATE: */ {    0,  3,     1,      1,      1,    3,       4,   1,  },
          112  +     /* 4 TRIGGER: */ {    5,  4,     4,      4,      4,    4,       4,   4,  },
          113  +     /* 5    SEMI: */ {    5,  5,     4,      4,      4,    4,       4,   6,  },
          114  +     /* 6     END: */ {    0,  6,     4,      4,      4,    4,       4,   4,  },
          115  +  };
          116  +#else
          117  +  /* If triggers are not suppored by this compile then the statement machine
          118  +  ** used to detect the end of a statement is much simplier
          119  +  */
          120  +  static const u8 trans[2][3] = {
          121  +                     /* Token:           */
          122  +     /* State:       **  SEMI  WS  OTHER */
          123  +     /* 0   START: */ {    0,  0,     1, },
          124  +     /* 1  NORMAL: */ {    0,  1,     1, },
          125  +  };
          126  +#endif /* SQLITE_OMIT_TRIGGER */
          127  +
          128  +  while( *zSql ){
          129  +    switch( *zSql ){
          130  +      case ';': {  /* A semicolon */
          131  +        token = tkSEMI;
          132  +        break;
          133  +      }
          134  +      case ' ':
          135  +      case '\r':
          136  +      case '\t':
          137  +      case '\n':
          138  +      case '\f': {  /* White space is ignored */
          139  +        token = tkWS;
          140  +        break;
          141  +      }
          142  +      case '/': {   /* C-style comments */
          143  +        if( zSql[1]!='*' ){
          144  +          token = tkOTHER;
          145  +          break;
          146  +        }
          147  +        zSql += 2;
          148  +        while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
          149  +        if( zSql[0]==0 ) return 0;
          150  +        zSql++;
          151  +        token = tkWS;
          152  +        break;
          153  +      }
          154  +      case '-': {   /* SQL-style comments from "--" to end of line */
          155  +        if( zSql[1]!='-' ){
          156  +          token = tkOTHER;
          157  +          break;
          158  +        }
          159  +        while( *zSql && *zSql!='\n' ){ zSql++; }
          160  +        if( *zSql==0 ) return state==0;
          161  +        token = tkWS;
          162  +        break;
          163  +      }
          164  +      case '[': {   /* Microsoft-style identifiers in [...] */
          165  +        zSql++;
          166  +        while( *zSql && *zSql!=']' ){ zSql++; }
          167  +        if( *zSql==0 ) return 0;
          168  +        token = tkOTHER;
          169  +        break;
          170  +      }
          171  +      case '`':     /* Grave-accent quoted symbols used by MySQL */
          172  +      case '"':     /* single- and double-quoted strings */
          173  +      case '\'': {
          174  +        int c = *zSql;
          175  +        zSql++;
          176  +        while( *zSql && *zSql!=c ){ zSql++; }
          177  +        if( *zSql==0 ) return 0;
          178  +        token = tkOTHER;
          179  +        break;
          180  +      }
          181  +      default: {
          182  +        int c;
          183  +        if( IdChar((u8)*zSql) ){
          184  +          /* Keywords and unquoted identifiers */
          185  +          int nId;
          186  +          for(nId=1; IdChar(zSql[nId]); nId++){}
          187  +#ifdef SQLITE_OMIT_TRIGGER
          188  +          token = tkOTHER;
          189  +#else
          190  +          switch( *zSql ){
          191  +            case 'c': case 'C': {
          192  +              if( nId==6 && sqlite3StrNICmp(zSql, "create", 6)==0 ){
          193  +                token = tkCREATE;
          194  +              }else{
          195  +                token = tkOTHER;
          196  +              }
          197  +              break;
          198  +            }
          199  +            case 't': case 'T': {
          200  +              if( nId==7 && sqlite3StrNICmp(zSql, "trigger", 7)==0 ){
          201  +                token = tkTRIGGER;
          202  +              }else if( nId==4 && sqlite3StrNICmp(zSql, "temp", 4)==0 ){
          203  +                token = tkTEMP;
          204  +              }else if( nId==9 && sqlite3StrNICmp(zSql, "temporary", 9)==0 ){
          205  +                token = tkTEMP;
          206  +              }else{
          207  +                token = tkOTHER;
          208  +              }
          209  +              break;
          210  +            }
          211  +            case 'e':  case 'E': {
          212  +              if( nId==3 && sqlite3StrNICmp(zSql, "end", 3)==0 ){
          213  +                token = tkEND;
          214  +              }else
          215  +#ifndef SQLITE_OMIT_EXPLAIN
          216  +              if( nId==7 && sqlite3StrNICmp(zSql, "explain", 7)==0 ){
          217  +                token = tkEXPLAIN;
          218  +              }else
          219  +#endif
          220  +              {
          221  +                token = tkOTHER;
          222  +              }
          223  +              break;
          224  +            }
          225  +            default: {
          226  +              token = tkOTHER;
          227  +              break;
          228  +            }
          229  +          }
          230  +#endif /* SQLITE_OMIT_TRIGGER */
          231  +          zSql += nId-1;
          232  +        }else{
          233  +          /* Operators and special symbols */
          234  +          token = tkOTHER;
          235  +        }
          236  +        break;
          237  +      }
          238  +    }
          239  +    state = trans[state][token];
          240  +    zSql++;
          241  +  }
          242  +  return state==0;
          243  +}
          244  +
          245  +#ifndef SQLITE_OMIT_UTF16
          246  +/*
          247  +** This routine is the same as the sqlite3_complete() routine described
          248  +** above, except that the parameter is required to be UTF-16 encoded, not
          249  +** UTF-8.
          250  +*/
          251  +int sqlite3_complete16(const void *zSql){
          252  +  sqlite3_value *pVal;
          253  +  char const *zSql8;
          254  +  int rc = 0;
          255  +
          256  +  pVal = sqlite3ValueNew();
          257  +  sqlite3ValueSetStr(pVal, -1, zSql, SQLITE_UTF16NATIVE, SQLITE_STATIC);
          258  +  zSql8 = (const char *)sqlite3ValueText(pVal, SQLITE_UTF8);
          259  +  if( zSql8 ){
          260  +    rc = sqlite3_complete(zSql8);
          261  +  }
          262  +  sqlite3ValueFree(pVal);
          263  +  return rc;
          264  +}
          265  +#endif /* SQLITE_OMIT_UTF16 */
          266  +#endif /* SQLITE_OMIT_COMPLETE */
          267  +}

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

    15     15   ** This file contains the C functions that implement date and time
    16     16   ** functions for SQLite.  
    17     17   **
    18     18   ** There is only one exported symbol in this file - the function
    19     19   ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
    20     20   ** All other code has file scope.
    21     21   **
    22         -** $Id: date.c,v 1.6 2005/08/01 19:32:09 rmsimpson Exp $
           22  +** $Id: date.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    23     23   **
    24     24   ** NOTES:
    25     25   **
    26     26   ** SQLite processes all times and dates as Julian Day numbers.  The
    27     27   ** dates and times are stored as the number of days since noon
    28     28   ** in Greenwich on November 24, 4714 B.C. according to the Gregorian
    29     29   ** calendar system.
................................................................................
   123    123     return cnt;
   124    124   }
   125    125   
   126    126   /*
   127    127   ** Read text from z[] and convert into a floating point number.  Return
   128    128   ** the number of digits converted.
   129    129   */
   130         -static int getValue(const char *z, double *pR){
   131         -  const char *zEnd;
   132         -  *pR = sqlite3AtoF(z, &zEnd);
   133         -  return zEnd - z;
   134         -}
          130  +#define getValue sqlite3AtoF
   135    131   
   136    132   /*
   137    133   ** Parse a timezone extension on the end of a date-time.
   138    134   ** The extension is of the form:
   139    135   **
   140    136   **        (+/-)HH:MM
   141    137   **
................................................................................
   319    315     }else if( sqlite3StrICmp(zDate,"now")==0){
   320    316       double r;
   321    317       sqlite3OsCurrentTime(&r);
   322    318       p->rJD = r;
   323    319       p->validJD = 1;
   324    320       return 0;
   325    321     }else if( sqlite3IsNumber(zDate, 0, SQLITE_UTF8) ){
   326         -    p->rJD = sqlite3AtoF(zDate, 0);
          322  +    getValue(zDate, &p->rJD);
   327    323       p->validJD = 1;
   328    324       return 0;
   329    325     }
   330    326     return 1;
   331    327   }
   332    328   
   333    329   /*
................................................................................
   997    993   
   998    994     for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
   999    995       sqlite3_create_function(db, aFuncs[i].zName, 0, SQLITE_UTF8, 
  1000    996           aFuncs[i].zFormat, currentTimeFunc, 0, 0);
  1001    997     }
  1002    998   #endif
  1003    999   }
  1004         -
  1005   1000   }

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

    11     11   **    May you find forgiveness for yourself and forgive others.
    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15     15   ** This file contains C code routines that are called by the parser
    16     16   ** in order to generate code for DELETE FROM statements.
    17     17   **
    18         -** $Id: delete.c,v 1.6 2005/08/01 19:32:09 rmsimpson Exp $
           18  +** $Id: delete.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   
    22     22   /*
    23     23   ** Look up every table that is named in pSrc.  If any table is not found,
    24     24   ** add an error message to pParse->zErrMsg and return NULL.  If all tables
    25     25   ** are found, return a pointer to the last table.
................................................................................
    64     64   */
    65     65   void sqlite3OpenTableForReading(
    66     66     Vdbe *v,        /* Generate code into this VDBE */
    67     67     int iCur,       /* The cursor number of the table */
    68     68     Table *pTab     /* The table to be opened */
    69     69   ){
    70     70     sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
    71         -  sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
    72     71     VdbeComment((v, "# %s", pTab->zName));
           72  +  sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
    73     73     sqlite3VdbeAddOp(v, OP_SetNumColumns, iCur, pTab->nCol);
    74     74   }
    75     75   
    76     76   
    77     77   /*
    78     78   ** Generate code for a DELETE FROM statement.
    79     79   **
................................................................................
   239    239       */
   240    240       pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0);
   241    241       if( pWInfo==0 ) goto delete_from_cleanup;
   242    242   
   243    243       /* Remember the rowid of every item to be deleted.
   244    244       */
   245    245       sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0);
   246         -    sqlite3VdbeAddOp(v, OP_ListWrite, 0, 0);
          246  +    sqlite3VdbeAddOp(v, OP_FifoWrite, 0, 0);
   247    247       if( db->flags & SQLITE_CountRows ){
   248    248         sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
   249    249       }
   250    250   
   251    251       /* End the database scan loop.
   252    252       */
   253    253       sqlite3WhereEnd(pWInfo);
................................................................................
   259    259         sqlite3VdbeAddOp(v, OP_SetNumColumns, oldIdx, pTab->nCol);
   260    260       }
   261    261   
   262    262       /* Delete every item whose key was written to the list during the
   263    263       ** database scan.  We have to delete items after the scan is complete
   264    264       ** because deleting an item can change the scan order.
   265    265       */
   266         -    sqlite3VdbeAddOp(v, OP_ListRewind, 0, 0);
   267    266       end = sqlite3VdbeMakeLabel(v);
   268    267   
   269    268       /* This is the beginning of the delete loop when there are
   270    269       ** row triggers.
   271    270       */
   272    271       if( triggers_exist ){
   273         -      addr = sqlite3VdbeAddOp(v, OP_ListRead, 0, end);
          272  +      addr = sqlite3VdbeAddOp(v, OP_FifoRead, 0, end);
   274    273         if( !isView ){
   275    274           sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
   276    275           sqlite3OpenTableForReading(v, iCur, pTab);
   277    276         }
   278    277         sqlite3VdbeAddOp(v, OP_MoveGe, iCur, 0);
   279    278         sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0);
   280    279         sqlite3VdbeAddOp(v, OP_RowData, iCur, 0);
................................................................................
   287    286             -1, oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default,
   288    287             addr);
   289    288       }
   290    289   
   291    290       if( !isView ){
   292    291         /* Open cursors for the table we are deleting from and all its
   293    292         ** indices.  If there are row triggers, this happens inside the
   294         -      ** OP_ListRead loop because the cursor have to all be closed
          293  +      ** OP_FifoRead loop because the cursor have to all be closed
   295    294         ** before the trigger fires.  If there are no row triggers, the
   296    295         ** cursors are opened only once on the outside the loop.
   297    296         */
   298    297         sqlite3OpenTableAndIndices(pParse, pTab, iCur, OP_OpenWrite);
   299    298   
   300    299         /* This is the beginning of the delete loop when there are no
   301    300         ** row triggers */
   302    301         if( !triggers_exist ){ 
   303         -        addr = sqlite3VdbeAddOp(v, OP_ListRead, 0, end);
          302  +        addr = sqlite3VdbeAddOp(v, OP_FifoRead, 0, end);
   304    303         }
   305    304   
   306    305         /* Delete the row */
   307    306         sqlite3GenerateRowDelete(db, v, pTab, iCur, pParse->nested==0);
   308    307       }
   309    308   
   310    309       /* If there are row triggers, close all cursors then invoke
................................................................................
   321    320             oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default,
   322    321             addr);
   323    322       }
   324    323   
   325    324       /* End of the delete loop */
   326    325       sqlite3VdbeAddOp(v, OP_Goto, 0, addr);
   327    326       sqlite3VdbeResolveLabel(v, end);
   328         -    sqlite3VdbeAddOp(v, OP_ListReset, 0, 0);
   329    327   
   330    328       /* Close the cursors after the loop if there are no row triggers */
   331    329       if( !triggers_exist ){
   332    330         for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
   333    331           sqlite3VdbeAddOp(v, OP_Close, iCur + i, pIdx->tnum);
   334    332         }
   335    333         sqlite3VdbeAddOp(v, OP_Close, iCur, 0);
................................................................................
   441    439       if( idx==pTab->iPKey ){
   442    440         sqlite3VdbeAddOp(v, OP_Dup, j, 0);
   443    441       }else{
   444    442         sqlite3VdbeAddOp(v, OP_Column, iCur, idx);
   445    443         sqlite3ColumnDefault(v, pTab, idx);
   446    444       }
   447    445     }
   448         -  sqlite3VdbeAddOp(v, OP_MakeRecord, pIdx->nColumn, (1<<24));
          446  +  sqlite3VdbeAddOp(v, OP_MakeIdxRec, pIdx->nColumn, 0);
   449    447     sqlite3IndexAffinityStr(v, pIdx);
   450    448   }
   451         -
   452    449   }

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

    11     11   **    May you find forgiveness for yourself and forgive others.
    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15     15   ** This file contains routines used for analyzing expressions and
    16     16   ** for generating VDBE code that evaluates expressions in SQLite.
    17     17   **
    18         -** $Id: expr.c,v 1.6 2005/08/01 19:32:10 rmsimpson Exp $
           18  +** $Id: expr.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** Return the 'affinity' of the expression pExpr if any.
    25     25   **
................................................................................
    33     33   **
    34     34   ** CREATE TABLE t1(a);
    35     35   ** SELECT * FROM t1 WHERE a;
    36     36   ** SELECT a AS b FROM t1 WHERE b;
    37     37   ** SELECT * FROM t1 WHERE (select a from t1);
    38     38   */
    39     39   char sqlite3ExprAffinity(Expr *pExpr){
    40         -  if( pExpr->op==TK_AS ){
           40  +  int op = pExpr->op;
           41  +  if( op==TK_AS ){
    41     42       return sqlite3ExprAffinity(pExpr->pLeft);
    42     43     }
    43         -  if( pExpr->op==TK_SELECT ){
           44  +  if( op==TK_SELECT ){
    44     45       return sqlite3ExprAffinity(pExpr->pSelect->pEList->a[0].pExpr);
    45     46     }
           47  +#ifndef SQLITE_OMIT_CAST
           48  +  if( op==TK_CAST ){
           49  +    return sqlite3AffinityType(&pExpr->token);
           50  +  }
           51  +#endif
    46     52     return pExpr->affinity;
    47     53   }
    48     54   
    49     55   /*
    50     56   ** Return the default collation sequence for the expression pExpr. If
    51     57   ** there is no default collation type, return 0.
    52     58   */
    53     59   CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){
    54     60     CollSeq *pColl = 0;
    55     61     if( pExpr ){
    56     62       pColl = pExpr->pColl;
    57         -    if( pExpr->op==TK_AS && !pColl ){
           63  +    if( (pExpr->op==TK_AS || pExpr->op==TK_CAST) && !pColl ){
    58     64         return sqlite3ExprCollSeq(pParse, pExpr->pLeft);
    59     65       }
    60     66     }
    61     67     if( sqlite3CheckCollSeq(pParse, pColl) ){ 
    62     68       pColl = 0;
    63     69     }
    64     70     return pColl;
................................................................................
    86     92       /* Neither side of the comparison is a column.  Compare the
    87     93       ** results directly.
    88     94       */
    89     95       /* return SQLITE_AFF_NUMERIC;  // Ticket #805 */
    90     96       return SQLITE_AFF_NONE;
    91     97     }else{
    92     98       /* One side is a column, the other is not. Use the columns affinity. */
           99  +    assert( aff1==0 || aff2==0 );
    93    100       return (aff1 + aff2);
    94    101     }
    95    102   }
    96    103   
    97    104   /*
    98    105   ** pExpr is a comparison operator.  Return the type affinity that should
    99    106   ** be applied to both operands prior to doing the comparison.
................................................................................
   206    213     }
   207    214     return pNew;
   208    215   }
   209    216   
   210    217   /*
   211    218   ** When doing a nested parse, you can include terms in an expression
   212    219   ** that look like this:   #0 #1 #2 ...  These terms refer to elements
   213         -** on the stack.  "#0" (or just "#") means the top of the stack.
   214         -** "#1" means the next down on the stack.  And so forth.  #-1 means
   215         -** memory location 0.  #-2 means memory location 1.  And so forth.
          220  +** on the stack.  "#0" means the top of the stack.
          221  +** "#1" means the next down on the stack.  And so forth.
   216    222   **
   217    223   ** This routine is called by the parser to deal with on of those terms.
   218    224   ** It immediately generates code to store the value in a memory location.
   219    225   ** The returns an expression that will code to extract the value from
   220    226   ** that memory location as needed.
   221    227   */
   222    228   Expr *sqlite3RegisterExpr(Parse *pParse, Token *pToken){
   223    229     Vdbe *v = pParse->pVdbe;
   224    230     Expr *p;
   225    231     int depth;
   226         -  if( v==0 ) return 0;
   227    232     if( pParse->nested==0 ){
   228    233       sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", pToken);
   229    234       return 0;
   230    235     }
          236  +  if( v==0 ) return 0;
   231    237     p = sqlite3Expr(TK_REGISTER, 0, 0, pToken);
   232    238     if( p==0 ){
   233    239       return 0;  /* Malloc failed */
   234    240     }
   235         -  depth = atoi((char *)&pToken->z[1]);
   236         -  if( depth>=0 ){
   237         -    p->iTable = pParse->nMem++;
   238         -    sqlite3VdbeAddOp(v, OP_Dup, depth, 0);
   239         -    sqlite3VdbeAddOp(v, OP_MemStore, p->iTable, 1);
   240         -  }else{
   241         -    p->iTable = -1-depth;
   242         -  }
          241  +  depth = atoi((const char *)&pToken->z[1]);
          242  +  p->iTable = pParse->nMem++;
          243  +  sqlite3VdbeAddOp(v, OP_Dup, depth, 0);
          244  +  sqlite3VdbeAddOp(v, OP_MemStore, p->iTable, 1);
   243    245     return p;
   244    246   }
   245    247   
   246    248   /*
   247    249   ** Join two expressions using an AND operator.  If either expression is
   248    250   ** NULL, then just return the other expression.
   249    251   */
................................................................................
   324    326     if( pToken->n==1 ){
   325    327       /* Wildcard of the form "?".  Assign the next variable number */
   326    328       pExpr->iTable = ++pParse->nVar;
   327    329     }else if( pToken->z[0]=='?' ){
   328    330       /* Wildcard of the form "?nnn".  Convert "nnn" to an integer and
   329    331       ** use it as the variable number */
   330    332       int i;
   331         -    pExpr->iTable = i = atoi((char *)&pToken->z[1]);
          333  +    pExpr->iTable = i = atoi((const char *)&pToken->z[1]);
   332    334       if( i<1 || i>SQLITE_MAX_VARIABLE_NUMBER ){
   333    335         sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
   334    336             SQLITE_MAX_VARIABLE_NUMBER);
   335    337       }
   336    338       if( i>pParse->nVar ){
   337    339         pParse->nVar = i;
   338    340       }
................................................................................
   377    379     sqlite3ExprDelete(p->pLeft);
   378    380     sqlite3ExprDelete(p->pRight);
   379    381     sqlite3ExprListDelete(p->pList);
   380    382     sqlite3SelectDelete(p->pSelect);
   381    383     sqliteFree(p);
   382    384   }
   383    385   
          386  +/*
          387  +** The Expr.token field might be a string literal that is quoted.
          388  +** If so, remove the quotation marks.
          389  +*/
          390  +void sqlite3DequoteExpr(Expr *p){
          391  +  if( ExprHasAnyProperty(p, EP_Dequoted) ){
          392  +    return;
          393  +  }
          394  +  ExprSetProperty(p, EP_Dequoted);
          395  +  if( p->token.dyn==0 ){
          396  +    sqlite3TokenCopy(&p->token, &p->token);
          397  +  }
          398  +  sqlite3Dequote((char*)p->token.z);
          399  +}
          400  +
   384    401   
   385    402   /*
   386    403   ** The following group of routines make deep copies of expressions,
   387    404   ** expression lists, ID lists, and select statements.  The copies can
   388    405   ** be deleted (by being passed to their respective ...Delete() routines)
   389    406   ** without effecting the originals.
   390    407   **
................................................................................
   397    414   Expr *sqlite3ExprDup(Expr *p){
   398    415     Expr *pNew;
   399    416     if( p==0 ) return 0;
   400    417     pNew = (Expr *)sqliteMallocRaw( sizeof(*p) );
   401    418     if( pNew==0 ) return 0;
   402    419     memcpy(pNew, p, sizeof(*pNew));
   403    420     if( p->token.z!=0 ){
   404         -    pNew->token.z = (const unsigned char *)sqliteStrNDup((char *)p->token.z, p->token.n);
          421  +    pNew->token.z = (const unsigned char *)sqliteStrNDup((const char *)p->token.z, p->token.n);
   405    422       pNew->token.dyn = 1;
   406    423     }else{
   407    424       assert( pNew->token.z==0 );
   408    425     }
   409    426     pNew->span.z = 0;
   410    427     pNew->pLeft = sqlite3ExprDup(p->pLeft);
   411    428     pNew->pRight = sqlite3ExprDup(p->pRight);
................................................................................
   414    431     pNew->pTab = p->pTab;
   415    432     return pNew;
   416    433   }
   417    434   void sqlite3TokenCopy(Token *pTo, Token *pFrom){
   418    435     if( pTo->dyn ) sqliteFree((char*)pTo->z);
   419    436     if( pFrom->z ){
   420    437       pTo->n = pFrom->n;
   421         -    pTo->z = (const unsigned char *)sqliteStrNDup((char *)pFrom->z, pFrom->n);
          438  +    pTo->z = (const unsigned char *)sqliteStrNDup((const char *)pFrom->z, pFrom->n);
   422    439       pTo->dyn = 1;
   423    440     }else{
   424    441       pTo->z = 0;
   425    442     }
   426    443   }
   427    444   ExprList *sqlite3ExprListDup(ExprList *p){
   428    445     ExprList *pNew;
................................................................................
   471    488     int nByte;
   472    489     if( p==0 ) return 0;
   473    490     nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);
   474    491     pNew = (SrcList *)sqliteMallocRaw( nByte );
   475    492     if( pNew==0 ) return 0;
   476    493     pNew->nSrc = pNew->nAlloc = p->nSrc;
   477    494     for(i=0; i<p->nSrc; i++){
   478         -	  struct SrcList::SrcList_item *pNewItem = &pNew->a[i];
   479         -	  struct SrcList::SrcList_item *pOldItem = &p->a[i];
          495  +    struct SrcList::SrcList_item *pNewItem = &pNew->a[i];
          496  +    struct SrcList::SrcList_item *pOldItem = &p->a[i];
   480    497       Table *pTab;
   481    498       pNewItem->zDatabase = sqliteStrDup(pOldItem->zDatabase);
   482    499       pNewItem->zName = sqliteStrDup(pOldItem->zName);
   483    500       pNewItem->zAlias = sqliteStrDup(pOldItem->zAlias);
   484    501       pNewItem->jointype = pOldItem->jointype;
   485    502       pNewItem->iCursor = pOldItem->iCursor;
   486    503       pTab = pNewItem->pTab = pOldItem->pTab;
................................................................................
   503    520     pNew->nId = pNew->nAlloc = p->nId;
   504    521     pNew->a = (IdList::IdList_item *)sqliteMallocRaw( p->nId*sizeof(p->a[0]) );
   505    522     if( pNew->a==0 ){
   506    523       sqliteFree(pNew);
   507    524       return 0;
   508    525     }
   509    526     for(i=0; i<p->nId; i++){
   510         -	  struct IdList::IdList_item *pNewItem = &pNew->a[i];
   511         -	  struct IdList::IdList_item *pOldItem = &p->a[i];
          527  +    struct IdList::IdList_item *pNewItem = &pNew->a[i];
          528  +    struct IdList::IdList_item *pOldItem = &p->a[i];
   512    529       pNewItem->zName = sqliteStrDup(pOldItem->zName);
   513    530       pNewItem->idx = pOldItem->idx;
   514    531     }
   515    532     return pNew;
   516    533   }
   517    534   Select *sqlite3SelectDup(Select *p){
   518    535     Select *pNew;
................................................................................
   528    545     pNew->pOrderBy = sqlite3ExprListDup(p->pOrderBy);
   529    546     pNew->op = p->op;
   530    547     pNew->pPrior = sqlite3SelectDup(p->pPrior);
   531    548     pNew->pLimit = sqlite3ExprDup(p->pLimit);
   532    549     pNew->pOffset = sqlite3ExprDup(p->pOffset);
   533    550     pNew->iLimit = -1;
   534    551     pNew->iOffset = -1;
   535         -  pNew->ppOpenTemp = 0;
          552  +  pNew->ppOpenVirtual = 0;
   536    553     pNew->isResolved = p->isResolved;
   537    554     pNew->isAgg = p->isAgg;
   538    555     return pNew;
   539    556   }
   540    557   #else
   541    558   Select *sqlite3SelectDup(Select *p){
   542    559     assert( p==0 );
................................................................................
   554    571       pList = (ExprList *)sqliteMalloc( sizeof(ExprList) );
   555    572       if( pList==0 ){
   556    573         goto no_mem;
   557    574       }
   558    575       assert( pList->nAlloc==0 );
   559    576     }
   560    577     if( pList->nAlloc<=pList->nExpr ){
   561         -	  struct ExprList::ExprList_item *a;
          578  +    struct ExprList::ExprList_item *a;
   562    579       int n = pList->nAlloc*2 + 4;
   563         -	a = (ExprList::ExprList_item *)sqliteRealloc(pList->a, n*sizeof(pList->a[0]));
          580  +    a = (ExprList::ExprList_item *)sqliteRealloc(pList->a, n*sizeof(pList->a[0]));
   564    581       if( a==0 ){
   565    582         goto no_mem;
   566    583       }
   567    584       pList->a = a;
   568    585       pList->nAlloc = n;
   569    586     }
   570    587     assert( pList->a!=0 );
   571    588     if( pExpr || pName ){
   572         -	  struct ExprList::ExprList_item *pItem = &pList->a[pList->nExpr++];
          589  +    struct ExprList::ExprList_item *pItem = &pList->a[pList->nExpr++];
   573    590       memset(pItem, 0, sizeof(*pItem));
   574    591       pItem->zName = sqlite3NameFromToken(pName);
   575    592       pItem->pExpr = pExpr;
   576    593     }
   577    594     return pList;
   578    595   
   579    596   no_mem:     
................................................................................
   663    680   **
   664    681   ** After walking the whole tree, if no nodes are found that disqualify
   665    682   ** the expression as constant, then we assume the whole expression
   666    683   ** is constant.  See sqlite3ExprIsConstant() for additional information.
   667    684   */
   668    685   static int exprNodeIsConstant(void *pArg, Expr *pExpr){
   669    686     switch( pExpr->op ){
          687  +    /* Consider functions to be constant if all their arguments are constant
          688  +    ** and *pArg==2 */
          689  +    case TK_FUNCTION:
          690  +      if( *((int*)pArg)==2 ) return 0;
          691  +      /* Fall through */
   670    692       case TK_ID:
   671    693       case TK_COLUMN:
   672    694       case TK_DOT:
   673    695       case TK_AGG_FUNCTION:
   674         -    case TK_FUNCTION:
   675    696   #ifndef SQLITE_OMIT_SUBQUERY
   676    697       case TK_SELECT:
   677    698       case TK_EXISTS:
   678    699   #endif
   679    700         *((int*)pArg) = 0;
   680    701         return 2;
   681    702       default:
   682    703         return 0;
   683    704     }
   684    705   }
   685    706   
   686    707   /*
   687    708   ** Walk an expression tree.  Return 1 if the expression is constant
   688         -** and 0 if it involves variables.
          709  +** and 0 if it involves variables or function calls.
   689    710   **
   690    711   ** For the purposes of this function, a double-quoted string (ex: "abc")
   691    712   ** is considered a variable but a single-quoted string (ex: 'abc') is
   692    713   ** a constant.
   693    714   */
   694    715   int sqlite3ExprIsConstant(Expr *p){
   695    716     int isConst = 1;
   696    717     walkExprTree(p, exprNodeIsConstant, &isConst);
   697    718     return isConst;
   698    719   }
          720  +
          721  +/*
          722  +** Walk an expression tree.  Return 1 if the expression is constant
          723  +** or a function call with constant arguments.  Return and 0 if there
          724  +** are any variables.
          725  +**
          726  +** For the purposes of this function, a double-quoted string (ex: "abc")
          727  +** is considered a variable but a single-quoted string (ex: 'abc') is
          728  +** a constant.
          729  +*/
          730  +int sqlite3ExprIsConstantOrFunction(Expr *p){
          731  +  int isConst = 2;
          732  +  walkExprTree(p, exprNodeIsConstant, &isConst);
          733  +  return isConst!=0;
          734  +}
   699    735   
   700    736   /*
   701    737   ** If the expression p codes a constant integer that is small enough
   702    738   ** to fit in a 32-bit integer, return 1 and put the value of the integer
   703    739   ** in *pValue.  If the expression is not an integer or if it is too big
   704    740   ** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
   705    741   */
   706    742   int sqlite3ExprIsInteger(Expr *p, int *pValue){
   707    743     switch( p->op ){
   708    744       case TK_INTEGER: {
   709         -      if( sqlite3GetInt32((char *)p->token.z, pValue) ){
          745  +      if( sqlite3GetInt32((const char *)p->token.z, pValue) ){
   710    746           return 1;
   711    747         }
   712    748         break;
   713    749       }
   714    750       case TK_UPLUS: {
   715    751         return sqlite3ExprIsInteger(p->pLeft, pValue);
   716    752       }
................................................................................
  1217   1253   **
  1218   1254   ** The first form is handled by creating a set holding the list
  1219   1255   ** of allowed values.  The second form causes the SELECT to generate 
  1220   1256   ** a temporary table.
  1221   1257   */
  1222   1258   #ifndef SQLITE_OMIT_SUBQUERY
  1223   1259   void sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
  1224         -  int label = 0;                         /* Address after sub-select code */
         1260  +  int testAddr = 0;                       /* One-time test address */
  1225   1261     Vdbe *v = sqlite3GetVdbe(pParse);
  1226   1262     if( v==0 ) return;
  1227   1263   
  1228         -  /* If this is not a variable (correlated) select, then execute
  1229         -  ** it only once. Unless this is part of a trigger program. In
  1230         -  ** that case re-execute every time (this could be optimized).
         1264  +  /* This code must be run in its entirety every time it is encountered
         1265  +  ** if any of the following is true:
         1266  +  **
         1267  +  **    *  The right-hand side is a correlated subquery
         1268  +  **    *  The right-hand side is an expression list containing variables
         1269  +  **    *  We are inside a trigger
         1270  +  **
         1271  +  ** If all of the above are false, then we can run this code just once
         1272  +  ** save the results, and reuse the same result on subsequent invocations.
  1231   1273     */
  1232   1274     if( !ExprHasAnyProperty(pExpr, EP_VarSelect) && !pParse->trigStack ){
  1233   1275       int mem = pParse->nMem++;
  1234   1276       sqlite3VdbeAddOp(v, OP_MemLoad, mem, 0);
  1235         -    label = sqlite3VdbeMakeLabel(v);
  1236         -    sqlite3VdbeAddOp(v, OP_If, 0, label);
         1277  +    testAddr = sqlite3VdbeAddOp(v, OP_If, 0, 0);
         1278  +    assert( testAddr>0 );
  1237   1279       sqlite3VdbeAddOp(v, OP_Integer, 1, 0);
  1238   1280       sqlite3VdbeAddOp(v, OP_MemStore, mem, 1);
  1239   1281     }
  1240   1282   
  1241   1283     if( pExpr->pSelect ){
  1242   1284       sqlite3VdbeAddOp(v, OP_AggContextPush, 0, 0);
  1243   1285     }
  1244   1286   
  1245   1287     switch( pExpr->op ){
  1246   1288       case TK_IN: {
  1247   1289         char affinity;
  1248   1290         KeyInfo keyInfo;
  1249         -      int addr;        /* Address of OP_OpenTemp instruction */
         1291  +      int addr;        /* Address of OP_OpenVirtual instruction */
  1250   1292   
  1251   1293         affinity = sqlite3ExprAffinity(pExpr->pLeft);
  1252   1294   
  1253   1295         /* Whether this is an 'x IN(SELECT...)' or an 'x IN(<exprlist>)'
  1254         -      ** expression it is handled the same way. A temporary table is 
         1296  +      ** expression it is handled the same way. A virtual table is 
  1255   1297         ** filled with single-field index keys representing the results
  1256   1298         ** from the SELECT or the <exprlist>.
  1257   1299         **
  1258   1300         ** If the 'x' expression is a column value, or the SELECT...
  1259   1301         ** statement returns a column value, then the affinity of that
  1260   1302         ** column is used to build the index keys. If both 'x' and the
  1261   1303         ** SELECT... statement are columns, then numeric affinity is used
  1262   1304         ** if either column has NUMERIC or INTEGER affinity. If neither
  1263   1305         ** 'x' nor the SELECT... statement are columns, then numeric affinity
  1264   1306         ** is used.
  1265   1307         */
  1266   1308         pExpr->iTable = pParse->nTab++;
  1267         -      addr = sqlite3VdbeAddOp(v, OP_OpenTemp, pExpr->iTable, 0);
         1309  +      addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, pExpr->iTable, 0);
  1268   1310         memset(&keyInfo, 0, sizeof(keyInfo));
  1269   1311         keyInfo.nField = 1;
  1270   1312         sqlite3VdbeAddOp(v, OP_SetNumColumns, pExpr->iTable, 1);
  1271   1313   
  1272   1314         if( pExpr->pSelect ){
  1273   1315           /* Case 1:     expr IN (SELECT ...)
  1274   1316           **
................................................................................
  1289   1331           **
  1290   1332   	** For each expression, build an index key from the evaluation and
  1291   1333           ** store it in the temporary table. If <expr> is a column, then use
  1292   1334           ** that columns affinity when building index keys. If <expr> is not
  1293   1335           ** a column, use numeric affinity.
  1294   1336           */
  1295   1337           int i;
         1338  +        ExprList *pList = pExpr->pList;
         1339  +        struct ExprList::ExprList_item *pItem;
         1340  +
  1296   1341           if( !affinity ){
  1297   1342             affinity = SQLITE_AFF_NUMERIC;
  1298   1343           }
  1299   1344           keyInfo.aColl[0] = pExpr->pLeft->pColl;
  1300   1345   
  1301   1346           /* Loop through each expression in <exprlist>. */
  1302         -        for(i=0; i<pExpr->pList->nExpr; i++){
  1303         -          Expr *pE2 = pExpr->pList->a[i].pExpr;
         1347  +        for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
         1348  +          Expr *pE2 = pItem->pExpr;
  1304   1349   
  1305         -          /* Check that the expression is constant and valid. */
  1306         -          if( !sqlite3ExprIsConstant(pE2) ){
  1307         -            sqlite3ErrorMsg(pParse,
  1308         -              "right-hand side of IN operator must be constant");
  1309         -            return;
         1350  +          /* If the expression is not constant then we will need to
         1351  +          ** disable the test that was generated above that makes sure
         1352  +          ** this code only executes once.  Because for a non-constant
         1353  +          ** expression we need to rerun this code each time.
         1354  +          */
         1355  +          if( testAddr>0 && !sqlite3ExprIsConstant(pE2) ){
         1356  +            VdbeOp *aOp = sqlite3VdbeGetOp(v, testAddr-1);
         1357  +            int i;
         1358  +            for(i=0; i<4; i++){
         1359  +              aOp[i].opcode = OP_Noop;
         1360  +            }
         1361  +            testAddr = 0;
  1310   1362             }
  1311   1363   
  1312   1364             /* Evaluate the expression and insert it into the temp table */
  1313   1365             sqlite3ExprCode(pParse, pE2);
  1314   1366             sqlite3VdbeOp3(v, OP_MakeRecord, 1, 0, &affinity, 1);
  1315   1367             sqlite3VdbeAddOp(v, OP_IdxInsert, pExpr->iTable, 0);
  1316   1368           }
  1317   1369         }
  1318         -      sqlite3VdbeChangeP3(v, addr, (char *)(void *)&keyInfo, P3_KEYINFO);
         1370  +      sqlite3VdbeChangeP3(v, addr, (const char *)(void *)&keyInfo, P3_KEYINFO);
  1319   1371         break;
  1320   1372       }
  1321   1373   
  1322   1374       case TK_EXISTS:
  1323   1375       case TK_SELECT: {
  1324   1376         /* This has to be a scalar SELECT.  Generate code to put the
  1325   1377         ** value of this select in a memory cell and record the number
................................................................................
  1329   1381         Select *pSel;
  1330   1382   
  1331   1383         pExpr->iColumn = pParse->nMem++;
  1332   1384         pSel = pExpr->pSelect;
  1333   1385         if( pExpr->op==TK_SELECT ){
  1334   1386           sop = SRT_Mem;
  1335   1387         }else{
  1336         -        static const Token one = { (const unsigned char *)"1", 0, 1 };
         1388  +        static const Token one = { (unsigned char *)"1", 0, 1 };
  1337   1389           sop = SRT_Exists;
  1338   1390           sqlite3ExprListDelete(pSel->pEList);
  1339   1391           pSel->pEList = sqlite3ExprListAppend(0, 
  1340   1392                             sqlite3Expr(TK_INTEGER, 0, 0, &one), 0);
  1341   1393         }
  1342   1394         sqlite3Select(pParse, pSel, sop, pExpr->iColumn, 0, 0, 0, 0);
  1343   1395         break;
  1344   1396       }
  1345   1397     }
  1346   1398   
  1347   1399     if( pExpr->pSelect ){
  1348   1400       sqlite3VdbeAddOp(v, OP_AggContextPop, 0, 0);
  1349   1401     }
  1350         -  if( label<0 ){
  1351         -    sqlite3VdbeResolveLabel(v, label);
         1402  +  if( testAddr ){
         1403  +    sqlite3VdbeChangeP2(v, testAddr, sqlite3VdbeCurrentAddr(v));
  1352   1404     }
  1353   1405     return;
  1354   1406   }
  1355   1407   #endif /* SQLITE_OMIT_SUBQUERY */
  1356   1408   
  1357   1409   /*
  1358   1410   ** Generate an instruction that will put the integer describe by
................................................................................
  1359   1411   ** text z[0..n-1] on the stack.
  1360   1412   */
  1361   1413   static void codeInteger(Vdbe *v, const char *z, int n){
  1362   1414     int i;
  1363   1415     if( sqlite3GetInt32(z, &i) ){
  1364   1416       sqlite3VdbeAddOp(v, OP_Integer, i, 0);
  1365   1417     }else if( sqlite3FitsIn64Bits(z) ){
  1366         -    sqlite3VdbeOp3(v, OP_Integer, 0, 0, z, n);
         1418  +    sqlite3VdbeOp3(v, OP_Int64, 0, 0, z, n);
  1367   1419     }else{
  1368   1420       sqlite3VdbeOp3(v, OP_Real, 0, 0, z, n);
  1369   1421     }
  1370   1422   }
  1371   1423   
  1372   1424   /*
  1373   1425   ** Generate code into the current Vdbe to evaluate the given
................................................................................
  1397   1449           sqlite3ColumnDefault(v, pExpr->pTab, pExpr->iColumn);
  1398   1450         }else{
  1399   1451           sqlite3VdbeAddOp(v, OP_Rowid, pExpr->iTable, 0);
  1400   1452         }
  1401   1453         break;
  1402   1454       }
  1403   1455       case TK_INTEGER: {
  1404         -      codeInteger(v, (char *)pExpr->token.z, pExpr->token.n);
         1456  +      codeInteger(v, (const char *)pExpr->token.z, pExpr->token.n);
  1405   1457         break;
  1406   1458       }
  1407   1459       case TK_FLOAT:
  1408   1460       case TK_STRING: {
  1409   1461         assert( TK_FLOAT==OP_Real );
  1410   1462         assert( TK_STRING==OP_String8 );
  1411         -      sqlite3VdbeOp3(v, op, 0, 0, (char *)pExpr->token.z, pExpr->token.n);
  1412         -      sqlite3VdbeDequoteP3(v, -1);
         1463  +      sqlite3DequoteExpr(pExpr);
         1464  +      sqlite3VdbeOp3(v, op, 0, 0, (const char *)pExpr->token.z, pExpr->token.n);
  1413   1465         break;
  1414   1466       }
  1415   1467       case TK_NULL: {
  1416   1468         sqlite3VdbeAddOp(v, OP_Null, 0, 0);
  1417   1469         break;
  1418   1470       }
  1419   1471   #ifndef SQLITE_OMIT_BLOB_LITERAL
  1420   1472       case TK_BLOB: {
  1421   1473         assert( TK_BLOB==OP_HexBlob );
  1422         -      sqlite3VdbeOp3(v, op, 0, 0, (char *)pExpr->token.z+1, pExpr->token.n-1);
  1423         -      sqlite3VdbeDequoteP3(v, -1);
         1474  +      sqlite3VdbeOp3(v, op, 0, 0, (const char *)pExpr->token.z+2, pExpr->token.n-3);
  1424   1475         break;
  1425   1476       }
  1426   1477   #endif
  1427   1478       case TK_VARIABLE: {
  1428   1479         sqlite3VdbeAddOp(v, OP_Variable, pExpr->iTable, 0);
  1429   1480         if( pExpr->token.n>1 ){
  1430         -        sqlite3VdbeChangeP3(v, -1, (char *)pExpr->token.z, pExpr->token.n);
         1481  +        sqlite3VdbeChangeP3(v, -1, (const char *)pExpr->token.z, pExpr->token.n);
  1431   1482         }
  1432   1483         break;
  1433   1484       }
  1434   1485       case TK_REGISTER: {
  1435   1486         sqlite3VdbeAddOp(v, OP_MemLoad, pExpr->iTable, 0);
  1436   1487         break;
  1437   1488       }
         1489  +#ifndef SQLITE_OMIT_CAST
         1490  +    case TK_CAST: {
         1491  +      /* Expressions of the form:   CAST(pLeft AS token) */
         1492  +      int aff, op;
         1493  +      sqlite3ExprCode(pParse, pExpr->pLeft);
         1494  +      aff = sqlite3AffinityType(&pExpr->token);
         1495  +      switch( aff ){
         1496  +        case SQLITE_AFF_INTEGER:   op = OP_ToInt;      break;
         1497  +        case SQLITE_AFF_NUMERIC:   op = OP_ToNumeric;  break;
         1498  +        case SQLITE_AFF_TEXT:      op = OP_ToText;     break;
         1499  +        case SQLITE_AFF_NONE:      op = OP_ToBlob;     break;
         1500  +      }
         1501  +      sqlite3VdbeAddOp(v, op, 0, 0);
         1502  +      break;
         1503  +    }
         1504  +#endif /* SQLITE_OMIT_CAST */
  1438   1505       case TK_LT:
  1439   1506       case TK_LE:
  1440   1507       case TK_GT:
  1441   1508       case TK_GE:
  1442   1509       case TK_NE:
  1443   1510       case TK_EQ: {
  1444   1511         assert( TK_LT==OP_Lt );
................................................................................
  1662   1729                          "RAISE() may only be used within a trigger-program");
  1663   1730   	return;
  1664   1731         }
  1665   1732         if( pExpr->iColumn!=OE_Ignore ){
  1666   1733            assert( pExpr->iColumn==OE_Rollback ||
  1667   1734                    pExpr->iColumn == OE_Abort ||
  1668   1735                    pExpr->iColumn == OE_Fail );
         1736  +         sqlite3DequoteExpr(pExpr);
  1669   1737            sqlite3VdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, pExpr->iColumn,
  1670         -                        (char *)pExpr->token.z, pExpr->token.n);
  1671         -         sqlite3VdbeDequoteP3(v, -1);
         1738  +                        (const char *)pExpr->token.z, pExpr->token.n);
         1739  +//         sqlite3VdbeDequoteP3(v, -1);
  1672   1740         } else {
  1673   1741            assert( pExpr->iColumn == OE_Ignore );
  1674   1742            sqlite3VdbeAddOp(v, OP_ContextPop, 0, 0);
  1675   1743            sqlite3VdbeAddOp(v, OP_Goto, 0, pParse->trigStack->ignoreJump);
  1676   1744            VdbeComment((v, "# raise(IGNORE)"));
  1677   1745         }
  1678   1746       }
................................................................................
  1716   1784   */
  1717   1785   int sqlite3ExprCodeExprList(
  1718   1786     Parse *pParse,     /* Parsing context */
  1719   1787     ExprList *pList    /* The expression list to be coded */
  1720   1788   ){
  1721   1789     struct ExprList::ExprList_item *pItem;
  1722   1790     int i, n;
  1723         -  Vdbe *v;
  1724   1791     if( pList==0 ) return 0;
  1725         -  v = sqlite3GetVdbe(pParse);
  1726   1792     n = pList->nExpr;
  1727         -  for(pItem=pList->a, i=0; i<n; i++, pItem++){
         1793  +  for(pItem=pList->a, i=n; i>0; i--, pItem++){
  1728   1794       sqlite3ExprCode(pParse, pItem->pExpr);
  1729   1795     }
  1730   1796     return n;
  1731   1797   }
  1732   1798   
  1733   1799   /*
  1734   1800   ** Generate code for a boolean expression such that a jump is made
................................................................................
  1958   2024       return 0;
  1959   2025     }
  1960   2026     if( pA->pSelect || pB->pSelect ) return 0;
  1961   2027     if( pA->iTable!=pB->iTable || pA->iColumn!=pB->iColumn ) return 0;
  1962   2028     if( pA->token.z ){
  1963   2029       if( pB->token.z==0 ) return 0;
  1964   2030       if( pB->token.n!=pA->token.n ) return 0;
  1965         -    if( sqlite3StrNICmp((char *)pA->token.z, (char *)pB->token.z, pB->token.n)!=0 ) return 0;
         2031  +    if( sqlite3StrNICmp((const char *)pA->token.z, (const char *)pB->token.z, pB->token.n)!=0 ) return 0;
  1966   2032     }
  1967   2033     return 1;
  1968   2034   }
  1969   2035   
  1970   2036   /*
  1971   2037   ** Add a new element to the pParse->aAgg[] array and return its index.
  1972   2038   ** The new element is initialized to zero.  The calling function is
................................................................................
  2036   2102           if( i>=pParse->nAgg ){
  2037   2103             u8 enc = pParse->db->enc;
  2038   2104             i = appendAggInfo(pParse);
  2039   2105             if( i<0 ) return 1;
  2040   2106             pParse->aAgg[i].isAgg = 1;
  2041   2107             pParse->aAgg[i].pExpr = pExpr;
  2042   2108             pParse->aAgg[i].pFunc = sqlite3FindFunction(pParse->db,
  2043         -               (char *)pExpr->token.z, pExpr->token.n,
         2109  +               (const char *)pExpr->token.z, pExpr->token.n,
  2044   2110                  pExpr->pList ? pExpr->pList->nExpr : 0, enc, 0);
  2045   2111           }
  2046   2112           pExpr->iAgg = i;
  2047   2113           return 1;
  2048   2114         }
  2049   2115       }
  2050   2116     }
................................................................................
  2068   2134   ** the number of errors.
  2069   2135   */
  2070   2136   int sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){
  2071   2137     int nErr = pNC->pParse->nErr;
  2072   2138     walkExprTree(pExpr, analyzeAggregate, pNC);
  2073   2139     return pNC->pParse->nErr - nErr;
  2074   2140   }
  2075         -
  2076   2141   }

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

    15     15   ** This file contains the C functions that implement various SQL
    16     16   ** functions of SQLite.  
    17     17   **
    18     18   ** There is only one exported symbol in this file - the function
    19     19   ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
    20     20   ** All other code has file scope.
    21     21   **
    22         -** $Id: func.c,v 1.6 2005/08/01 19:32:10 rmsimpson Exp $
           22  +** $Id: func.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    23     23   */
    24     24   #include "sqliteInt.h"
    25     25   #include <ctype.h>
    26     26   #include <math.h>
    27     27   #include <stdlib.h>
    28     28   #include <assert.h>
    29     29   #include "vdbeInt.h"
    30     30   #include "os.h"
    31     31   
           32  +/*
           33  +** Return the collating function associated with a function.
           34  +*/
    32     35   static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
    33     36     return context->pColl;
    34     37   }
    35     38   
    36     39   /*
    37     40   ** Implementation of the non-aggregate min() and max() functions
    38     41   */
................................................................................
    76     79       case SQLITE_INTEGER: z = "integer"; break;
    77     80       case SQLITE_TEXT:    z = "text";    break;
    78     81       case SQLITE_FLOAT:   z = "real";    break;
    79     82       case SQLITE_BLOB:    z = "blob";    break;
    80     83     }
    81     84     sqlite3_result_text(context, z, -1, SQLITE_STATIC);
    82     85   }
           86  +
    83     87   
    84     88   /*
    85     89   ** Implementation of the length() function
    86     90   */
    87     91   static void lengthFunc(
    88     92     sqlite3_context *context,
    89     93     int argc,
................................................................................
   182    186   
   183    187   /*
   184    188   ** Implementation of the round() function
   185    189   */
   186    190   static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
   187    191     int n = 0;
   188    192     double r;
   189         -  char zBuf[100];
          193  +  char zBuf[500];  /* larger than the %f representation of the largest double */
   190    194     assert( argc==1 || argc==2 );
   191    195     if( argc==2 ){
   192    196       if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;
   193    197       n = sqlite3_value_int(argv[1]);
   194    198       if( n>30 ) n = 30;
   195    199       if( n<0 ) n = 0;
   196    200     }
   197    201     if( SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
   198    202     r = sqlite3_value_double(argv[0]);
   199         -  sprintf(zBuf,"%.*f",n,r);
          203  +  sqlite3_snprintf(sizeof(zBuf),zBuf,"%.*f",n,r);
   200    204     sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
   201    205   }
   202    206   
   203    207   /*
   204    208   ** Implementation of the upper() and lower() SQL functions.
   205    209   */
   206    210   static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
   207    211     unsigned char *z;
   208    212     int i;
   209    213     if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
   210    214     z = (unsigned char *)sqliteMalloc(sqlite3_value_bytes(argv[0])+1);
   211    215     if( z==0 ) return;
   212         -  strcpy((char *)z, (char *)sqlite3_value_text(argv[0]));
          216  +  strcpy((char *)z, (const char *)sqlite3_value_text(argv[0]));
   213    217     for(i=0; z[i]; i++){
   214    218       z[i] = toupper(z[i]);
   215    219     }
   216         -  sqlite3_result_text(context, (char *)z, -1, SQLITE_TRANSIENT);
          220  +  sqlite3_result_text(context, (const char *)z, -1, SQLITE_TRANSIENT);
   217    221     sqliteFree(z);
   218    222   }
   219    223   static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
   220    224     unsigned char *z;
   221    225     int i;
   222    226     if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
   223    227     z = (unsigned char *)sqliteMalloc(sqlite3_value_bytes(argv[0])+1);
   224    228     if( z==0 ) return;
   225         -  strcpy((char *)z, (char *)sqlite3_value_text(argv[0]));
          229  +  strcpy((char *)z, (const char *)sqlite3_value_text(argv[0]));
   226    230     for(i=0; z[i]; i++){
   227    231       z[i] = tolower(z[i]);
   228    232     }
   229         -  sqlite3_result_text(context, (char *)z, -1, SQLITE_TRANSIENT);
          233  +  sqlite3_result_text(context, (const char *)z, -1, SQLITE_TRANSIENT);
   230    234     sqliteFree(z);
   231    235   }
   232    236   
   233    237   /*
   234    238   ** Implementation of the IFNULL(), NVL(), and COALESCE() functions.  
   235    239   ** All three do the same thing.  They return the first non-NULL
   236    240   ** argument.
................................................................................
   306    310   */
   307    311   struct compareInfo {
   308    312     u8 matchAll;
   309    313     u8 matchOne;
   310    314     u8 matchSet;
   311    315     u8 noCase;
   312    316   };
          317  +
   313    318   static const struct compareInfo globInfo = { '*', '?', '[', 0 };
   314         -static const struct compareInfo likeInfo = { '%', '_',   0, 1 };
          319  +/* The correct SQL-92 behavior is for the LIKE operator to ignore
          320  +** case.  Thus  'a' LIKE 'A' would be true. */
          321  +static const struct compareInfo likeInfoNorm = { '%', '_',   0, 1 };
          322  +/* If SQLITE_CASE_SENSITIVE_LIKE is defined, then the LIKE operator
          323  +** is case sensitive causing 'a' LIKE 'A' to be false */
          324  +static const struct compareInfo likeInfoAlt = { '%', '_',   0, 0 };
   315    325   
   316    326   /*
   317    327   ** X is a pointer to the first byte of a UTF-8 character.  Increment
   318    328   ** X so that it points to the next character.  This only works right
   319    329   ** if X points to a well-formed UTF-8 string.
   320    330   */
   321    331   #define sqliteNextChar(X)  while( (0xc0&*++(X))==0x80 ){}
................................................................................
   449    459         zString++;
   450    460         prevEscape = 0;
   451    461       }
   452    462     }
   453    463     return *zString==0;
   454    464   }
   455    465   
          466  +/*
          467  +** Count the number of times that the LIKE operator (or GLOB which is
          468  +** just a variation of LIKE) gets called.  This is used for testing
          469  +** only.
          470  +*/
          471  +#ifdef SQLITE_TEST
          472  +int sqlite3_like_count = 0;
          473  +#endif
          474  +
   456    475   
   457    476   /*
   458    477   ** Implementation of the like() SQL function.  This function implements
   459    478   ** the build-in LIKE operator.  The first argument to the function is the
   460    479   ** pattern and the second argument is the string.  So, the SQL statements:
   461    480   **
   462    481   **       A LIKE B
   463    482   **
   464    483   ** is implemented as like(B,A).
   465    484   **
   466         -** If the pointer retrieved by via a call to sqlite3_user_data() is
   467         -** not NULL, then this function uses UTF-16. Otherwise UTF-8.
          485  +** This same function (with a different compareInfo structure) computes
          486  +** the GLOB operator.
   468    487   */
   469    488   static void likeFunc(
   470    489     sqlite3_context *context, 
   471    490     int argc, 
   472    491     sqlite3_value **argv
   473    492   ){
   474    493     const unsigned char *zA = sqlite3_value_text(argv[0]);
................................................................................
   475    494     const unsigned char *zB = sqlite3_value_text(argv[1]);
   476    495     int escape = 0;
   477    496     if( argc==3 ){
   478    497       /* The escape character string must consist of a single UTF-8 character.
   479    498       ** Otherwise, return an error.
   480    499       */
   481    500       const unsigned char *zEsc = sqlite3_value_text(argv[2]);
   482         -    if( sqlite3utf8CharLen((char *)zEsc, -1)!=1 ){
          501  +    if( sqlite3utf8CharLen((const char *)zEsc, -1)!=1 ){
   483    502         sqlite3_result_error(context, 
   484    503             "ESCAPE expression must be a single character", -1);
   485    504         return;
   486    505       }
   487    506       escape = sqlite3ReadUtf8(zEsc);
   488    507     }
   489    508     if( zA && zB ){
   490         -    sqlite3_result_int(context, patternCompare(zA, zB, &likeInfo, escape));
   491         -  }
   492         -}
   493         -
   494         -/*
   495         -** Implementation of the glob() SQL function.  This function implements
   496         -** the build-in GLOB operator.  The first argument to the function is the
   497         -** string and the second argument is the pattern.  So, the SQL statements:
   498         -**
   499         -**       A GLOB B
   500         -**
   501         -** is implemented as glob(B,A).
   502         -*/
   503         -static void globFunc(sqlite3_context *context, int arg, sqlite3_value **argv){
   504         -  const unsigned char *zA = sqlite3_value_text(argv[0]);
   505         -  const unsigned char *zB = sqlite3_value_text(argv[1]);
   506         -  if( zA && zB ){
   507         -    sqlite3_result_int(context, patternCompare(zA, zB, &globInfo, 0));
          509  +    struct compareInfo *pInfo = (compareInfo *)sqlite3_user_data(context);
          510  +#ifdef SQLITE_TEST
          511  +    sqlite3_like_count++;
          512  +#endif
          513  +    sqlite3_result_int(context, patternCompare(zA, zB, pInfo, escape));
   508    514     }
   509    515   }
   510    516   
   511    517   /*
   512    518   ** Implementation of the NULLIF(x,y) function.  The result is the first
   513    519   ** argument if the arguments are different.  The result is NULL if the
   514    520   ** arguments are equal to each other.
................................................................................
   961    967       { "upper",              1, 0, SQLITE_UTF8,    0, upperFunc  },
   962    968       { "lower",              1, 0, SQLITE_UTF8,    0, lowerFunc  },
   963    969       { "coalesce",          -1, 0, SQLITE_UTF8,    0, ifnullFunc },
   964    970       { "coalesce",           0, 0, SQLITE_UTF8,    0, 0          },
   965    971       { "coalesce",           1, 0, SQLITE_UTF8,    0, 0          },
   966    972       { "ifnull",             2, 0, SQLITE_UTF8,    1, ifnullFunc },
   967    973       { "random",            -1, 0, SQLITE_UTF8,    0, randomFunc },
   968         -    { "like",               2, 0, SQLITE_UTF8,    0, likeFunc   },
   969         -    { "like",               3, 0, SQLITE_UTF8,    0, likeFunc   },
   970         -    { "glob",               2, 0, SQLITE_UTF8,    0, globFunc   },
   971    974       { "nullif",             2, 0, SQLITE_UTF8,    1, nullifFunc },
   972    975       { "sqlite_version",     0, 0, SQLITE_UTF8,    0, versionFunc},
   973    976       { "quote",              1, 0, SQLITE_UTF8,    0, quoteFunc  },
   974    977       { "last_insert_rowid",  0, 1, SQLITE_UTF8,    0, last_insert_rowid },
   975    978       { "changes",            0, 1, SQLITE_UTF8,    0, changes    },
   976    979       { "total_changes",      0, 1, SQLITE_UTF8,    0, total_changes },
   977    980   #ifdef SQLITE_SOUNDEX
................................................................................
  1035   1038         if( pFunc && aAggs[i].needCollSeq ){
  1036   1039           pFunc->needCollSeq = 1;
  1037   1040         }
  1038   1041       }
  1039   1042     }
  1040   1043     sqlite3RegisterDateTimeFunctions(db);
  1041   1044   #ifdef SQLITE_SSE
  1042         -  {
  1043         -    sqlite3SseFunctions(db);
  1044         -  }
         1045  +  sqlite3SseFunctions(db);
         1046  +#endif
         1047  +#ifdef SQLITE_CASE_SENSITIVE_LIKE
         1048  +  sqlite3RegisterLikeFunctions(db, 1);
         1049  +#else
         1050  +  sqlite3RegisterLikeFunctions(db, 0);
  1045   1051   #endif
  1046   1052   }
  1047   1053   
         1054  +/*
         1055  +** Set the LIKEOPT flag on the 2-argument function with the given name.
         1056  +*/
         1057  +static void setLikeOptFlag(sqlite3 *db, const char *zName){
         1058  +  FuncDef *pDef;
         1059  +  pDef = sqlite3FindFunction(db, zName, strlen(zName), 2, SQLITE_UTF8, 0);
         1060  +  if( pDef ){
         1061  +    pDef->flags = SQLITE_FUNC_LIKEOPT;
         1062  +  }
         1063  +}
         1064  +
         1065  +/*
         1066  +** Register the built-in LIKE and GLOB functions.  The caseSensitive
         1067  +** parameter determines whether or not the LIKE operator is case
         1068  +** sensitive.  GLOB is always case sensitive.
         1069  +*/
         1070  +void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){
         1071  +  struct compareInfo *pInfo;
         1072  +  if( caseSensitive ){
         1073  +    pInfo = (struct compareInfo*)&likeInfoAlt;
         1074  +  }else{
         1075  +    pInfo = (struct compareInfo*)&likeInfoNorm;
         1076  +  }
         1077  +  sqlite3_create_function(db, "like", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0);
         1078  +  sqlite3_create_function(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0);
         1079  +  sqlite3_create_function(db, "glob", 2, SQLITE_UTF8, 
         1080  +      (struct compareInfo*)&globInfo, likeFunc, 0,0);
         1081  +  setLikeOptFlag(db, "glob");
         1082  +  if( caseSensitive ){
         1083  +    setLikeOptFlag(db, "like");
         1084  +  }
         1085  +}
         1086  +
         1087  +/*
         1088  +** pExpr points to an expression which implements a function.  If
         1089  +** it is appropriate to apply the LIKE optimization to that function
         1090  +** then set aWc[0] through aWc[2] to the wildcard characters and
         1091  +** return TRUE.  If the function is not a LIKE-style function then
         1092  +** return FALSE.
         1093  +*/
         1094  +int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, char *aWc){
         1095  +  FuncDef *pDef;
         1096  +  if( pExpr->op!=TK_FUNCTION ){
         1097  +    return 0;
         1098  +  }
         1099  +  if( pExpr->pList->nExpr!=2 ){
         1100  +    return 0;
         1101  +  }
         1102  +  pDef = sqlite3FindFunction(db, (const char *)pExpr->token.z, pExpr->token.n, 2,
         1103  +                             SQLITE_UTF8, 0);
         1104  +  if( pDef==0 || (pDef->flags & SQLITE_FUNC_LIKEOPT)==0 ){
         1105  +    return 0;
         1106  +  }
         1107  +
         1108  +  /* The memcpy() statement assumes that the wildcard characters are
         1109  +  ** the first three statements in the compareInfo structure.  The
         1110  +  ** asserts() that follow verify that assumption
         1111  +  */
         1112  +  memcpy(aWc, pDef->pUserData, 3);
         1113  +  assert( (char*)&likeInfoAlt == (char*)&likeInfoAlt.matchAll );
         1114  +  assert( &((char*)&likeInfoAlt)[1] == (char*)&likeInfoAlt.matchOne );
         1115  +  assert( &((char*)&likeInfoAlt)[2] == (char*)&likeInfoAlt.matchSet );
         1116  +
         1117  +  return 1;
         1118  +}
  1048   1119   }

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

    11     11   **    May you find forgiveness for yourself and forgive others.
    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15     15   ** This is the implementation of generic hash-tables
    16     16   ** used in SQLite.
    17     17   **
    18         -** $Id: hash.c,v 1.6 2005/08/01 19:32:10 rmsimpson Exp $
           18  +** $Id: hash.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   #include <assert.h>
    22     22   
    23     23   /* Turn bulk memory into a hash table object by initializing the
    24     24   ** fields of the Hash structure.
    25     25   **
................................................................................
   384    384     assert( pH->htsize>0 );
   385    385     assert( (pH->htsize & (pH->htsize-1))==0 );
   386    386     h = hraw & (pH->htsize-1);
   387    387     insertElement(pH, &pH->ht[h], new_elem);
   388    388     new_elem->data = data;
   389    389     return 0;
   390    390   }
   391         -
   392    391   }

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

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This is the header file for the generic hash-table implemenation
    13     13   ** used in SQLite.
    14     14   **
    15         -** $Id: hash.h,v 1.6 2005/08/01 19:32:10 rmsimpson Exp $
           15  +** $Id: hash.h,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    16     16   */
    17     17   #ifndef _SQLITE_HASH_H_
    18     18   #define _SQLITE_HASH_H_
    19     19   
    20     20   /* Forward declarations of structures. */
    21     21   typedef struct Hash Hash;
    22     22   typedef struct HashElem HashElem;

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

    11     11   **    May you find forgiveness for yourself and forgive others.
    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15     15   ** This file contains C code routines that are called by the parser
    16     16   ** to handle INSERT statements in SQLite.
    17     17   **
    18         -** $Id: insert.c,v 1.6 2005/08/01 19:32:10 rmsimpson Exp $
           18  +** $Id: insert.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   
    22     22   /*
    23     23   ** Set P3 of the most recently inserted opcode to a column affinity
    24     24   ** string for index pIdx. A column affinity string has one character
    25     25   ** for each column in the table, according to the affinity of the column:
................................................................................
   372    372         sqlite3VdbeAddOp(v, OP_Return, 0, 0);
   373    373   
   374    374         /* The following code runs first because the GOTO at the very top
   375    375         ** of the program jumps to it.  Create the temporary table, then jump
   376    376         ** back up and execute the SELECT code above.
   377    377         */
   378    378         sqlite3VdbeChangeP2(v, iInitCode, sqlite3VdbeCurrentAddr(v));
   379         -      sqlite3VdbeAddOp(v, OP_OpenTemp, srcTab, 0);
          379  +      sqlite3VdbeAddOp(v, OP_OpenVirtual, srcTab, 0);
   380    380         sqlite3VdbeAddOp(v, OP_SetNumColumns, srcTab, nColumn);
   381    381         sqlite3VdbeAddOp(v, OP_Goto, 0, iSelectLoop);
   382    382         sqlite3VdbeResolveLabel(v, iCleanup);
   383    383       }else{
   384    384         sqlite3VdbeChangeP2(v, iInitCode, sqlite3VdbeCurrentAddr(v));
   385    385       }
   386    386     }else{
................................................................................
   948    948         int idx = pIdx->aiColumn[i];
   949    949         if( idx==pTab->iPKey ){
   950    950           sqlite3VdbeAddOp(v, OP_Dup, i+extra+nCol+1, 1);
   951    951         }else{
   952    952           sqlite3VdbeAddOp(v, OP_Dup, i+extra+nCol-idx, 1);
   953    953         }
   954    954       }
   955         -    jumpInst1 = sqlite3VdbeAddOp(v, OP_MakeRecord, pIdx->nColumn, (1<<24));
          955  +    jumpInst1 = sqlite3VdbeAddOp(v, OP_MakeIdxRec, pIdx->nColumn, 0);
   956    956       sqlite3IndexAffinityStr(v, pIdx);
   957    957   
   958    958       /* Find out what action to take in case there is an indexing conflict */
   959    959       onError = pIdx->onError;
   960    960       if( onError==OE_None ) continue;  /* pIdx is not a UNIQUE index */
   961    961       if( overrideError!=OE_Default ){
   962    962         onError = overrideError;
................................................................................
  1018   1018             sqlite3VdbeAddOp(v, OP_MoveGe, base, 0);
  1019   1019           }
  1020   1020           seenReplace = 1;
  1021   1021           break;
  1022   1022         }
  1023   1023       }
  1024   1024       contAddr = sqlite3VdbeCurrentAddr(v);
  1025         -    assert( contAddr<(1<<24) );
  1026   1025   #if NULL_DISTINCT_FOR_UNIQUE
  1027         -    sqlite3VdbeChangeP2(v, jumpInst1, contAddr | (1<<24));
         1026  +    sqlite3VdbeChangeP2(v, jumpInst1, contAddr);
  1028   1027   #endif
  1029   1028       sqlite3VdbeChangeP2(v, jumpInst2, contAddr);
  1030   1029     }
  1031   1030   }
  1032   1031   
  1033   1032   /*
  1034   1033   ** This routine generates code to finish the INSERT or UPDATE operation
................................................................................
  1096   1095     int op           /* OP_OpenRead or OP_OpenWrite */
  1097   1096   ){
  1098   1097     int i;
  1099   1098     Index *pIdx;
  1100   1099     Vdbe *v = sqlite3GetVdbe(pParse);
  1101   1100     assert( v!=0 );
  1102   1101     sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
  1103         -  sqlite3VdbeAddOp(v, op, base, pTab->tnum);
  1104   1102     VdbeComment((v, "# %s", pTab->zName));
         1103  +  sqlite3VdbeAddOp(v, op, base, pTab->tnum);
  1105   1104     sqlite3VdbeAddOp(v, OP_SetNumColumns, base, pTab->nCol);
  1106   1105     for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
  1107   1106       sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
         1107  +    VdbeComment((v, "# %s", pIdx->zName));
  1108   1108       sqlite3VdbeOp3(v, op, i+base, pIdx->tnum,
  1109   1109                      (char*)&pIdx->keyInfo, P3_KEYINFO);
  1110   1110     }
  1111   1111     if( pParse->nTab<=base+i ){
  1112   1112       pParse->nTab = base+i;
  1113   1113     }
  1114   1114   }
  1115         -
  1116   1115   }

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

     1         -/* Hash score: 153 */
            1  +/* Hash score: 156 */
     2      2   static int keywordCode(const char *z, int n){
     3         -  static const char zText[515] =
            3  +  static const char zText[526] =
     4      4       "ABORTABLEFTEMPORARYADDATABASELECTHENDEFAULTRANSACTIONATURALTER"
     5         -    "AISEACHECKEYAFTEREFERENCESCAPELSEXCEPTRIGGEREGEXPLAINITIALLYAND"
     6         -    "EFERRABLEXCLUSIVEXISTSTATEMENTATTACHAVINGLOBEFOREIGNOREINDEXAUTOINCREMENT"
     7         -    "BEGINNERENAMEBETWEENOTNULLIKEBYCASCADEFERREDELETECASECOLLATECOLUMN"
     8         -    "COMMITCONFLICTCONSTRAINTERSECTCREATECROSSCURRENT_DATECURRENT_TIMESTAMP"
     9         -    "RAGMATCHDESCDETACHDISTINCTDROPRIMARYFAILIMITFROMFULLGROUPDATE"
    10         -    "IMMEDIATEINSERTINSTEADINTOFFSETISNULLJOINORDEREPLACEOUTERESTRICT"
    11         -    "RIGHTROLLBACKROWHENUNIONUNIQUEUSINGVACUUMVALUESVIEWHERE";
            5  +    "AISEACHECKEYAFTEREFERENCESCAPELSEXCEPTRIGGEREGEXPLAINITIALLYANALYZE"
            6  +    "XCLUSIVEXISTSTATEMENTANDEFERRABLEATTACHAVINGLOBEFOREIGNOREINDEX"
            7  +    "AUTOINCREMENTBEGINNERENAMEBETWEENOTNULLIKEBYCASCADEFERREDELETE"
            8  +    "CASECASTCOLLATECOLUMNCOMMITCONFLICTCONSTRAINTERSECTCREATECROSS"
            9  +    "CURRENT_DATECURRENT_TIMESTAMPRAGMATCHDESCDETACHDISTINCTDROPRIMARY"
           10  +    "FAILIMITFROMFULLGROUPDATEIMMEDIATEINSERTINSTEADINTOFFSETISNULL"
           11  +    "JOINORDEREPLACEOUTERESTRICTRIGHTROLLBACKROWHENUNIONUNIQUEUSING"
           12  +    "VACUUMVALUESVIEWHERE";
    12     13     static const unsigned char aHash[127] = {
    13         -      89,  79, 102,  88,   0,   4,   0,   0, 109,   0,  75,   0,   0,
    14         -      92,  43,   0,  90,   0, 101, 104,  94,   0,   0,  10,   0,   0,
    15         -     108,   0, 105, 100,   0,  28,  47,   0,  40,   0,   0,  63,  69,
    16         -       0,  62,  19,   0,   0,  32,  81,   0, 103,  72,   0,   0,  34,
    17         -       0,  60,  33,   0,   8,   0, 110,  37,  12,   0,  76,  39,  25,
    18         -      64,   0,   0,  31,  80,  52,  30,  49,  20,  86,   0,  35,   0,
    19         -      73,  26,   0,  70,   0,   0,   0,   0,  46,  65,  22,  85,  29,
    20         -      67,  84,   0,   1,   0,   9,  98,  57,  18,   0, 107,  74,  96,
    21         -      53,   6,  83,   0,   0,  48,  91,   0,  99,   0,  68,   0,   0,
    22         -      15,   0, 111,  50,  55,   0,   2,  54,   0, 106,
           14  +      91,  81, 104,  90,   0,   4,   0,   0, 111,   0,  77,   0,   0,
           15  +      94,  44,   0,  92,   0, 103, 106,  96,   0,   0,  10,   0,   0,
           16  +     110,   0, 107, 102,   0,  28,  48,   0,  41,   0,   0,  65,  71,
           17  +       0,  63,  19,   0,   0,  36,  83,   0, 105,  74,   0,   0,  33,
           18  +       0,  61,  37,   0,   8,   0, 112,  38,  12,   0,  78,  40,  25,
           19  +      66,   0,   0,  31,  82,  53,  30,  50,  20,  88,   0,  34,   0,
           20  +      75,  26,   0,  72,   0,   0,   0,  64,  47,  67,  22,  87,  29,
           21  +      69,  86,   0,   1,   0,   9, 100,  58,  18,   0, 109,  76,  98,
           22  +      54,   6,  85,   0,   0,  49,  93,   0, 101,   0,  70,   0,   0,
           23  +      15,   0, 113,  51,  56,   0,   2,  55,   0, 108,
    23     24     };
    24         -  static const unsigned char aNext[111] = {
           25  +  static const unsigned char aNext[113] = {
    25     26          0,   0,   0,   0,   0,   3,   0,   0,   0,   0,   0,   0,   0,
    26     27          0,   0,   0,   0,   0,   0,   0,   0,  17,   0,   0,   0,   0,
    27         -       0,  11,   0,   0,   0,   7,   0,   5,  13,   0,   0,   0,   0,
    28         -       0,   0,   0,   0,   0,   0,  42,   0,   0,   0,   0,   0,   0,
    29         -       0,  16,   0,  23,  51,   0,   0,   0,   0,  44,  58,   0,   0,
    30         -       0,   0,   0,   0,   0,   0,  71,  41,   0,   0,  24,  59,  21,
    31         -       0,  78,   0,  66,   0,   0,  82,  45,   0,   0,   0,   0,   0,
    32         -       0,   0,  38,  93,  95,   0,   0,  97,   0,  14,  27,  77,   0,
    33         -      56,  87,   0,  36,   0,  61,   0,
           28  +       0,  11,   0,   0,   0,   0,   5,  13,   0,   7,   0,   0,   0,
           29  +       0,   0,   0,   0,   0,   0,   0,  43,   0,   0,   0,   0,   0,
           30  +       0,   0,  16,   0,  23,  52,   0,   0,   0,   0,  45,   0,  59,
           31  +       0,   0,   0,   0,   0,   0,   0,   0,  73,  42,   0,   0,  24,
           32  +      60,  21,   0,  80,  32,  68,   0,   0,  84,  46,   0,   0,   0,
           33  +       0,   0,   0,   0,  39,  95,  97,   0,   0,  99,   0,  14,  27,
           34  +      79,   0,  57,  89,   0,  35,   0,  62,   0,
    34     35     };
    35         -  static const unsigned char aLen[111] = {
           36  +  static const unsigned char aLen[113] = {
    36     37          5,   5,   4,   4,   9,   2,   3,   8,   2,   6,   4,   3,   7,
    37     38         11,   2,   7,   5,   5,   4,   5,   3,   5,  10,   6,   4,   6,
    38         -       7,   6,   7,   9,   3,   3,  10,   9,   6,   9,   6,   6,   4,
    39         -       6,   3,   7,   6,   7,   5,  13,   2,   2,   5,   5,   6,   7,
    40         -       3,   7,   4,   4,   2,   7,   3,   8,   6,   4,   7,   6,   6,
    41         -       8,  10,   9,   6,   5,  12,  12,  17,   6,   5,   4,   6,   8,
    42         -       2,   4,   7,   4,   5,   4,   4,   5,   6,   9,   6,   7,   4,
    43         -       2,   6,   3,   6,   4,   5,   7,   5,   8,   5,   8,   3,   4,
    44         -       5,   6,   5,   6,   6,   4,   5,
           39  +       7,   6,   7,   9,   3,   7,   9,   6,   9,   3,  10,   6,   6,
           40  +       4,   6,   3,   7,   6,   7,   5,  13,   2,   2,   5,   5,   6,
           41  +       7,   3,   7,   4,   4,   2,   7,   3,   8,   6,   4,   4,   7,
           42  +       6,   6,   8,  10,   9,   6,   5,  12,  12,  17,   6,   5,   4,
           43  +       6,   8,   2,   4,   7,   4,   5,   4,   4,   5,   6,   9,   6,
           44  +       7,   4,   2,   6,   3,   6,   4,   5,   7,   5,   8,   5,   8,
           45  +       3,   4,   5,   6,   5,   6,   6,   4,   5,
    45     46     };
    46         -  static const unsigned short int aOffset[111] = {
           47  +  static const unsigned short int aOffset[113] = {
    47     48          0,   4,   7,  10,  10,  14,  19,  21,  26,  27,  32,  34,  36,
    48     49         42,  51,  52,  57,  61,  65,  67,  71,  74,  78,  86,  91,  94,
    49         -      99, 105, 108, 113, 118, 122, 124, 133, 141, 146, 155, 160, 165,
    50         -     168, 170, 170, 174, 178, 180, 185, 187, 189, 198, 201, 205, 211,
    51         -     217, 217, 220, 223, 227, 229, 230, 234, 241, 247, 251, 258, 264,
    52         -     270, 278, 285, 294, 300, 305, 317, 317, 333, 337, 342, 346, 352,
    53         -     353, 360, 363, 370, 373, 378, 382, 386, 389, 395, 404, 410, 417,
    54         -     420, 420, 423, 426, 432, 436, 440, 447, 451, 459, 464, 472, 474,
    55         -     478, 483, 489, 494, 500, 506, 509,
           50  +      99, 105, 108, 113, 118, 122, 128, 136, 141, 150, 152, 162, 167,
           51  +     172, 175, 177, 177, 181, 185, 187, 192, 194, 196, 205, 208, 212,
           52  +     218, 224, 224, 227, 230, 234, 236, 237, 241, 248, 254, 258, 262,
           53  +     269, 275, 281, 289, 296, 305, 311, 316, 328, 328, 344, 348, 353,
           54  +     357, 363, 364, 371, 374, 381, 384, 389, 393, 397, 400, 406, 415,
           55  +     421, 428, 431, 431, 434, 437, 443, 447, 451, 458, 462, 470, 475,
           56  +     483, 485, 489, 494, 500, 505, 511, 517, 520,
    56     57     };
    57         -  static const unsigned char aCode[111] = {
           58  +  static const unsigned char aCode[113] = {
    58     59       TK_ABORT,      TK_TABLE,      TK_JOIN_KW,    TK_TEMP,       TK_TEMP,       
    59     60       TK_OR,         TK_ADD,        TK_DATABASE,   TK_AS,         TK_SELECT,     
    60     61       TK_THEN,       TK_END,        TK_DEFAULT,    TK_TRANSACTION,TK_ON,         
    61     62       TK_JOIN_KW,    TK_ALTER,      TK_RAISE,      TK_EACH,       TK_CHECK,      
    62     63       TK_KEY,        TK_AFTER,      TK_REFERENCES, TK_ESCAPE,     TK_ELSE,       
    63     64       TK_EXCEPT,     TK_TRIGGER,    TK_LIKE_KW,    TK_EXPLAIN,    TK_INITIALLY,  
    64         -    TK_ALL,        TK_AND,        TK_DEFERRABLE, TK_EXCLUSIVE,  TK_EXISTS,     
    65         -    TK_STATEMENT,  TK_ATTACH,     TK_HAVING,     TK_LIKE_KW,    TK_BEFORE,     
    66         -    TK_FOR,        TK_FOREIGN,    TK_IGNORE,     TK_REINDEX,    TK_INDEX,      
    67         -    TK_AUTOINCR,   TK_TO,         TK_IN,         TK_BEGIN,      TK_JOIN_KW,    
    68         -    TK_RENAME,     TK_BETWEEN,    TK_NOT,        TK_NOTNULL,    TK_NULL,       
    69         -    TK_LIKE_KW,    TK_BY,         TK_CASCADE,    TK_ASC,        TK_DEFERRED,   
    70         -    TK_DELETE,     TK_CASE,       TK_COLLATE,    TK_COLUMNKW,   TK_COMMIT,     
    71         -    TK_CONFLICT,   TK_CONSTRAINT, TK_INTERSECT,  TK_CREATE,     TK_JOIN_KW,    
    72         -    TK_CTIME_KW,   TK_CTIME_KW,   TK_CTIME_KW,   TK_PRAGMA,     TK_MATCH,      
    73         -    TK_DESC,       TK_DETACH,     TK_DISTINCT,   TK_IS,         TK_DROP,       
    74         -    TK_PRIMARY,    TK_FAIL,       TK_LIMIT,      TK_FROM,       TK_JOIN_KW,    
    75         -    TK_GROUP,      TK_UPDATE,     TK_IMMEDIATE,  TK_INSERT,     TK_INSTEAD,    
    76         -    TK_INTO,       TK_OF,         TK_OFFSET,     TK_SET,        TK_ISNULL,     
    77         -    TK_JOIN,       TK_ORDER,      TK_REPLACE,    TK_JOIN_KW,    TK_RESTRICT,   
    78         -    TK_JOIN_KW,    TK_ROLLBACK,   TK_ROW,        TK_WHEN,       TK_UNION,      
    79         -    TK_UNIQUE,     TK_USING,      TK_VACUUM,     TK_VALUES,     TK_VIEW,       
    80         -    TK_WHERE,      
           65  +    TK_ALL,        TK_ANALYZE,    TK_EXCLUSIVE,  TK_EXISTS,     TK_STATEMENT,  
           66  +    TK_AND,        TK_DEFERRABLE, TK_ATTACH,     TK_HAVING,     TK_LIKE_KW,    
           67  +    TK_BEFORE,     TK_FOR,        TK_FOREIGN,    TK_IGNORE,     TK_REINDEX,    
           68  +    TK_INDEX,      TK_AUTOINCR,   TK_TO,         TK_IN,         TK_BEGIN,      
           69  +    TK_JOIN_KW,    TK_RENAME,     TK_BETWEEN,    TK_NOT,        TK_NOTNULL,    
           70  +    TK_NULL,       TK_LIKE_KW,    TK_BY,         TK_CASCADE,    TK_ASC,        
           71  +    TK_DEFERRED,   TK_DELETE,     TK_CASE,       TK_CAST,       TK_COLLATE,    
           72  +    TK_COLUMNKW,   TK_COMMIT,     TK_CONFLICT,   TK_CONSTRAINT, TK_INTERSECT,  
           73  +    TK_CREATE,     TK_JOIN_KW,    TK_CTIME_KW,   TK_CTIME_KW,   TK_CTIME_KW,   
           74  +    TK_PRAGMA,     TK_MATCH,      TK_DESC,       TK_DETACH,     TK_DISTINCT,   
           75  +    TK_IS,         TK_DROP,       TK_PRIMARY,    TK_FAIL,       TK_LIMIT,      
           76  +    TK_FROM,       TK_JOIN_KW,    TK_GROUP,      TK_UPDATE,     TK_IMMEDIATE,  
           77  +    TK_INSERT,     TK_INSTEAD,    TK_INTO,       TK_OF,         TK_OFFSET,     
           78  +    TK_SET,        TK_ISNULL,     TK_JOIN,       TK_ORDER,      TK_REPLACE,    
           79  +    TK_JOIN_KW,    TK_RESTRICT,   TK_JOIN_KW,    TK_ROLLBACK,   TK_ROW,        
           80  +    TK_WHEN,       TK_UNION,      TK_UNIQUE,     TK_USING,      TK_VACUUM,     
           81  +    TK_VALUES,     TK_VIEW,       TK_WHERE,      
    81     82     };
    82     83     int h, i;
    83     84     if( n<2 ) return TK_ID;
    84     85     h = ((sqlite3UpperToLower[((unsigned char*)z)[0]]*4) ^
    85     86         (sqlite3UpperToLower[((unsigned char*)z)[n-1]]*3) ^
    86     87         n) % 127;
    87     88     for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){

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

    13     13   **
    14     14   *************************************************************************
    15     15   ** Main file for the SQLite library.  The routines in this file
    16     16   ** implement the programmer interface to the library.  Routines in
    17     17   ** other files are for internal use by SQLite and should not be
    18     18   ** accessed by users of the library.
    19     19   **
    20         -** $Id: legacy.c,v 1.6 2005/08/01 19:32:10 rmsimpson Exp $
           20  +** $Id: legacy.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    21     21   */
    22     22   
    23     23   #include "sqliteInt.h"
    24     24   #include "os.h"
    25     25   #include <ctype.h>
    26     26   
    27     27   /*
................................................................................
   135    135       }
   136    136     }else if( pzErrMsg ){
   137    137       *pzErrMsg = 0;
   138    138     }
   139    139   
   140    140     return rc;
   141    141   }
   142         -
   143    142   }

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

    13     13   **
    14     14   *************************************************************************
    15     15   ** Main file for the SQLite library.  The routines in this file
    16     16   ** implement the programmer interface to the library.  Routines in
    17     17   ** other files are for internal use by SQLite and should not be
    18     18   ** accessed by users of the library.
    19     19   **
    20         -** $Id: main.c,v 1.6 2005/08/01 19:32:10 rmsimpson Exp $
           20  +** $Id: main.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    21     21   */
    22     22   #include "sqliteInt.h"
    23     23   #include "os.h"
    24     24   #include <ctype.h>
    25     25   
    26     26   /*
    27     27   ** The following constant value is used by the SQLITE_BIGENDIAN and
................................................................................
   233    233   const char *sqlite3ErrStr(int rc){
   234    234     const char *z;
   235    235     switch( rc ){
   236    236       case SQLITE_ROW:
   237    237       case SQLITE_DONE:
   238    238       case SQLITE_OK:         z = "not an error";                          break;
   239    239       case SQLITE_ERROR:      z = "SQL logic error or missing database";   break;
   240         -    case SQLITE_INTERNAL:   z = "internal SQLite implementation flaw";   break;
   241    240       case SQLITE_PERM:       z = "access permission denied";              break;
   242    241       case SQLITE_ABORT:      z = "callback requested query abort";        break;
   243    242       case SQLITE_BUSY:       z = "database is locked";                    break;
   244    243       case SQLITE_LOCKED:     z = "database table is locked";              break;
   245    244       case SQLITE_NOMEM:      z = "out of memory";                         break;
   246    245       case SQLITE_READONLY:   z = "attempt to write a readonly database";  break;
   247    246       case SQLITE_INTERRUPT:  z = "interrupted";                           break;
   248    247       case SQLITE_IOERR:      z = "disk I/O error";                        break;
   249    248       case SQLITE_CORRUPT:    z = "database disk image is malformed";      break;
   250         -    case SQLITE_NOTFOUND:   z = "table or record not found";             break;
   251         -    case SQLITE_FULL:       z = "database is full";                      break;
          249  +    case SQLITE_FULL:       z = "database or disk is full";              break;
   252    250       case SQLITE_CANTOPEN:   z = "unable to open database file";          break;
   253    251       case SQLITE_PROTOCOL:   z = "database locking protocol failure";     break;
   254    252       case SQLITE_EMPTY:      z = "table contains no data";                break;
   255    253       case SQLITE_SCHEMA:     z = "database schema has changed";           break;
   256         -    case SQLITE_TOOBIG:     z = "too much data for one table row";       break;
   257    254       case SQLITE_CONSTRAINT: z = "constraint failed";                     break;
   258    255       case SQLITE_MISMATCH:   z = "datatype mismatch";                     break;
   259    256       case SQLITE_MISUSE:     z = "library routine called out of sequence";break;
   260    257       case SQLITE_NOLFS:      z = "kernel lacks large file support";       break;
   261    258       case SQLITE_AUTH:       z = "authorization denied";                  break;
   262    259       case SQLITE_FORMAT:     z = "auxiliary database format error";       break;
   263    260       case SQLITE_RANGE:      z = "bind or column index out of range";     break;
................................................................................
   297    294     if( prior + delay > timeout ){
   298    295       delay = timeout - prior;
   299    296       if( delay<=0 ) return 0;
   300    297     }
   301    298     sqlite3OsSleep(delay);
   302    299     return 1;
   303    300   #else
   304         -  int timeout = (int)Timeout;
          301  +  int timeout = ((sqlite3 *)ptr)->busyTimeout;
   305    302     if( (count+1)*1000 > timeout ){
   306    303       return 0;
   307    304     }
   308    305     sqlite3OsSleep(1000);
   309    306     return 1;
   310    307   #endif
   311    308   }
          309  +
          310  +/*
          311  +** Invoke the given busy handler.
          312  +**
          313  +** This routine is called when an operation failed with a lock.
          314  +** If this routine returns non-zero, the lock is retried.  If it
          315  +** returns 0, the operation aborts with an SQLITE_BUSY error.
          316  +*/
          317  +int sqlite3InvokeBusyHandler(BusyHandler *p){
          318  +  int rc;
          319  +  if( p==0 || p->xFunc==0 || p->nBusy<0 ) return 0;
          320  +  rc = p->xFunc(p->pArg, p->nBusy);
          321  +  if( rc==0 ){
          322  +    p->nBusy = -1;
          323  +  }else{
          324  +    p->nBusy++;
          325  +  }
          326  +  return rc; 
          327  +}
   312    328   
   313    329   /*
   314    330   ** This routine sets the busy callback for an Sqlite database to the
   315    331   ** given callback function with the given argument.
   316    332   */
   317    333   int sqlite3_busy_handler(
   318    334     sqlite3 *db,
................................................................................
   320    336     void *pArg
   321    337   ){
   322    338     if( sqlite3SafetyCheck(db) ){
   323    339       return SQLITE_MISUSE;
   324    340     }
   325    341     db->busyHandler.xFunc = xBusy;
   326    342     db->busyHandler.pArg = pArg;
          343  +  db->busyHandler.nBusy = 0;
   327    344     return SQLITE_OK;
   328    345   }
   329    346   
   330    347   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
   331    348   /*
   332    349   ** This routine sets the progress callback for an Sqlite database to the
   333    350   ** given callback function with the given argument. The progress callback will
................................................................................
   453    470       }else{
   454    471         sqlite3ExpirePreparedStatements(db);
   455    472       }
   456    473     }
   457    474   
   458    475     p = sqlite3FindFunction(db, zFunctionName, nName, nArg, enc, 1);
   459    476     if( p==0 ) return SQLITE_NOMEM;
          477  +  p->flags = 0;
   460    478     p->xFunc = xFunc;
   461    479     p->xStep = xStep;
   462    480     p->xFinalize = xFinal;
   463    481     p->pUserData = pUserData;
   464    482     return SQLITE_OK;
   465    483   }
   466    484   #ifndef SQLITE_OMIT_UTF16
................................................................................
   529    547   
   530    548   /*
   531    549   ** This routine is called to create a connection to a database BTree
   532    550   ** driver.  If zFilename is the name of a file, then that file is
   533    551   ** opened and used.  If zFilename is the magic name ":memory:" then
   534    552   ** the database is stored in memory (and is thus forgotten as soon as
   535    553   ** the connection is closed.)  If zFilename is NULL then the database
   536         -** is for temporary use only and is deleted as soon as the connection
   537         -** is closed.
          554  +** is a "virtual" database for transient use only and is deleted as
          555  +** soon as the connection is closed.
   538    556   **
   539         -** A temporary database can be either a disk file (that is automatically
   540         -** deleted when the file is closed) or a set of red-black trees held in memory,
          557  +** A virtual database can be either a disk file (that is automatically
          558  +** deleted when the file is closed) or it an be held entirely in memory,
   541    559   ** depending on the values of the TEMP_STORE compile-time macro and the
   542    560   ** db->temp_store variable, according to the following chart:
   543    561   **
   544    562   **       TEMP_STORE     db->temp_store     Location of temporary database
   545    563   **       ----------     --------------     ------------------------------
   546    564   **           0               any             file
   547    565   **           1                1              file
................................................................................
  1000   1018   ** by the next COMMIT or ROLLBACK.
  1001   1019   **
  1002   1020   ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
  1003   1021   */
  1004   1022   int sqlite3_get_autocommit(sqlite3 *db){
  1005   1023     return db->autoCommit;
  1006   1024   }
  1007         -
  1008   1025   }

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

     1      1   #pragma unmanaged
     2      2   extern "C"
     3      3   {
     4      4   /* Automatically generated.  Do not edit */
     5      5   /* See the mkopcodec.awk script for details. */
     6      6   #if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
     7         -const char *const sqlite3OpcodeNames[] = { "?",
            7  +extern const char * sqlite3OpcodeNames[] = { "?",
     8      8    /*   1 */ "MemLoad",
     9      9    /*   2 */ "Column",
    10     10    /*   3 */ "SetCookie",
    11     11    /*   4 */ "IfMemPos",
    12     12    /*   5 */ "MoveGt",
    13     13    /*   6 */ "AggFocus",
    14     14    /*   7 */ "RowKey",
    15     15    /*   8 */ "AggNext",
    16     16    /*   9 */ "OpenWrite",
    17     17    /*  10 */ "If",
    18         - /*  11 */ "Pop",
    19         - /*  12 */ "AggContextPush",
    20         - /*  13 */ "CollSeq",
    21         - /*  14 */ "OpenRead",
    22         - /*  15 */ "Expire",
    23         - /*  16 */ "SortReset",
    24         - /*  17 */ "AutoCommit",
    25         - /*  18 */ "Sort",
    26         - /*  19 */ "ListRewind",
           18  + /*  11 */ "ToInt",
           19  + /*  12 */ "Pop",
           20  + /*  13 */ "AggContextPush",
           21  + /*  14 */ "CollSeq",
           22  + /*  15 */ "OpenRead",
           23  + /*  16 */ "Expire",
           24  + /*  17 */ "SortReset",
           25  + /*  18 */ "AutoCommit",
           26  + /*  19 */ "Sort",
    27     27    /*  20 */ "IntegrityCk",
    28     28    /*  21 */ "SortInsert",
    29     29    /*  22 */ "Function",
    30     30    /*  23 */ "Noop",
    31     31    /*  24 */ "Return",
    32     32    /*  25 */ "NewRowid",
    33     33    /*  26 */ "Variable",
    34     34    /*  27 */ "String",
    35     35    /*  28 */ "ParseSchema",
    36     36    /*  29 */ "AggFunc",
    37     37    /*  30 */ "Close",
    38         - /*  31 */ "ListWrite",
    39         - /*  32 */ "CreateIndex",
    40         - /*  33 */ "IsUnique",
    41         - /*  34 */ "IdxIsNull",
    42         - /*  35 */ "NotFound",
           38  + /*  31 */ "CreateIndex",
           39  + /*  32 */ "IsUnique",
           40  + /*  33 */ "IdxIsNull",
           41  + /*  34 */ "NotFound",
           42  + /*  35 */ "Int64",
    43     43    /*  36 */ "MustBeInt",
    44     44    /*  37 */ "Halt",
    45     45    /*  38 */ "Rowid",
    46     46    /*  39 */ "IdxLT",
    47     47    /*  40 */ "AddImm",
    48     48    /*  41 */ "Statement",
    49     49    /*  42 */ "RowData",
    50     50    /*  43 */ "MemMax",
    51     51    /*  44 */ "Push",
    52     52    /*  45 */ "NotExists",
    53         - /*  46 */ "OpenTemp",
    54         - /*  47 */ "MemIncr",
    55         - /*  48 */ "Gosub",
    56         - /*  49 */ "AggSet",
    57         - /*  50 */ "Integer",
           53  + /*  46 */ "MemIncr",
           54  + /*  47 */ "Gosub",
           55  + /*  48 */ "AggSet",
           56  + /*  49 */ "Integer",
           57  + /*  50 */ "ToNumeric",
    58     58    /*  51 */ "SortNext",
    59     59    /*  52 */ "Prev",
    60     60    /*  53 */ "CreateTable",
    61     61    /*  54 */ "Last",
    62     62    /*  55 */ "IdxRowid",
    63         - /*  56 */ "ResetCount",
    64         - /*  57 */ "Callback",
    65         - /*  58 */ "ContextPush",
    66         - /*  59 */ "DropTrigger",
    67         - /*  60 */ "DropIndex",
    68         - /*  61 */ "IdxGE",
    69         - /*  62 */ "Or",
    70         - /*  63 */ "And",
    71         - /*  64 */ "Not",
    72         - /*  65 */ "IdxDelete",
    73         - /*  66 */ "Vacuum",
    74         - /*  67 */ "MoveLe",
    75         - /*  68 */ "IsNull",
    76         - /*  69 */ "NotNull",
    77         - /*  70 */ "Ne",
    78         - /*  71 */ "Eq",
    79         - /*  72 */ "Gt",
    80         - /*  73 */ "Le",
    81         - /*  74 */ "Lt",
    82         - /*  75 */ "Ge",
    83         - /*  76 */ "IfNot",
    84         - /*  77 */ "BitAnd",
    85         - /*  78 */ "BitOr",
    86         - /*  79 */ "ShiftLeft",
    87         - /*  80 */ "ShiftRight",
    88         - /*  81 */ "Add",
    89         - /*  82 */ "Subtract",
    90         - /*  83 */ "Multiply",
    91         - /*  84 */ "Divide",
    92         - /*  85 */ "Remainder",
    93         - /*  86 */ "Concat",
    94         - /*  87 */ "Negative",
    95         - /*  88 */ "DropTable",
    96         - /*  89 */ "BitNot",
    97         - /*  90 */ "String8",
    98         - /*  91 */ "MakeRecord",
    99         - /*  92 */ "Delete",
   100         - /*  93 */ "AggContextPop",
   101         - /*  94 */ "ListRead",
   102         - /*  95 */ "ListReset",
   103         - /*  96 */ "Dup",
   104         - /*  97 */ "Goto",
   105         - /*  98 */ "Clear",
   106         - /*  99 */ "IdxGT",
   107         - /* 100 */ "MoveLt",
   108         - /* 101 */ "VerifyCookie",
   109         - /* 102 */ "Pull",
   110         - /* 103 */ "SetNumColumns",
   111         - /* 104 */ "AbsValue",
   112         - /* 105 */ "Transaction",
   113         - /* 106 */ "AggGet",
   114         - /* 107 */ "ContextPop",
   115         - /* 108 */ "Next",
   116         - /* 109 */ "AggInit",
   117         - /* 110 */ "IdxInsert",
   118         - /* 111 */ "Distinct",
   119         - /* 112 */ "AggReset",
   120         - /* 113 */ "Insert",
   121         - /* 114 */ "Destroy",
   122         - /* 115 */ "ReadCookie",
   123         - /* 116 */ "ForceInt",
   124         - /* 117 */ "OpenPseudo",
   125         - /* 118 */ "Null",
   126         - /* 119 */ "Blob",
   127         - /* 120 */ "MemStore",
   128         - /* 121 */ "Rewind",
   129         - /* 122 */ "MoveGe",
   130         - /* 123 */ "Found",
   131         - /* 124 */ "NullRow",
   132         - /* 125 */ "NotUsed_125",
   133         - /* 126 */ "NotUsed_126",
   134         - /* 127 */ "NotUsed_127",
   135         - /* 128 */ "Real",
   136         - /* 129 */ "HexBlob",
           63  + /*  56 */ "MakeIdxRec",
           64  + /*  57 */ "ResetCount",
           65  + /*  58 */ "FifoWrite",
           66  + /*  59 */ "Callback",
           67  + /*  60 */ "ContextPush",
           68  + /*  61 */ "DropTrigger",
           69  + /*  62 */ "DropIndex",
           70  + /*  63 */ "IdxGE",
           71  + /*  64 */ "Or",
           72  + /*  65 */ "And",
           73  + /*  66 */ "Not",
           74  + /*  67 */ "IdxDelete",
           75  + /*  68 */ "Vacuum",
           76  + /*  69 */ "MoveLe",
           77  + /*  70 */ "IsNull",
           78  + /*  71 */ "NotNull",
           79  + /*  72 */ "Ne",
           80  + /*  73 */ "Eq",
           81  + /*  74 */ "Gt",
           82  + /*  75 */ "Le",
           83  + /*  76 */ "Lt",
           84  + /*  77 */ "Ge",
           85  + /*  78 */ "IfNot",
           86  + /*  79 */ "BitAnd",
           87  + /*  80 */ "BitOr",
           88  + /*  81 */ "ShiftLeft",
           89  + /*  82 */ "ShiftRight",
           90  + /*  83 */ "Add",
           91  + /*  84 */ "Subtract",
           92  + /*  85 */ "Multiply",
           93  + /*  86 */ "Divide",
           94  + /*  87 */ "Remainder",
           95  + /*  88 */ "Concat",
           96  + /*  89 */ "Negative",
           97  + /*  90 */ "DropTable",
           98  + /*  91 */ "BitNot",
           99  + /*  92 */ "String8",
          100  + /*  93 */ "MakeRecord",
          101  + /*  94 */ "ToBlob",
          102  + /*  95 */ "Delete",
          103  + /*  96 */ "AggContextPop",
          104  + /*  97 */ "Dup",
          105  + /*  98 */ "Goto",
          106  + /*  99 */ "FifoRead",
          107  + /* 100 */ "Clear",
          108  + /* 101 */ "IdxGT",
          109  + /* 102 */ "MoveLt",
          110  + /* 103 */ "VerifyCookie",
          111  + /* 104 */ "Pull",
          112  + /* 105 */ "ToText",
          113  + /* 106 */ "SetNumColumns",
          114  + /* 107 */ "AbsValue",
          115  + /* 108 */ "Transaction",
          116  + /* 109 */ "AggGet",
          117  + /* 110 */ "ContextPop",
          118  + /* 111 */ "Next",
          119  + /* 112 */ "AggInit",
          120  + /* 113 */ "IdxInsert",
          121  + /* 114 */ "Distinct",
          122  + /* 115 */ "AggReset",
          123  + /* 116 */ "Insert",
          124  + /* 117 */ "Destroy",
          125  + /* 118 */ "ReadCookie",
          126  + /* 119 */ "ForceInt",
          127  + /* 120 */ "LoadAnalysis",
          128  + /* 121 */ "OpenVirtual",
          129  + /* 122 */ "OpenPseudo",
          130  + /* 123 */ "Null",
          131  + /* 124 */ "Blob",
          132  + /* 125 */ "MemStore",
          133  + /* 126 */ "Rewind",
          134  + /* 127 */ "MoveGe",
          135  + /* 128 */ "Found",
          136  + /* 129 */ "NullRow",
          137  + /* 130 */ "Real",
          138  + /* 131 */ "HexBlob",
   137    139   };
   138    140   #endif
   139         -
   140    141   }

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

     1      1   /* Automatically generated.  Do not edit */
     2      2   /* See the mkopcodeh.awk script for details */
     3      3   #define OP_MemLoad                              1
     4         -#define OP_HexBlob                            129   /* same as TK_BLOB     */
            4  +#define OP_HexBlob                            131   /* same as TK_BLOB     */
     5      5   #define OP_Column                               2
     6      6   #define OP_SetCookie                            3
     7      7   #define OP_IfMemPos                             4
     8         -#define OP_Real                               128   /* same as TK_FLOAT    */
            8  +#define OP_Real                               130   /* same as TK_FLOAT    */
     9      9   #define OP_MoveGt                               5
    10         -#define OP_Ge                                  75   /* same as TK_GE       */
           10  +#define OP_Ge                                  77   /* same as TK_GE       */
    11     11   #define OP_AggFocus                             6
    12     12   #define OP_RowKey                               7
    13     13   #define OP_AggNext                              8
    14         -#define OP_Eq                                  71   /* same as TK_EQ       */
           14  +#define OP_Eq                                  73   /* same as TK_EQ       */
    15     15   #define OP_OpenWrite                            9
    16         -#define OP_NotNull                             69   /* same as TK_NOTNULL  */
           16  +#define OP_NotNull                             71   /* same as TK_NOTNULL  */
    17     17   #define OP_If                                  10
    18         -#define OP_String8                             90   /* same as TK_STRING   */
    19         -#define OP_Pop                                 11
    20         -#define OP_AggContextPush                      12
    21         -#define OP_CollSeq                             13
    22         -#define OP_OpenRead                            14
    23         -#define OP_Expire                              15
    24         -#define OP_SortReset                           16
    25         -#define OP_AutoCommit                          17
    26         -#define OP_Gt                                  72   /* same as TK_GT       */
    27         -#define OP_Sort                                18
    28         -#define OP_ListRewind                          19
           18  +#define OP_ToInt                               11
           19  +#define OP_String8                             92   /* same as TK_STRING   */
           20  +#define OP_Pop                                 12
           21  +#define OP_AggContextPush                      13
           22  +#define OP_CollSeq                             14
           23  +#define OP_OpenRead                            15
           24  +#define OP_Expire                              16
           25  +#define OP_SortReset                           17
           26  +#define OP_AutoCommit                          18
           27  +#define OP_Gt                                  74   /* same as TK_GT       */
           28  +#define OP_Sort                                19
    29     29   #define OP_IntegrityCk                         20
    30     30   #define OP_SortInsert                          21
    31     31   #define OP_Function                            22
    32         -#define OP_And                                 63   /* same as TK_AND      */
    33         -#define OP_Subtract                            82   /* same as TK_MINUS    */
           32  +#define OP_And                                 65   /* same as TK_AND      */
           33  +#define OP_Subtract                            84   /* same as TK_MINUS    */
    34     34   #define OP_Noop                                23
    35     35   #define OP_Return                              24
    36         -#define OP_Remainder                           85   /* same as TK_REM      */
           36  +#define OP_Remainder                           87   /* same as TK_REM      */
    37     37   #define OP_NewRowid                            25
    38         -#define OP_Multiply                            83   /* same as TK_STAR     */
           38  +#define OP_Multiply                            85   /* same as TK_STAR     */
    39     39   #define OP_Variable                            26
    40     40   #define OP_String                              27
    41     41   #define OP_ParseSchema                         28
    42     42   #define OP_AggFunc                             29
    43     43   #define OP_Close                               30
    44         -#define OP_ListWrite                           31
    45         -#define OP_CreateIndex                         32
    46         -#define OP_IsUnique                            33
    47         -#define OP_IdxIsNull                           34
    48         -#define OP_NotFound                            35
           44  +#define OP_CreateIndex                         31
           45  +#define OP_IsUnique                            32
           46  +#define OP_IdxIsNull                           33
           47  +#define OP_NotFound                            34
           48  +#define OP_Int64                               35
    49     49   #define OP_MustBeInt                           36
    50     50   #define OP_Halt                                37
    51     51   #define OP_Rowid                               38
    52     52   #define OP_IdxLT                               39
    53     53   #define OP_AddImm                              40
    54     54   #define OP_Statement                           41
    55     55   #define OP_RowData                             42
    56     56   #define OP_MemMax                              43
    57     57   #define OP_Push                                44
    58         -#define OP_Or                                  62   /* same as TK_OR       */
           58  +#define OP_Or                                  64   /* same as TK_OR       */
    59     59   #define OP_NotExists                           45
    60         -#define OP_OpenTemp                            46
    61         -#define OP_MemIncr                             47
    62         -#define OP_Gosub                               48
    63         -#define OP_Divide                              84   /* same as TK_SLASH    */
    64         -#define OP_AggSet                              49
    65         -#define OP_Integer                             50
           60  +#define OP_MemIncr                             46
           61  +#define OP_Gosub                               47
           62  +#define OP_Divide                              86   /* same as TK_SLASH    */
           63  +#define OP_AggSet                              48
           64  +#define OP_Integer                             49
           65  +#define OP_ToNumeric                           50
    66     66   #define OP_SortNext                            51
    67     67   #define OP_Prev                                52
    68         -#define OP_Concat                              86   /* same as TK_CONCAT   */
    69         -#define OP_BitAnd                              77   /* same as TK_BITAND   */
           68  +#define OP_Concat                              88   /* same as TK_CONCAT   */
           69  +#define OP_BitAnd                              79   /* same as TK_BITAND   */
    70     70   #define OP_CreateTable                         53
    71     71   #define OP_Last                                54
    72         -#define OP_IsNull                              68   /* same as TK_ISNULL   */
           72  +#define OP_IsNull                              70   /* same as TK_ISNULL   */
    73     73   #define OP_IdxRowid                            55
    74         -#define OP_ShiftRight                          80   /* same as TK_RSHIFT   */
    75         -#define OP_ResetCount                          56
    76         -#define OP_Callback                            57
    77         -#define OP_ContextPush                         58
    78         -#define OP_DropTrigger                         59
    79         -#define OP_DropIndex                           60
    80         -#define OP_IdxGE                               61
    81         -#define OP_IdxDelete                           65
    82         -#define OP_Vacuum                              66
    83         -#define OP_MoveLe                              67
    84         -#define OP_IfNot                               76
    85         -#define OP_DropTable                           88
    86         -#define OP_MakeRecord                          91
    87         -#define OP_Delete                              92
    88         -#define OP_AggContextPop                       93
    89         -#define OP_ListRead                            94
    90         -#define OP_ListReset                           95
    91         -#define OP_ShiftLeft                           79   /* same as TK_LSHIFT   */
    92         -#define OP_Dup                                 96
    93         -#define OP_Goto                                97
    94         -#define OP_Clear                               98
    95         -#define OP_IdxGT                               99
    96         -#define OP_MoveLt                             100
    97         -#define OP_Le                                  73   /* same as TK_LE       */
    98         -#define OP_VerifyCookie                       101
    99         -#define OP_Pull                               102
   100         -#define OP_Not                                 64   /* same as TK_NOT      */
   101         -#define OP_SetNumColumns                      103
   102         -#define OP_AbsValue                           104
   103         -#define OP_Transaction                        105
   104         -#define OP_Negative                            87   /* same as TK_UMINUS   */
   105         -#define OP_Ne                                  70   /* same as TK_NE       */
   106         -#define OP_AggGet                             106
   107         -#define OP_ContextPop                         107
   108         -#define OP_BitOr                               78   /* same as TK_BITOR    */
   109         -#define OP_Next                               108
   110         -#define OP_AggInit                            109
   111         -#define OP_IdxInsert                          110
   112         -#define OP_Distinct                           111
   113         -#define OP_Lt                                  74   /* same as TK_LT       */
   114         -#define OP_AggReset                           112
   115         -#define OP_Insert                             113
   116         -#define OP_Destroy                            114
   117         -#define OP_ReadCookie                         115
   118         -#define OP_ForceInt                           116
   119         -#define OP_OpenPseudo                         117
   120         -#define OP_Null                               118
   121         -#define OP_Blob                               119
   122         -#define OP_Add                                 81   /* same as TK_PLUS     */
   123         -#define OP_MemStore                           120
   124         -#define OP_Rewind                             121
   125         -#define OP_MoveGe                             122
   126         -#define OP_BitNot                              89   /* same as TK_BITNOT   */
   127         -#define OP_Found                              123
   128         -#define OP_NullRow                            124
   129         -
   130         -/* The following opcode values are never used */
   131         -#define OP_NotUsed_125                        125
   132         -#define OP_NotUsed_126                        126
   133         -#define OP_NotUsed_127                        127
           74  +#define OP_MakeIdxRec                          56
           75  +#define OP_ShiftRight                          82   /* same as TK_RSHIFT   */
           76  +#define OP_ResetCount                          57
           77  +#define OP_FifoWrite                           58
           78  +#define OP_Callback                            59
           79  +#define OP_ContextPush                         60
           80  +#define OP_DropTrigger                         61
           81  +#define OP_DropIndex                           62
           82  +#define OP_IdxGE                               63
           83  +#define OP_IdxDelete                           67
           84  +#define OP_Vacuum                              68
           85  +#define OP_MoveLe                              69
           86  +#define OP_IfNot                               78
           87  +#define OP_DropTable                           90
           88  +#define OP_MakeRecord                          93
           89  +#define OP_ToBlob                              94
           90  +#define OP_Delete                              95
           91  +#define OP_AggContextPop                       96
           92  +#define OP_ShiftLeft                           81   /* same as TK_LSHIFT   */
           93  +#define OP_Dup                                 97
           94  +#define OP_Goto                                98
           95  +#define OP_FifoRead                            99
           96  +#define OP_Clear                              100
           97  +#define OP_IdxGT                              101
           98  +#define OP_MoveLt                             102
           99  +#define OP_Le                                  75   /* same as TK_LE       */
          100  +#define OP_VerifyCookie                       103
          101  +#define OP_Pull                               104
          102  +#define OP_ToText                             105
          103  +#define OP_Not                                 66   /* same as TK_NOT      */
          104  +#define OP_SetNumColumns                      106
          105  +#define OP_AbsValue                           107
          106  +#define OP_Transaction                        108
          107  +#define OP_Negative                            89   /* same as TK_UMINUS   */
          108  +#define OP_Ne                                  72   /* same as TK_NE       */
          109  +#define OP_AggGet                             109
          110  +#define OP_ContextPop                         110
          111  +#define OP_BitOr                               80   /* same as TK_BITOR    */
          112  +#define OP_Next                               111
          113  +#define OP_AggInit                            112
          114  +#define OP_IdxInsert                          113
          115  +#define OP_Distinct                           114
          116  +#define OP_Lt                                  76   /* same as TK_LT       */
          117  +#define OP_AggReset                           115
          118  +#define OP_Insert                             116
          119  +#define OP_Destroy                            117
          120  +#define OP_ReadCookie                         118
          121  +#define OP_ForceInt                           119
          122  +#define OP_LoadAnalysis                       120
          123  +#define OP_OpenVirtual                        121
          124  +#define OP_OpenPseudo                         122
          125  +#define OP_Null                               123
          126  +#define OP_Blob                               124
          127  +#define OP_Add                                 83   /* same as TK_PLUS     */
          128  +#define OP_MemStore                           125
          129  +#define OP_Rewind                             126
          130  +#define OP_MoveGe                             127
          131  +#define OP_BitNot                              91   /* same as TK_BITNOT   */
          132  +#define OP_Found                              128
          133  +#define OP_NullRow                            129
   134    134   
   135    135   #define NOPUSH_MASK_0 65400
   136         -#define NOPUSH_MASK_1 61871
   137         -#define NOPUSH_MASK_2 64446
   138         -#define NOPUSH_MASK_3 65363
          136  +#define NOPUSH_MASK_1 29103
          137  +#define NOPUSH_MASK_2 64439
          138  +#define NOPUSH_MASK_3 65109
   139    139   #define NOPUSH_MASK_4 65535
   140         -#define NOPUSH_MASK_5 46015
   141         -#define NOPUSH_MASK_6 64254
   142         -#define NOPUSH_MASK_7 7987
   143         -#define NOPUSH_MASK_8 0
          140  +#define NOPUSH_MASK_5 52991
          141  +#define NOPUSH_MASK_6 55285
          142  +#define NOPUSH_MASK_7 59295
          143  +#define NOPUSH_MASK_8 3
   144    144   #define NOPUSH_MASK_9 0

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

    51     51   ** lacks the fcntl() system call.  So redefine fcntl() to be something
    52     52   ** that always succeeds.  This means that locking does not occur under
    53     53   ** DJGPP.  But its DOS - what did you expect?
    54     54   */
    55     55   #ifdef __DJGPP__
    56     56   # define fcntl(A,B,C) 0
    57     57   #endif
    58         -
    59         -/*
    60         -** Macros used to determine whether or not to use threads.  The
    61         -** SQLITE_UNIX_THREADS macro is defined if we are synchronizing for
    62         -** Posix threads and SQLITE_W32_THREADS is defined if we are
    63         -** synchronizing using Win32 threads.
    64         -*/
    65         -#if defined(THREADSAFE) && THREADSAFE
    66         -# include <pthread.h>
    67         -# define SQLITE_UNIX_THREADS 1
    68         -#endif
    69         -
    70     58   
    71     59   /*
    72     60   ** Include code that is common to all os_*.c files
    73     61   */
    74     62   #include "os_common.h"
    75     63   
    76         -#if defined(THREADSAFE) && THREADSAFE && defined(__linux__)
    77         -#define getpid pthread_self
           64  +/*
           65  +** The threadid macro resolves to the thread-id or to 0.  Used for
           66  +** testing and debugging only.
           67  +*/
           68  +#ifdef SQLITE_UNIX_THREADS
           69  +#define threadid pthread_self()
           70  +#else
           71  +#define threadid 0
           72  +#endif
           73  +
           74  +/*
           75  +** Set or check the OsFile.tid field.  This field is set when an OsFile
           76  +** is first opened.  All subsequent uses of the OsFile verify that the
           77  +** same thread is operating on the OsFile.  Some operating systems do
           78  +** not allow locks to be overridden by other threads and that restriction
           79  +** means that sqlite3* database handles cannot be moved from one thread
           80  +** to another.  This logic makes sure a user does not try to do that
           81  +** by mistake.
           82  +*/
           83  +#ifdef SQLITE_UNIX_THREADS
           84  +# define SET_THREADID(X)   X->tid = pthread_self()
           85  +# define CHECK_THREADID(X) (!pthread_equal(X->tid, pthread_self()))
           86  +#else
           87  +# define SET_THREADID(X)
           88  +# define CHECK_THREADID(X) 0
    78     89   #endif
    79     90   
    80     91   /*
    81     92   ** Here is the dirt on POSIX advisory locks:  ANSI STD 1003.1 (1996)
    82     93   ** section 6.5.2.2 lines 483 through 490 specify that when a process
    83     94   ** sets or clears a lock, that operation overrides any prior locks set
    84     95   ** by the same process.  It does not explicitly say so, but this implies
................................................................................
   260    271   */
   261    272   struct threadTestData {
   262    273     int fd;                /* File to be locked */
   263    274     struct flock lock;     /* The locking operation */
   264    275     int result;            /* Result of the locking operation */
   265    276   };
   266    277   
          278  +#ifdef SQLITE_LOCK_TRACE
          279  +/*
          280  +** Print out information about all locking operations.
          281  +**
          282  +** This routine is used for troubleshooting locks on multithreaded
          283  +** platforms.  Enable by compiling with the -DSQLITE_LOCK_TRACE
          284  +** command-line option on the compiler.  This code is normally
          285  +** turnned off.
          286  +*/
          287  +static int lockTrace(int fd, int op, struct flock *p){
          288  +  char *zOpName, *zType;
          289  +  int s;
          290  +  int savedErrno;
          291  +  if( op==F_GETLK ){
          292  +    zOpName = "GETLK";
          293  +  }else if( op==F_SETLK ){
          294  +    zOpName = "SETLK";
          295  +  }else{
          296  +    s = fcntl(fd, op, p);
          297  +    sqlite3DebugPrintf("fcntl unknown %d %d %d\n", fd, op, s);
          298  +    return s;
          299  +  }
          300  +  if( p->l_type==F_RDLCK ){
          301  +    zType = "RDLCK";
          302  +  }else if( p->l_type==F_WRLCK ){
          303  +    zType = "WRLCK";
          304  +  }else if( p->l_type==F_UNLCK ){
          305  +    zType = "UNLCK";
          306  +  }else{
          307  +    assert( 0 );
          308  +  }
          309  +  assert( p->l_whence==SEEK_SET );
          310  +  s = fcntl(fd, op, p);
          311  +  savedErrno = errno;
          312  +  sqlite3DebugPrintf("fcntl %d %d %s %s %d %d %d %d\n",
          313  +     threadid, fd, zOpName, zType, (int)p->l_start, (int)p->l_len,
          314  +     (int)p->l_pid, s);
          315  +  if( s && op==F_SETLK && (p->l_type==F_RDLCK || p->l_type==F_WRLCK) ){
          316  +    struct flock l2;
          317  +    l2 = *p;
          318  +    fcntl(fd, F_GETLK, &l2);
          319  +    if( l2.l_type==F_RDLCK ){
          320  +      zType = "RDLCK";
          321  +    }else if( l2.l_type==F_WRLCK ){
          322  +      zType = "WRLCK";
          323  +    }else if( l2.l_type==F_UNLCK ){
          324  +      zType = "UNLCK";
          325  +    }else{
          326  +      assert( 0 );
          327  +    }
          328  +    sqlite3DebugPrintf("fcntl-failure-reason: %s %d %d %d\n",
          329  +       zType, (int)l2.l_start, (int)l2.l_len, (int)l2.l_pid);
          330  +  }
          331  +  errno = savedErrno;
          332  +  return s;
          333  +}
          334  +#define fcntl lockTrace
          335  +#endif /* SQLITE_LOCK_TRACE */
          336  +
   267    337   /*
   268    338   ** The testThreadLockingBehavior() routine launches two separate
   269    339   ** threads on this routine.  This routine attempts to lock a file
   270    340   ** descriptor then returns.  The success or failure of that attempt
   271    341   ** allows the testThreadLockingBehavior() procedure to determine
   272    342   ** whether or not threads can override each others locks.
   273    343   */
................................................................................
   439    509     const char *zFilename,
   440    510     OsFile *id,
   441    511     int *pReadonly
   442    512   ){
   443    513     int rc;
   444    514     assert( !id->isOpen );
   445    515     id->dirfd = -1;
          516  +  SET_THREADID(id);
   446    517     id->h = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY,
   447    518                             SQLITE_DEFAULT_FILE_PERMISSIONS);
   448    519     if( id->h<0 ){
   449    520   #ifdef EISDIR
   450    521       if( errno==EISDIR ){
   451    522         return SQLITE_CANTOPEN;
   452    523       }
................................................................................
   490    561   */
   491    562   int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
   492    563     int rc;
   493    564     assert( !id->isOpen );
   494    565     if( access(zFilename, 0)==0 ){
   495    566       return SQLITE_CANTOPEN;
   496    567     }
          568  +  SET_THREADID(id);
   497    569     id->dirfd = -1;
   498    570     id->h = open(zFilename,
   499         -                O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_LARGEFILE|O_BINARY, 0600);
          571  +                O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_LARGEFILE|O_BINARY,
          572  +                SQLITE_DEFAULT_FILE_PERMISSIONS);
   500    573     if( id->h<0 ){
   501    574       return SQLITE_CANTOPEN;
   502    575     }
   503    576     sqlite3OsEnterMutex();
   504    577     rc = findLockInfo(id->h, &id->pLock, &id->pOpen);
   505    578     sqlite3OsLeaveMutex();
   506    579     if( rc ){
................................................................................
   524    597   ** On success, write the file handle into *id and return SQLITE_OK.
   525    598   **
   526    599   ** On failure, return SQLITE_CANTOPEN.
   527    600   */
   528    601   int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){
   529    602     int rc;
   530    603     assert( !id->isOpen );
          604  +  SET_THREADID(id);
   531    605     id->dirfd = -1;
   532    606     id->h = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY);
   533    607     if( id->h<0 ){
   534    608       return SQLITE_CANTOPEN;
   535    609     }
   536    610     sqlite3OsEnterMutex();
   537    611     rc = findLockInfo(id->h, &id->pLock, &id->pOpen);
................................................................................
   568    642     OsFile *id
   569    643   ){
   570    644     if( !id->isOpen ){
   571    645       /* Do not open the directory if the corresponding file is not already
   572    646       ** open. */
   573    647       return SQLITE_CANTOPEN;
   574    648     }
          649  +  SET_THREADID(id);
   575    650     assert( id->dirfd<0 );
   576    651     id->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0);
   577    652     if( id->dirfd<0 ){
   578    653       return SQLITE_CANTOPEN; 
   579    654     }
   580    655     TRACE3("OPENDIR %-3d %s\n", id->dirfd, zDirname);
   581    656     return SQLITE_OK;
................................................................................
   835    910   ** non-zero.  If the file is unlocked or holds only SHARED locks, then
   836    911   ** return zero.
   837    912   */
   838    913   int sqlite3OsCheckReservedLock(OsFile *id){
   839    914     int r = 0;
   840    915   
   841    916     assert( id->isOpen );
          917  +  if( CHECK_THREADID(id) ) return SQLITE_MISUSE;
   842    918     sqlite3OsEnterMutex(); /* Needed because id->pLock is shared across threads */
   843    919   
   844    920     /* Check if a thread in this process holds such a lock */
   845    921     if( id->pLock->locktype>SHARED_LOCK ){
   846    922       r = 1;
   847    923     }
   848    924   
................................................................................
   952   1028     struct flock lock;
   953   1029     int s;
   954   1030   
   955   1031     assert( id->isOpen );
   956   1032     TRACE7("LOCK    %d %s was %s(%s,%d) pid=%d\n", id->h, locktypeName(locktype), 
   957   1033         locktypeName(id->locktype), locktypeName(pLock->locktype), pLock->cnt
   958   1034         ,getpid() );
         1035  +  if( CHECK_THREADID(id) ) return SQLITE_MISUSE;
   959   1036   
   960   1037     /* If there is already a lock of this type or more restrictive on the
   961   1038     ** OsFile, do nothing. Don't use the end_lock: exit path, as
   962   1039     ** sqlite3OsEnterMutex() hasn't been called yet.
   963   1040     */
   964   1041     if( id->locktype>=locktype ){
   965   1042       TRACE3("LOCK    %d %s ok (already held)\n", id->h, locktypeName(locktype));
................................................................................
   998   1075       id->locktype = SHARED_LOCK;
   999   1076       pLock->cnt++;
  1000   1077       id->pOpen->nLock++;
  1001   1078       goto end_lock;
  1002   1079     }
  1003   1080   
  1004   1081     lock.l_len = 1L;
         1082  +
  1005   1083     lock.l_whence = SEEK_SET;
  1006   1084   
  1007   1085     /* A PENDING lock is needed before acquiring a SHARED lock and before
  1008   1086     ** acquiring an EXCLUSIVE lock.  For the SHARED lock, the PENDING will
  1009   1087     ** be released.
  1010   1088     */
  1011   1089     if( locktype==SHARED_LOCK 
................................................................................
  1033   1111       lock.l_len = SHARED_SIZE;
  1034   1112       s = fcntl(id->h, F_SETLK, &lock);
  1035   1113   
  1036   1114       /* Drop the temporary PENDING lock */
  1037   1115       lock.l_start = PENDING_BYTE;
  1038   1116       lock.l_len = 1L;
  1039   1117       lock.l_type = F_UNLCK;
  1040         -    fcntl(id->h, F_SETLK, &lock);
         1118  +    if( fcntl(id->h, F_SETLK, &lock)!=0 ){
         1119  +      rc = SQLITE_IOERR;  /* This should never happen */
         1120  +      goto end_lock;
         1121  +    }
  1041   1122       if( s ){
  1042   1123         rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
  1043   1124       }else{
  1044   1125         id->locktype = SHARED_LOCK;
  1045   1126         id->pOpen->nLock++;
  1046   1127         pLock->cnt = 1;
  1047   1128       }
................................................................................
  1103   1184     struct lockInfo *pLock;
  1104   1185     struct flock lock;
  1105   1186     int rc = SQLITE_OK;
  1106   1187   
  1107   1188     assert( id->isOpen );
  1108   1189     TRACE7("UNLOCK  %d %d was %d(%d,%d) pid=%d\n", id->h, locktype, id->locktype, 
  1109   1190         id->pLock->locktype, id->pLock->cnt, getpid());
         1191  +  if( CHECK_THREADID(id) ) return SQLITE_MISUSE;
  1110   1192   
  1111   1193     assert( locktype<=SHARED_LOCK );
  1112   1194     if( id->locktype<=locktype ){
  1113   1195       return SQLITE_OK;
  1114   1196     }
  1115   1197     sqlite3OsEnterMutex();
  1116   1198     pLock = id->pLock;
................................................................................
  1127   1209           rc = SQLITE_IOERR;
  1128   1210         }
  1129   1211       }
  1130   1212       lock.l_type = F_UNLCK;
  1131   1213       lock.l_whence = SEEK_SET;
  1132   1214       lock.l_start = PENDING_BYTE;
  1133   1215       lock.l_len = 2L;  assert( PENDING_BYTE+1==RESERVED_BYTE );
  1134         -    fcntl(id->h, F_SETLK, &lock);
  1135         -    pLock->locktype = SHARED_LOCK;
         1216  +    if( fcntl(id->h, F_SETLK, &lock)==0 ){
         1217  +      pLock->locktype = SHARED_LOCK;
         1218  +    }else{
         1219  +      rc = SQLITE_IOERR;  /* This should never happen */
         1220  +    }
  1136   1221     }
  1137   1222     if( locktype==NO_LOCK ){
  1138   1223       struct openCnt *pOpen;
  1139   1224   
  1140   1225       /* Decrement the shared lock counter.  Release the lock using an
  1141   1226       ** OS call only when all threads in this same process have released
  1142   1227       ** the lock.
  1143   1228       */
  1144   1229       pLock->cnt--;
  1145   1230       if( pLock->cnt==0 ){
  1146   1231         lock.l_type = F_UNLCK;
  1147   1232         lock.l_whence = SEEK_SET;
  1148   1233         lock.l_start = lock.l_len = 0L;
  1149         -      fcntl(id->h, F_SETLK, &lock);
  1150         -      pLock->locktype = NO_LOCK;
         1234  +      if( fcntl(id->h, F_SETLK, &lock)==0 ){
         1235  +        pLock->locktype = NO_LOCK;
         1236  +      }else{
         1237  +        rc = SQLITE_IOERR;  /* This should never happen */
         1238  +      }
  1151   1239       }
  1152   1240   
  1153   1241       /* Decrement the count of locks against this same file.  When the
  1154   1242       ** count reaches zero, close any other file descriptors whose close
  1155   1243       ** was deferred because of outstanding locks.
  1156   1244       */
  1157   1245       pOpen = id->pOpen;
................................................................................
  1173   1261   }
  1174   1262   
  1175   1263   /*
  1176   1264   ** Close a file.
  1177   1265   */
  1178   1266   int sqlite3OsClose(OsFile *id){
  1179   1267     if( !id->isOpen ) return SQLITE_OK;
         1268  +  if( CHECK_THREADID(id) ) return SQLITE_MISUSE;
  1180   1269     sqlite3OsUnlock(id, NO_LOCK);
  1181   1270     if( id->dirfd>=0 ) close(id->dirfd);
  1182   1271     id->dirfd = -1;
  1183   1272     sqlite3OsEnterMutex();
  1184   1273     if( id->pOpen->nLock ){
  1185   1274       /* If there are outstanding locks, do not actually close the file just
  1186   1275       ** yet because that would clear those locks.  Instead, add the file

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

    47     47   ** standard include files.
    48     48   */
    49     49   #include <sys/types.h>
    50     50   #include <sys/stat.h>
    51     51   #include <fcntl.h>
    52     52   #include <unistd.h>
    53     53   
           54  +/*
           55  +** Macros used to determine whether or not to use threads.  The
           56  +** SQLITE_UNIX_THREADS macro is defined if we are synchronizing for
           57  +** Posix threads and SQLITE_W32_THREADS is defined if we are
           58  +** synchronizing using Win32 threads.
           59  +*/
           60  +#if defined(THREADSAFE) && THREADSAFE
           61  +# include <pthread.h>
           62  +# define SQLITE_UNIX_THREADS 1
           63  +#endif
           64  +
    54     65   /*
    55     66   ** The OsFile structure is a operating-system independing representation
    56     67   ** of an open file handle.  It is defined differently for each architecture.
    57     68   **
    58     69   ** This is the definition for Unix.
    59     70   **
    60     71   ** OsFile.locktype takes one of the values SHARED_LOCK, RESERVED_LOCK,
................................................................................
    66     77     struct openCnt *pOpen;    /* Info about all open fd's on this inode */
    67     78     struct lockInfo *pLock;   /* Info about locks on this inode */
    68     79     int h;                    /* The file descriptor */
    69     80     unsigned char locktype;   /* The type of lock held on this fd */
    70     81     unsigned char isOpen;     /* True if needs to be closed */
    71     82     unsigned char fullSync;   /* Use F_FULLSYNC if available */
    72     83     int dirfd;                /* File descriptor for the directory */
           84  +#ifdef SQLITE_UNIX_THREADS
           85  +  pthread_t tid;            /* The thread authorized to use this OsFile */
           86  +#endif
    73     87   };
    74     88   
    75     89   /*
    76     90   ** A macro to set the OsFile.fullSync flag, if it exists.
    77     91   */
    78     92   #define SET_FULLSYNC(x,y)  ((x).fullSync = (y))
    79     93   

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

            1  +#pragma unmanaged
     1      2   extern "C"
     2      3   {
     3      4   /*
     4      5   ** 2004 May 22
     5      6   **
     6      7   ** The author disclaims copyright to this source code.  In place of
     7      8   ** a legal notice, here is a blessing:
................................................................................
   769    770       *prNow = sqlite3_current_time/86400.0 + 2440587.5;
   770    771     }
   771    772   #endif
   772    773     return 0;
   773    774   }
   774    775   
   775    776   #endif /* OS_WIN */
   776         -
   777    777   }

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

            1  +#pragma unmanaged
     1      2   extern "C"
     2      3   {
     3      4   /*
     4      5   ** 2005 April 1 - Nuno Lucas
     5      6   **
     6      7   ** The author disclaims copyright to this source code.  In place of
     7      8   ** a legal notice, here is a blessing:

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

    17     17   ** The pager is used to access a database disk file.  It implements
    18     18   ** atomic commit and rollback through the use of a journal file that
    19     19   ** is separate from the database file.  The pager also implements file
    20     20   ** locking to prevent two processes from writing the same database
    21     21   ** file simultaneously, or one process from reading the database while
    22     22   ** another is writing.
    23     23   **
    24         -** @(#) $Id: pager.c,v 1.6 2005/08/01 19:32:10 rmsimpson Exp $
           24  +** @(#) $Id: pager.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    25     25   */
    26     26   #ifndef SQLITE_OMIT_DISKIO
    27     27   #include "sqliteInt.h"
    28     28   #include "os.h"
    29     29   #include "pager.h"
    30     30   #include <assert.h>
    31     31   #include <string.h>
................................................................................
  1006   1006     if( pgno>(unsigned)pPager->dbSize ){
  1007   1007       return SQLITE_OK;
  1008   1008     }
  1009   1009     if( useCksum ){
  1010   1010       rc = read32bits(jfd, &cksum);
  1011   1011       if( rc ) return rc;
  1012   1012       pPager->journalOff += 4;
  1013         -    if( pager_cksum(pPager, pgno, (char *)aData)!=cksum ){
         1013  +    if( pager_cksum(pPager, pgno, (const char *)aData)!=cksum ){
  1014   1014         return SQLITE_DONE;
  1015   1015       }
  1016   1016     }
  1017   1017   
  1018   1018     assert( pPager->state==PAGER_RESERVED || pPager->state>=PAGER_EXCLUSIVE );
  1019   1019   
  1020   1020     /* If the pager is in RESERVED state, then there must be a copy of this
................................................................................
  1757   1757     if( pPager->dbSize>=0 ){
  1758   1758       return pPager->dbSize;
  1759   1759     }
  1760   1760     if( sqlite3OsFileSize(&pPager->fd, &n)!=SQLITE_OK ){
  1761   1761       pPager->errMask |= PAGER_ERR_DISK;
  1762   1762       return 0;
  1763   1763     }
  1764         -  n /= pPager->pageSize;
         1764  +  if( n>0 && n<pPager->pageSize ){
         1765  +    n = 1;
         1766  +  }else{
         1767  +    n /= pPager->pageSize;
         1768  +  }
  1765   1769     if( !MEMDB && n==PENDING_BYTE/pPager->pageSize ){
  1766   1770       n++;
  1767   1771     }
  1768   1772     if( pPager->state!=PAGER_UNLOCK ){
  1769   1773       pPager->dbSize = n;
  1770   1774     }
  1771   1775     return n;
................................................................................
  1865   1869   }
  1866   1870   #else
  1867   1871   #define memoryTruncate(p)
  1868   1872   #endif
  1869   1873   
  1870   1874   /*
  1871   1875   ** Try to obtain a lock on a file.  Invoke the busy callback if the lock
  1872         -** is currently not available.  Repeate until the busy callback returns
         1876  +** is currently not available.  Repeat until the busy callback returns
  1873   1877   ** false or until the lock succeeds.
  1874   1878   **
  1875   1879   ** Return SQLITE_OK on success and an error code if we cannot obtain
  1876   1880   ** the lock.
  1877   1881   */
  1878   1882   static int pager_wait_on_lock(Pager *pPager, int locktype){
  1879   1883     int rc;
  1880   1884     assert( PAGER_SHARED==SHARED_LOCK );
  1881   1885     assert( PAGER_RESERVED==RESERVED_LOCK );
  1882   1886     assert( PAGER_EXCLUSIVE==EXCLUSIVE_LOCK );
  1883   1887     if( pPager->state>=locktype ){
  1884   1888       rc = SQLITE_OK;
  1885   1889     }else{
  1886         -    int busy = 1;
  1887         -    BusyHandler *pH;
  1888   1890       do {
  1889   1891         rc = sqlite3OsLock(&pPager->fd, locktype);
  1890         -    }while( rc==SQLITE_BUSY && 
  1891         -        (pH = pPager->pBusyHandler)!=0 && 
  1892         -        pH->xFunc && pH->xFunc(pH->pArg, busy++)
  1893         -    );
         1892  +    }while( rc==SQLITE_BUSY && sqlite3InvokeBusyHandler(pPager->pBusyHandler) );
  1894   1893       if( rc==SQLITE_OK ){
  1895   1894         pPager->state = locktype;
  1896   1895       }
  1897   1896     }
  1898   1897     return rc;
  1899   1898   }
  1900   1899   
................................................................................
  2816   2815             pHist->pOrig = (u8 *)sqliteMallocRaw( pPager->pageSize );
  2817   2816             if( pHist->pOrig ){
  2818   2817               memcpy(pHist->pOrig, PGHDR_TO_DATA(pPg), pPager->pageSize);
  2819   2818             }
  2820   2819           }else{
  2821   2820             u32 cksum;
  2822   2821             CODEC(pPager, pData, pPg->pgno, 7);
  2823         -          cksum = pager_cksum(pPager, pPg->pgno, (char *)pData);
         2822  +          cksum = pager_cksum(pPager, pPg->pgno, (const char *)pData);
  2824   2823             saved = *(u32*)PGHDR_TO_EXTRA(pPg, pPager);
  2825   2824             store32bits(cksum, pPg, pPager->pageSize);
  2826   2825             szPg = pPager->pageSize+8;
  2827   2826             store32bits(pPg->pgno, pPg, -4);
  2828   2827             rc = sqlite3OsWrite(&pPager->jfd, &((char*)pData)[-4], szPg);
  2829   2828             pPager->journalOff += szPg;
  2830   2829             TRACE4("JOURNAL %d page %d needSync=%d\n",
................................................................................
  3601   3600       sqlite3DebugPrintf("PAGE %3d addr=%p nRef=%d\n", 
  3602   3601          pPg->pgno, PGHDR_TO_DATA(pPg), pPg->nRef);
  3603   3602     }
  3604   3603   }
  3605   3604   #endif
  3606   3605   
  3607   3606   #endif /* SQLITE_OMIT_DISKIO */
  3608         -
  3609   3607   }

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

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This header file defines the interface that the sqlite page cache
    13     13   ** subsystem.  The page cache subsystem reads and writes a file a page
    14     14   ** at a time and provides a journal for rollback.
    15     15   **
    16         -** @(#) $Id: pager.h,v 1.6 2005/08/01 19:32:12 rmsimpson Exp $
           16  +** @(#) $Id: pager.h,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    17     17   */
    18     18   
    19     19   /*
    20     20   ** The default size of a database page.
    21     21   */
    22     22   #ifndef SQLITE_DEFAULT_PAGE_SIZE
    23     23   # define SQLITE_DEFAULT_PAGE_SIZE 1024

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

     3      3   {
     4      4   /* Driver template for the LEMON parser generator.
     5      5   ** The author disclaims copyright to this source code.
     6      6   */
     7      7   /* First off, code is include which follows the "include" declaration
     8      8   ** in the input file. */
     9      9   #include <stdio.h>
    10         -////#line 33 "parse.y"
           10  +//#line 51 "parse.y"
    11     11   
    12     12   #include "sqliteInt.h"
    13     13   #include "parse.h"
    14     14   
    15     15   /*
    16     16   ** An instance of this structure holds information about the
    17     17   ** LIMIT clause of a SELECT statement.
................................................................................
    22     22   };
    23     23   
    24     24   /*
    25     25   ** An instance of this structure is used to store the LIKE,
    26     26   ** GLOB, NOT LIKE, and NOT GLOB operators.
    27     27   */
    28     28   struct LikeOp {
    29         -  Token operat0r;  /* "like" or "glob" or "regexp" */
           29  +  Token _operator;  /* "like" or "glob" or "regexp" */
    30     30     int not;         /* True if the NOT keyword is present */
    31     31   };
    32     32   
    33     33   /*
    34     34   ** An instance of the following structure describes the event of a
    35     35   ** TRIGGER.  "a" is the event type, one of TK_UPDATE, TK_INSERT,
    36     36   ** TK_DELETE, or TK_INSTEAD.  If the event is of the form
................................................................................
    92     92   **    sqlite3ParserARG_FETCH     Code to extract %extra_argument from yypParser
    93     93   **    YYNSTATE           the combined number of states.
    94     94   **    YYNRULE            the number of rules in the grammar
    95     95   **    YYERRORSYMBOL      is the code number of the error symbol.  If not
    96     96   **                       defined, then do no error processing.
    97     97   */
    98     98   #define YYCODETYPE unsigned char
    99         -#define YYNOCODE 241
           99  +#define YYNOCODE 244
   100    100   #define YYACTIONTYPE unsigned short int
   101    101   #define sqlite3ParserTOKENTYPE Token
   102    102   typedef union {
   103    103     sqlite3ParserTOKENTYPE yy0;
   104         -  Expr* yy2;
   105         -  struct {int value; int mask;} yy47;
   106         -  SrcList* yy67;
   107         -  ExprList* yy82;
   108         -  struct AttachKey yy132;
   109         -  struct TrigEvent yy210;
   110         -  IdList* yy240;
   111         -  struct LimitVal yy244;
   112         -  Token yy258;
   113         -  TriggerStep* yy347;
   114         -  int yy412;
   115         -  struct LikeOp yy438;
   116         -  Select* yy459;
   117         -  int yy481;
          104  +  struct {int value; int mask;} yy35;
          105  +  Expr* yy44;
          106  +  int yy58;
          107  +  Select* yy99;
          108  +  struct LimitVal yy112;
          109  +  Token yy144;
          110  +  TriggerStep* yy203;
          111  +  struct TrigEvent yy234;
          112  +  IdList* yy258;
          113  +  struct AttachKey yy300;
          114  +  SrcList* yy367;
          115  +  ExprList* yy412;
          116  +  struct LikeOp yy432;
          117  +  int yy487;
   118    118   } YYMINORTYPE;
   119    119   #define YYSTACKDEPTH 100
   120    120   #define sqlite3ParserARG_SDECL Parse *pParse;
   121    121   #define sqlite3ParserARG_PDECL ,Parse *pParse
   122    122   #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
   123    123   #define sqlite3ParserARG_STORE yypParser->pParse = pParse
   124         -#define YYNSTATE 565
   125         -#define YYNRULE 305
   126         -#define YYERRORSYMBOL 141
   127         -#define YYERRSYMDT yy481
          124  +#define YYNSTATE 578
          125  +#define YYNRULE 310
          126  +#define YYERRORSYMBOL 143
          127  +#define YYERRSYMDT yy487
   128    128   #define YYFALLBACK 1
   129    129   #define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
   130    130   #define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
   131    131   #define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
   132    132   
   133    133   /* Next are that tables used to determine what action to take based on the
   134    134   ** current state and lookahead token.  These tables are used to implement
................................................................................
   174    174   **  yy_shift_ofst[]    For each state, the offset into yy_action for
   175    175   **                     shifting terminals.
   176    176   **  yy_reduce_ofst[]   For each state, the offset into yy_action for
   177    177   **                     shifting non-terminals after a reduce.
   178    178   **  yy_default[]       Default action for each state.
   179    179   */
   180    180   static const YYACTIONTYPE yy_action[] = {
   181         - /*     0 */   259,   65,  257,  112,  114,  110,  116,   66,  122,  124,
   182         - /*    10 */   126,  128,  130,  132,  134,  136,  138,  140,  568,  142,
   183         - /*    20 */   150,  122,  124,  126,  128,  130,  132,  134,  136,  138,
   184         - /*    30 */   140,  130,  132,  134,  136,  138,  140,  108,   94,  143,
   185         - /*    40 */   153,  158,  163,  152,  157,  118,  120,  112,  114,  110,
   186         - /*    50 */   116,   72,  122,  124,  126,  128,  130,  132,  134,  136,
   187         - /*    60 */   138,  140,    7,  106,  219,  258,  122,  124,  126,  128,
   188         - /*    70 */   130,  132,  134,  136,  138,  140,  367,   13,    9,  369,
   189         - /*    80 */   376,  381,  142,  871,    1,  564,   92,   27,    4,  399,
   190         - /*    90 */   363,  384,  844,  341,  291,   28,   10,   95,  398,   33,
   191         - /*   100 */   108,   94,  143,  153,  158,  163,  152,  157,  118,  120,
   192         - /*   110 */   112,  114,  110,  116,   96,  122,  124,  126,  128,  130,
   193         - /*   120 */   132,  134,  136,  138,  140,  456,  565,  142,  395,  305,
   194         - /*   130 */   101,  102,  103,  288,   75,  394,    3,  563,  231,  275,
   195         - /*   140 */    14,   15,  575,  597,  437,  108,   94,  143,  153,  158,
   196         - /*   150 */   163,  152,  157,  118,  120,  112,  114,  110,  116,   13,
   197         - /*   160 */   122,  124,  126,  128,  130,  132,  134,  136,  138,  140,
   198         - /*   170 */   573,   77,  142,  223,  232,   13,  490,  462,  452,  167,
   199         - /*   180 */   306,  169,  170,  276,  254,    3,  563,   81,  277,  183,
   200         - /*   190 */   108,   94,  143,  153,  158,  163,  152,  157,  118,  120,
   201         - /*   200 */   112,  114,  110,  116,   52,  122,  124,  126,  128,  130,
   202         - /*   210 */   132,  134,  136,  138,  140,   48,   54,  799,  448,   51,
   203         - /*   220 */   797,   77,   14,   15,   49,  363,  134,  136,  138,  140,
   204         - /*   230 */    16,   17,   18,   32,   33,   50,  308,  197,   14,   15,
   205         - /*   240 */   367,  261,   13,  369,  376,  381,  142,   37,  337,   40,
   206         - /*   250 */    59,   67,   69,  301,  332,  384,  364,  397,  259,  807,
   207         - /*   260 */   257,  334,   51,  193,  108,   94,  143,  153,  158,  163,
   208         - /*   270 */   152,  157,  118,  120,  112,  114,  110,  116,  262,  122,
   209         - /*   280 */   124,  126,  128,  130,  132,  134,  136,  138,  140,   13,
   210         - /*   290 */   171,  142,   40,   59,   67,   69,  301,  332,  642,  148,
   211         - /*   300 */   365,  159,  164,  261,  334,   14,   15,   44,   45,  108,
   212         - /*   310 */    94,  143,  153,  158,  163,  152,  157,  118,  120,  112,
   213         - /*   320 */   114,  110,  116,  258,  122,  124,  126,  128,  130,  132,
   214         - /*   330 */   134,  136,  138,  140,  148,  218,  159,  164,  184,   12,
   215         - /*   340 */   284,  417,   48,  360,  358,  293,  290,  347,  352,  353,
   216         - /*   350 */   289,   49,   14,   15,  688,    2,   96,  148,    4,  159,
   217         - /*   360 */   164,  257,   50,  530,   46,  142,  367,  155,  165,  369,
   218         - /*   370 */   376,  381,   13,  576,   47,  167,   75,  169,  170,  554,
   219         - /*   380 */   172,  384,  207,  108,   94,  143,  153,  158,  163,  152,
   220         - /*   390 */   157,  118,  120,  112,  114,  110,  116,  154,  122,  124,
   221         - /*   400 */   126,  128,  130,  132,  134,  136,  138,  140,  299,  354,
   222         - /*   410 */   350,  352,  353,   96,   96,   13,   34,   20,  294,  362,
   223         - /*   420 */   345,  144,  581,  167,  258,  169,  170,  821,  142,  558,
   224         - /*   430 */   213,  244,  254,   75,   75,   14,   15,  172,  186,  167,
   225         - /*   440 */   533,  169,  170,  146,  147,  417,  108,   94,  143,  153,
   226         - /*   450 */   158,  163,  152,  157,  118,  120,  112,  114,  110,  116,
   227         - /*   460 */    96,  122,  124,  126,  128,  130,  132,  134,  136,  138,
   228         - /*   470 */   140,  145,  354,  142,   22,  239,  383,  589,   14,   15,
   229         - /*   480 */    75,   36,  336,  419,  172,  187,  842,  213,  528,  582,
   230         - /*   490 */   331,  108,   94,  143,  153,  158,  163,  152,  157,  118,
   231         - /*   500 */   120,  112,  114,  110,  116,  249,  122,  124,  126,  128,
   232         - /*   510 */   130,  132,  134,  136,  138,  140,  306,  661,  142,  327,
   233         - /*   520 */   574,  849,  148,   11,  159,  164,  309,  316,  318,  168,
   234         - /*   530 */    42,  327,  666,  327,  212,  393,  108,   94,  143,  153,
   235         - /*   540 */   158,  163,  152,  157,  118,  120,  112,  114,  110,  116,
   236         - /*   550 */    96,  122,  124,  126,  128,  130,  132,  134,  136,  138,
   237         - /*   560 */   140,  847,   83,  142,  321,  641,  372,   31,  663,  282,
   238         - /*   570 */    75,  242,  308,  689,  231,  246,  167,  334,  169,  170,
   239         - /*   580 */   269,  108,   94,  143,  153,  158,  163,  152,  157,  118,
   240         - /*   590 */   120,  112,  114,  110,  116,  324,  122,  124,  126,  128,
   241         - /*   600 */   130,  132,  134,  136,  138,  140,  246,  328,  142,  328,
   242         - /*   610 */   225,  434,   24,   39,  433,  210,  167,  211,  169,  170,
   243         - /*   620 */   167,  331,  169,  170,  583,  435,  108,  161,  143,  153,
   244         - /*   630 */   158,  163,  152,  157,  118,  120,  112,  114,  110,  116,
   245         - /*   640 */   248,  122,  124,  126,  128,  130,  132,  134,  136,  138,
   246         - /*   650 */   140,   57,   58,  142,  624,  837,  323,  727,  271,  261,
   247         - /*   660 */   167,  243,  169,  170,  313,  312,  247,  167,  798,  169,
   248         - /*   670 */   170,  248,   94,  143,  153,  158,  163,  152,  157,  118,
   249         - /*   680 */   120,  112,  114,  110,  116,   96,  122,  124,  126,  128,
   250         - /*   690 */   130,  132,  134,  136,  138,  140,  279,  247,  142,  360,
   251         - /*   700 */   358,    6,    5,  363,  346,   75,  274,   25,  257,  489,
   252         - /*   710 */    13,  561,   33,  503,   13,  268,  267,  269,  143,  153,
   253         - /*   720 */   158,  163,  152,  157,  118,  120,  112,  114,  110,  116,
   254         - /*   730 */    64,  122,  124,  126,  128,  130,  132,  134,  136,  138,
   255         - /*   740 */   140,   26,   76,   96,  400,   77,   71,  584,   96,  451,
   256         - /*   750 */   166,  485,   29,   76,  402,   78,  167,   71,  169,  170,
   257         - /*   760 */   295,  451,  211,   75,   30,  257,  314,  172,   75,  195,
   258         - /*   770 */   514,  258,  292,   14,   15,  690,   77,   14,   15,  106,
   259         - /*   780 */   195,   77,   77,  173,  191,  315,  203,   77,  344,  215,
   260         - /*   790 */   106,  690,  327,   77,  173,  495,  338,  588,  529,  403,
   261         - /*   800 */   179,  177,  296,  453,  251,  209,  475,  327,  175,   73,
   262         - /*   810 */    74,  179,  177,   95,  531,  532,   35,  213,  475,  175,
   263         - /*   820 */    73,   74,  457,   38,   95,  378,  438,  459,  258,  501,
   264         - /*   830 */   449,  497,  841,  411,  461,  406,  653,   76,  311,  459,
   265         - /*   840 */   387,   71,  322,   81,  323,   42,  101,  102,  103,  104,
   266         - /*   850 */   105,  181,  185,   96,  356,  357,   96,  101,  102,  103,
   267         - /*   860 */   104,  105,  181,  185,  195,   76,  655,  544,  328,   71,
   268         - /*   870 */    96,  271,  431,   75,  106,  354,   75,  489,  173,  327,
   269         - /*   880 */   298,  215,  410,  328,  428,  430,  429,  426,  427,   96,
   270         - /*   890 */    75,  721,  195,   76,   91,  179,  177,   71,  348,  379,
   271         - /*   900 */   349,  323,  106,  175,   73,   74,  173,  467,   95,   75,
   272         - /*   910 */   271,  499,  445,   93,   77,  388,  446,  323,  323,  521,
   273         - /*   920 */   195,  454,   45,  179,  177,  285,  836,   42,   41,  432,
   274         - /*   930 */   106,  175,   73,   74,  173,  480,   95,  269,  488,   43,
   275         - /*   940 */   486,  101,  102,  103,  104,  105,  181,  185,  800,  721,
   276         - /*   950 */   417,  179,  177,  229,  422,  328,   96,   96,   96,  175,
   277         - /*   960 */    73,   74,  814,   96,   95,  522,   53,  486,  479,  101,
   278         - /*   970 */   102,  103,  104,  105,  181,  185,   75,   75,   75,   13,
   279         - /*   980 */   107,  109,  423,   75,   55,    8,  106,  111,  496,  857,
   280         - /*   990 */    19,   21,   23,  401,   96,  472,   56,  101,  102,  103,
   281         - /*  1000 */   104,  105,  181,  185,  536,  240,   81,  339,  342,  863,
   282         - /*  1010 */   546,   61,   96,   96,   75,   96,  341,  482,  113,  483,
   283         - /*  1020 */    95,   96,  525,  417,  456,  542,   13,   96,   96,  523,
   284         - /*  1030 */   417,  549,   75,   75,  552,   75,  115,  117,  472,  119,
   285         - /*  1040 */    96,   75,   14,   15,   81,  121,   96,   75,   75,   77,
   286         - /*  1050 */   417,  123,  125,  101,  102,  103,   60,  519,  466,   96,
   287         - /*  1060 */    75,  498,  417,  240,  127,  417,   75,   64,  500,   62,
   288         - /*  1070 */   129,   96,   63,  690,   96,  504,  508,  452,   68,   75,
   289         - /*  1080 */   417,  494,   96,  131,   96,   96,   81,   96,  502,   14,
   290         - /*  1090 */    15,   75,   96,   96,   75,  133,  555,   70,  135,   96,
   291         - /*  1100 */   506,  512,   75,  510,   75,   75,  137,   75,  139,  141,
   292         - /*  1110 */    96,  149,   75,   75,   81,   96,  151,  160,  516,   75,
   293         - /*  1120 */    96,   96,   96,  162,  598,   80,  599,   96,   96,   82,
   294         - /*  1130 */    75,  240,  221,   84,  174,   75,   96,   96,   96,  176,
   295         - /*  1140 */    75,   75,   75,   96,  178,  180,  192,   75,   75,  518,
   296         - /*  1150 */    96,  194,  204,   96,   79,  286,   75,   75,   75,  237,
   297         - /*  1160 */   206,  208,  220,   75,   96,   96,   96,  236,   85,  235,
   298         - /*  1170 */    75,   96,   87,   75,  241,   75,  867,  273,  215,  283,
   299         - /*  1180 */    86,   77,   90,   97,   75,   75,   75,   88,  382,  470,
   300         - /*  1190 */   474,   75,   89,   98,   99,  487,  100,  140,  156,  214,
   301         - /*  1200 */   667,  668,  669,  182,  205,  188,  190,  189,  196,  199,
   302         - /*  1210 */   198,  201,  215,  200,  202,  216,  217,  224,  222,  228,
   303         - /*  1220 */   227,  229,  230,  226,  234,  238,  211,  245,  233,  253,
   304         - /*  1230 */   250,  252,  255,  272,  260,  263,  265,  256,  264,  266,
   305         - /*  1240 */   270,  278,  287,  280,  297,  281,  300,  320,  303,  302,
   306         - /*  1250 */   305,  307,  304,  325,  333,  329,  310,  317,  326,  351,
   307         - /*  1260 */   355,  370,  359,  330,  319,  340,  343,  368,  371,  361,
   308         - /*  1270 */   374,  377,  385,  335,  375,  373,  396,  386,  380,  389,
   309         - /*  1280 */   390,   54,  366,  391,  404,  392,  407,  405,  409,  408,
   310         - /*  1290 */   412,  413,  418,  416,  829,  414,  424,  425,  415,  834,
   311         - /*  1300 */   420,  439,  835,  421,  436,  440,  441,  442,  443,  444,
   312         - /*  1310 */   447,  805,  450,  806,  455,  458,  828,  460,  728,  464,
   313         - /*  1320 */   729,  843,  453,  465,  468,  471,  463,  845,  476,  469,
   314         - /*  1330 */   481,  478,  473,  477,  484,  846,  493,  491,  848,  492,
   315         - /*  1340 */   660,  662,  813,  855,  505,  507,  720,  509,  511,  723,
   316         - /*  1350 */   513,  726,  515,  815,  524,  526,  527,  520,  517,  816,
   317         - /*  1360 */   817,  818,  819,  534,  535,  820,  856,  539,  858,  540,
   318         - /*  1370 */   545,  538,  543,  859,  862,  548,  551,  864,  553,  550,
   319         - /*  1380 */   537,  557,  541,  547,  865,  556,  866,  560,  559,  547,
   320         - /*  1390 */   562,
          181  + /*     0 */   283,  581,  110,  137,  139,  135,  141,  268,  147,  149,
          182  + /*    10 */   151,  153,  155,  157,  159,  161,  163,  165,  114,  119,
          183  + /*    20 */   120,  167,  175,  147,  149,  151,  153,  155,  157,  159,
          184  + /*    30 */   161,  163,  165,  155,  157,  159,  161,  163,  165,  132,
          185  + /*    40 */    94,  168,  178,  183,  188,  177,  182,  143,  145,  137,
          186  + /*    50 */   139,  135,  141,   72,  147,  149,  151,  153,  155,  157,
          187  + /*    60 */   159,  161,  163,  165,   44,   45,  245,  111,  147,  149,
          188  + /*    70 */   151,  153,  155,  157,  159,  161,  163,  165,   13,  427,
          189  + /*    80 */   121,  578,  657,  639,  375,  347,  167,   39,    6,    5,
          190  + /*    90 */    92,    3,  576,  363,   25,  355,  299,  255,   34,  269,
          191  + /*   100 */   513,  129,  372,  112,  132,   94,  168,  178,  183,  188,
          192  + /*   110 */   177,  182,  143,  145,  137,  139,  135,  141,  567,  147,
          193  + /*   120 */   149,  151,  153,  155,  157,  159,  161,  163,  165,   77,
          194  + /*   130 */   109,  373,  133,   77,  117,  119,  120,    7,   13,   32,
          195  + /*   140 */    33,  300,  280,   14,   15,  377,  301,  610,  379,  386,
          196  + /*   150 */   391,  167,  377,  366,  369,  379,  386,  391,  524,  330,
          197  + /*   160 */   394,   64,  368,  374,  407,  705,   95,  394,  571,  132,
          198  + /*   170 */    94,  168,  178,  183,  188,  177,  182,  143,  145,  137,
          199  + /*   180 */   139,  135,  141,    9,  147,  149,  151,  153,  155,  157,
          200  + /*   190 */   159,  161,  163,  165,  127,  125,  121,  373,  167,  101,
          201  + /*   200 */   102,  103,   28,   14,   15,  408,   33,  860,  889,    1,
          202  + /*   210 */   577,    3,  576,    4,  540,  332,  132,   94,  168,  178,
          203  + /*   220 */   183,  188,  177,  182,  143,  145,  137,  139,  135,  141,
          204  + /*   230 */   295,  147,  149,  151,  153,  155,  157,  159,  161,  163,
          205  + /*   240 */   165,    2,  466,  377,    4,  167,  379,  386,  391,   16,
          206  + /*   250 */    17,   18,  285,  159,  161,  163,  165,  240,  394,  173,
          207  + /*   260 */   243,  184,  189,  132,   94,  168,  178,  183,  188,  177,
          208  + /*   270 */   182,  143,  145,  137,  139,  135,  141,   96,  147,  149,
          209  + /*   280 */   151,  153,  155,  157,  159,  161,  163,  165,  815,  291,
          210  + /*   290 */   308,  813,   51,  500,  472,  462,  588,  539,   75,  322,
          211  + /*   300 */    27,  133,  409,  704,   81,  272,   10,  173,   96,  184,
          212  + /*   310 */   189,   96,  190,   13,  541,  542,   13,  393,   78,  167,
          213  + /*   320 */    37,  361,   40,   59,   67,   69,  325,  356,  586,   75,
          214  + /*   330 */   197,  368,   75,  316,  358,   95,  218,  132,   94,  168,
          215  + /*   340 */   178,  183,  188,  177,  182,  143,  145,  137,  139,  135,
          216  + /*   350 */   141,   77,  147,  149,  151,  153,  155,  157,  159,  161,
          217  + /*   360 */   163,  165,  173,  113,  184,  189,  167,  110,  101,  102,
          218  + /*   370 */   103,  318,  274,  405,  329,  121,   12,  461,   14,   15,
          219  + /*   380 */   404,   14,   15,  238,  132,   94,  168,  178,  183,  188,
          220  + /*   390 */   177,  182,  143,  145,  137,  139,  135,  141,  273,  147,
          221  + /*   400 */   149,  151,  153,  155,  157,  159,  161,  163,  165,   96,
          222  + /*   410 */    77,   51,  315,  427,   48,   36,  360,  196,  317,  129,
          223  + /*   420 */   130,  112,  314,   49,  355,  209,  313,   13,   96,  110,
          224  + /*   430 */    75,  197,  111,   96,  814,  485,   50,  589,   46,  461,
          225  + /*   440 */   167,   40,   59,   67,   69,  325,  356,  482,   47,   75,
          226  + /*   450 */   257,  467,  429,  358,   75,  197,  469,  232,  132,   94,
          227  + /*   460 */   168,  178,  183,  188,  177,  182,  143,  145,  137,  139,
          228  + /*   470 */   135,  141,   77,  147,  149,  151,  153,  155,  157,  159,
          229  + /*   480 */   161,  163,  165,  323,  237,   13,  830,  169,  249,  258,
          230  + /*   490 */    13,  703,   14,   15,  111,   96,  265,  485,   96,  192,
          231  + /*   500 */    96,  194,  195,   13,  192,  167,  194,  195,  238,  171,
          232  + /*   510 */   172,  476,  192,  471,  194,  195,   75,  211,  469,   75,
          233  + /*   520 */   257,   75,   91,  132,   94,  168,  178,  183,  188,  177,
          234  + /*   530 */   182,  143,  145,  137,  139,  135,  141,  170,  147,  149,
          235  + /*   540 */   151,  153,  155,  157,  159,  161,  163,  165,  365,   48,
          236  + /*   550 */    14,   15,  216,   65,  228,   14,   15,  298,   49,  251,
          237  + /*   560 */    66,   13,  602,   13,  330,   96,  676,  212,   14,   15,
          238  + /*   570 */   167,   50,  865,  222,   57,   58,  678,  275,  192,   20,
          239  + /*   580 */   194,  195,  277,  403,   26,  351,   75,  499,  132,   94,
          240  + /*   590 */   168,  178,  183,  188,  177,  182,  143,  145,  137,  139,
          241  + /*   600 */   135,  141,   96,  147,  149,  151,  153,  155,  157,  159,
          242  + /*   610 */   161,  163,  165,  587,  863,   83,   11,  167,  742,  345,
          243  + /*   620 */   332,  312,  306,   75,   93,  358,   14,   15,   14,   15,
          244  + /*   630 */   858,  173,  495,  184,  189,  132,   94,  168,  178,  183,
          245  + /*   640 */   188,  177,  182,  143,  145,  137,  139,  135,  141,  594,
          246  + /*   650 */   147,  149,  151,  153,  155,  157,  159,  161,  163,  165,
          247  + /*   660 */    22,  272,  352,  192,  167,  194,  195,  192,  295,  194,
          248  + /*   670 */   195,  285,  505,  192,   42,  194,  195,  192,  351,  194,
          249  + /*   680 */   195,  595,  132,   94,  168,  178,  183,  188,  177,  182,
          250  + /*   690 */   143,  145,  137,  139,  135,  141,  338,  147,  149,  151,
          251  + /*   700 */   153,  155,  157,  159,  161,  163,  165,  837,  511,  286,
          252  + /*   710 */   507,  167,  382,  127,  125,  192,  339,  194,  195,  192,
          253  + /*   720 */   543,  194,  195,  333,  340,  342,  351,  442,  274,  132,
          254  + /*   730 */    94,  168,  178,  183,  188,  177,  182,  143,  145,  137,
          255  + /*   740 */   139,  135,  141,   96,  147,  149,  151,  153,  155,  157,
          256  + /*   750 */   159,  161,  163,  165,  273,  352,  110,  371,  167,  373,
          257  + /*   760 */   388,  438,  440,  439,   75,  499,  362,  574,   33,  335,
          258  + /*   770 */   538,  668,  656,  351,   31,  413,  132,  186,  168,  178,
          259  + /*   780 */   183,  188,  177,  182,  143,  145,  137,  139,  135,  141,
          260  + /*   790 */   509,  147,  149,  151,  153,  155,  157,  159,  161,  163,
          261  + /*   800 */   165,   96,  736,  352,  283,  167,  110,  397,  123,  124,
          262  + /*   810 */   531,  421,  193,  416,  115,  681,  116,  235,  477,  236,
          263  + /*   820 */   351,  111,   75,  244,   94,  168,  178,  183,  188,  177,
          264  + /*   830 */   182,  143,  145,  137,  139,  135,  141,   96,  147,  149,
          265  + /*   840 */   151,  153,  155,  157,  159,  161,  163,  165,   96,  879,
          266  + /*   850 */   352,  881,  167,  292,  455,  293,  270,  280,   75,  108,
          267  + /*   860 */   554,  319,  857,  236,   42,  447,   13,  351,   13,   75,
          268  + /*   870 */   134,  111,  168,  178,  183,  188,  177,  182,  143,  145,
          269  + /*   880 */   137,  139,  135,  141,   96,  147,  149,  151,  153,  155,
          270  + /*   890 */   157,  159,  161,  163,  165,   96,   76,  352,  444,   96,
          271  + /*   900 */    71,   96,  443,   52,  208,   75,  136,   76,  106,   24,
          272  + /*   910 */   412,   71,  180,  596,  445,   54,   75,  138,  266,  106,
          273  + /*   920 */    75,  140,   75,  142,  441,  220,   96,  337,  336,   29,
          274  + /*   930 */    96,   14,   15,   14,   15,  133,  220,   77,   96,  198,
          275  + /*   940 */    96,  458,  179,  346,  348,  347,  133,   75,  433,   96,
          276  + /*   950 */   198,   75,  144,  389,  285,  347,  204,  202,  320,   75,
          277  + /*   960 */   146,   75,  148,  410,  200,   73,   74,  204,  202,   95,
          278  + /*   970 */    75,  150,  398,   96,  347,  200,   73,   74,  852,   96,
          279  + /*   980 */    95,   76,  823,  448,  597,   71,  432,  459,  293,  420,
          280  + /*   990 */    96,  705,  303,  106,   75,  480,   77,  436,  437,   81,
          281  + /*  1000 */    75,  152,  101,  102,  103,  104,  105,  206,  210,  705,
          282  + /*  1010 */   220,   75,  154,  101,  102,  103,  104,  105,  206,  210,
          283  + /*  1020 */   133,   30,   77,  240,  198,  456,   96,  347,   35,  464,
          284  + /*  1030 */    45,  490,  463,  293,   96,  873,  498,   96,  496,   96,
          285  + /*  1040 */    76,  204,  202,  736,   71,   96,  601,   75,  156,  200,
          286  + /*  1050 */    73,   74,  106,   96,   95,   75,  158,  295,   75,  160,
          287  + /*  1060 */    75,  162,   38,  492,   96,  853,   75,  164,   76,  220,
          288  + /*  1070 */    41,  191,   71,  552,   75,  166,  482,   43,  427,  133,
          289  + /*  1080 */   106,  528,  568,  198,   96,   75,  197,  101,  102,  103,
          290  + /*  1090 */   104,  105,  206,  210,  816,  670,   77,  220,  240,   81,
          291  + /*  1100 */   204,  202,  309,   96,   77,   75,  174,  133,  200,   73,
          292  + /*  1110 */    74,  198,  493,   95,   77,    8,  489,  506,  427,  427,
          293  + /*  1120 */    19,   21,   23,  411,   75,  176,   42,  234,  204,  202,
          294  + /*  1130 */   427,   81,  427,  562,  427,  546,  200,   73,   74,  238,
          295  + /*  1140 */   522,   95,  556,   96,  529,  427,  101,  102,  103,  104,
          296  + /*  1150 */   105,  206,  210,  532,  535,  496,  466,  508,  510,  266,
          297  + /*  1160 */    96,  533,  885,  559,   75,  185,  565,   96,   56,  512,
          298  + /*  1170 */    96,  516,   96,  520,  101,  102,  103,  104,  105,  206,
          299  + /*  1180 */   210,   75,  187,   55,  526,   53,   60,   61,   75,  199,
          300  + /*  1190 */    96,   75,  201,   75,  203,   96,   64,   62,   96,   70,
          301  + /*  1200 */    96,   63,   96,   68,   96,  611,   96,  514,  518,  462,
          302  + /*  1210 */    84,   75,  205,  504,   96,  612,   75,  217,   81,   75,
          303  + /*  1220 */   219,   75,  229,   75,  231,   75,  233,   75,  246,   81,
          304  + /*  1230 */    79,   80,   96,  266,   82,   75,  262,   96,  263,  310,
          305  + /*  1240 */    86,   96,  261,   96,   85,   96,  247,   96,   87,   97,
          306  + /*  1250 */    99,   88,   90,   75,  267,  107,   89,   98,   75,  297,
          307  + /*  1260 */    75,  307,   75,  364,   75,  392,   75,  484,   75,  497,
          308  + /*  1270 */   118,  100,  131,  128,  165,  122,  181,  682,  239,  683,
          309  + /*  1280 */   684,  207,  230,  213,  126,  214,  215,  221,  225,  224,
          310  + /*  1290 */   223,  226,  240,  227,  241,  248,  242,  250,  254,  253,
          311  + /*  1300 */   252,  255,  236,  264,  259,  256,  260,  271,  276,  278,
          312  + /*  1310 */   279,  281,  284,  296,  282,  289,  287,  290,  288,  294,
          313  + /*  1320 */   302,  305,  311,  304,  321,  324,  326,  344,  328,  327,
          314  + /*  1330 */   331,  349,  357,  329,  353,  334,  341,  343,  380,  350,
          315  + /*  1340 */   378,  381,  354,  367,  359,  370,  384,  387,  396,  395,
          316  + /*  1350 */   399,  400,  385,   54,  406,  414,  376,  401,  390,  383,
          317  + /*  1360 */   415,  417,  418,  402,  419,  422,  425,  423,  424,  434,
          318  + /*  1370 */   426,  428,  430,  845,  431,  435,  850,  446,  851,  449,
          319  + /*  1380 */   450,  451,  452,  453,  821,  454,  822,  457,  460,  465,
          320  + /*  1390 */   743,  468,  744,  844,  470,  859,  463,  481,  475,  479,
          321  + /*  1400 */   861,  474,  473,  478,  483,  486,  487,  491,  488,  494,
          322  + /*  1410 */   862,  501,  502,  503,  864,  675,  677,  829,  871,  517,
          323  + /*  1420 */   515,  735,  519,  521,  523,  738,  525,  741,  831,  534,
          324  + /*  1430 */   832,  833,  530,  536,  834,  527,  537,  835,  544,  836,
          325  + /*  1440 */   545,  547,  872,  874,  549,  875,  557,  555,  548,  550,
          326  + /*  1450 */   553,  878,  880,  882,  561,  558,  883,  560,  551,  563,
          327  + /*  1460 */   566,  569,  564,  570,  572,  573,  884,  555,  555,  555,
          328  + /*  1470 */   555,  575,
   321    329   };
   322    330   static const YYCODETYPE yy_lookahead[] = {
   323         - /*     0 */    25,   30,   27,   72,   73,   74,   75,   36,   77,   78,
   324         - /*    10 */    79,   80,   81,   82,   83,   84,   85,   86,   10,   44,
   325         - /*    20 */    76,   77,   78,   79,   80,   81,   82,   83,   84,   85,
   326         - /*    30 */    86,   81,   82,   83,   84,   85,   86,   62,   63,   64,
          331  + /*     0 */    25,   10,   27,   74,   75,   76,   77,   26,   79,   80,
          332  + /*    10 */    81,   82,   83,   84,   85,   86,   87,   88,  168,  169,
          333  + /*    20 */   170,   46,   78,   79,   80,   81,   82,   83,   84,   85,
          334  + /*    30 */    86,   87,   88,   83,   84,   85,   86,   87,   88,   64,
   327    335    /*    40 */    65,   66,   67,   68,   69,   70,   71,   72,   73,   74,
   328         - /*    50 */    75,   23,   77,   78,   79,   80,   81,   82,   83,   84,
   329         - /*    60 */    85,   86,   10,   60,   26,   90,   77,   78,   79,   80,
   330         - /*    70 */    81,   82,   83,   84,   85,   86,   92,   27,  148,   95,
   331         - /*    80 */    96,   97,   44,  142,  143,  144,   48,   23,  147,   25,
   332         - /*    90 */   150,  107,   18,   90,   24,  155,  149,   94,  158,  159,
   333         - /*   100 */    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
   334         - /*   110 */    72,   73,   74,   75,  150,   77,   78,   79,   80,   81,
   335         - /*   120 */    82,   83,   84,   85,   86,   51,    0,   44,  177,  178,
   336         - /*   130 */   127,  128,  129,   83,  170,  184,   10,   11,  174,  157,
   337         - /*   140 */    90,   91,   10,  115,   22,   62,   63,   64,   65,   66,
   338         - /*   150 */    67,   68,   69,   70,   71,   72,   73,   74,   75,   27,
   339         - /*   160 */    77,   78,   79,   80,   81,   82,   83,   84,   85,   86,
   340         - /*   170 */    10,  189,   44,  209,  210,   27,  102,  103,  104,  109,
   341         - /*   180 */    45,  111,  112,  201,  202,   10,   11,  113,  206,  157,
   342         - /*   190 */    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
   343         - /*   200 */    72,   73,   74,   75,   94,   77,   78,   79,   80,   81,
   344         - /*   210 */    82,   83,   84,   85,   86,   19,  106,  134,   96,   64,
   345         - /*   220 */    18,  189,   90,   91,   28,  150,   83,   84,   85,   86,
   346         - /*   230 */    14,   15,   16,  158,  159,   39,  101,   41,   90,   91,
   347         - /*   240 */    92,  163,   27,   95,   96,   97,   44,   92,   93,   94,
   348         - /*   250 */    95,   96,   97,   98,   99,  107,  181,  182,   25,  137,
   349         - /*   260 */    27,  106,   64,  135,   62,   63,   64,   65,   66,   67,
   350         - /*   270 */    68,   69,   70,   71,   72,   73,   74,   75,  200,   77,
   351         - /*   280 */    78,   79,   80,   81,   82,   83,   84,   85,   86,   27,
   352         - /*   290 */    24,   44,   94,   95,   96,   97,   98,   99,   24,  217,
   353         - /*   300 */    26,  219,  220,  163,  106,   90,   91,  186,  187,   62,
   354         - /*   310 */    63,   64,   65,   66,   67,   68,   69,   70,   71,   72,
   355         - /*   320 */    73,   74,   75,   90,   77,   78,   79,   80,   81,   82,
   356         - /*   330 */    83,   84,   85,   86,  217,  218,  219,  220,   24,  150,
   357         - /*   340 */   200,  150,   19,   81,   82,   24,  110,  165,  166,  167,
   358         - /*   350 */   114,   28,   90,   91,   24,  144,  150,  217,  147,  219,
   359         - /*   360 */   220,   27,   39,  101,   41,   44,   92,   64,   23,   95,
   360         - /*   370 */    96,   97,   27,   10,   51,  109,  170,  111,  112,  188,
   361         - /*   380 */   174,  107,  135,   62,   63,   64,   65,   66,   67,   68,
   362         - /*   390 */    69,   70,   71,   72,   73,   74,   75,   94,   77,   78,
   363         - /*   400 */    79,   80,   81,   82,   83,   84,   85,   86,   24,  227,
   364         - /*   410 */   165,  166,  167,  150,  150,   27,  160,  149,  212,  163,
   365         - /*   420 */   164,   44,   10,  109,   90,  111,  112,   10,   44,  238,
   366         - /*   430 */   224,  201,  202,  170,  170,   90,   91,  174,  174,  109,
   367         - /*   440 */    23,  111,  112,   66,   67,  150,   62,   63,   64,   65,
   368         - /*   450 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
   369         - /*   460 */   150,   77,   78,   79,   80,   81,   82,   83,   84,   85,
   370         - /*   470 */    86,   94,  227,   44,  149,  212,  171,   10,   90,   91,
   371         - /*   480 */   170,  168,  169,  188,  174,  221,   12,  224,   71,   10,
   372         - /*   490 */   177,   62,   63,   64,   65,   66,   67,   68,   69,   70,
   373         - /*   500 */    71,   72,   73,   74,   75,  117,   77,   78,   79,   80,
   374         - /*   510 */    81,   82,   83,   84,   85,   86,   45,   10,   44,  150,
   375         - /*   520 */    10,   10,  217,   13,  219,  220,  102,  103,  104,  110,
   376         - /*   530 */   101,  150,  113,  150,  224,   64,   62,   63,   64,   65,
   377         - /*   540 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
   378         - /*   550 */   150,   77,   78,   79,   80,   81,   82,   83,   84,   85,
   379         - /*   560 */    86,   10,  192,   44,  183,   24,  183,   26,   10,  199,
   380         - /*   570 */   170,   26,  101,   24,  174,   26,  109,  106,  111,  112,
   381         - /*   580 */    26,   62,   63,   64,   65,   66,   67,   68,   69,   70,
   382         - /*   590 */    71,   72,   73,   74,   75,  226,   77,   78,   79,   80,
   383         - /*   600 */    81,   82,   83,   84,   85,   86,   26,  226,   44,  226,
   384         - /*   610 */   210,   29,  149,  169,   32,   24,  109,   26,  111,  112,
   385         - /*   620 */   109,  177,  111,  112,   10,   43,   62,   63,   64,   65,
   386         - /*   630 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
   387         - /*   640 */    91,   77,   78,   79,   80,   81,   82,   83,   84,   85,
   388         - /*   650 */    86,   14,   15,   44,   24,  101,   26,   10,  150,  163,
   389         - /*   660 */   109,  116,  111,  112,   93,   94,  117,  109,   18,  111,
   390         - /*   670 */   112,   91,   63,   64,   65,   66,   67,   68,   69,   70,
   391         - /*   680 */    71,   72,   73,   74,   75,  150,   77,   78,   79,   80,
   392         - /*   690 */    81,   82,   83,   84,   85,   86,  200,  117,   44,   81,
   393         - /*   700 */    82,  145,  146,  150,   23,  170,   23,  151,   27,  174,
   394         - /*   710 */    27,  158,  159,  157,   27,   24,  208,   26,   64,   65,
   395         - /*   720 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
   396         - /*   730 */   100,   77,   78,   79,   80,   81,   82,   83,   84,   85,
   397         - /*   740 */    86,  152,   23,  150,  157,  189,   27,   10,  150,  157,
   398         - /*   750 */   157,  216,  156,   23,  153,  157,  109,   27,  111,  112,
   399         - /*   760 */    24,  157,   26,  170,   24,   27,   33,  174,  170,   50,
   400         - /*   770 */   214,   90,  174,   90,   91,  101,  189,   90,   91,   60,
   401         - /*   780 */    50,  189,  189,   64,  134,   52,  136,  189,  162,  115,
   402         - /*   790 */    60,   25,  150,  189,   64,   21,  170,   10,  150,   21,
   403         - /*   800 */    81,   82,   83,   62,  117,  212,  214,  150,   89,   90,
   404         - /*   810 */    91,   81,   82,   94,  166,  167,  161,  224,  214,   89,
   405         - /*   820 */    90,   91,  230,  150,   94,  183,  225,  235,   90,   55,
   406         - /*   830 */   229,   57,   12,   55,  230,   57,   10,   23,  105,  235,
   407         - /*   840 */   183,   27,   24,  113,   26,  101,  127,  128,  129,  130,
   408         - /*   850 */   131,  132,  133,  150,  127,  128,  150,  127,  128,  129,
   409         - /*   860 */   130,  131,  132,  133,   50,   23,  125,  129,  226,   27,
   410         - /*   870 */   150,  150,   47,  170,   60,  227,  170,  174,   64,  150,
   411         - /*   880 */   174,  115,  157,  226,  102,  103,  104,   53,   54,  150,
   412         - /*   890 */   170,   10,   50,   23,  174,   81,   82,   27,   24,   24,
   413         - /*   900 */    26,   26,   60,   89,   90,   91,   64,   26,   94,  170,
   414         - /*   910 */   150,  137,  183,  174,  189,   24,   24,   26,   26,  216,
   415         - /*   920 */    50,  186,  187,   81,   82,   83,  101,  101,  171,  208,
   416         - /*   930 */    60,   89,   90,   91,   64,   24,   94,   26,   24,   34,
   417         - /*   940 */    26,  127,  128,  129,  130,  131,  132,  133,  134,   10,
   418         - /*   950 */   150,   81,   82,   27,  134,  226,  150,  150,  150,   89,
   419         - /*   960 */    90,   91,   10,  150,   94,   24,  171,   26,  208,  127,
   420         - /*   970 */   128,  129,  130,  131,  132,  133,  170,  170,  170,   27,
   421         - /*   980 */   174,  174,  174,  170,  180,   12,   60,  174,  188,   10,
   422         - /*   990 */    17,   18,   19,   20,  150,  150,   42,  127,  128,  129,
   423         - /*  1000 */   130,  131,  132,  133,   31,  124,  113,   81,   82,   10,
   424         - /*  1010 */    37,  172,  150,  150,  170,  150,   90,  157,  174,  126,
   425         - /*  1020 */    94,  150,   49,  150,   51,   46,   27,  150,  150,   56,
   426         - /*  1030 */   150,   58,  170,  170,   61,  170,  174,  174,  150,  174,
   427         - /*  1040 */   150,  170,   90,   91,  113,  174,  150,  170,  170,  189,
   428         - /*  1050 */   150,  174,  174,  127,  128,  129,   46,  126,  213,  150,
   429         - /*  1060 */   170,  188,  150,  124,  174,  150,  170,  100,  188,  171,
   430         - /*  1070 */   174,  150,  173,   10,  150,  102,  103,  104,  171,  170,
   431         - /*  1080 */   150,  108,  150,  174,  150,  150,  113,  150,  188,   90,
   432         - /*  1090 */    91,  170,  150,  150,  170,  174,   59,   23,  174,  150,
   433         - /*  1100 */   188,  213,  170,  188,  170,  170,  174,  170,  174,  174,
   434         - /*  1110 */   150,  174,  170,  170,  113,  150,  174,  174,  188,  170,
   435         - /*  1120 */   150,  150,  150,  174,  115,  189,  115,  150,  150,  191,
   436         - /*  1130 */   170,  124,  119,  193,  174,  170,  150,  150,  150,  174,
   437         - /*  1140 */   170,  170,  170,  150,  174,  174,  174,  170,  170,  157,
   438         - /*  1150 */   150,  174,  174,  150,  190,  150,  170,  170,  170,  121,
   439         - /*  1160 */   174,  174,  174,  170,  150,  150,  150,  174,  194,  122,
   440         - /*  1170 */   170,  150,  196,  170,  174,  170,  139,  174,  115,  174,
   441         - /*  1180 */   195,  189,  123,  115,  170,  170,  170,  197,  174,  174,
   442         - /*  1190 */   174,  170,  198,  150,  115,  174,  150,   86,   94,  150,
   443         - /*  1200 */   113,  113,  113,   23,  134,  222,   18,  223,   23,  187,
   444         - /*  1210 */    24,  150,  115,   26,   24,  150,  154,   26,  120,   99,
   445         - /*  1220 */   172,   27,  162,  211,  172,  120,   26,  203,  211,  117,
   446         - /*  1230 */   150,  150,  150,  101,  150,  204,  118,  154,  205,   23,
   447         - /*  1240 */   150,   24,  115,  204,   24,  205,  171,   23,  175,  150,
   448         - /*  1250 */   178,  150,  176,  211,  162,  211,  179,  179,  172,   24,
   449         - /*  1260 */   228,   46,  228,  172,  179,  170,  170,  150,   23,  163,
   450         - /*  1270 */    24,   23,   46,  180,  171,  173,  182,   23,  171,   98,
   451         - /*  1280 */   150,  106,  182,  175,  150,  176,  150,  154,   25,  154,
   452         - /*  1290 */   150,  154,  154,  101,   12,  231,   40,   38,  232,  101,
   453         - /*  1300 */   233,  137,  101,  234,   47,  150,  154,  101,  150,   23,
   454         - /*  1310 */   171,   10,   12,  137,  185,   18,   10,   10,  125,  150,
   455         - /*  1320 */   125,   18,   62,  105,  150,  194,  185,   10,  125,   71,
   456         - /*  1330 */   215,   23,   71,  150,   23,   10,  194,  116,   10,  150,
   457         - /*  1340 */    10,   10,   10,   10,  116,  194,   10,  185,  105,   10,
   458         - /*  1350 */   194,   10,  125,   10,  150,  150,  154,   23,  215,   10,
   459         - /*  1360 */    10,   10,   10,  150,   24,   10,   10,   25,   10,  150,
   460         - /*  1370 */    35,  163,  163,   10,   10,  150,  154,   10,   21,  150,
   461         - /*  1380 */   236,  150,  237,  236,   10,  138,   10,  239,  139,  240,
   462         - /*  1390 */   140,
          336  + /*    50 */    75,   76,   77,   23,   79,   80,   81,   82,   83,   84,
          337  + /*    60 */    85,   86,   87,   88,  189,  190,   26,   92,   79,   80,
          338  + /*    70 */    81,   82,   83,   84,   85,   86,   87,   88,   27,  152,
          339  + /*    80 */   230,    0,   24,   24,   26,   26,   46,  172,  147,  148,
          340  + /*    90 */    50,   10,   11,   23,  153,  180,  159,   27,  162,  118,
          341  + /*   100 */   159,  165,  166,  167,   64,   65,   66,   67,   68,   69,
          342  + /*   110 */    70,   71,   72,   73,   74,   75,   76,   77,  191,   79,
          343  + /*   120 */    80,   81,   82,   83,   84,   85,   86,   87,   88,  192,
          344  + /*   130 */    25,  152,   62,  192,  168,  169,  170,   10,   27,  160,
          345  + /*   140 */   161,  204,  205,   92,   93,   94,  209,  117,   97,   98,
          346  + /*   150 */    99,   46,   94,   83,   84,   97,   98,   99,  217,   47,
          347  + /*   160 */   109,  102,   92,  184,  185,   25,   96,  109,  241,   64,
          348  + /*   170 */    65,   66,   67,   68,   69,   70,   71,   72,   73,   74,
          349  + /*   180 */    75,   76,   77,  150,   79,   80,   81,   82,   83,   84,
          350  + /*   190 */    85,   86,   87,   88,   83,   84,  230,  152,   46,  129,
          351  + /*   200 */   130,  131,  157,   92,   93,  160,  161,   18,  144,  145,
          352  + /*   210 */   146,   10,   11,  149,  103,  103,   64,   65,   66,   67,
          353  + /*   220 */    68,   69,   70,   71,   72,   73,   74,   75,   76,   77,
          354  + /*   230 */   152,   79,   80,   81,   82,   83,   84,   85,   86,   87,
          355  + /*   240 */    88,  146,   53,   94,  149,   46,   97,   98,   99,   14,
          356  + /*   250 */    15,   16,  165,   85,   86,   87,   88,  117,  109,  220,
          357  + /*   260 */   221,  222,  223,   64,   65,   66,   67,   68,   69,   70,
          358  + /*   270 */    71,   72,   73,   74,   75,   76,   77,  152,   79,   80,
          359  + /*   280 */    81,   82,   83,   84,   85,   86,   87,   88,  136,  211,
          360  + /*   290 */   203,   18,   66,  104,  105,  106,   10,  152,  173,  174,
          361  + /*   300 */    23,   62,   25,   24,  115,   26,  151,  220,  152,  222,
          362  + /*   310 */   223,  152,   23,   27,  169,  170,   27,  175,  159,   46,
          363  + /*   320 */    94,   95,   96,   97,   98,   99,  100,  101,   10,  173,
          364  + /*   330 */   174,   92,  173,  174,  108,   96,  137,   64,   65,   66,
          365  + /*   340 */    67,   68,   69,   70,   71,   72,   73,   74,   75,   76,
          366  + /*   350 */    77,  192,   79,   80,   81,   82,   83,   84,   85,   86,
          367  + /*   360 */    87,   88,  220,   23,  222,  223,   46,   27,  129,  130,
          368  + /*   370 */   131,  215,   93,  180,  181,  230,  152,  159,   92,   93,
          369  + /*   380 */   187,   92,   93,  227,   64,   65,   66,   67,   68,   69,
          370  + /*   390 */    70,   71,   72,   73,   74,   75,   76,   77,  119,   79,
          371  + /*   400 */    80,   81,   82,   83,   84,   85,   86,   87,   88,  152,
          372  + /*   410 */   192,   66,   24,  152,   19,  171,  172,   24,   24,  165,
          373  + /*   420 */   166,  167,  112,   28,  180,   24,  116,   27,  152,   27,
          374  + /*   430 */   173,  174,   92,  152,   18,  217,   41,   10,   43,  159,
          375  + /*   440 */    46,   96,   97,   98,   99,  100,  101,  152,   53,  173,
          376  + /*   450 */   174,  233,  191,  108,  173,  174,  238,  137,   64,   65,
          377  + /*   460 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
          378  + /*   470 */    76,   77,  192,   79,   80,   81,   82,   83,   84,   85,
          379  + /*   480 */    86,   87,   88,   24,  227,   27,   10,   46,  212,  213,
          380  + /*   490 */    27,   24,   92,   93,   92,  152,  215,  217,  152,  111,
          381  + /*   500 */   152,  113,  114,   27,  111,   46,  113,  114,  227,   68,
          382  + /*   510 */    69,  216,  111,  233,  113,  114,  173,  174,  238,  173,
          383  + /*   520 */   174,  173,  174,   64,   65,   66,   67,   68,   69,   70,
          384  + /*   530 */    71,   72,   73,   74,   75,   76,   77,   96,   79,   80,
          385  + /*   540 */    81,   82,   83,   84,   85,   86,   87,   88,   24,   19,
          386  + /*   550 */    92,   93,  136,   31,  138,   92,   93,   23,   28,  213,
          387  + /*   560 */    38,   27,   10,   27,   47,  152,   10,  224,   92,   93,
          388  + /*   570 */    46,   41,   10,   43,   14,   15,   10,  119,  111,  151,
          389  + /*   580 */   113,  114,  119,   66,  154,  152,  173,  174,   64,   65,
          390  + /*   590 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
          391  + /*   600 */    76,   77,  152,   79,   80,   81,   82,   83,   84,   85,
          392  + /*   610 */    86,   87,   88,   10,   10,  195,   13,   46,   10,  186,
          393  + /*   620 */   103,   85,  202,  173,  174,  108,   92,   93,   92,   93,
          394  + /*   630 */    12,  220,  219,  222,  223,   64,   65,   66,   67,   68,
          395  + /*   640 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   10,
          396  + /*   650 */    79,   80,   81,   82,   83,   84,   85,   86,   87,   88,
          397  + /*   660 */   151,   26,  229,  111,   46,  113,  114,  111,  152,  113,
          398  + /*   670 */   114,  165,   21,  111,  103,  113,  114,  111,  152,  113,
          399  + /*   680 */   114,   10,   64,   65,   66,   67,   68,   69,   70,   71,
          400  + /*   690 */    72,   73,   74,   75,   76,   77,   34,   79,   80,   81,
          401  + /*   700 */    82,   83,   84,   85,   86,   87,   88,   10,   57,  203,
          402  + /*   710 */    59,   46,  186,   83,   84,  111,   54,  113,  114,  111,
          403  + /*   720 */    23,  113,  114,  104,  105,  106,  152,  211,   93,   64,
          404  + /*   730 */    65,   66,   67,   68,   69,   70,   71,   72,   73,   74,
          405  + /*   740 */    75,   76,   77,  152,   79,   80,   81,   82,   83,   84,
          406  + /*   750 */    85,   86,   87,   88,  119,  229,   27,  164,   46,  152,
          407  + /*   760 */   186,  104,  105,  106,  173,  174,  173,  160,  161,  107,
          408  + /*   770 */    73,   10,   24,  152,   26,   21,   64,   65,   66,   67,
          409  + /*   780 */    68,   69,   70,   71,   72,   73,   74,   75,   76,   77,
          410  + /*   790 */   139,   79,   80,   81,   82,   83,   84,   85,   86,   87,
          411  + /*   800 */    88,  152,   10,  229,   25,   46,   27,  186,  129,  130,
          412  + /*   810 */   219,   57,  112,   59,   24,  115,   26,   24,   26,   26,
          413  + /*   820 */   152,   92,  173,  174,   65,   66,   67,   68,   69,   70,
          414  + /*   830 */    71,   72,   73,   74,   75,   76,   77,  152,   79,   80,
          415  + /*   840 */    81,   82,   83,   84,   85,   86,   87,   88,  152,   10,
          416  + /*   850 */   229,   10,   46,   24,  186,   26,  204,  205,  173,  174,
          417  + /*   860 */   131,   24,   12,   26,  103,   22,   27,  152,   27,  173,
          418  + /*   870 */   174,   92,   66,   67,   68,   69,   70,   71,   72,   73,
          419  + /*   880 */    74,   75,   76,   77,  152,   79,   80,   81,   82,   83,
          420  + /*   890 */    84,   85,   86,   87,   88,  152,   23,  229,   29,  152,
          421  + /*   900 */    27,  152,   33,   96,  159,  173,  174,   23,   35,  151,
          422  + /*   910 */   155,   27,   66,   10,   45,  108,  173,  174,  126,   35,
          423  + /*   920 */   173,  174,  173,  174,   49,   52,  152,   95,   96,  158,
          424  + /*   930 */   152,   92,   93,   92,   93,   62,   52,  192,  152,   66,
          425  + /*   940 */   152,   98,   96,   24,  229,   26,   62,  173,  174,  152,
          426  + /*   950 */    66,  173,  174,   24,  165,   26,   83,   84,   85,  173,
          427  + /*   960 */   174,  173,  174,  159,   91,   92,   93,   83,   84,   96,
          428  + /*   970 */   173,  174,   24,  152,   26,   91,   92,   93,  103,  152,
          429  + /*   980 */    96,   23,  139,  228,   10,   27,  136,  232,   26,  159,
          430  + /*   990 */   152,   10,  203,   35,  173,  174,  192,   55,   56,  115,
          431  + /*  1000 */   173,  174,  129,  130,  131,  132,  133,  134,  135,  103,
          432  + /*  1010 */    52,  173,  174,  129,  130,  131,  132,  133,  134,  135,
          433  + /*  1020 */    62,   24,  192,  117,   66,   24,  152,   26,  163,  189,
          434  + /*  1030 */   190,   24,   64,   26,  152,   10,   24,  152,   26,  152,
          435  + /*  1040 */    23,   83,   84,   10,   27,  152,   10,  173,  174,   91,
          436  + /*  1050 */    92,   93,   35,  152,   96,  173,  174,  152,  173,  174,
          437  + /*  1060 */   173,  174,  152,  159,  152,  103,  173,  174,   23,   52,
          438  + /*  1070 */   175,  159,   27,   48,  173,  174,  152,   36,  152,   62,
          439  + /*  1080 */    35,  159,   61,   66,  152,  173,  174,  129,  130,  131,
          440  + /*  1090 */   132,  133,  134,  135,  136,  127,  192,   52,  117,  115,
          441  + /*  1100 */    83,   84,   85,  152,  192,  173,  174,   62,   91,   92,
          442  + /*  1110 */    93,   66,  128,   96,  192,   12,  211,  191,  152,  152,
          443  + /*  1120 */    17,   18,   19,   20,  173,  174,  103,  215,   83,   84,
          444  + /*  1130 */   152,  115,  152,   30,  152,   32,   91,   92,   93,  227,
          445  + /*  1140 */   216,   96,   39,  152,  128,  152,  129,  130,  131,  132,
          446  + /*  1150 */   133,  134,  135,   24,   51,   26,   53,  191,  191,  126,
          447  + /*  1160 */   152,   58,  141,   60,  173,  174,   63,  152,   44,  191,
          448  + /*  1170 */   152,  191,  152,  191,  129,  130,  131,  132,  133,  134,
          449  + /*  1180 */   135,  173,  174,  183,  191,  175,   48,  176,  173,  174,
          450  + /*  1190 */   152,  173,  174,  173,  174,  152,  102,  175,  152,   23,
          451  + /*  1200 */   152,  177,  152,  175,  152,  117,  152,  104,  105,  106,
          452  + /*  1210 */   196,  173,  174,  110,  152,  117,  173,  174,  115,  173,
          453  + /*  1220 */   174,  173,  174,  173,  174,  173,  174,  173,  174,  115,
          454  + /*  1230 */   193,  192,  152,  126,  194,  173,  174,  152,  123,  152,
          455  + /*  1240 */   198,  152,  124,  152,  197,  152,  121,  152,  199,  117,
          456  + /*  1250 */   117,  200,  125,  173,  174,   23,  201,  152,  173,  174,
          457  + /*  1260 */   173,  174,  173,  174,  173,  174,  173,  174,  173,  174,
          458  + /*  1270 */    24,  152,   24,  165,   88,  231,   96,  115,  152,  115,
          459  + /*  1280 */   115,   23,  136,  225,  231,  226,   18,   23,   26,  190,
          460  + /*  1290 */    24,  152,  117,   24,  152,  122,  156,   26,  101,  176,
          461  + /*  1300 */   214,   27,   26,  122,  214,  164,  176,  206,  152,  152,
          462  + /*  1310 */   119,  152,  152,  103,  156,  120,  207,   23,  208,  152,
          463  + /*  1320 */    24,  208,  117,  207,   24,  175,  152,   23,  179,  178,
          464  + /*  1330 */   152,  214,  164,  181,  214,  182,  182,  182,   48,  176,
          465  + /*  1340 */   152,   23,  176,  173,  183,  173,   24,   23,   23,   48,
          466  + /*  1350 */   100,  152,  175,  108,  185,  152,  185,  178,  175,  177,
          467  + /*  1360 */   156,  152,  156,  179,   25,  152,  235,  156,  234,   42,
          468  + /*  1370 */   103,  156,  236,   12,  237,   40,  103,   49,  103,  139,
          469  + /*  1380 */   152,  156,  103,  152,   10,   23,  139,  175,   12,  188,
          470  + /*  1390 */   127,   18,  127,   10,   10,   18,   64,  197,  107,   73,
          471  + /*  1400 */    10,  152,  188,  152,   73,  127,  152,  218,   23,   23,
          472  + /*  1410 */    10,  118,  152,  197,   10,   10,   10,   10,   10,  197,
          473  + /*  1420 */   118,   10,  188,  107,  197,   10,  127,   10,   10,  152,
          474  + /*  1430 */    10,   10,   23,  152,   10,  218,  156,   10,  152,   10,
          475  + /*  1440 */    24,  239,   10,   10,   25,   10,  239,   37,  165,  152,
          476  + /*  1450 */   165,   10,   10,   10,  156,  152,   10,  152,  240,  152,
          477  + /*  1460 */    21,  140,  156,  152,  141,  242,   10,  243,  243,  243,
          478  + /*  1470 */   243,  142,
   463    479   };
   464         -#define YY_SHIFT_USE_DFLT (-70)
          480  +#define YY_SHIFT_USE_DFLT (-72)
   465    481   static const short yy_shift_ofst[] = {
   466         - /*     0 */   175,  126,  -70,  -70,  973,    8,   52,  -70,  216,  510,
   467         - /*    10 */   160,  132,  363,  -70,  -70,  -70,  -70,  -70,  -70,  510,
   468         - /*    20 */   412,  510,  479,  510,  614,   64,  737,  215,  541,  740,
   469         - /*    30 */   787,  148,  -70,  334,  -70,  155,  -70,  215,  198,  -70,
   470         - /*    40 */   744,  -70,  905,  323,  -70,  -70,  -70,  -70,  -70,  -70,
   471         - /*    50 */   -70,  110,  744,  -70,  954,  -70,  637,  -70,  -70, 1010,
   472         - /*    60 */   -29,  744,  967,  -70,  -70,  -70,  -70,  744,  -70, 1074,
   473         - /*    70 */   870,   28,  719, 1009, 1011,  -70,  730,  -70,   70, 1001,
   474         - /*    80 */   -70,  236,  -70,  545, 1007, 1038, 1047, 1013, 1059,  -70,
   475         - /*    90 */   870,   38,  870,  519,  870,  -70, 1068,  215, 1079,  215,
   476         - /*   100 */   -70,  -70,  -70,  -70,  -70,  -70,  -70,  654,  870,  609,
   477         - /*   110 */   870,  -11,  870,  -11,  870,  -11,  870,  -11,  870,  -69,
   478         - /*   120 */   870,  -69,  870,  -50,  870,  -50,  870,  -50,  870,  -50,
   479         - /*   130 */   870,  143,  870,  143,  870, 1111,  870, 1111,  870, 1111,
   480         - /*   140 */   870,  -70,  -70,  377,  -70,  -70,  -70,  -70,  870,  -56,
   481         - /*   150 */   870,  -11,  -70,  303,  -70, 1104,  -70,  -70,  -70,  870,
   482         - /*   160 */   564,  870,  -69,  -70,  345,  730,  266,  419, 1087, 1088,
   483         - /*   170 */  1089,  -70,  519,  870,  654,  870,  -70,  870,  -70,  870,
   484         - /*   180 */   -70, 1180, 1001,  314,  -70,  814,   83, 1070,  650, 1188,
   485         - /*   190 */   -70,  870,  128,  870,  519, 1185,  196, 1186,  -70, 1187,
   486         - /*   200 */   215, 1190,  -70,  870,  202,  870,  247,  870,  519,  591,
   487         - /*   210 */   -70,  870,  -70,  -70, 1097,  215,  -70,  -70,  -70,  870,
   488         - /*   220 */   519, 1098,  870, 1191,  870, 1120,  -29,  -70, 1194,  -70,
   489         - /*   230 */   -70,  519, 1120,  -29,  -70,  870,  519, 1105,  870, 1200,
   490         - /*   240 */   870,  519,  -70,  -70,  580,  -70,  -70,  -70,  388,  -70,
   491         - /*   250 */   687,  -70, 1112,  -70,  683, 1097,  233,  -70,  -70,  215,
   492         - /*   260 */   -70,  -70, 1132, 1118,  -70, 1216,  215,  691,  -70,  215,
   493         - /*   270 */   -70,  -70,  870,  519, 1001,  330,  549, 1217,  233, 1132,
   494         - /*   280 */  1118,  -70,  842,  -25,  -70,  -70, 1127,   50,  -70,  -70,
   495         - /*   290 */   -70,  -70,  321,  -70,  736,  -70, 1220,  -70,  384,  744,
   496         - /*   300 */   -70,  215, 1224,  -70,  135,  -70,  215,  -70,  424,  733,
   497         - /*   310 */   -70,  571,  -70,  -70,  -70,  -70,  733,  -70,  733,  -70,
   498         - /*   320 */   215,  818,  -70,  215, 1120,  -29,  -70,  -70, 1120,  -29,
   499         - /*   330 */   -70,  -70, 1194,  -70,  954,  -70,  -70,  926,  -70,    3,
   500         - /*   340 */   -70,  -70,    3,  -70,  -70,  681,  618,  874,  -70,  618,
   501         - /*   350 */  1235,  -70,  -70,  -70,  727,  -70,  -70,  -70,  727,  -70,
   502         - /*   360 */   -70,  -70,  -70,  -70,  274,  -16,  -70,  215,  -70, 1215,
   503         - /*   370 */  1245,  215,  630, 1246,  744,  -70, 1248,  215,  875,  744,
   504         - /*   380 */   -70,  870,  429,  -70, 1226, 1254,  215,  891, 1181,  215,
   505         - /*   390 */  1224,  -70,  471, 1175,  -70,  -70,  -70,  -70,  -70, 1001,
   506         - /*   400 */   467,  122,  778,  215, 1097,  -70,  215,  766, 1263, 1001,
   507         - /*   410 */   507,  215, 1097,  582,  782, 1192,  215, 1097,  -70, 1256,
   508         - /*   420 */   820, 1282,  870,  474, 1259,  834,  -70,  -70, 1198, 1201,
   509         - /*   430 */   825,  215,  554,  -70,  -70, 1257,  -70,  -70, 1164,  215,
   510         - /*   440 */   674, 1206,  215, 1286,  215,  892,  826, 1301, 1176, 1300,
   511         - /*   450 */    74,  511,  741,  323,  -70, 1193, 1195, 1297, 1306, 1307,
   512         - /*   460 */    74, 1303, 1260,  215, 1218,  215,  881,  215, 1258,  870,
   513         - /*   470 */   519, 1317, 1261,  870,  519, 1203,  215, 1308,  215,  911,
   514         - /*   480 */   -70,  893,  551, 1311,  870,  914,  870,  519, 1325,  519,
   515         - /*   490 */  1221,  215,  939, 1328,  774,  215, 1330,  215, 1331,  215,
   516         - /*   500 */  1332,  215, 1333,  558, 1228,  215,  939, 1336, 1260,  215,
   517         - /*   510 */  1243,  215,  881, 1339, 1227,  215, 1308,  931,  647, 1334,
   518         - /*   520 */   870,  941, 1341,  952, 1343,  215, 1097,  417,  262, 1349,
   519         - /*   530 */  1350, 1351, 1352,  215, 1340, 1355, 1335,  334, 1342,  215,
   520         - /*   540 */   979, 1356,  738, 1358, 1363,  -70, 1335,  215, 1364,  999,
   521         - /*   550 */  1063, 1367, 1357,  215, 1037, 1247,  215, 1374, 1249, 1250,
   522         - /*   560 */   215, 1376,  -70,  -70,  -70,
          482  + /*     0 */   201,   81,  -72,  -72, 1103,   -9,  127,  -72,  235,  603,
          483  + /*    10 */   318,  286,  427,  -72,  -72,  -72,  -72,  -72,  -72,  603,
          484  + /*    20 */   639,  603,  671,  603,  903,  277,  974,  400,  748,  997,
          485  + /*    30 */  1036,   51,  -72,  402,  -72,  226,  -72,  400,  345,  -72,
          486  + /*    40 */  1023,  -72, 1041,  395,  -72,  -72,  -72,  -72,  -72,  -72,
          487  + /*    50 */   -72,  807, 1023,  -72, 1124,  -72,  560,  -72,  -72, 1138,
          488  + /*    60 */   522, 1023, 1094,  -72,  -72,  -72,  -72, 1023,  -72, 1176,
          489  + /*    70 */  1045,   30,  873, 1088, 1098,  -72,  884,  -72,  388, 1114,
          490  + /*    80 */   -72,  310,  -72,  -19, 1107, 1115, 1118, 1125, 1127,  -72,
          491  + /*    90 */  1045,   40, 1045,  665, 1045,  -72, 1132,  400, 1133,  400,
          492  + /*   100 */   -72,  -72,  -72,  -72,  -72,  -72, 1232, 1045,  105,  402,
          493  + /*   110 */   -72,  -72,  340,  630,  790,  -72,  630, 1246,  -72,  -72,
          494  + /*   120 */   -72,  679,  -72,  -72,  -72,  679,  -72,  -72,  -72,  -72,
          495  + /*   130 */  1248,  -72, 1045,  -72,  759, 1045,  -11, 1045,  -11, 1045,
          496  + /*   140 */   -11, 1045,  -11, 1045,  -71, 1045,  -71, 1045,  -50, 1045,
          497  + /*   150 */   -50, 1045,  -50, 1045,  -50, 1045,  168, 1045,  168, 1045,
          498  + /*   160 */  1186, 1045, 1186, 1045, 1186, 1045,  -72,  -72,  441,  -72,
          499  + /*   170 */   -72,  -72,  -72, 1045,  -56, 1045,  -11,  -72,  846,  -72,
          500  + /*   180 */  1180,  -72,  -72,  -72, 1045,  712, 1045,  -71,  -72,  289,
          501  + /*   190 */   884,  393,  700, 1162, 1164, 1165,  -72,  665, 1045,  806,
          502  + /*   200 */  1045,  -72, 1045,  -72, 1045,  -72, 1258, 1114,  401,  -72,
          503  + /*   210 */   958,  152, 1146,  416, 1268,  -72, 1045,  199, 1045,  665,
          504  + /*   220 */  1264,  530, 1266,  -72, 1262,  400, 1269,  -72, 1045,  273,
          505  + /*   230 */  1045,  320, 1045,  665,  793,  -72, 1045,  -72,  -72, 1175,
          506  + /*   240 */   400,  -72,  -72,  -72,  806, 1045,  665, 1173, 1045, 1271,
          507  + /*   250 */  1045, 1197,  522,  -72, 1274,  -72,  -72,  665, 1197,  522,
          508  + /*   260 */   -72, 1045,  665, 1181, 1045, 1276, 1045,  665,  -72,  -72,
          509  + /*   270 */   635,  -72,  -72,  -72,  458,  -72,  463,  -72, 1191,  -72,
          510  + /*   280 */   534, 1175,  779,  400,  -72,  -72, 1210, 1195,  -72, 1294,
          511  + /*   290 */   400,  829,  -72,  400,  -72,  -72, 1045,  665, 1114,  467,
          512  + /*   300 */   279, 1296,  779, 1210, 1195,  -72, 1017,  -25,  -72,  -72,
          513  + /*   310 */  1205,  536,  -72,  -72,  -72,  -72,  394,  -72,  837,  -72,
          514  + /*   320 */  1300,  -72,  459, 1023,  -72,  400, 1304,  -72,  112,  -72,
          515  + /*   330 */   400,  -72,  619,  662,  -72,  832,  -72,  -72,  -72,  -72,
          516  + /*   340 */   662,  -72,  662,  -72,  400,  919,  -72,  400, 1197,  522,
          517  + /*   350 */   -72,  -72, 1197,  522,  -72,  -72, 1274,  -72, 1124,  -72,
          518  + /*   360 */   -72,   70,  -72, 1045,  524,  -72,  239,  -72,  -72,  239,
          519  + /*   370 */   -72,  -72,  -72,  -72,   58,  149,  -72,  400,  -72, 1290,
          520  + /*   380 */  1318,  400,   59, 1322, 1023,  -72, 1324,  400,  929, 1023,
          521  + /*   390 */   -72, 1045,  571,  -72, 1301, 1325,  400,  948, 1250,  400,
          522  + /*   400 */  1304,  -72,  517, 1245,  -72,  -72,  -72,  -72,  -72, 1114,
          523  + /*   410 */   552,  843,  754,  400, 1175,  -72,  400,  140, 1339, 1114,
          524  + /*   420 */   556,  400, 1175,  869,  657, 1267,  400, 1175,  -72, 1327,
          525  + /*   430 */   850, 1361, 1045,  618, 1335,  942,  -72,  -72, 1273, 1275,
          526  + /*   440 */   875,  400,  962,  -72,  -72, 1328,  -72,  -72, 1240,  400,
          527  + /*   450 */   906, 1279,  400, 1362,  400, 1001,  761, 1374, 1247, 1376,
          528  + /*   460 */   189,  562,  968,  395,  -72, 1263, 1265, 1373, 1383, 1384,
          529  + /*   470 */   189, 1377, 1332,  400, 1291,  400,  792,  400, 1326, 1045,
          530  + /*   480 */   665, 1390, 1331, 1045,  665, 1278,  400, 1385,  400, 1007,
          531  + /*   490 */   -72,  984,  604, 1386, 1045, 1012, 1045,  665, 1400,  665,
          532  + /*   500 */  1293,  400, 1033, 1404,  651,  400, 1405,  400, 1406,  400,
          533  + /*   510 */  1407,  400, 1408,  566, 1302,  400, 1033, 1411, 1332,  400,
          534  + /*   520 */  1316,  400,  792, 1415, 1299,  400, 1385, 1016,  608, 1409,
          535  + /*   530 */  1045, 1129, 1417,  476, 1418,  400, 1175,  697,  111, 1420,
          536  + /*   540 */  1421, 1424, 1427,  400, 1416, 1429, 1410,  402, 1419,  400,
          537  + /*   550 */  1025, 1432,  729, 1433, 1435,  -72, 1410,  400, 1441,  839,
          538  + /*   560 */   981, 1442,  841,  981, 1443, 1439,  400, 1021, 1321,  400,
          539  + /*   570 */  1446, 1323, 1329,  400, 1456,  -72,  -72,  -72,
   523    540   };
   524         -#define YY_REDUCE_USE_DFLT (-71)
          541  +#define YY_REDUCE_USE_DFLT (-151)
   525    542   static const short yy_reduce_ofst[] = {
   526         - /*     0 */   -59,  211,  -71,  -71,  556,  -71,  -71,  -71,  -70,  -53,
   527         - /*    10 */   -71,  189,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  268,
   528         - /*    20 */   -71,  325,  -71,  463,  -71,  589,  -71,  -60,  596,  -71,
   529         - /*    30 */   -71,   75,  -71,  256,  655,  313,  -71,  673,  444,  -71,
   530         - /*    40 */   757,  -71,  -71,  121,  -71,  -71,  -71,  -71,  -71,  -71,
   531         - /*    50 */   -71,  -71,  795,  -71,  804,  -71,  -71,  -71,  -71,  -71,
   532         - /*    60 */   839,  898,  899,  -71,  -71,  -71,  -71,  907,  -71,  -71,
   533         - /*    70 */   706,  -71,  206,  -71,  -71,  -71,  598,  -71,  964,  936,
   534         - /*    80 */   -71,  938,  370,  940,  974,  985,  976,  990,  994,  -71,
   535         - /*    90 */   720,   82,  739,   82,  806,  -71,  -71, 1043,  -71, 1046,
   536         - /*   100 */   -71,  -71,  -71,  -71,  -71,  -71,  -71,   82,  807,   82,
   537         - /*   110 */   813,   82,  844,   82,  862,   82,  863,   82,  865,   82,
   538         - /*   120 */   871,   82,  877,   82,  878,   82,  890,   82,  896,   82,
   539         - /*   130 */   909,   82,  921,   82,  924,   82,  932,   82,  934,   82,
   540         - /*   140 */   935,   82,  -71,  -71,  -71,  -71,  -71,  -71,  937,  117,
   541         - /*   150 */   942,   82,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  943,
   542         - /*   160 */    82,  949,   82,  -71, 1049,  593,  964,  -71,  -71,  -71,
   543         - /*   170 */   -71,  -71,   82,  960,   82,  965,   82,  970,   82,  971,
   544         - /*   180 */    82,  -71,   32,  964,  -71,  264,   82,  983,  984,  -71,
   545         - /*   190 */   -71,  972,   82,  977,   82,  -71, 1022,  -71,  -71,  -71,
   546         - /*   200 */  1061,  -71,  -71,  978,   82,  986,   82,  987,   82,  -71,
   547         - /*   210 */   -71,  310,  -71,  -71, 1062, 1065,  -71,  -71,  -71,  988,
   548         - /*   220 */    82,  -71,  -36,  -71,  400, 1012, 1048,  -71, 1060,  -71,
   549         - /*   230 */   -71,   82, 1017, 1052,  -71,  993,   82,  -71,  263,  -71,
   550         - /*   240 */  1000,   82,  -71,  230, 1024,  -71,  -71,  -71, 1080,  -71,
   551         - /*   250 */  1081,  -71,  -71,  -71, 1082, 1083,   78,  -71,  -71, 1084,
   552         - /*   260 */   -71,  -71, 1031, 1033,  -71,  -71,  508,  -71,  -71, 1090,
   553         - /*   270 */   -71,  -71, 1003,   82,  -18,  964, 1024,  -71,  496, 1039,
   554         - /*   280 */  1040,  -71, 1005,  140,  -71,  -71,  -71, 1043,  -71,  -71,
   555         - /*   290 */   -71,  -71,   82,  -71,  -71,  -71,  -71,  -71,   82, 1075,
   556         - /*   300 */   -71, 1099, 1073, 1076, 1072,  -71, 1101,  -71,  -71, 1077,
   557         - /*   310 */   -71,  -71,  -71,  -71,  -71,  -71, 1078,  -71, 1085,  -71,
   558         - /*   320 */   381,  -71,  -71,  369, 1042, 1086,  -71,  -71, 1044, 1091,
   559         - /*   330 */   -71,  -71, 1092,  -71, 1093,  -71,  -71,  626,  -71, 1095,
   560         - /*   340 */   -71,  -71, 1096,  -71,  -71, 1106,  182,  -71,  -71,  245,
   561         - /*   350 */   -71,  -71,  -71,  -71, 1032,  -71,  -71,  -71, 1034,  -71,
   562         - /*   360 */   -71,  -71,  -71,  -71, 1094, 1100,  -71, 1117,  -71,  -71,
   563         - /*   370 */   -71,  383, 1102,  -71, 1103,  -71,  -71,  642,  -71, 1107,
   564         - /*   380 */   -71, 1014,  305,  -71,  -71,  -71,  657,  -71,  -71, 1130,
   565         - /*   390 */  1108, 1109,  -49,  -71,  -71,  -71,  -71,  -71,  -71,  587,
   566         - /*   400 */   964,  601,  -71, 1134, 1133,  -71, 1136, 1135,  -71,  725,
   567         - /*   410 */   964, 1140, 1137, 1064, 1066,  -71,  295, 1138,  -71, 1067,
   568         - /*   420 */  1069,  -71,  808,   82,  -71,  -71,  -71,  -71,  -71,  -71,
   569         - /*   430 */   -71,  721,  -71,  -71,  -71,  -71,  -71,  -71,  -71, 1155,
   570         - /*   440 */  1152,  -71, 1158,  -71,  729,  -71, 1139,  -71,  -71,  -71,
   571         - /*   450 */   592,  964, 1129,  735,  -71,  -71,  -71,  -71,  -71,  -71,
   572         - /*   460 */   604,  -71, 1141, 1169,  -71,  845, 1131, 1174,  -71, 1015,
   573         - /*   470 */    82,  -71,  -71, 1016,   82,  -71, 1183, 1115,  760,  -71,
   574         - /*   480 */   -71,  860,  964,  -71,  535,  -71, 1021,   82,  -71,   82,
   575         - /*   490 */   -71, 1189, 1142,  -71,  -71,  800,  -71,  873,  -71,  880,
   576         - /*   500 */   -71,  900,  -71,  964,  -71,  912, 1151,  -71, 1162,  915,
   577         - /*   510 */   -71,  888, 1156,  -71,  -71,  930, 1143,  992,  964,  -71,
   578         - /*   520 */   703,  -71,  -71, 1204,  -71, 1205, 1202,  -71,  648,  -71,
   579         - /*   530 */   -71,  -71,  -71, 1213,  -71,  -71, 1144, 1208,  -71, 1219,
   580         - /*   540 */  1145,  -71, 1209,  -71,  -71,  -71, 1147, 1225,  -71, 1229,
   581         - /*   550 */  1222,  -71,  -71,  191,  -71,  -71, 1231,  -71,  -71, 1148,
   582         - /*   560 */   553,  -71,  -71,  -71,  -71,
          543  + /*     0 */    64,   95, -151, -151,  -59, -151, -151, -151,   33,  155,
          544  + /*    10 */  -151,  224, -151, -151, -151, -151, -151, -151, -151,  428,
          545  + /*    20 */  -151,  509, -151,  758, -151,  430, -151,   45,  771, -151,
          546  + /*    30 */  -151,  -21, -151,  -64,  865,  244, -151,  910,  -85, -151,
          547  + /*    40 */   895, -151, -151, -125, -151, -151, -151, -151, -151, -151,
          548  + /*    50 */  -151, -151, 1010, -151, 1000, -151, -151, -151, -151, -151,
          549  + /*    60 */  1011, 1022, 1024, -151, -151, -151, -151, 1028, -151, -151,
          550  + /*    70 */   125, -151,  156, -151, -151, -151,  159, -151, 1037, 1039,
          551  + /*    80 */  -151, 1040,  420, 1014, 1047, 1042, 1049, 1051, 1055, -151,
          552  + /*    90 */   348,  411,  450,  411,  649, -151, -151, 1105, -151, 1119,
          553  + /*   100 */  -151, -151, -151, -151, -151, -151, -151,  685,  411,  254,
          554  + /*   110 */  -151, -151, 1108, -150, -151, -151,  -34, -151, -151, -151,
          555  + /*   120 */  -151, 1044, -151, -151, -151, 1053, -151, -151, -151, -151,
          556  + /*   130 */  -151, -151,  696, -151,  411,  732,  411,  743,  411,  747,
          557  + /*   140 */   411,  749,  411,  778,  411,  786,  411,  788,  411,  797,
          558  + /*   150 */   411,  827,  411,  838,  411,  874,  411,  882,  411,  885,
          559  + /*   160 */   411,  887,  411,  893,  411,  901,  411, -151, -151, -151,
          560  + /*   170 */  -151, -151, -151,  932,   39,  951,  411, -151, -151, -151,
          561  + /*   180 */  -151, -151, -151, -151,  991,  411, 1008,  411, -151, 1126,
          562  + /*   190 */   912, 1037, -151, -151, -151, -151, -151,  411, 1015,  411,
          563  + /*   200 */  1018,  411, 1020,  411, 1038,  411, -151,  745, 1037, -151,
          564  + /*   210 */   343,  411, 1058, 1059, -151, -151, 1043,  411, 1046,  411,
          565  + /*   220 */  -151, 1099, -151, -151, -151, 1139, -151, -151, 1048,  411,
          566  + /*   230 */  1050,  411, 1052,  411, -151, -151,  257, -151, -151, 1140,
          567  + /*   240 */  1142, -151, -151, -151,  411, 1054,  411, -151,  276, -151,
          568  + /*   250 */   346, 1086, 1123, -151, 1141, -151, -151,  411, 1090, 1130,
          569  + /*   260 */  -151, 1062,  411, -151,  281, -151, 1080,  411, -151,  652,
          570  + /*   270 */  1101, -151, -151, -151, 1156, -151, 1157, -151, -151, -151,
          571  + /*   280 */  1159, 1158,  506, 1160, -151, -151, 1109, 1110, -151, -151,
          572  + /*   290 */    78, -151, -151, 1167, -151, -151, 1085,  411,  -63, 1037,
          573  + /*   300 */  1101, -151,  789, 1116, 1113, -151, 1087,   87, -151, -151,
          574  + /*   310 */  -151, 1105, -151, -151, -151, -151,  411, -151, -151, -151,
          575  + /*   320 */  -151, -151,  411, 1150, -151, 1174, 1151, 1149, 1152, -151,
          576  + /*   330 */  1178, -151, -151, 1153, -151, -151, -151, -151, -151, -151,
          577  + /*   340 */  1154, -151, 1155, -151,  433, -151, -151,  715, 1117, 1163,
          578  + /*   350 */  -151, -151, 1120, 1166, -151, -151, 1168, -151, 1161, -151,
          579  + /*   360 */  -151,  593, -151, 1089,  411, -151, 1170, -151, -151, 1172,
          580  + /*   370 */  -151, -151, -151, -151, 1169, 1171, -151, 1188, -151, -151,
          581  + /*   380 */  -151,  526, 1182, -151, 1177, -151, -151,  574, -151, 1183,
          582  + /*   390 */  -151, 1091,  142, -151, -151, -151,  621, -151, -151, 1199,
          583  + /*   400 */  1179, 1184,  193, -151, -151, -151, -151, -151, -151,  804,
          584  + /*   410 */  1037,  755, -151, 1203, 1204, -151, 1209, 1206, -151,  830,
          585  + /*   420 */  1037, 1213, 1211, 1134, 1131, -151,  261, 1215, -151, 1136,
          586  + /*   430 */  1137, -151,  774,  411, -151, -151, -151, -151, -151, -151,
          587  + /*   440 */  -151,  516, -151, -151, -151, -151, -151, -151, -151, 1228,
          588  + /*   450 */  1225, -151, 1231, -151,  668, -151, 1212, -151, -151, -151,
          589  + /*   460 */   218, 1037, 1201,  840, -151, -151, -151, -151, -151, -151,
          590  + /*   470 */   280, -151, 1214, 1249, -151,  295, 1200, 1251, -151,  821,
          591  + /*   480 */   411, -151, -151, 1093,  411, -151, 1254, 1189,  905, -151,
          592  + /*   490 */  -151,  904, 1037, -151,  413, -151, 1095,  411, -151,  411,
          593  + /*   500 */  -151, 1260, 1216, -151, -151,  926, -151,  966, -151,  967,
          594  + /*   510 */  -151,  978, -151, 1037, -151,  980, 1222, -151, 1234,  982,
          595  + /*   520 */  -151,  924, 1227, -151, -151,  993, 1217,  922, 1037, -151,
          596  + /*   530 */   591, -151, -151, 1277, -151, 1281, 1280, -151,  145, -151,
          597  + /*   540 */  -151, -151, -151, 1286, -151, -151, 1202, 1283, -151, 1297,
          598  + /*   550 */  1218, -151, 1285, -151, -151, -151, 1207, 1303, -151, 1305,
          599  + /*   560 */  1298, -151, 1307, 1306, -151, -151,  -73, -151, -151, 1311,
          600  + /*   570 */  -151, -151, 1223,  607, -151, -151, -151, -151,
   583    601   };
   584    602   static const YYACTIONTYPE yy_default[] = {
   585         - /*     0 */   571,  571,  566,  569,  870,  870,  870,  570,  577,  870,
   586         - /*    10 */   870,  870,  870,  597,  598,  599,  578,  579,  580,  870,
   587         - /*    20 */   870,  870,  870,  870,  870,  870,  870,  870,  870,  870,
   588         - /*    30 */   870,  870,  590,  600,  609,  592,  608,  870,  870,  610,
   589         - /*    40 */   653,  616,  870,  870,  654,  657,  658,  659,  852,  853,
   590         - /*    50 */   854,  870,  653,  617,  638,  636,  870,  639,  640,  870,
   591         - /*    60 */   709,  653,  624,  618,  625,  707,  708,  653,  619,  870,
   592         - /*    70 */   870,  739,  804,  745,  740,  736,  870,  664,  870,  870,
   593         - /*    80 */   665,  673,  675,  682,  721,  712,  714,  702,  716,  670,
   594         - /*    90 */   870,  717,  870,  718,  870,  738,  870,  870,  741,  870,
   595         - /*   100 */   742,  743,  744,  746,  747,  748,  751,  752,  870,  753,
   596         - /*   110 */   870,  754,  870,  755,  870,  756,  870,  757,  870,  758,
   597         - /*   120 */   870,  759,  870,  760,  870,  761,  870,  762,  870,  763,
   598         - /*   130 */   870,  764,  870,  765,  870,  766,  870,  767,  870,  768,
   599         - /*   140 */   870,  769,  770,  870,  771,  778,  785,  788,  870,  773,
   600         - /*   150 */   870,  772,  775,  870,  776,  870,  779,  777,  784,  870,
   601         - /*   160 */   870,  870,  786,  787,  870,  804,  870,  870,  870,  870,
   602         - /*   170 */   870,  791,  803,  870,  780,  870,  781,  870,  782,  870,
   603         - /*   180 */   783,  870,  870,  870,  793,  870,  870,  870,  870,  870,
   604         - /*   190 */   794,  870,  870,  870,  795,  870,  870,  870,  850,  870,
   605         - /*   200 */   870,  870,  851,  870,  870,  870,  870,  870,  796,  870,
   606         - /*   210 */   789,  804,  801,  802,  690,  870,  691,  792,  774,  870,
   607         - /*   220 */   719,  870,  870,  703,  870,  710,  709,  704,  870,  594,
   608         - /*   230 */   711,  706,  710,  709,  705,  870,  715,  870,  804,  713,
   609         - /*   240 */   870,  722,  674,  685,  683,  684,  693,  694,  870,  695,
   610         - /*   250 */   870,  696,  870,  697,  870,  690,  681,  595,  596,  870,
   611         - /*   260 */   679,  680,  699,  701,  686,  870,  870,  870,  700,  870,
   612         - /*   270 */   734,  735,  870,  698,  685,  870,  870,  870,  681,  699,
   613         - /*   280 */   701,  687,  870,  681,  676,  677,  870,  870,  678,  671,
   614         - /*   290 */   672,  790,  870,  737,  870,  749,  870,  750,  870,  653,
   615         - /*   300 */   620,  870,  808,  626,  621,  627,  870,  628,  870,  870,
   616         - /*   310 */   629,  870,  632,  633,  634,  635,  870,  630,  870,  631,
   617         - /*   320 */   870,  870,  809,  870,  710,  709,  810,  812,  710,  709,
   618         - /*   330 */   811,  622,  870,  623,  638,  637,  611,  870,  612,  870,
   619         - /*   340 */   613,  745,  870,  614,  615,  601,  827,  870,  602,  827,
   620         - /*   350 */   870,  603,  606,  607,  870,  822,  824,  825,  870,  823,
   621         - /*   360 */   826,  605,  604,  593,  870,  870,  643,  870,  646,  870,
   622         - /*   370 */   870,  870,  870,  870,  653,  647,  870,  870,  870,  653,
   623         - /*   380 */   648,  870,  653,  649,  870,  870,  870,  870,  870,  870,
   624         - /*   390 */   808,  626,  651,  870,  650,  652,  644,  645,  591,  870,
   625         - /*   400 */   870,  587,  870,  870,  690,  585,  870,  870,  870,  870,
   626         - /*   410 */   870,  870,  690,  833,  870,  870,  870,  690,  692,  838,
   627         - /*   420 */   870,  870,  870,  870,  870,  870,  839,  840,  870,  870,
   628         - /*   430 */   870,  870,  870,  830,  831,  870,  832,  586,  870,  870,
   629         - /*   440 */   870,  870,  870,  870,  870,  870,  870,  870,  870,  870,
   630         - /*   450 */   870,  870,  870,  870,  656,  870,  870,  870,  870,  870,
   631         - /*   460 */   870,  870,  655,  870,  870,  870,  870,  870,  870,  870,
   632         - /*   470 */   724,  870,  870,  870,  725,  870,  870,  732,  870,  870,
   633         - /*   480 */   733,  870,  870,  870,  870,  870,  870,  730,  870,  731,
   634         - /*   490 */   870,  870,  870,  870,  870,  870,  870,  870,  870,  870,
   635         - /*   500 */   870,  870,  870,  870,  870,  870,  870,  870,  655,  870,
   636         - /*   510 */   870,  870,  870,  870,  870,  870,  732,  870,  870,  870,
   637         - /*   520 */   870,  870,  870,  870,  870,  870,  690,  870,  827,  870,
   638         - /*   530 */   870,  870,  870,  870,  870,  870,  861,  870,  870,  870,
   639         - /*   540 */   870,  870,  870,  870,  870,  860,  861,  870,  870,  870,
   640         - /*   550 */   870,  870,  870,  870,  870,  870,  870,  870,  870,  868,
   641         - /*   560 */   870,  870,  869,  572,  567,
          603  + /*     0 */   584,  584,  579,  582,  888,  888,  888,  583,  590,  888,
          604  + /*    10 */   888,  888,  888,  610,  611,  612,  591,  592,  593,  888,
          605  + /*    20 */   888,  888,  888,  888,  888,  888,  888,  888,  888,  888,
          606  + /*    30 */   888,  888,  603,  613,  623,  605,  622,  888,  888,  624,
          607  + /*    40 */   668,  631,  888,  888,  669,  672,  673,  674,  868,  869,
          608  + /*    50 */   870,  888,  668,  632,  653,  651,  888,  654,  655,  888,
          609  + /*    60 */   724,  668,  639,  633,  640,  722,  723,  668,  634,  888,
          610  + /*    70 */   888,  754,  820,  760,  755,  751,  888,  679,  888,  888,
          611  + /*    80 */   680,  688,  690,  697,  736,  727,  729,  717,  731,  685,
          612  + /*    90 */   888,  732,  888,  733,  888,  753,  888,  888,  756,  888,
          613  + /*   100 */   757,  758,  759,  761,  762,  763,  888,  888,  888,  888,
          614  + /*   110 */   608,  609,  615,  843,  888,  616,  843,  888,  617,  620,
          615  + /*   120 */   621,  888,  838,  840,  841,  888,  839,  842,  619,  618,
          616  + /*   130 */   888,  764,  888,  767,  769,  888,  770,  888,  771,  888,
          617  + /*   140 */   772,  888,  773,  888,  774,  888,  775,  888,  776,  888,
          618  + /*   150 */   777,  888,  778,  888,  779,  888,  780,  888,  781,  888,
          619  + /*   160 */   782,  888,  783,  888,  784,  888,  785,  786,  888,  787,
          620  + /*   170 */   794,  801,  804,  888,  789,  888,  788,  791,  888,  792,
          621  + /*   180 */   888,  795,  793,  800,  888,  888,  888,  802,  803,  888,
          622  + /*   190 */   820,  888,  888,  888,  888,  888,  807,  819,  888,  796,
          623  + /*   200 */   888,  797,  888,  798,  888,  799,  888,  888,  888,  809,
          624  + /*   210 */   888,  888,  888,  888,  888,  810,  888,  888,  888,  811,
          625  + /*   220 */   888,  888,  888,  866,  888,  888,  888,  867,  888,  888,
          626  + /*   230 */   888,  888,  888,  812,  888,  805,  820,  817,  818,  705,
          627  + /*   240 */   888,  706,  808,  790,  768,  888,  734,  888,  888,  718,
          628  + /*   250 */   888,  725,  724,  719,  888,  607,  726,  721,  725,  724,
          629  + /*   260 */   720,  888,  730,  888,  820,  728,  888,  737,  689,  700,
          630  + /*   270 */   698,  699,  708,  709,  888,  710,  888,  711,  888,  712,
          631  + /*   280 */   888,  705,  696,  888,  694,  695,  714,  716,  701,  888,
          632  + /*   290 */   888,  888,  715,  888,  749,  750,  888,  713,  700,  888,
          633  + /*   300 */   888,  888,  696,  714,  716,  702,  888,  696,  691,  692,
          634  + /*   310 */   888,  888,  693,  686,  687,  806,  888,  752,  888,  765,
          635  + /*   320 */   888,  766,  888,  668,  635,  888,  824,  641,  636,  642,
          636  + /*   330 */   888,  643,  888,  888,  644,  888,  647,  648,  649,  650,
          637  + /*   340 */   888,  645,  888,  646,  888,  888,  825,  888,  725,  724,
          638  + /*   350 */   826,  828,  725,  724,  827,  637,  888,  638,  653,  652,
          639  + /*   360 */   625,  888,  626,  888,  888,  627,  888,  628,  760,  888,
          640  + /*   370 */   629,  630,  614,  606,  888,  888,  658,  888,  661,  888,
          641  + /*   380 */   888,  888,  888,  888,  668,  662,  888,  888,  888,  668,
          642  + /*   390 */   663,  888,  668,  664,  888,  888,  888,  888,  888,  888,
          643  + /*   400 */   824,  641,  666,  888,  665,  667,  659,  660,  604,  888,
          644  + /*   410 */   888,  600,  888,  888,  705,  598,  888,  888,  888,  888,
          645  + /*   420 */   888,  888,  705,  849,  888,  888,  888,  705,  707,  854,
          646  + /*   430 */   888,  888,  888,  888,  888,  888,  855,  856,  888,  888,
          647  + /*   440 */   888,  888,  888,  846,  847,  888,  848,  599,  888,  888,
          648  + /*   450 */   888,  888,  888,  888,  888,  888,  888,  888,  888,  888,
          649  + /*   460 */   888,  888,  888,  888,  671,  888,  888,  888,  888,  888,
          650  + /*   470 */   888,  888,  670,  888,  888,  888,  888,  888,  888,  888,
          651  + /*   480 */   739,  888,  888,  888,  740,  888,  888,  747,  888,  888,
          652  + /*   490 */   748,  888,  888,  888,  888,  888,  888,  745,  888,  746,
          653  + /*   500 */   888,  888,  888,  888,  888,  888,  888,  888,  888,  888,
          654  + /*   510 */   888,  888,  888,  888,  888,  888,  888,  888,  670,  888,
          655  + /*   520 */   888,  888,  888,  888,  888,  888,  747,  888,  888,  888,
          656  + /*   530 */   888,  888,  888,  888,  888,  888,  705,  888,  843,  888,
          657  + /*   540 */   888,  888,  888,  888,  888,  888,  877,  888,  888,  888,
          658  + /*   550 */   888,  888,  888,  888,  888,  876,  877,  888,  888,  888,
          659  + /*   560 */   888,  888,  888,  888,  888,  888,  888,  888,  888,  888,
          660  + /*   570 */   888,  888,  886,  888,  888,  887,  585,  580,
   642    661   };
   643    662   #define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0]))
   644    663   
   645    664   /* The next table maps tokens into fallback tokens.  If a construct
   646    665   ** like the following:
   647    666   ** 
   648    667   **      %fallback ID X Y Z.
................................................................................
   680    699       0,  /*         LP => nothing */
   681    700       0,  /*         RP => nothing */
   682    701       0,  /*         AS => nothing */
   683    702       0,  /*      COMMA => nothing */
   684    703       0,  /*         ID => nothing */
   685    704      27,  /*      ABORT => ID */
   686    705      27,  /*      AFTER => ID */
          706  +   27,  /*    ANALYZE => ID */
   687    707      27,  /*        ASC => ID */
   688    708      27,  /*     ATTACH => ID */
   689    709      27,  /*     BEFORE => ID */
   690    710      27,  /*    CASCADE => ID */
          711  +   27,  /*       CAST => ID */
   691    712      27,  /*   CONFLICT => ID */
   692    713      27,  /*   DATABASE => ID */
   693    714      27,  /*       DESC => ID */
   694    715      27,  /*     DETACH => ID */
   695    716      27,  /*       EACH => ID */
   696    717      27,  /*       FAIL => ID */
   697    718      27,  /*        FOR => ID */
................................................................................
   868    889     "$",             "END_OF_FILE",   "ILLEGAL",       "SPACE",       
   869    890     "UNCLOSED_STRING",  "COMMENT",       "FUNCTION",      "COLUMN",      
   870    891     "AGG_FUNCTION",  "CONST_FUNC",    "SEMI",          "EXPLAIN",     
   871    892     "BEGIN",         "TRANSACTION",   "DEFERRED",      "IMMEDIATE",   
   872    893     "EXCLUSIVE",     "COMMIT",        "END",           "ROLLBACK",    
   873    894     "CREATE",        "TABLE",         "TEMP",          "LP",          
   874    895     "RP",            "AS",            "COMMA",         "ID",          
   875         -  "ABORT",         "AFTER",         "ASC",           "ATTACH",      
   876         -  "BEFORE",        "CASCADE",       "CONFLICT",      "DATABASE",    
   877         -  "DESC",          "DETACH",        "EACH",          "FAIL",        
   878         -  "FOR",           "IGNORE",        "INITIALLY",     "INSTEAD",     
   879         -  "LIKE_KW",       "MATCH",         "KEY",           "OF",          
   880         -  "OFFSET",        "PRAGMA",        "RAISE",         "REPLACE",     
   881         -  "RESTRICT",      "ROW",           "STATEMENT",     "TRIGGER",     
   882         -  "VACUUM",        "VIEW",          "REINDEX",       "RENAME",      
   883         -  "CTIME_KW",      "ALTER",         "OR",            "AND",         
   884         -  "NOT",           "IS",            "BETWEEN",       "IN",          
   885         -  "ISNULL",        "NOTNULL",       "NE",            "EQ",          
   886         -  "GT",            "LE",            "LT",            "GE",          
   887         -  "ESCAPE",        "BITAND",        "BITOR",         "LSHIFT",      
   888         -  "RSHIFT",        "PLUS",          "MINUS",         "STAR",        
   889         -  "SLASH",         "REM",           "CONCAT",        "UMINUS",      
   890         -  "UPLUS",         "BITNOT",        "STRING",        "JOIN_KW",     
   891         -  "CONSTRAINT",    "DEFAULT",       "NULL",          "PRIMARY",     
   892         -  "UNIQUE",        "CHECK",         "REFERENCES",    "COLLATE",     
   893         -  "AUTOINCR",      "ON",            "DELETE",        "UPDATE",      
   894         -  "INSERT",        "SET",           "DEFERRABLE",    "FOREIGN",     
   895         -  "DROP",          "UNION",         "ALL",           "INTERSECT",   
   896         -  "EXCEPT",        "SELECT",        "DISTINCT",      "DOT",         
   897         -  "FROM",          "JOIN",          "USING",         "ORDER",       
   898         -  "BY",            "GROUP",         "HAVING",        "LIMIT",       
   899         -  "WHERE",         "INTO",          "VALUES",        "INTEGER",     
   900         -  "FLOAT",         "BLOB",          "REGISTER",      "VARIABLE",    
   901         -  "EXISTS",        "CASE",          "WHEN",          "THEN",        
   902         -  "ELSE",          "INDEX",         "TO",            "ADD",         
   903         -  "COLUMNKW",      "error",         "input",         "cmdlist",     
   904         -  "ecmd",          "cmdx",          "cmd",           "explain",     
   905         -  "transtype",     "trans_opt",     "nm",            "create_table",
   906         -  "create_table_args",  "temp",          "dbnm",          "columnlist",  
   907         -  "conslist_opt",  "select",        "column",        "columnid",    
   908         -  "type",          "carglist",      "id",            "ids",         
   909         -  "typename",      "signed",        "plus_num",      "minus_num",   
   910         -  "carg",          "ccons",         "term",          "onconf",      
   911         -  "sortorder",     "autoinc",       "expr",          "idxlist_opt", 
   912         -  "refargs",       "defer_subclause",  "refarg",        "refact",      
   913         -  "init_deferred_pred_opt",  "conslist",      "tcons",         "idxlist",     
   914         -  "defer_subclause_opt",  "orconf",        "resolvetype",   "raisetype",   
   915         -  "fullname",      "oneselect",     "multiselect_op",  "distinct",    
   916         -  "selcollist",    "from",          "where_opt",     "groupby_opt", 
   917         -  "having_opt",    "orderby_opt",   "limit_opt",     "sclp",        
   918         -  "as",            "seltablist",    "stl_prefix",    "joinop",      
   919         -  "on_opt",        "using_opt",     "seltablist_paren",  "joinop2",     
   920         -  "inscollist",    "sortlist",      "sortitem",      "collate",     
   921         -  "exprlist",      "setlist",       "insert_cmd",    "inscollist_opt",
   922         -  "itemlist",      "likeop",        "escape",        "between_op",  
   923         -  "in_op",         "case_operand",  "case_exprlist",  "case_else",   
   924         -  "expritem",      "uniqueflag",    "idxitem",       "plus_opt",    
   925         -  "number",        "trigger_decl",  "trigger_cmd_list",  "trigger_time",
   926         -  "trigger_event",  "foreach_clause",  "when_clause",   "trigger_cmd", 
   927         -  "database_kw_opt",  "key_opt",       "add_column_fullname",  "kwcolumn_opt",
          896  +  "ABORT",         "AFTER",         "ANALYZE",       "ASC",         
          897  +  "ATTACH",        "BEFORE",        "CASCADE",       "CAST",        
          898  +  "CONFLICT",      "DATABASE",      "DESC",          "DETACH",      
          899  +  "EACH",          "FAIL",          "FOR",           "IGNORE",      
          900  +  "INITIALLY",     "INSTEAD",       "LIKE_KW",       "MATCH",       
          901  +  "KEY",           "OF",            "OFFSET",        "PRAGMA",      
          902  +  "RAISE",         "REPLACE",       "RESTRICT",      "ROW",         
          903  +  "STATEMENT",     "TRIGGER",       "VACUUM",        "VIEW",        
          904  +  "REINDEX",       "RENAME",        "CTIME_KW",      "ALTER",       
          905  +  "OR",            "AND",           "NOT",           "IS",          
          906  +  "BETWEEN",       "IN",            "ISNULL",        "NOTNULL",     
          907  +  "NE",            "EQ",            "GT",            "LE",          
          908  +  "LT",            "GE",            "ESCAPE",        "BITAND",      
          909  +  "BITOR",         "LSHIFT",        "RSHIFT",        "PLUS",        
          910  +  "MINUS",         "STAR",          "SLASH",         "REM",         
          911  +  "CONCAT",        "UMINUS",        "UPLUS",         "BITNOT",      
          912  +  "STRING",        "JOIN_KW",       "CONSTRAINT",    "DEFAULT",     
          913  +  "NULL",          "PRIMARY",       "UNIQUE",        "CHECK",       
          914  +  "REFERENCES",    "COLLATE",       "AUTOINCR",      "ON",          
          915  +  "DELETE",        "UPDATE",        "INSERT",        "SET",         
          916  +  "DEFERRABLE",    "FOREIGN",       "DROP",          "UNION",       
          917  +  "ALL",           "INTERSECT",     "EXCEPT",        "SELECT",      
          918  +  "DISTINCT",      "DOT",           "FROM",          "JOIN",        
          919  +  "USING",         "ORDER",         "BY",            "GROUP",       
          920  +  "HAVING",        "LIMIT",         "WHERE",         "INTO",        
          921  +  "VALUES",        "INTEGER",       "FLOAT",         "BLOB",        
          922  +  "REGISTER",      "VARIABLE",      "EXISTS",        "CASE",        
          923  +  "WHEN",          "THEN",          "ELSE",          "INDEX",       
          924  +  "TO",            "ADD",           "COLUMNKW",      "error",       
          925  +  "input",         "cmdlist",       "ecmd",          "cmdx",        
          926  +  "cmd",           "explain",       "transtype",     "trans_opt",   
          927  +  "nm",            "create_table",  "create_table_args",  "temp",        
          928  +  "dbnm",          "columnlist",    "conslist_opt",  "select",      
          929  +  "column",        "columnid",      "type",          "carglist",    
          930  +  "id",            "ids",           "typetoken",     "typename",    
          931  +  "signed",        "plus_num",      "minus_num",     "carg",        
          932  +  "ccons",         "term",          "expr",          "onconf",      
          933  +  "sortorder",     "autoinc",       "idxlist_opt",   "refargs",     
          934  +  "defer_subclause",  "refarg",        "refact",        "init_deferred_pred_opt",
          935  +  "conslist",      "tcons",         "idxlist",       "defer_subclause_opt",
          936  +  "orconf",        "resolvetype",   "raisetype",     "fullname",    
          937  +  "oneselect",     "multiselect_op",  "distinct",      "selcollist",  
          938  +  "from",          "where_opt",     "groupby_opt",   "having_opt",  
          939  +  "orderby_opt",   "limit_opt",     "sclp",          "as",          
          940  +  "seltablist",    "stl_prefix",    "joinop",        "on_opt",      
          941  +  "using_opt",     "seltablist_paren",  "joinop2",       "inscollist",  
          942  +  "sortlist",      "sortitem",      "collate",       "exprlist",    
          943  +  "setlist",       "insert_cmd",    "inscollist_opt",  "itemlist",    
          944  +  "likeop",        "escape",        "between_op",    "in_op",       
          945  +  "case_operand",  "case_exprlist",  "case_else",     "expritem",    
          946  +  "uniqueflag",    "idxitem",       "plus_opt",      "number",      
          947  +  "trigger_decl",  "trigger_cmd_list",  "trigger_time",  "trigger_event",
          948  +  "foreach_clause",  "when_clause",   "trigger_cmd",   "database_kw_opt",
          949  +  "key_opt",       "add_column_fullname",  "kwcolumn_opt",
   928    950   };
   929    951   #endif /* NDEBUG */
   930    952   
   931    953   #ifndef NDEBUG
   932    954   /* For tracing reduce actions, the names of all rules are required.
   933    955   */
   934    956   static const char *const yyRuleName[] = {
................................................................................
   964    986    /*  29 */ "id ::= ID",
   965    987    /*  30 */ "ids ::= ID",
   966    988    /*  31 */ "ids ::= STRING",
   967    989    /*  32 */ "nm ::= ID",
   968    990    /*  33 */ "nm ::= STRING",
   969    991    /*  34 */ "nm ::= JOIN_KW",
   970    992    /*  35 */ "type ::=",
   971         - /*  36 */ "type ::= typename",
   972         - /*  37 */ "type ::= typename LP signed RP",
   973         - /*  38 */ "type ::= typename LP signed COMMA signed RP",
   974         - /*  39 */ "typename ::= ids",
   975         - /*  40 */ "typename ::= typename ids",
   976         - /*  41 */ "signed ::= plus_num",
   977         - /*  42 */ "signed ::= minus_num",
   978         - /*  43 */ "carglist ::= carglist carg",
   979         - /*  44 */ "carglist ::=",
   980         - /*  45 */ "carg ::= CONSTRAINT nm ccons",
   981         - /*  46 */ "carg ::= ccons",
   982         - /*  47 */ "carg ::= DEFAULT term",
   983         - /*  48 */ "carg ::= DEFAULT PLUS term",
   984         - /*  49 */ "carg ::= DEFAULT MINUS term",
   985         - /*  50 */ "carg ::= DEFAULT id",
   986         - /*  51 */ "ccons ::= NULL onconf",
   987         - /*  52 */ "ccons ::= NOT NULL onconf",
   988         - /*  53 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
   989         - /*  54 */ "ccons ::= UNIQUE onconf",
   990         - /*  55 */ "ccons ::= CHECK LP expr RP onconf",
   991         - /*  56 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
   992         - /*  57 */ "ccons ::= defer_subclause",
   993         - /*  58 */ "ccons ::= COLLATE id",
   994         - /*  59 */ "autoinc ::=",
   995         - /*  60 */ "autoinc ::= AUTOINCR",
   996         - /*  61 */ "refargs ::=",
   997         - /*  62 */ "refargs ::= refargs refarg",
   998         - /*  63 */ "refarg ::= MATCH nm",
   999         - /*  64 */ "refarg ::= ON DELETE refact",
  1000         - /*  65 */ "refarg ::= ON UPDATE refact",
  1001         - /*  66 */ "refarg ::= ON INSERT refact",
  1002         - /*  67 */ "refact ::= SET NULL",
  1003         - /*  68 */ "refact ::= SET DEFAULT",
  1004         - /*  69 */ "refact ::= CASCADE",
  1005         - /*  70 */ "refact ::= RESTRICT",
  1006         - /*  71 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
  1007         - /*  72 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
  1008         - /*  73 */ "init_deferred_pred_opt ::=",
  1009         - /*  74 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
  1010         - /*  75 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
  1011         - /*  76 */ "conslist_opt ::=",
  1012         - /*  77 */ "conslist_opt ::= COMMA conslist",
  1013         - /*  78 */ "conslist ::= conslist COMMA tcons",
  1014         - /*  79 */ "conslist ::= conslist tcons",
  1015         - /*  80 */ "conslist ::= tcons",
  1016         - /*  81 */ "tcons ::= CONSTRAINT nm",
  1017         - /*  82 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf",
  1018         - /*  83 */ "tcons ::= UNIQUE LP idxlist RP onconf",
  1019         - /*  84 */ "tcons ::= CHECK expr onconf",
  1020         - /*  85 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
  1021         - /*  86 */ "defer_subclause_opt ::=",
  1022         - /*  87 */ "defer_subclause_opt ::= defer_subclause",
  1023         - /*  88 */ "onconf ::=",
  1024         - /*  89 */ "onconf ::= ON CONFLICT resolvetype",
  1025         - /*  90 */ "orconf ::=",
  1026         - /*  91 */ "orconf ::= OR resolvetype",
  1027         - /*  92 */ "resolvetype ::= raisetype",
  1028         - /*  93 */ "resolvetype ::= IGNORE",
  1029         - /*  94 */ "resolvetype ::= REPLACE",
  1030         - /*  95 */ "cmd ::= DROP TABLE fullname",
  1031         - /*  96 */ "cmd ::= CREATE temp VIEW nm dbnm AS select",
  1032         - /*  97 */ "cmd ::= DROP VIEW fullname",
  1033         - /*  98 */ "cmd ::= select",
  1034         - /*  99 */ "select ::= oneselect",
  1035         - /* 100 */ "select ::= select multiselect_op oneselect",
  1036         - /* 101 */ "multiselect_op ::= UNION",
  1037         - /* 102 */ "multiselect_op ::= UNION ALL",
  1038         - /* 103 */ "multiselect_op ::= INTERSECT",
  1039         - /* 104 */ "multiselect_op ::= EXCEPT",
  1040         - /* 105 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
  1041         - /* 106 */ "distinct ::= DISTINCT",
  1042         - /* 107 */ "distinct ::= ALL",
  1043         - /* 108 */ "distinct ::=",
  1044         - /* 109 */ "sclp ::= selcollist COMMA",
  1045         - /* 110 */ "sclp ::=",
  1046         - /* 111 */ "selcollist ::= sclp expr as",
  1047         - /* 112 */ "selcollist ::= sclp STAR",
  1048         - /* 113 */ "selcollist ::= sclp nm DOT STAR",
  1049         - /* 114 */ "as ::= AS nm",
  1050         - /* 115 */ "as ::= ids",
  1051         - /* 116 */ "as ::=",
  1052         - /* 117 */ "from ::=",
  1053         - /* 118 */ "from ::= FROM seltablist",
  1054         - /* 119 */ "stl_prefix ::= seltablist joinop",
  1055         - /* 120 */ "stl_prefix ::=",
  1056         - /* 121 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt",
  1057         - /* 122 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt",
  1058         - /* 123 */ "seltablist_paren ::= select",
  1059         - /* 124 */ "seltablist_paren ::= seltablist",
  1060         - /* 125 */ "dbnm ::=",
  1061         - /* 126 */ "dbnm ::= DOT nm",
  1062         - /* 127 */ "fullname ::= nm dbnm",
  1063         - /* 128 */ "joinop ::= COMMA",
  1064         - /* 129 */ "joinop ::= JOIN",
  1065         - /* 130 */ "joinop ::= JOIN_KW JOIN",
  1066         - /* 131 */ "joinop ::= JOIN_KW nm JOIN",
  1067         - /* 132 */ "joinop ::= JOIN_KW nm nm JOIN",
  1068         - /* 133 */ "on_opt ::= ON expr",
  1069         - /* 134 */ "on_opt ::=",
  1070         - /* 135 */ "using_opt ::= USING LP inscollist RP",
  1071         - /* 136 */ "using_opt ::=",
  1072         - /* 137 */ "orderby_opt ::=",
  1073         - /* 138 */ "orderby_opt ::= ORDER BY sortlist",
  1074         - /* 139 */ "sortlist ::= sortlist COMMA sortitem collate sortorder",
  1075         - /* 140 */ "sortlist ::= sortitem collate sortorder",
  1076         - /* 141 */ "sortitem ::= expr",
  1077         - /* 142 */ "sortorder ::= ASC",
  1078         - /* 143 */ "sortorder ::= DESC",
  1079         - /* 144 */ "sortorder ::=",
  1080         - /* 145 */ "collate ::=",
  1081         - /* 146 */ "collate ::= COLLATE id",
  1082         - /* 147 */ "groupby_opt ::=",
  1083         - /* 148 */ "groupby_opt ::= GROUP BY exprlist",
  1084         - /* 149 */ "having_opt ::=",
  1085         - /* 150 */ "having_opt ::= HAVING expr",
  1086         - /* 151 */ "limit_opt ::=",
  1087         - /* 152 */ "limit_opt ::= LIMIT expr",
  1088         - /* 153 */ "limit_opt ::= LIMIT expr OFFSET expr",
  1089         - /* 154 */ "limit_opt ::= LIMIT expr COMMA expr",
  1090         - /* 155 */ "cmd ::= DELETE FROM fullname where_opt",
  1091         - /* 156 */ "where_opt ::=",
  1092         - /* 157 */ "where_opt ::= WHERE expr",
  1093         - /* 158 */ "cmd ::= UPDATE orconf fullname SET setlist where_opt",
  1094         - /* 159 */ "setlist ::= setlist COMMA nm EQ expr",
  1095         - /* 160 */ "setlist ::= nm EQ expr",
  1096         - /* 161 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP",
  1097         - /* 162 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
  1098         - /* 163 */ "insert_cmd ::= INSERT orconf",
  1099         - /* 164 */ "insert_cmd ::= REPLACE",
  1100         - /* 165 */ "itemlist ::= itemlist COMMA expr",
  1101         - /* 166 */ "itemlist ::= expr",
  1102         - /* 167 */ "inscollist_opt ::=",
  1103         - /* 168 */ "inscollist_opt ::= LP inscollist RP",
  1104         - /* 169 */ "inscollist ::= inscollist COMMA nm",
  1105         - /* 170 */ "inscollist ::= nm",
  1106         - /* 171 */ "expr ::= term",
  1107         - /* 172 */ "expr ::= LP expr RP",
  1108         - /* 173 */ "term ::= NULL",
  1109         - /* 174 */ "expr ::= ID",
  1110         - /* 175 */ "expr ::= JOIN_KW",
  1111         - /* 176 */ "expr ::= nm DOT nm",
  1112         - /* 177 */ "expr ::= nm DOT nm DOT nm",
  1113         - /* 178 */ "term ::= INTEGER",
  1114         - /* 179 */ "term ::= FLOAT",
  1115         - /* 180 */ "term ::= STRING",
  1116         - /* 181 */ "term ::= BLOB",
  1117         - /* 182 */ "expr ::= REGISTER",
  1118         - /* 183 */ "expr ::= VARIABLE",
  1119         - /* 184 */ "expr ::= ID LP exprlist RP",
  1120         - /* 185 */ "expr ::= ID LP STAR RP",
  1121         - /* 186 */ "term ::= CTIME_KW",
  1122         - /* 187 */ "expr ::= expr AND expr",
  1123         - /* 188 */ "expr ::= expr OR expr",
  1124         - /* 189 */ "expr ::= expr LT expr",
  1125         - /* 190 */ "expr ::= expr GT expr",
  1126         - /* 191 */ "expr ::= expr LE expr",
  1127         - /* 192 */ "expr ::= expr GE expr",
  1128         - /* 193 */ "expr ::= expr NE expr",
  1129         - /* 194 */ "expr ::= expr EQ expr",
  1130         - /* 195 */ "expr ::= expr BITAND expr",
  1131         - /* 196 */ "expr ::= expr BITOR expr",
  1132         - /* 197 */ "expr ::= expr LSHIFT expr",
  1133         - /* 198 */ "expr ::= expr RSHIFT expr",
  1134         - /* 199 */ "expr ::= expr PLUS expr",
  1135         - /* 200 */ "expr ::= expr MINUS expr",
  1136         - /* 201 */ "expr ::= expr STAR expr",
  1137         - /* 202 */ "expr ::= expr SLASH expr",
  1138         - /* 203 */ "expr ::= expr REM expr",
  1139         - /* 204 */ "expr ::= expr CONCAT expr",
  1140         - /* 205 */ "likeop ::= LIKE_KW",
  1141         - /* 206 */ "likeop ::= NOT LIKE_KW",
  1142         - /* 207 */ "escape ::= ESCAPE expr",
  1143         - /* 208 */ "escape ::=",
  1144         - /* 209 */ "expr ::= expr likeop expr escape",
  1145         - /* 210 */ "expr ::= expr ISNULL",
  1146         - /* 211 */ "expr ::= expr IS NULL",
  1147         - /* 212 */ "expr ::= expr NOTNULL",
  1148         - /* 213 */ "expr ::= expr NOT NULL",
  1149         - /* 214 */ "expr ::= expr IS NOT NULL",
  1150         - /* 215 */ "expr ::= NOT expr",
  1151         - /* 216 */ "expr ::= BITNOT expr",
  1152         - /* 217 */ "expr ::= MINUS expr",
  1153         - /* 218 */ "expr ::= PLUS expr",
  1154         - /* 219 */ "between_op ::= BETWEEN",
  1155         - /* 220 */ "between_op ::= NOT BETWEEN",
  1156         - /* 221 */ "expr ::= expr between_op expr AND expr",
  1157         - /* 222 */ "in_op ::= IN",
  1158         - /* 223 */ "in_op ::= NOT IN",
  1159         - /* 224 */ "expr ::= expr in_op LP exprlist RP",
  1160         - /* 225 */ "expr ::= LP select RP",
  1161         - /* 226 */ "expr ::= expr in_op LP select RP",
  1162         - /* 227 */ "expr ::= expr in_op nm dbnm",
  1163         - /* 228 */ "expr ::= EXISTS LP select RP",
  1164         - /* 229 */ "expr ::= CASE case_operand case_exprlist case_else END",
  1165         - /* 230 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
  1166         - /* 231 */ "case_exprlist ::= WHEN expr THEN expr",
  1167         - /* 232 */ "case_else ::= ELSE expr",
  1168         - /* 233 */ "case_else ::=",
  1169         - /* 234 */ "case_operand ::= expr",
  1170         - /* 235 */ "case_operand ::=",
  1171         - /* 236 */ "exprlist ::= exprlist COMMA expritem",
  1172         - /* 237 */ "exprlist ::= expritem",
  1173         - /* 238 */ "expritem ::= expr",
  1174         - /* 239 */ "expritem ::=",
  1175         - /* 240 */ "cmd ::= CREATE uniqueflag INDEX nm dbnm ON nm LP idxlist RP onconf",
  1176         - /* 241 */ "uniqueflag ::= UNIQUE",
  1177         - /* 242 */ "uniqueflag ::=",
  1178         - /* 243 */ "idxlist_opt ::=",
  1179         - /* 244 */ "idxlist_opt ::= LP idxlist RP",
  1180         - /* 245 */ "idxlist ::= idxlist COMMA idxitem collate sortorder",
  1181         - /* 246 */ "idxlist ::= idxitem collate sortorder",
  1182         - /* 247 */ "idxitem ::= nm",
  1183         - /* 248 */ "cmd ::= DROP INDEX fullname",
  1184         - /* 249 */ "cmd ::= VACUUM",
  1185         - /* 250 */ "cmd ::= VACUUM nm",
  1186         - /* 251 */ "cmd ::= PRAGMA nm dbnm EQ nm",
  1187         - /* 252 */ "cmd ::= PRAGMA nm dbnm EQ ON",
  1188         - /* 253 */ "cmd ::= PRAGMA nm dbnm EQ plus_num",
  1189         - /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
  1190         - /* 255 */ "cmd ::= PRAGMA nm dbnm LP nm RP",
  1191         - /* 256 */ "cmd ::= PRAGMA nm dbnm",
  1192         - /* 257 */ "plus_num ::= plus_opt number",
  1193         - /* 258 */ "minus_num ::= MINUS number",
  1194         - /* 259 */ "number ::= INTEGER",
  1195         - /* 260 */ "number ::= FLOAT",
  1196         - /* 261 */ "plus_opt ::= PLUS",
  1197         - /* 262 */ "plus_opt ::=",
  1198         - /* 263 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END",
  1199         - /* 264 */ "trigger_decl ::= temp TRIGGER nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
  1200         - /* 265 */ "trigger_time ::= BEFORE",
  1201         - /* 266 */ "trigger_time ::= AFTER",
  1202         - /* 267 */ "trigger_time ::= INSTEAD OF",
  1203         - /* 268 */ "trigger_time ::=",
  1204         - /* 269 */ "trigger_event ::= DELETE",
  1205         - /* 270 */ "trigger_event ::= INSERT",
  1206         - /* 271 */ "trigger_event ::= UPDATE",
  1207         - /* 272 */ "trigger_event ::= UPDATE OF inscollist",
  1208         - /* 273 */ "foreach_clause ::=",
  1209         - /* 274 */ "foreach_clause ::= FOR EACH ROW",
  1210         - /* 275 */ "foreach_clause ::= FOR EACH STATEMENT",
  1211         - /* 276 */ "when_clause ::=",
  1212         - /* 277 */ "when_clause ::= WHEN expr",
  1213         - /* 278 */ "trigger_cmd_list ::= trigger_cmd SEMI trigger_cmd_list",
  1214         - /* 279 */ "trigger_cmd_list ::=",
  1215         - /* 280 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt",
  1216         - /* 281 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP",
  1217         - /* 282 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select",
  1218         - /* 283 */ "trigger_cmd ::= DELETE FROM nm where_opt",
  1219         - /* 284 */ "trigger_cmd ::= select",
  1220         - /* 285 */ "expr ::= RAISE LP IGNORE RP",
  1221         - /* 286 */ "expr ::= RAISE LP raisetype COMMA nm RP",
  1222         - /* 287 */ "raisetype ::= ROLLBACK",
  1223         - /* 288 */ "raisetype ::= ABORT",
  1224         - /* 289 */ "raisetype ::= FAIL",
  1225         - /* 290 */ "cmd ::= DROP TRIGGER fullname",
  1226         - /* 291 */ "cmd ::= ATTACH database_kw_opt ids AS nm key_opt",
  1227         - /* 292 */ "key_opt ::=",
  1228         - /* 293 */ "key_opt ::= KEY ids",
  1229         - /* 294 */ "key_opt ::= KEY BLOB",
  1230         - /* 295 */ "database_kw_opt ::= DATABASE",
  1231         - /* 296 */ "database_kw_opt ::=",
  1232         - /* 297 */ "cmd ::= DETACH database_kw_opt nm",
  1233         - /* 298 */ "cmd ::= REINDEX",
  1234         - /* 299 */ "cmd ::= REINDEX nm dbnm",
  1235         - /* 300 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
  1236         - /* 301 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
  1237         - /* 302 */ "add_column_fullname ::= fullname",
  1238         - /* 303 */ "kwcolumn_opt ::=",
  1239         - /* 304 */ "kwcolumn_opt ::= COLUMNKW",
          993  + /*  36 */ "type ::= typetoken",
          994  + /*  37 */ "typetoken ::= typename",
          995  + /*  38 */ "typetoken ::= typename LP signed RP",
          996  + /*  39 */ "typetoken ::= typename LP signed COMMA signed RP",
          997  + /*  40 */ "typename ::= ids",
          998  + /*  41 */ "typename ::= typename ids",
          999  + /*  42 */ "signed ::= plus_num",
         1000  + /*  43 */ "signed ::= minus_num",
         1001  + /*  44 */ "carglist ::= carglist carg",
         1002  + /*  45 */ "carglist ::=",
         1003  + /*  46 */ "carg ::= CONSTRAINT nm ccons",
         1004  + /*  47 */ "carg ::= ccons",
         1005  + /*  48 */ "carg ::= DEFAULT term",
         1006  + /*  49 */ "carg ::= DEFAULT LP expr RP",
         1007  + /*  50 */ "carg ::= DEFAULT PLUS term",
         1008  + /*  51 */ "carg ::= DEFAULT MINUS term",
         1009  + /*  52 */ "carg ::= DEFAULT id",
         1010  + /*  53 */ "ccons ::= NULL onconf",
         1011  + /*  54 */ "ccons ::= NOT NULL onconf",
         1012  + /*  55 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
         1013  + /*  56 */ "ccons ::= UNIQUE onconf",
         1014  + /*  57 */ "ccons ::= CHECK LP expr RP onconf",
         1015  + /*  58 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
         1016  + /*  59 */ "ccons ::= defer_subclause",
         1017  + /*  60 */ "ccons ::= COLLATE id",
         1018  + /*  61 */ "autoinc ::=",
         1019  + /*  62 */ "autoinc ::= AUTOINCR",
         1020  + /*  63 */ "refargs ::=",
         1021  + /*  64 */ "refargs ::= refargs refarg",
         1022  + /*  65 */ "refarg ::= MATCH nm",
         1023  + /*  66 */ "refarg ::= ON DELETE refact",
         1024  + /*  67 */ "refarg ::= ON UPDATE refact",
         1025  + /*  68 */ "refarg ::= ON INSERT refact",
         1026  + /*  69 */ "refact ::= SET NULL",
         1027  + /*  70 */ "refact ::= SET DEFAULT",
         1028  + /*  71 */ "refact ::= CASCADE",
         1029  + /*  72 */ "refact ::= RESTRICT",
         1030  + /*  73 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
         1031  + /*  74 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
         1032  + /*  75 */ "init_deferred_pred_opt ::=",
         1033  + /*  76 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
         1034  + /*  77 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
         1035  + /*  78 */ "conslist_opt ::=",
         1036  + /*  79 */ "conslist_opt ::= COMMA conslist",
         1037  + /*  80 */ "conslist ::= conslist COMMA tcons",
         1038  + /*  81 */ "conslist ::= conslist tcons",
         1039  + /*  82 */ "conslist ::= tcons",
         1040  + /*  83 */ "tcons ::= CONSTRAINT nm",
         1041  + /*  84 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf",
         1042  + /*  85 */ "tcons ::= UNIQUE LP idxlist RP onconf",
         1043  + /*  86 */ "tcons ::= CHECK expr onconf",
         1044  + /*  87 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
         1045  + /*  88 */ "defer_subclause_opt ::=",
         1046  + /*  89 */ "defer_subclause_opt ::= defer_subclause",
         1047  + /*  90 */ "onconf ::=",
         1048  + /*  91 */ "onconf ::= ON CONFLICT resolvetype",
         1049  + /*  92 */ "orconf ::=",
         1050  + /*  93 */ "orconf ::= OR resolvetype",
         1051  + /*  94 */ "resolvetype ::= raisetype",
         1052  + /*  95 */ "resolvetype ::= IGNORE",
         1053  + /*  96 */ "resolvetype ::= REPLACE",
         1054  + /*  97 */ "cmd ::= DROP TABLE fullname",
         1055  + /*  98 */ "cmd ::= CREATE temp VIEW nm dbnm AS select",
         1056  + /*  99 */ "cmd ::= DROP VIEW fullname",
         1057  + /* 100 */ "cmd ::= select",
         1058  + /* 101 */ "select ::= oneselect",
         1059  + /* 102 */ "select ::= select multiselect_op oneselect",
         1060  + /* 103 */ "multiselect_op ::= UNION",
         1061  + /* 104 */ "multiselect_op ::= UNION ALL",
         1062  + /* 105 */ "multiselect_op ::= INTERSECT",
         1063  + /* 106 */ "multiselect_op ::= EXCEPT",
         1064  + /* 107 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
         1065  + /* 108 */ "distinct ::= DISTINCT",
         1066  + /* 109 */ "distinct ::= ALL",
         1067  + /* 110 */ "distinct ::=",
         1068  + /* 111 */ "sclp ::= selcollist COMMA",
         1069  + /* 112 */ "sclp ::=",
         1070  + /* 113 */ "selcollist ::= sclp expr as",
         1071  + /* 114 */ "selcollist ::= sclp STAR",
         1072  + /* 115 */ "selcollist ::= sclp nm DOT STAR",
         1073  + /* 116 */ "as ::= AS nm",
         1074  + /* 117 */ "as ::= ids",
         1075  + /* 118 */ "as ::=",
         1076  + /* 119 */ "from ::=",
         1077  + /* 120 */ "from ::= FROM seltablist",
         1078  + /* 121 */ "stl_prefix ::= seltablist joinop",
         1079  + /* 122 */ "stl_prefix ::=",
         1080  + /* 123 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt",
         1081  + /* 124 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt",
         1082  + /* 125 */ "seltablist_paren ::= select",
         1083  + /* 126 */ "seltablist_paren ::= seltablist",
         1084  + /* 127 */ "dbnm ::=",
         1085  + /* 128 */ "dbnm ::= DOT nm",
         1086  + /* 129 */ "fullname ::= nm dbnm",
         1087  + /* 130 */ "joinop ::= COMMA",
         1088  + /* 131 */ "joinop ::= JOIN",
         1089  + /* 132 */ "joinop ::= JOIN_KW JOIN",
         1090  + /* 133 */ "joinop ::= JOIN_KW nm JOIN",
         1091  + /* 134 */ "joinop ::= JOIN_KW nm nm JOIN",
         1092  + /* 135 */ "on_opt ::= ON expr",
         1093  + /* 136 */ "on_opt ::=",
         1094  + /* 137 */ "using_opt ::= USING LP inscollist RP",
         1095  + /* 138 */ "using_opt ::=",
         1096  + /* 139 */ "orderby_opt ::=",
         1097  + /* 140 */ "orderby_opt ::= ORDER BY sortlist",
         1098  + /* 141 */ "sortlist ::= sortlist COMMA sortitem collate sortorder",
         1099  + /* 142 */ "sortlist ::= sortitem collate sortorder",
         1100  + /* 143 */ "sortitem ::= expr",
         1101  + /* 144 */ "sortorder ::= ASC",
         1102  + /* 145 */ "sortorder ::= DESC",
         1103  + /* 146 */ "sortorder ::=",
         1104  + /* 147 */ "collate ::=",
         1105  + /* 148 */ "collate ::= COLLATE id",
         1106  + /* 149 */ "groupby_opt ::=",
         1107  + /* 150 */ "groupby_opt ::= GROUP BY exprlist",
         1108  + /* 151 */ "having_opt ::=",
         1109  + /* 152 */ "having_opt ::= HAVING expr",
         1110  + /* 153 */ "limit_opt ::=",
         1111  + /* 154 */ "limit_opt ::= LIMIT expr",
         1112  + /* 155 */ "limit_opt ::= LIMIT expr OFFSET expr",
         1113  + /* 156 */ "limit_opt ::= LIMIT expr COMMA expr",
         1114  + /* 157 */ "cmd ::= DELETE FROM fullname where_opt",
         1115  + /* 158 */ "where_opt ::=",
         1116  + /* 159 */ "where_opt ::= WHERE expr",
         1117  + /* 160 */ "cmd ::= UPDATE orconf fullname SET setlist where_opt",
         1118  + /* 161 */ "setlist ::= setlist COMMA nm EQ expr",
         1119  + /* 162 */ "setlist ::= nm EQ expr",
         1120  + /* 163 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP",
         1121  + /* 164 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
         1122  + /* 165 */ "insert_cmd ::= INSERT orconf",
         1123  + /* 166 */ "insert_cmd ::= REPLACE",
         1124  + /* 167 */ "itemlist ::= itemlist COMMA expr",
         1125  + /* 168 */ "itemlist ::= expr",
         1126  + /* 169 */ "inscollist_opt ::=",
         1127  + /* 170 */ "inscollist_opt ::= LP inscollist RP",
         1128  + /* 171 */ "inscollist ::= inscollist COMMA nm",
         1129  + /* 172 */ "inscollist ::= nm",
         1130  + /* 173 */ "expr ::= term",
         1131  + /* 174 */ "expr ::= LP expr RP",
         1132  + /* 175 */ "term ::= NULL",
         1133  + /* 176 */ "expr ::= ID",
         1134  + /* 177 */ "expr ::= JOIN_KW",
         1135  + /* 178 */ "expr ::= nm DOT nm",
         1136  + /* 179 */ "expr ::= nm DOT nm DOT nm",
         1137  + /* 180 */ "term ::= INTEGER",
         1138  + /* 181 */ "term ::= FLOAT",
         1139  + /* 182 */ "term ::= STRING",
         1140  + /* 183 */ "term ::= BLOB",
         1141  + /* 184 */ "expr ::= REGISTER",
         1142  + /* 185 */ "expr ::= VARIABLE",
         1143  + /* 186 */ "expr ::= CAST LP expr AS typetoken RP",
         1144  + /* 187 */ "expr ::= ID LP exprlist RP",
         1145  + /* 188 */ "expr ::= ID LP STAR RP",
         1146  + /* 189 */ "term ::= CTIME_KW",
         1147  + /* 190 */ "expr ::= expr AND expr",
         1148  + /* 191 */ "expr ::= expr OR expr",
         1149  + /* 192 */ "expr ::= expr LT expr",
         1150  + /* 193 */ "expr ::= expr GT expr",
         1151  + /* 194 */ "expr ::= expr LE expr",
         1152  + /* 195 */ "expr ::= expr GE expr",
         1153  + /* 196 */ "expr ::= expr NE expr",
         1154  + /* 197 */ "expr ::= expr EQ expr",
         1155  + /* 198 */ "expr ::= expr BITAND expr",
         1156  + /* 199 */ "expr ::= expr BITOR expr",
         1157  + /* 200 */ "expr ::= expr LSHIFT expr",
         1158  + /* 201 */ "expr ::= expr RSHIFT expr",
         1159  + /* 202 */ "expr ::= expr PLUS expr",
         1160  + /* 203 */ "expr ::= expr MINUS expr",
         1161  + /* 204 */ "expr ::= expr STAR expr",
         1162  + /* 205 */ "expr ::= expr SLASH expr",
         1163  + /* 206 */ "expr ::= expr REM expr",
         1164  + /* 207 */ "expr ::= expr CONCAT expr",
         1165  + /* 208 */ "likeop ::= LIKE_KW",
         1166  + /* 209 */ "likeop ::= NOT LIKE_KW",
         1167  + /* 210 */ "escape ::= ESCAPE expr",
         1168  + /* 211 */ "escape ::=",
         1169  + /* 212 */ "expr ::= expr likeop expr escape",
         1170  + /* 213 */ "expr ::= expr ISNULL",
         1171  + /* 214 */ "expr ::= expr IS NULL",
         1172  + /* 215 */ "expr ::= expr NOTNULL",
         1173  + /* 216 */ "expr ::= expr NOT NULL",
         1174  + /* 217 */ "expr ::= expr IS NOT NULL",
         1175  + /* 218 */ "expr ::= NOT expr",
         1176  + /* 219 */ "expr ::= BITNOT expr",
         1177  + /* 220 */ "expr ::= MINUS expr",
         1178  + /* 221 */ "expr ::= PLUS expr",
         1179  + /* 222 */ "between_op ::= BETWEEN",
         1180  + /* 223 */ "between_op ::= NOT BETWEEN",
         1181  + /* 224 */ "expr ::= expr between_op expr AND expr",
         1182  + /* 225 */ "in_op ::= IN",
         1183  + /* 226 */ "in_op ::= NOT IN",
         1184  + /* 227 */ "expr ::= expr in_op LP exprlist RP",
         1185  + /* 228 */ "expr ::= LP select RP",
         1186  + /* 229 */ "expr ::= expr in_op LP select RP",
         1187  + /* 230 */ "expr ::= expr in_op nm dbnm",
         1188  + /* 231 */ "expr ::= EXISTS LP select RP",
         1189  + /* 232 */ "expr ::= CASE case_operand case_exprlist case_else END",
         1190  + /* 233 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
         1191  + /* 234 */ "case_exprlist ::= WHEN expr THEN expr",
         1192  + /* 235 */ "case_else ::= ELSE expr",
         1193  + /* 236 */ "case_else ::=",
         1194  + /* 237 */ "case_operand ::= expr",
         1195  + /* 238 */ "case_operand ::=",
         1196  + /* 239 */ "exprlist ::= exprlist COMMA expritem",
         1197  + /* 240 */ "exprlist ::= expritem",
         1198  + /* 241 */ "expritem ::= expr",
         1199  + /* 242 */ "expritem ::=",
         1200  + /* 243 */ "cmd ::= CREATE uniqueflag INDEX nm dbnm ON nm LP idxlist RP onconf",
         1201  + /* 244 */ "uniqueflag ::= UNIQUE",
         1202  + /* 245 */ "uniqueflag ::=",
         1203  + /* 246 */ "idxlist_opt ::=",
         1204  + /* 247 */ "idxlist_opt ::= LP idxlist RP",
         1205  + /* 248 */ "idxlist ::= idxlist COMMA idxitem collate sortorder",
         1206  + /* 249 */ "idxlist ::= idxitem collate sortorder",
         1207  + /* 250 */ "idxitem ::= nm",
         1208  + /* 251 */ "cmd ::= DROP INDEX fullname",
         1209  + /* 252 */ "cmd ::= VACUUM",
         1210  + /* 253 */ "cmd ::= VACUUM nm",
         1211  + /* 254 */ "cmd ::= PRAGMA nm dbnm EQ nm",
         1212  + /* 255 */ "cmd ::= PRAGMA nm dbnm EQ ON",
         1213  + /* 256 */ "cmd ::= PRAGMA nm dbnm EQ plus_num",
         1214  + /* 257 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
         1215  + /* 258 */ "cmd ::= PRAGMA nm dbnm LP nm RP",
         1216  + /* 259 */ "cmd ::= PRAGMA nm dbnm",
         1217  + /* 260 */ "plus_num ::= plus_opt number",
         1218  + /* 261 */ "minus_num ::= MINUS number",
         1219  + /* 262 */ "number ::= INTEGER",
         1220  + /* 263 */ "number ::= FLOAT",
         1221  + /* 264 */ "plus_opt ::= PLUS",
         1222  + /* 265 */ "plus_opt ::=",
         1223  + /* 266 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END",
         1224  + /* 267 */ "trigger_decl ::= temp TRIGGER nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
         1225  + /* 268 */ "trigger_time ::= BEFORE",
         1226  + /* 269 */ "trigger_time ::= AFTER",
         1227  + /* 270 */ "trigger_time ::= INSTEAD OF",
         1228  + /* 271 */ "trigger_time ::=",
         1229  + /* 272 */ "trigger_event ::= DELETE",
         1230  + /* 273 */ "trigger_event ::= INSERT",
         1231  + /* 274 */ "trigger_event ::= UPDATE",
         1232  + /* 275 */ "trigger_event ::= UPDATE OF inscollist",
         1233  + /* 276 */ "foreach_clause ::=",
         1234  + /* 277 */ "foreach_clause ::= FOR EACH ROW",
         1235  + /* 278 */ "foreach_clause ::= FOR EACH STATEMENT",
         1236  + /* 279 */ "when_clause ::=",
         1237  + /* 280 */ "when_clause ::= WHEN expr",
         1238  + /* 281 */ "trigger_cmd_list ::= trigger_cmd SEMI trigger_cmd_list",
         1239  + /* 282 */ "trigger_cmd_list ::=",
         1240  + /* 283 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt",
         1241  + /* 284 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP",
         1242  + /* 285 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select",
         1243  + /* 286 */ "trigger_cmd ::= DELETE FROM nm where_opt",
         1244  + /* 287 */ "trigger_cmd ::= select",
         1245  + /* 288 */ "expr ::= RAISE LP IGNORE RP",
         1246  + /* 289 */ "expr ::= RAISE LP raisetype COMMA nm RP",
         1247  + /* 290 */ "raisetype ::= ROLLBACK",
         1248  + /* 291 */ "raisetype ::= ABORT",
         1249  + /* 292 */ "raisetype ::= FAIL",
         1250  + /* 293 */ "cmd ::= DROP TRIGGER fullname",
         1251  + /* 294 */ "cmd ::= ATTACH database_kw_opt ids AS nm key_opt",
         1252  + /* 295 */ "key_opt ::=",
         1253  + /* 296 */ "key_opt ::= KEY ids",
         1254  + /* 297 */ "key_opt ::= KEY BLOB",
         1255  + /* 298 */ "database_kw_opt ::= DATABASE",
         1256  + /* 299 */ "database_kw_opt ::=",
         1257  + /* 300 */ "cmd ::= DETACH database_kw_opt nm",
         1258  + /* 301 */ "cmd ::= REINDEX",
         1259  + /* 302 */ "cmd ::= REINDEX nm dbnm",
         1260  + /* 303 */ "cmd ::= ANALYZE",
         1261  + /* 304 */ "cmd ::= ANALYZE nm dbnm",
         1262  + /* 305 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
         1263  + /* 306 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
         1264  + /* 307 */ "add_column_fullname ::= fullname",
         1265  + /* 308 */ "kwcolumn_opt ::=",
         1266  + /* 309 */ "kwcolumn_opt ::= COLUMNKW",
  1240   1267   };
  1241   1268   #endif /* NDEBUG */
  1242   1269   
  1243   1270   /*
  1244   1271   ** This function returns the symbolic name associated with a token
  1245   1272   ** value.
  1246   1273   */
................................................................................
  1290   1317       ** reduce or during error processing or when a parser is 
  1291   1318       ** being destroyed before it is finished parsing.
  1292   1319       **
  1293   1320       ** Note: during a reduce, the only symbols destroyed are those
  1294   1321       ** which appear on the RHS of the rule, but which are not used
  1295   1322       ** inside the C code.
  1296   1323       */
  1297         -    case 157:
  1298         -    case 189:
  1299         -    case 206:
  1300         -//#line 334 "parse.y"
  1301         -{sqlite3SelectDelete((yypminor->yy459));}
  1302         -//#line 1301 "parse.c"
         1324  +    case 159:
         1325  +    case 192:
         1326  +    case 209:
         1327  +//#line 369 "parse.y"
         1328  +{sqlite3SelectDelete((yypminor->yy99));}
         1329  +//#line 1328 "parse.c"
  1303   1330         break;
  1304         -    case 170:
         1331  +    case 173:
  1305   1332       case 174:
  1306         -    case 194:
  1307         -    case 196:
  1308         -    case 204:
  1309         -    case 210:
  1310         -    case 224:
  1311         -//#line 593 "parse.y"
  1312         -{sqlite3ExprDelete((yypminor->yy2));}
  1313         -//#line 1312 "parse.c"
  1314         -      break;
  1315         -    case 175:
  1316         -    case 183:
  1317         -    case 192:
  1318         -    case 195:
  1319   1333       case 197:
  1320   1334       case 199:
  1321         -    case 209:
  1322         -    case 212:
         1335  +    case 207:
  1323   1336       case 213:
  1324         -    case 216:
  1325         -    case 222:
  1326         -//#line 812 "parse.y"
  1327         -{sqlite3ExprListDelete((yypminor->yy82));}
  1328         -//#line 1327 "parse.c"
         1337  +    case 227:
         1338  +//#line 628 "parse.y"
         1339  +{sqlite3ExprDelete((yypminor->yy44));}
         1340  +//#line 1339 "parse.c"
  1329   1341         break;
  1330         -    case 188:
  1331         -    case 193:
  1332         -    case 201:
         1342  +    case 178:
         1343  +    case 186:
         1344  +    case 195:
         1345  +    case 198:
         1346  +    case 200:
  1333   1347       case 202:
  1334         -//#line 463 "parse.y"
  1335         -{sqlite3SrcListDelete((yypminor->yy67));}
  1336         -//#line 1335 "parse.c"
         1348  +    case 212:
         1349  +    case 215:
         1350  +    case 216:
         1351  +    case 219:
         1352  +    case 225:
         1353  +//#line 853 "parse.y"
         1354  +{sqlite3ExprListDelete((yypminor->yy412));}
         1355  +//#line 1354 "parse.c"
  1337   1356         break;
  1338         -    case 198:
  1339         -//#line 525 "parse.y"
  1340         -{
  1341         -  sqlite3ExprDelete((yypminor->yy244).pLimit);
  1342         -  sqlite3ExprDelete((yypminor->yy244).pOffset);
  1343         -}
  1344         -//#line 1343 "parse.c"
  1345         -      break;
         1357  +    case 191:
         1358  +    case 196:
         1359  +    case 204:
  1346   1360       case 205:
         1361  +//#line 498 "parse.y"
         1362  +{sqlite3SrcListDelete((yypminor->yy367));}
         1363  +//#line 1362 "parse.c"
         1364  +      break;
         1365  +    case 201:
         1366  +//#line 560 "parse.y"
         1367  +{
         1368  +  sqlite3ExprDelete((yypminor->yy112).pLimit);
         1369  +  sqlite3ExprDelete((yypminor->yy112).pOffset);
         1370  +}
         1371  +//#line 1370 "parse.c"
         1372  +      break;
  1347   1373       case 208:
  1348         -    case 215:
  1349         -//#line 481 "parse.y"
  1350         -{sqlite3IdListDelete((yypminor->yy240));}
  1351         -//#line 1350 "parse.c"
         1374  +    case 211:
         1375  +    case 218:
         1376  +//#line 516 "parse.y"
         1377  +{sqlite3IdListDelete((yypminor->yy258));}
         1378  +//#line 1377 "parse.c"
  1352   1379         break;
  1353         -    case 230:
  1354         -    case 235:
  1355         -//#line 905 "parse.y"
  1356         -{sqlite3DeleteTriggerStep((yypminor->yy347));}
  1357         -//#line 1356 "parse.c"
         1380  +    case 233:
         1381  +    case 238:
         1382  +//#line 946 "parse.y"
         1383  +{sqlite3DeleteTriggerStep((yypminor->yy203));}
         1384  +//#line 1383 "parse.c"
  1358   1385         break;
  1359         -    case 232:
  1360         -//#line 889 "parse.y"
  1361         -{sqlite3IdListDelete((yypminor->yy210).b);}
  1362         -//#line 1361 "parse.c"
         1386  +    case 235:
         1387  +//#line 930 "parse.y"
         1388  +{sqlite3IdListDelete((yypminor->yy234).b);}
         1389  +//#line 1388 "parse.c"
  1363   1390         break;
  1364   1391       default:  break;   /* If no destructor action specified: do nothing */
  1365   1392     }
  1366   1393   }
  1367   1394   
  1368   1395   /*
  1369   1396   ** Pop the parser's stack once.
................................................................................
  1531   1558   /* The following table contains information about every rule that
  1532   1559   ** is used during the reduce.
  1533   1560   */
  1534   1561   static const struct {
  1535   1562     YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */
  1536   1563     unsigned char nrhs;     /* Number of right-hand side symbols in the rule */
  1537   1564   } yyRuleInfo[] = {
  1538         -  { 142, 1 },
  1539         -  { 143, 2 },
  1540         -  { 143, 1 },
         1565  +  { 144, 1 },
         1566  +  { 145, 2 },
  1541   1567     { 145, 1 },
  1542         -  { 144, 1 },
  1543         -  { 144, 3 },
  1544         -  { 147, 0 },
  1545   1568     { 147, 1 },
         1569  +  { 146, 1 },
  1546   1570     { 146, 3 },
  1547   1571     { 149, 0 },
  1548   1572     { 149, 1 },
  1549         -  { 149, 2 },
  1550         -  { 148, 0 },
  1551         -  { 148, 1 },
  1552         -  { 148, 1 },
  1553         -  { 148, 1 },
  1554         -  { 146, 2 },
  1555         -  { 146, 2 },
  1556         -  { 146, 2 },
  1557         -  { 146, 2 },
  1558         -  { 151, 5 },
  1559         -  { 153, 1 },
  1560         -  { 153, 0 },
  1561         -  { 152, 4 },
  1562         -  { 152, 2 },
  1563         -  { 155, 3 },
  1564         -  { 155, 1 },
  1565         -  { 158, 3 },
  1566         -  { 159, 1 },
  1567         -  { 162, 1 },
  1568         -  { 163, 1 },
  1569         -  { 163, 1 },
         1573  +  { 148, 3 },
         1574  +  { 151, 0 },
         1575  +  { 151, 1 },
         1576  +  { 151, 2 },
         1577  +  { 150, 0 },
  1570   1578     { 150, 1 },
  1571   1579     { 150, 1 },
  1572   1580     { 150, 1 },
  1573         -  { 160, 0 },
  1574         -  { 160, 1 },
  1575         -  { 160, 4 },
  1576         -  { 160, 6 },
         1581  +  { 148, 2 },
         1582  +  { 148, 2 },
         1583  +  { 148, 2 },
         1584  +  { 148, 2 },
         1585  +  { 153, 5 },
         1586  +  { 155, 1 },
         1587  +  { 155, 0 },
         1588  +  { 154, 4 },
         1589  +  { 154, 2 },
         1590  +  { 157, 3 },
         1591  +  { 157, 1 },
         1592  +  { 160, 3 },
         1593  +  { 161, 1 },
  1577   1594     { 164, 1 },
  1578         -  { 164, 2 },
  1579   1595     { 165, 1 },
  1580   1596     { 165, 1 },
  1581         -  { 161, 2 },
  1582         -  { 161, 0 },
  1583         -  { 168, 3 },
         1597  +  { 152, 1 },
         1598  +  { 152, 1 },
         1599  +  { 152, 1 },
         1600  +  { 162, 0 },
         1601  +  { 162, 1 },
         1602  +  { 166, 1 },
         1603  +  { 166, 4 },
         1604  +  { 166, 6 },
         1605  +  { 167, 1 },
         1606  +  { 167, 2 },
         1607  +  { 168, 1 },
  1584   1608     { 168, 1 },
  1585         -  { 168, 2 },
  1586         -  { 168, 3 },
  1587         -  { 168, 3 },
  1588         -  { 168, 2 },
  1589         -  { 169, 2 },
  1590         -  { 169, 3 },
  1591         -  { 169, 5 },
  1592         -  { 169, 2 },
  1593         -  { 169, 5 },
  1594         -  { 169, 4 },
  1595         -  { 169, 1 },
  1596         -  { 169, 2 },
  1597         -  { 173, 0 },
  1598         -  { 173, 1 },
  1599         -  { 176, 0 },
  1600         -  { 176, 2 },
  1601         -  { 178, 2 },
  1602         -  { 178, 3 },
  1603         -  { 178, 3 },
  1604         -  { 178, 3 },
         1609  +  { 163, 2 },
         1610  +  { 163, 0 },
         1611  +  { 171, 3 },
         1612  +  { 171, 1 },
         1613  +  { 171, 2 },
         1614  +  { 171, 4 },
         1615  +  { 171, 3 },
         1616  +  { 171, 3 },
         1617  +  { 171, 2 },
         1618  +  { 172, 2 },
         1619  +  { 172, 3 },
         1620  +  { 172, 5 },
         1621  +  { 172, 2 },
         1622  +  { 172, 5 },
         1623  +  { 172, 4 },
         1624  +  { 172, 1 },
         1625  +  { 172, 2 },
         1626  +  { 177, 0 },
         1627  +  { 177, 1 },
         1628  +  { 179, 0 },
  1605   1629     { 179, 2 },
  1606         -  { 179, 2 },
  1607         -  { 179, 1 },
  1608         -  { 179, 1 },
  1609         -  { 177, 3 },
  1610         -  { 177, 2 },
  1611         -  { 180, 0 },
  1612         -  { 180, 2 },
  1613         -  { 180, 2 },
  1614         -  { 156, 0 },
  1615         -  { 156, 2 },
         1630  +  { 181, 2 },
         1631  +  { 181, 3 },
         1632  +  { 181, 3 },
  1616   1633     { 181, 3 },
  1617         -  { 181, 2 },
  1618         -  { 181, 1 },
         1634  +  { 182, 2 },
  1619   1635     { 182, 2 },
  1620         -  { 182, 7 },
  1621         -  { 182, 5 },
  1622         -  { 182, 3 },
  1623         -  { 182, 10 },
  1624         -  { 184, 0 },
         1636  +  { 182, 1 },
         1637  +  { 182, 1 },
         1638  +  { 180, 3 },
         1639  +  { 180, 2 },
         1640  +  { 183, 0 },
         1641  +  { 183, 2 },
         1642  +  { 183, 2 },
         1643  +  { 158, 0 },
         1644  +  { 158, 2 },
         1645  +  { 184, 3 },
         1646  +  { 184, 2 },
  1625   1647     { 184, 1 },
  1626         -  { 171, 0 },
  1627         -  { 171, 3 },
  1628         -  { 185, 0 },
  1629   1648     { 185, 2 },
  1630         -  { 186, 1 },
  1631         -  { 186, 1 },
  1632         -  { 186, 1 },
  1633         -  { 146, 3 },
  1634         -  { 146, 7 },
  1635         -  { 146, 3 },
  1636         -  { 146, 1 },
  1637         -  { 157, 1 },
  1638         -  { 157, 3 },
  1639         -  { 190, 1 },
  1640         -  { 190, 2 },
  1641         -  { 190, 1 },
  1642         -  { 190, 1 },
  1643         -  { 189, 9 },
  1644         -  { 191, 1 },
  1645         -  { 191, 1 },
  1646         -  { 191, 0 },
  1647         -  { 199, 2 },
  1648         -  { 199, 0 },
  1649         -  { 192, 3 },
  1650         -  { 192, 2 },
  1651         -  { 192, 4 },
  1652         -  { 200, 2 },
  1653         -  { 200, 1 },
  1654         -  { 200, 0 },
  1655         -  { 193, 0 },
         1649  +  { 185, 7 },
         1650  +  { 185, 5 },
         1651  +  { 185, 3 },
         1652  +  { 185, 10 },
         1653  +  { 187, 0 },
         1654  +  { 187, 1 },
         1655  +  { 175, 0 },
         1656  +  { 175, 3 },
         1657  +  { 188, 0 },
         1658  +  { 188, 2 },
         1659  +  { 189, 1 },
         1660  +  { 189, 1 },
         1661  +  { 189, 1 },
         1662  +  { 148, 3 },
         1663  +  { 148, 7 },
         1664  +  { 148, 3 },
         1665  +  { 148, 1 },
         1666  +  { 159, 1 },
         1667  +  { 159, 3 },
         1668  +  { 193, 1 },
  1656   1669     { 193, 2 },
         1670  +  { 193, 1 },
         1671  +  { 193, 1 },
         1672  +  { 192, 9 },
         1673  +  { 194, 1 },
         1674  +  { 194, 1 },
         1675  +  { 194, 0 },
  1657   1676     { 202, 2 },
  1658   1677     { 202, 0 },
  1659         -  { 201, 6 },
  1660         -  { 201, 7 },
  1661         -  { 206, 1 },
  1662         -  { 206, 1 },
  1663         -  { 154, 0 },
  1664         -  { 154, 2 },
  1665         -  { 188, 2 },
         1678  +  { 195, 3 },
         1679  +  { 195, 2 },
         1680  +  { 195, 4 },
         1681  +  { 203, 2 },
  1666   1682     { 203, 1 },
  1667         -  { 203, 1 },
  1668         -  { 203, 2 },
  1669         -  { 203, 3 },
  1670         -  { 203, 4 },
  1671         -  { 204, 2 },
  1672         -  { 204, 0 },
  1673         -  { 205, 4 },
  1674         -  { 205, 0 },
  1675         -  { 197, 0 },
  1676         -  { 197, 3 },
  1677         -  { 209, 5 },
  1678         -  { 209, 3 },
  1679         -  { 210, 1 },
  1680         -  { 172, 1 },
  1681         -  { 172, 1 },
  1682         -  { 172, 0 },
  1683         -  { 211, 0 },
  1684         -  { 211, 2 },
  1685         -  { 195, 0 },
  1686         -  { 195, 3 },
         1683  +  { 203, 0 },
  1687   1684     { 196, 0 },
  1688   1685     { 196, 2 },
  1689         -  { 198, 0 },
  1690         -  { 198, 2 },
  1691         -  { 198, 4 },
  1692         -  { 198, 4 },
  1693         -  { 146, 4 },
  1694         -  { 194, 0 },
  1695         -  { 194, 2 },
  1696         -  { 146, 6 },
  1697         -  { 213, 5 },
  1698         -  { 213, 3 },
  1699         -  { 146, 8 },
  1700         -  { 146, 5 },
         1686  +  { 205, 2 },
         1687  +  { 205, 0 },
         1688  +  { 204, 6 },
         1689  +  { 204, 7 },
         1690  +  { 209, 1 },
         1691  +  { 209, 1 },
         1692  +  { 156, 0 },
         1693  +  { 156, 2 },
         1694  +  { 191, 2 },
         1695  +  { 206, 1 },
         1696  +  { 206, 1 },
         1697  +  { 206, 2 },
         1698  +  { 206, 3 },
         1699  +  { 206, 4 },
         1700  +  { 207, 2 },
         1701  +  { 207, 0 },
         1702  +  { 208, 4 },
         1703  +  { 208, 0 },
         1704  +  { 200, 0 },
         1705  +  { 200, 3 },
         1706  +  { 212, 5 },
         1707  +  { 212, 3 },
         1708  +  { 213, 1 },
         1709  +  { 176, 1 },
         1710  +  { 176, 1 },
         1711  +  { 176, 0 },
         1712  +  { 214, 0 },
  1701   1713     { 214, 2 },
  1702         -  { 214, 1 },
         1714  +  { 198, 0 },
         1715  +  { 198, 3 },
         1716  +  { 199, 0 },
         1717  +  { 199, 2 },
         1718  +  { 201, 0 },
         1719  +  { 201, 2 },
         1720  +  { 201, 4 },
         1721  +  { 201, 4 },
         1722  +  { 148, 4 },
         1723  +  { 197, 0 },
         1724  +  { 197, 2 },
         1725  +  { 148, 6 },
         1726  +  { 216, 5 },
  1703   1727     { 216, 3 },
  1704         -  { 216, 1 },
  1705         -  { 215, 0 },
  1706         -  { 215, 3 },
  1707         -  { 208, 3 },
  1708         -  { 208, 1 },
         1728  +  { 148, 8 },
         1729  +  { 148, 5 },
         1730  +  { 217, 2 },
         1731  +  { 217, 1 },
         1732  +  { 219, 3 },
         1733  +  { 219, 1 },
         1734  +  { 218, 0 },
         1735  +  { 218, 3 },
         1736  +  { 211, 3 },
         1737  +  { 211, 1 },
  1709   1738     { 174, 1 },
  1710   1739     { 174, 3 },
  1711         -  { 170, 1 },
         1740  +  { 173, 1 },
  1712   1741     { 174, 1 },
  1713   1742     { 174, 1 },
  1714   1743     { 174, 3 },
  1715   1744     { 174, 5 },
  1716         -  { 170, 1 },
  1717         -  { 170, 1 },
  1718         -  { 170, 1 },
  1719         -  { 170, 1 },
         1745  +  { 173, 1 },
         1746  +  { 173, 1 },
         1747  +  { 173, 1 },
         1748  +  { 173, 1 },
  1720   1749     { 174, 1 },
  1721   1750     { 174, 1 },
         1751  +  { 174, 6 },
  1722   1752     { 174, 4 },
  1723   1753     { 174, 4 },
  1724         -  { 170, 1 },
         1754  +  { 173, 1 },
  1725   1755     { 174, 3 },
  1726   1756     { 174, 3 },
  1727   1757     { 174, 3 },
  1728   1758     { 174, 3 },
  1729   1759     { 174, 3 },
  1730   1760     { 174, 3 },
  1731   1761     { 174, 3 },
................................................................................
  1736   1766     { 174, 3 },
  1737   1767     { 174, 3 },
  1738   1768     { 174, 3 },
  1739   1769     { 174, 3 },
  1740   1770     { 174, 3 },
  1741   1771     { 174, 3 },
  1742   1772     { 174, 3 },
  1743         -  { 217, 1 },
  1744         -  { 217, 2 },
  1745         -  { 218, 2 },
  1746         -  { 218, 0 },
         1773  +  { 220, 1 },
         1774  +  { 220, 2 },
         1775  +  { 221, 2 },
         1776  +  { 221, 0 },
  1747   1777     { 174, 4 },
  1748   1778     { 174, 2 },
  1749   1779     { 174, 3 },
  1750   1780     { 174, 2 },
  1751   1781     { 174, 3 },
  1752   1782     { 174, 4 },
  1753   1783     { 174, 2 },
  1754   1784     { 174, 2 },
  1755   1785     { 174, 2 },
  1756   1786     { 174, 2 },
  1757         -  { 219, 1 },
  1758         -  { 219, 2 },
         1787  +  { 222, 1 },
         1788  +  { 222, 2 },
  1759   1789     { 174, 5 },
  1760         -  { 220, 1 },
  1761         -  { 220, 2 },
         1790  +  { 223, 1 },
         1791  +  { 223, 2 },
  1762   1792     { 174, 5 },
  1763   1793     { 174, 3 },
  1764   1794     { 174, 5 },
  1765   1795     { 174, 4 },
  1766   1796     { 174, 4 },
  1767   1797     { 174, 5 },
  1768         -  { 222, 5 },
  1769         -  { 222, 4 },
  1770         -  { 223, 2 },
  1771         -  { 223, 0 },
  1772         -  { 221, 1 },
  1773         -  { 221, 0 },
  1774         -  { 212, 3 },
  1775         -  { 212, 1 },
         1798  +  { 225, 5 },
         1799  +  { 225, 4 },
         1800  +  { 226, 2 },
         1801  +  { 226, 0 },
  1776   1802     { 224, 1 },
  1777   1803     { 224, 0 },
  1778         -  { 146, 11 },
  1779         -  { 225, 1 },
  1780         -  { 225, 0 },
  1781         -  { 175, 0 },
  1782         -  { 175, 3 },
  1783         -  { 183, 5 },
  1784         -  { 183, 3 },
  1785         -  { 226, 1 },
  1786         -  { 146, 3 },
  1787         -  { 146, 1 },
  1788         -  { 146, 2 },
  1789         -  { 146, 5 },
  1790         -  { 146, 5 },
  1791         -  { 146, 5 },
  1792         -  { 146, 5 },
  1793         -  { 146, 6 },
  1794         -  { 146, 3 },
  1795         -  { 166, 2 },
  1796         -  { 167, 2 },
  1797         -  { 228, 1 },
  1798         -  { 228, 1 },
         1804  +  { 215, 3 },
         1805  +  { 215, 1 },
  1799   1806     { 227, 1 },
  1800   1807     { 227, 0 },
  1801         -  { 146, 5 },
  1802         -  { 229, 10 },
         1808  +  { 148, 11 },
         1809  +  { 228, 1 },
         1810  +  { 228, 0 },
         1811  +  { 178, 0 },
         1812  +  { 178, 3 },
         1813  +  { 186, 5 },
         1814  +  { 186, 3 },
         1815  +  { 229, 1 },
         1816  +  { 148, 3 },
         1817  +  { 148, 1 },
         1818  +  { 148, 2 },
         1819  +  { 148, 5 },
         1820  +  { 148, 5 },
         1821  +  { 148, 5 },
         1822  +  { 148, 5 },
         1823  +  { 148, 6 },
         1824  +  { 148, 3 },
         1825  +  { 169, 2 },
         1826  +  { 170, 2 },
  1803   1827     { 231, 1 },
  1804   1828     { 231, 1 },
  1805         -  { 231, 2 },
  1806         -  { 231, 0 },
  1807         -  { 232, 1 },
  1808         -  { 232, 1 },
  1809         -  { 232, 1 },
  1810         -  { 232, 3 },
  1811         -  { 233, 0 },
  1812         -  { 233, 3 },
  1813         -  { 233, 3 },
         1829  +  { 230, 1 },
         1830  +  { 230, 0 },
         1831  +  { 148, 5 },
         1832  +  { 232, 10 },
         1833  +  { 234, 1 },
         1834  +  { 234, 1 },
         1835  +  { 234, 2 },
  1814   1836     { 234, 0 },
  1815         -  { 234, 2 },
  1816         -  { 230, 3 },
  1817         -  { 230, 0 },
  1818         -  { 235, 6 },
  1819         -  { 235, 8 },
  1820         -  { 235, 5 },
  1821         -  { 235, 4 },
         1837  +  { 235, 1 },
         1838  +  { 235, 1 },
  1822   1839     { 235, 1 },
         1840  +  { 235, 3 },
         1841  +  { 236, 0 },
         1842  +  { 236, 3 },
         1843  +  { 236, 3 },
         1844  +  { 237, 0 },
         1845  +  { 237, 2 },
         1846  +  { 233, 3 },
         1847  +  { 233, 0 },
         1848  +  { 238, 6 },
         1849  +  { 238, 8 },
         1850  +  { 238, 5 },
         1851  +  { 238, 4 },
         1852  +  { 238, 1 },
  1823   1853     { 174, 4 },
  1824   1854     { 174, 6 },
  1825         -  { 187, 1 },
  1826         -  { 187, 1 },
  1827         -  { 187, 1 },
  1828         -  { 146, 3 },
  1829         -  { 146, 6 },
  1830         -  { 237, 0 },
  1831         -  { 237, 2 },
  1832         -  { 237, 2 },
  1833         -  { 236, 1 },
  1834         -  { 236, 0 },
  1835         -  { 146, 3 },
  1836         -  { 146, 1 },
  1837         -  { 146, 3 },
  1838         -  { 146, 6 },
  1839         -  { 146, 6 },
  1840         -  { 238, 1 },
         1855  +  { 190, 1 },
         1856  +  { 190, 1 },
         1857  +  { 190, 1 },
         1858  +  { 148, 3 },
         1859  +  { 148, 6 },
         1860  +  { 240, 0 },
         1861  +  { 240, 2 },
         1862  +  { 240, 2 },
         1863  +  { 239, 1 },
  1841   1864     { 239, 0 },
  1842         -  { 239, 1 },
         1865  +  { 148, 3 },
         1866  +  { 148, 1 },
         1867  +  { 148, 3 },
         1868  +  { 148, 1 },
         1869  +  { 148, 3 },
         1870  +  { 148, 6 },
         1871  +  { 148, 6 },
         1872  +  { 241, 1 },
         1873  +  { 242, 0 },
         1874  +  { 242, 1 },
  1843   1875   };
  1844   1876   
  1845   1877   static void yy_accept(yyParser*);  /* Forward Declaration */
  1846   1878   
  1847   1879   /*
  1848   1880   ** Perform a reduce action and the shift that must immediately
  1849   1881   ** follow the reduce.
................................................................................
  1885   1917     **   case 0:
  1886   1918     **  //#line <lineno> <grammarfile>
  1887   1919     **     { ... }           // User supplied code
  1888   1920     **  //#line <lineno> <thisfile>
  1889   1921     **     break;
  1890   1922     */
  1891   1923         case 3:
  1892         -//#line 84 "parse.y"
         1924  +//#line 102 "parse.y"
  1893   1925   { sqlite3FinishCoding(pParse); }
  1894         -//#line 1893 "parse.c"
         1926  +//#line 1925 "parse.c"
  1895   1927           break;
  1896   1928         case 6:
  1897         -//#line 87 "parse.y"
         1929  +//#line 105 "parse.y"
  1898   1930   { sqlite3BeginParse(pParse, 0); }
  1899         -//#line 1898 "parse.c"
         1931  +//#line 1930 "parse.c"
  1900   1932           break;
  1901   1933         case 7:
  1902         -//#line 89 "parse.y"
         1934  +//#line 107 "parse.y"
  1903   1935   { sqlite3BeginParse(pParse, 1); }
  1904         -//#line 1903 "parse.c"
         1936  +//#line 1935 "parse.c"
  1905   1937           break;
  1906   1938         case 8:
  1907         -//#line 95 "parse.y"
  1908         -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy412);}
  1909         -//#line 1908 "parse.c"
         1939  +//#line 113 "parse.y"
         1940  +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy58);}
         1941  +//#line 1940 "parse.c"
  1910   1942           break;
  1911   1943         case 12:
  1912         -//#line 100 "parse.y"
  1913         -{yygotominor.yy412 = TK_DEFERRED;}
  1914         -//#line 1913 "parse.c"
         1944  +//#line 118 "parse.y"
         1945  +{yygotominor.yy58 = TK_DEFERRED;}
         1946  +//#line 1945 "parse.c"
  1915   1947           break;
  1916   1948         case 13:
  1917   1949         case 14:
  1918   1950         case 15:
  1919         -      case 101:
  1920   1951         case 103:
  1921         -      case 104:
  1922         -//#line 101 "parse.y"
  1923         -{yygotominor.yy412 = yymsp[0].major;}
  1924         -//#line 1923 "parse.c"
         1952  +      case 105:
         1953  +      case 106:
         1954  +//#line 119 "parse.y"
         1955  +{yygotominor.yy58 = yymsp[0].major;}
         1956  +//#line 1955 "parse.c"
  1925   1957           break;
  1926   1958         case 16:
  1927   1959         case 17:
  1928         -//#line 104 "parse.y"
         1960  +//#line 122 "parse.y"
  1929   1961   {sqlite3CommitTransaction(pParse);}
  1930         -//#line 1929 "parse.c"
         1962  +//#line 1961 "parse.c"
  1931   1963           break;
  1932   1964         case 18:
  1933         -//#line 106 "parse.y"
         1965  +//#line 124 "parse.y"
  1934   1966   {sqlite3RollbackTransaction(pParse);}
  1935         -//#line 1934 "parse.c"
         1967  +//#line 1966 "parse.c"
  1936   1968           break;
  1937   1969         case 20:
  1938         -//#line 111 "parse.y"
         1970  +//#line 129 "parse.y"
  1939   1971   {
  1940         -   sqlite3StartTable(pParse,&yymsp[-4].minor.yy0,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy258,yymsp[-3].minor.yy412,0);
         1972  +   sqlite3StartTable(pParse,&yymsp[-4].minor.yy0,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy144,yymsp[-3].minor.yy58,0);
  1941   1973   }
  1942         -//#line 1941 "parse.c"
         1974  +//#line 1973 "parse.c"
  1943   1975           break;
  1944   1976         case 21:
  1945         -      case 60:
  1946         -      case 74:
  1947         -      case 106:
  1948         -      case 220:
         1977  +      case 62:
         1978  +      case 76:
         1979  +      case 108:
  1949   1980         case 223:
  1950         -//#line 116 "parse.y"
  1951         -{yygotominor.yy412 = 1;}
  1952         -//#line 1951 "parse.c"
         1981  +      case 226:
         1982  +//#line 134 "parse.y"
         1983  +{yygotominor.yy58 = 1;}
         1984  +//#line 1983 "parse.c"
  1953   1985           break;
  1954   1986         case 22:
  1955         -      case 59:
  1956         -      case 73:
         1987  +      case 61:
  1957   1988         case 75:
  1958         -      case 86:
  1959         -      case 107:
  1960         -      case 108:
  1961         -      case 219:
         1989  +      case 77:
         1990  +      case 88:
         1991  +      case 109:
         1992  +      case 110:
  1962   1993         case 222:
  1963         -//#line 118 "parse.y"
  1964         -{yygotominor.yy412 = 0;}
  1965         -//#line 1964 "parse.c"
         1994  +      case 225:
         1995  +//#line 136 "parse.y"
         1996  +{yygotominor.yy58 = 0;}
         1997  +//#line 1996 "parse.c"
  1966   1998           break;
  1967   1999         case 23:
  1968         -//#line 119 "parse.y"
         2000  +//#line 137 "parse.y"
  1969   2001   {
  1970         -  sqlite3EndTable(pParse,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy0,0);
         2002  +  sqlite3EndTable(pParse,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy0,0);
  1971   2003   }
  1972         -//#line 1971 "parse.c"
         2004  +//#line 2003 "parse.c"
  1973   2005           break;
  1974   2006         case 24:
  1975         -//#line 122 "parse.y"
         2007  +//#line 140 "parse.y"
  1976   2008   {
  1977         -  sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy459);
  1978         -  sqlite3SelectDelete(yymsp[0].minor.yy459);
         2009  +  sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy99);
         2010  +  sqlite3SelectDelete(yymsp[0].minor.yy99);
  1979   2011   }
  1980         -//#line 1979 "parse.c"
         2012  +//#line 2011 "parse.c"
  1981   2013           break;
  1982   2014         case 27:
  1983         -//#line 133 "parse.y"
         2015  +//#line 152 "parse.y"
  1984   2016   {
  1985         -  yygotominor.yy258.z = yymsp[-2].minor.yy258.z;
  1986         -  yygotominor.yy258.n = (pParse->sLastToken.z-yymsp[-2].minor.yy258.z) + pParse->sLastToken.n;
         2017  +  yygotominor.yy144.z = yymsp[-2].minor.yy144.z;
         2018  +  yygotominor.yy144.n = (pParse->sLastToken.z-yymsp[-2].minor.yy144.z) + pParse->sLastToken.n;
  1987   2019   }
  1988         -//#line 1987 "parse.c"
         2020  +//#line 2019 "parse.c"
  1989   2021           break;
  1990   2022         case 28:
  1991         -//#line 137 "parse.y"
         2023  +//#line 156 "parse.y"
  1992   2024   {
  1993         -  sqlite3AddColumn(pParse,&yymsp[0].minor.yy258);
  1994         -  yygotominor.yy258 = yymsp[0].minor.yy258;
         2025  +  sqlite3AddColumn(pParse,&yymsp[0].minor.yy144);
         2026  +  yygotominor.yy144 = yymsp[0].minor.yy144;
  1995   2027   }
  1996         -//#line 1995 "parse.c"
         2028  +//#line 2027 "parse.c"
  1997   2029           break;
  1998   2030         case 29:
  1999   2031         case 30:
  2000   2032         case 31:
  2001   2033         case 32:
  2002   2034         case 33:
  2003   2035         case 34:
  2004         -      case 259:
  2005         -      case 260:
  2006         -//#line 147 "parse.y"
  2007         -{yygotominor.yy258 = yymsp[0].minor.yy0;}
  2008         -//#line 2007 "parse.c"
         2036  +      case 262:
         2037  +      case 263:
         2038  +//#line 166 "parse.y"
         2039  +{yygotominor.yy144 = yymsp[0].minor.yy0;}
         2040  +//#line 2039 "parse.c"
  2009   2041           break;
  2010   2042         case 36:
  2011         -//#line 202 "parse.y"
  2012         -{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy258,&yymsp[0].minor.yy258);}
  2013         -//#line 2012 "parse.c"
         2043  +//#line 226 "parse.y"
         2044  +{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy144);}
         2045  +//#line 2044 "parse.c"
  2014   2046           break;
  2015   2047         case 37:
  2016         -//#line 203 "parse.y"
  2017         -{sqlite3AddColumnType(pParse,&yymsp[-3].minor.yy258,&yymsp[0].minor.yy0);}
  2018         -//#line 2017 "parse.c"
         2048  +      case 40:
         2049  +      case 116:
         2050  +      case 117:
         2051  +      case 128:
         2052  +      case 148:
         2053  +      case 250:
         2054  +      case 260:
         2055  +      case 261:
         2056  +//#line 227 "parse.y"
         2057  +{yygotominor.yy144 = yymsp[0].minor.yy144;}
         2058  +//#line 2057 "parse.c"
  2019   2059           break;
  2020   2060         case 38:
  2021         -//#line 205 "parse.y"
  2022         -{sqlite3AddColumnType(pParse,&yymsp[-5].minor.yy258,&yymsp[0].minor.yy0);}
  2023         -//#line 2022 "parse.c"
         2061  +//#line 228 "parse.y"
         2062  +{
         2063  +  yygotominor.yy144.z = yymsp[-3].minor.yy144.z;
         2064  +  yygotominor.yy144.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy144.z;
         2065  +}
         2066  +//#line 2065 "parse.c"
  2024   2067           break;
  2025   2068         case 39:
  2026         -      case 114:
  2027         -      case 115:
  2028         -      case 126:
  2029         -      case 146:
  2030         -      case 247:
  2031         -      case 257:
  2032         -      case 258:
  2033         -//#line 207 "parse.y"
  2034         -{yygotominor.yy258 = yymsp[0].minor.yy258;}
  2035         -//#line 2034 "parse.c"
  2036         -        break;
  2037         -      case 40:
  2038         -//#line 208 "parse.y"
  2039         -{yygotominor.yy258.z=yymsp[-1].minor.yy258.z; yygotominor.yy258.n=yymsp[0].minor.yy258.n+(yymsp[0].minor.yy258.z-yymsp[-1].minor.yy258.z);}
  2040         -//#line 2039 "parse.c"
         2069  +//#line 232 "parse.y"
         2070  +{
         2071  +  yygotominor.yy144.z = yymsp[-5].minor.yy144.z;
         2072  +  yygotominor.yy144.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy144.z;
         2073  +}
         2074  +//#line 2073 "parse.c"
  2041   2075           break;
  2042   2076         case 41:
  2043         -//#line 210 "parse.y"
  2044         -{ yygotominor.yy412 = atoi((char *)yymsp[0].minor.yy258.z); }
  2045         -//#line 2044 "parse.c"
         2077  +//#line 238 "parse.y"
         2078  +{yygotominor.yy144.z=yymsp[-1].minor.yy144.z; yygotominor.yy144.n=yymsp[0].minor.yy144.n+(yymsp[0].minor.yy144.z-yymsp[-1].minor.yy144.z);}
         2079  +//#line 2078 "parse.c"
  2046   2080           break;
  2047   2081         case 42:
  2048         -//#line 211 "parse.y"
  2049         -{ yygotominor.yy412 = -atoi((char *)yymsp[0].minor.yy258.z); }
  2050         -//#line 2049 "parse.c"
         2082  +//#line 240 "parse.y"
         2083  +{ yygotominor.yy58 = atoi((const char *)yymsp[0].minor.yy144.z); }
         2084  +//#line 2083 "parse.c"
  2051   2085           break;
  2052         -      case 47:
         2086  +      case 43:
         2087  +//#line 241 "parse.y"
         2088  +{ yygotominor.yy58 = -atoi((const char *)yymsp[0].minor.yy144.z); }
         2089  +//#line 2088 "parse.c"
         2090  +        break;
  2053   2091         case 48:
  2054         -//#line 216 "parse.y"
  2055         -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy2);}
  2056         -//#line 2055 "parse.c"
         2092  +      case 50:
         2093  +//#line 250 "parse.y"
         2094  +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy44);}
         2095  +//#line 2094 "parse.c"
  2057   2096           break;
  2058   2097         case 49:
  2059         -//#line 218 "parse.y"
         2098  +//#line 251 "parse.y"
         2099  +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy44);}
         2100  +//#line 2099 "parse.c"
         2101  +        break;
         2102  +      case 51:
         2103  +//#line 253 "parse.y"
  2060   2104   {
  2061         -  Expr *p = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy2, 0, 0);
         2105  +  Expr *p = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy44, 0, 0);
  2062   2106     sqlite3AddDefaultValue(pParse,p);
  2063   2107   }
  2064         -//#line 2063 "parse.c"
  2065         -        break;
  2066         -      case 50:
  2067         -//#line 222 "parse.y"
  2068         -{
  2069         -  Expr *p = sqlite3Expr(TK_STRING, 0, 0, &yymsp[0].minor.yy258);
  2070         -  sqlite3AddDefaultValue(pParse,p);
  2071         -}
  2072         -//#line 2071 "parse.c"
         2108  +//#line 2107 "parse.c"
  2073   2109           break;
  2074   2110         case 52:
  2075         -//#line 231 "parse.y"
  2076         -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy412);}
  2077         -//#line 2076 "parse.c"
  2078         -        break;
  2079         -      case 53:
  2080         -//#line 233 "parse.y"
  2081         -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy412,yymsp[0].minor.yy412);}
  2082         -//#line 2081 "parse.c"
         2111  +//#line 257 "parse.y"
         2112  +{
         2113  +  Expr *p = sqlite3Expr(TK_STRING, 0, 0, &yymsp[0].minor.yy144);
         2114  +  sqlite3AddDefaultValue(pParse,p);
         2115  +}
         2116  +//#line 2115 "parse.c"
  2083   2117           break;
  2084   2118         case 54:
  2085         -//#line 234 "parse.y"
  2086         -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy412,0,0);}
  2087         -//#line 2086 "parse.c"
         2119  +//#line 266 "parse.y"
         2120  +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy58);}
         2121  +//#line 2120 "parse.c"
  2088   2122           break;
  2089   2123         case 55:
  2090         -//#line 235 "parse.y"
  2091         -{sqlite3ExprDelete(yymsp[-2].minor.yy2);}
  2092         -//#line 2091 "parse.c"
         2124  +//#line 268 "parse.y"
         2125  +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy58,yymsp[0].minor.yy58);}
         2126  +//#line 2125 "parse.c"
  2093   2127           break;
  2094   2128         case 56:
  2095         -//#line 237 "parse.y"
  2096         -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy258,yymsp[-1].minor.yy82,yymsp[0].minor.yy412);}
  2097         -//#line 2096 "parse.c"
         2129  +//#line 269 "parse.y"
         2130  +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy58,0,0);}
         2131  +//#line 2130 "parse.c"
  2098   2132           break;
  2099   2133         case 57:
  2100         -//#line 238 "parse.y"
  2101         -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy412);}
  2102         -//#line 2101 "parse.c"
         2134  +//#line 270 "parse.y"
         2135  +{sqlite3ExprDelete(yymsp[-2].minor.yy44);}
         2136  +//#line 2135 "parse.c"
  2103   2137           break;
  2104   2138         case 58:
  2105         -//#line 239 "parse.y"
  2106         -{sqlite3AddCollateType(pParse, (char *)yymsp[0].minor.yy258.z, yymsp[0].minor.yy258.n);}
  2107         -//#line 2106 "parse.c"
         2139  +//#line 272 "parse.y"
         2140  +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy144,yymsp[-1].minor.yy412,yymsp[0].minor.yy58);}
         2141  +//#line 2140 "parse.c"
  2108   2142           break;
  2109         -      case 61:
  2110         -//#line 252 "parse.y"
  2111         -{ yygotominor.yy412 = OE_Restrict * 0x010101; }
  2112         -//#line 2111 "parse.c"
         2143  +      case 59:
         2144  +//#line 273 "parse.y"
         2145  +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy58);}
         2146  +//#line 2145 "parse.c"
  2113   2147           break;
  2114         -      case 62:
  2115         -//#line 253 "parse.y"
  2116         -{ yygotominor.yy412 = (yymsp[-1].minor.yy412 & yymsp[0].minor.yy47.mask) | yymsp[0].minor.yy47.value; }
  2117         -//#line 2116 "parse.c"
         2148  +      case 60:
         2149  +//#line 274 "parse.y"
         2150  +{sqlite3AddCollateType(pParse, (const char *)yymsp[0].minor.yy144.z, yymsp[0].minor.yy144.n);}
         2151  +//#line 2150 "parse.c"
  2118   2152           break;
  2119   2153         case 63:
  2120         -//#line 255 "parse.y"
  2121         -{ yygotominor.yy47.value = 0;     yygotominor.yy47.mask = 0x000000; }
  2122         -//#line 2121 "parse.c"
         2154  +//#line 287 "parse.y"
         2155  +{ yygotominor.yy58 = OE_Restrict * 0x010101; }
         2156  +//#line 2155 "parse.c"
  2123   2157           break;
  2124   2158         case 64:
  2125         -//#line 256 "parse.y"
  2126         -{ yygotominor.yy47.value = yymsp[0].minor.yy412;     yygotominor.yy47.mask = 0x0000ff; }
  2127         -//#line 2126 "parse.c"
         2159  +//#line 288 "parse.y"
         2160  +{ yygotominor.yy58 = (yymsp[-1].minor.yy58 & yymsp[0].minor.yy35.mask) | yymsp[0].minor.yy35.value; }
         2161  +//#line 2160 "parse.c"
  2128   2162           break;
  2129   2163         case 65:
  2130         -//#line 257 "parse.y"
  2131         -{ yygotominor.yy47.value = yymsp[0].minor.yy412<<8;  yygotominor.yy47.mask = 0x00ff00; }
  2132         -//#line 2131 "parse.c"
         2164  +//#line 290 "parse.y"
         2165  +{ yygotominor.yy35.value = 0;     yygotominor.yy35.mask = 0x000000; }
         2166  +//#line 2165 "parse.c"
  2133   2167           break;
  2134   2168         case 66:
  2135         -//#line 258 "parse.y"
  2136         -{ yygotominor.yy47.value = yymsp[0].minor.yy412<<16; yygotominor.yy47.mask = 0xff0000; }
  2137         -//#line 2136 "parse.c"
         2169  +//#line 291 "parse.y"
         2170  +{ yygotominor.yy35.value = yymsp[0].minor.yy58;     yygotominor.yy35.mask = 0x0000ff; }
         2171  +//#line 2170 "parse.c"
  2138   2172           break;
  2139   2173         case 67:
  2140         -//#line 260 "parse.y"
  2141         -{ yygotominor.yy412 = OE_SetNull; }
  2142         -//#line 2141 "parse.c"
         2174  +//#line 292 "parse.y"
         2175  +{ yygotominor.yy35.value = yymsp[0].minor.yy58<<8;  yygotominor.yy35.mask = 0x00ff00; }
         2176  +//#line 2175 "parse.c"
  2143   2177           break;
  2144   2178         case 68:
  2145         -//#line 261 "parse.y"
  2146         -{ yygotominor.yy412 = OE_SetDflt; }
  2147         -//#line 2146 "parse.c"
         2179  +//#line 293 "parse.y"
         2180  +{ yygotominor.yy35.value = yymsp[0].minor.yy58<<16; yygotominor.yy35.mask = 0xff0000; }
         2181  +//#line 2180 "parse.c"
  2148   2182           break;
  2149   2183         case 69:
  2150         -//#line 262 "parse.y"
  2151         -{ yygotominor.yy412 = OE_Cascade; }
  2152         -//#line 2151 "parse.c"
         2184  +//#line 295 "parse.y"
         2185  +{ yygotominor.yy58 = OE_SetNull; }
         2186  +//#line 2185 "parse.c"
  2153   2187           break;
  2154   2188         case 70:
  2155         -//#line 263 "parse.y"
  2156         -{ yygotominor.yy412 = OE_Restrict; }
  2157         -//#line 2156 "parse.c"
         2189  +//#line 296 "parse.y"
         2190  +{ yygotominor.yy58 = OE_SetDflt; }
         2191  +//#line 2190 "parse.c"
  2158   2192           break;
  2159   2193         case 71:
         2194  +//#line 297 "parse.y"
         2195  +{ yygotominor.yy58 = OE_Cascade; }
         2196  +//#line 2195 "parse.c"
         2197  +        break;
  2160   2198         case 72:
  2161         -      case 87:
         2199  +//#line 298 "parse.y"
         2200  +{ yygotominor.yy58 = OE_Restrict; }
         2201  +//#line 2200 "parse.c"
         2202  +        break;
         2203  +      case 73:
         2204  +      case 74:
  2162   2205         case 89:
  2163   2206         case 91:
  2164         -      case 92:
  2165         -      case 163:
  2166         -//#line 265 "parse.y"
  2167         -{yygotominor.yy412 = yymsp[0].minor.yy412;}
  2168         -//#line 2167 "parse.c"
  2169         -        break;
  2170         -      case 76:
  2171         -//#line 275 "parse.y"
  2172         -{yygotominor.yy258.n = 0; yygotominor.yy258.z = 0;}
  2173         -//#line 2172 "parse.c"
  2174         -        break;
  2175         -      case 77:
  2176         -//#line 276 "parse.y"
  2177         -{yygotominor.yy258 = yymsp[-1].minor.yy0;}
  2178         -//#line 2177 "parse.c"
  2179         -        break;
  2180         -      case 82:
  2181         -//#line 282 "parse.y"
  2182         -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy82,yymsp[0].minor.yy412,yymsp[-2].minor.yy412);}
  2183         -//#line 2182 "parse.c"
  2184         -        break;
  2185         -      case 83:
  2186         -//#line 284 "parse.y"
  2187         -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy82,yymsp[0].minor.yy412,0,0);}
  2188         -//#line 2187 "parse.c"
         2207  +      case 93:
         2208  +      case 94:
         2209  +      case 165:
         2210  +//#line 300 "parse.y"
         2211  +{yygotominor.yy58 = yymsp[0].minor.yy58;}
         2212  +//#line 2211 "parse.c"
         2213  +        break;
         2214  +      case 78:
         2215  +//#line 310 "parse.y"
         2216  +{yygotominor.yy144.n = 0; yygotominor.yy144.z = 0;}
         2217  +//#line 2216 "parse.c"
         2218  +        break;
         2219  +      case 79:
         2220  +//#line 311 "parse.y"
         2221  +{yygotominor.yy144 = yymsp[-1].minor.yy0;}
         2222  +//#line 2221 "parse.c"
         2223  +        break;
         2224  +      case 84:
         2225  +//#line 317 "parse.y"
         2226  +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy412,yymsp[0].minor.yy58,yymsp[-2].minor.yy58);}
         2227  +//#line 2226 "parse.c"
  2189   2228           break;
  2190   2229         case 85:
  2191         -//#line 287 "parse.y"
         2230  +//#line 319 "parse.y"
         2231  +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy412,yymsp[0].minor.yy58,0,0);}
         2232  +//#line 2231 "parse.c"
         2233  +        break;
         2234  +      case 87:
         2235  +//#line 322 "parse.y"
  2192   2236   {
  2193         -    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy82, &yymsp[-3].minor.yy258, yymsp[-2].minor.yy82, yymsp[-1].minor.yy412);
  2194         -    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy412);
         2237  +    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy412, &yymsp[-3].minor.yy144, yymsp[-2].minor.yy412, yymsp[-1].minor.yy58);
         2238  +    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy58);
  2195   2239   }
  2196         -//#line 2195 "parse.c"
         2240  +//#line 2239 "parse.c"
  2197   2241           break;
  2198         -      case 88:
  2199   2242         case 90:
  2200         -//#line 301 "parse.y"
  2201         -{yygotominor.yy412 = OE_Default;}
  2202         -//#line 2201 "parse.c"
  2203         -        break;
  2204         -      case 93:
  2205         -//#line 306 "parse.y"
  2206         -{yygotominor.yy412 = OE_Ignore;}
  2207         -//#line 2206 "parse.c"
  2208         -        break;
  2209         -      case 94:
  2210         -      case 164:
  2211         -//#line 307 "parse.y"
  2212         -{yygotominor.yy412 = OE_Replace;}
  2213         -//#line 2212 "parse.c"
         2243  +      case 92:
         2244  +//#line 336 "parse.y"
         2245  +{yygotominor.yy58 = OE_Default;}
         2246  +//#line 2245 "parse.c"
  2214   2247           break;
  2215   2248         case 95:
  2216         -//#line 311 "parse.y"
  2217         -{
  2218         -  sqlite3DropTable(pParse, yymsp[0].minor.yy67, 0);
  2219         -}
  2220         -//#line 2219 "parse.c"
         2249  +//#line 341 "parse.y"
         2250  +{yygotominor.yy58 = OE_Ignore;}
         2251  +//#line 2250 "parse.c"
  2221   2252           break;
  2222   2253         case 96:
  2223         -//#line 318 "parse.y"
  2224         -{
  2225         -  sqlite3CreateView(pParse, &yymsp[-6].minor.yy0, &yymsp[-3].minor.yy258, &yymsp[-2].minor.yy258, yymsp[0].minor.yy459, yymsp[-5].minor.yy412);
  2226         -}
  2227         -//#line 2226 "parse.c"
         2254  +      case 166:
         2255  +//#line 342 "parse.y"
         2256  +{yygotominor.yy58 = OE_Replace;}
         2257  +//#line 2256 "parse.c"
  2228   2258           break;
  2229   2259         case 97:
  2230         -//#line 321 "parse.y"
         2260  +//#line 346 "parse.y"
  2231   2261   {
  2232         -  sqlite3DropTable(pParse, yymsp[0].minor.yy67, 1);
         2262  +  sqlite3DropTable(pParse, yymsp[0].minor.yy367, 0);
  2233   2263   }
  2234         -//#line 2233 "parse.c"
         2264  +//#line 2263 "parse.c"
  2235   2265           break;
  2236   2266         case 98:
  2237         -//#line 328 "parse.y"
         2267  +//#line 353 "parse.y"
  2238   2268   {
  2239         -  sqlite3Select(pParse, yymsp[0].minor.yy459, SRT_Callback, 0, 0, 0, 0, 0);
  2240         -  sqlite3SelectDelete(yymsp[0].minor.yy459);
  2241         -}
  2242         -//#line 2241 "parse.c"
  2243         -        break;
  2244         -      case 99:
  2245         -      case 123:
  2246         -//#line 338 "parse.y"
  2247         -{yygotominor.yy459 = yymsp[0].minor.yy459;}
  2248         -//#line 2247 "parse.c"
  2249         -        break;
  2250         -      case 100:
  2251         -//#line 340 "parse.y"
  2252         -{
  2253         -  if( yymsp[0].minor.yy459 ){
  2254         -    yymsp[0].minor.yy459->op = yymsp[-1].minor.yy412;
  2255         -    yymsp[0].minor.yy459->pPrior = yymsp[-2].minor.yy459;
  2256         -  }
  2257         -  yygotominor.yy459 = yymsp[0].minor.yy459;
  2258         -}
  2259         -//#line 2258 "parse.c"
  2260         -        break;
  2261         -      case 102:
  2262         -//#line 349 "parse.y"
  2263         -{yygotominor.yy412 = TK_ALL;}
  2264         -//#line 2263 "parse.c"
  2265         -        break;
  2266         -      case 105:
  2267         -//#line 354 "parse.y"
  2268         -{
  2269         -  yygotominor.yy459 = sqlite3SelectNew(yymsp[-6].minor.yy82,yymsp[-5].minor.yy67,yymsp[-4].minor.yy2,yymsp[-3].minor.yy82,yymsp[-2].minor.yy2,yymsp[-1].minor.yy82,yymsp[-7].minor.yy412,yymsp[0].minor.yy244.pLimit,yymsp[0].minor.yy244.pOffset);
         2269  +  sqlite3CreateView(pParse, &yymsp[-6].minor.yy0, &yymsp[-3].minor.yy144, &yymsp[-2].minor.yy144, yymsp[0].minor.yy99, yymsp[-5].minor.yy58);
  2270   2270   }
  2271   2271   //#line 2270 "parse.c"
  2272   2272           break;
  2273         -      case 109:
  2274         -      case 244:
  2275         -//#line 375 "parse.y"
  2276         -{yygotominor.yy82 = yymsp[-1].minor.yy82;}
  2277         -//#line 2276 "parse.c"
         2273  +      case 99:
         2274  +//#line 356 "parse.y"
         2275  +{
         2276  +  sqlite3DropTable(pParse, yymsp[0].minor.yy367, 1);
         2277  +}
         2278  +//#line 2277 "parse.c"
  2278   2279           break;
  2279         -      case 110:
  2280         -      case 137:
  2281         -      case 147:
  2282         -      case 243:
  2283         -//#line 376 "parse.y"
  2284         -{yygotominor.yy82 = 0;}
  2285         -//#line 2284 "parse.c"
         2280  +      case 100:
         2281  +//#line 363 "parse.y"
         2282  +{
         2283  +  sqlite3Select(pParse, yymsp[0].minor.yy99, SRT_Callback, 0, 0, 0, 0, 0);
         2284  +  sqlite3SelectDelete(yymsp[0].minor.yy99);
         2285  +}
         2286  +//#line 2285 "parse.c"
  2286   2287           break;
  2287         -      case 111:
  2288         -//#line 377 "parse.y"
  2289         -{
  2290         -   yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-2].minor.yy82,yymsp[-1].minor.yy2,yymsp[0].minor.yy258.n?&yymsp[0].minor.yy258:0);
  2291         -}
         2288  +      case 101:
         2289  +      case 125:
         2290  +//#line 373 "parse.y"
         2291  +{yygotominor.yy99 = yymsp[0].minor.yy99;}
  2292   2292   //#line 2291 "parse.c"
  2293   2293           break;
  2294         -      case 112:
  2295         -//#line 380 "parse.y"
         2294  +      case 102:
         2295  +//#line 375 "parse.y"
  2296   2296   {
  2297         -  yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-1].minor.yy82, sqlite3Expr(TK_ALL, 0, 0, 0), 0);
         2297  +  if( yymsp[0].minor.yy99 ){
         2298  +    yymsp[0].minor.yy99->op = yymsp[-1].minor.yy58;
         2299  +    yymsp[0].minor.yy99->pPrior = yymsp[-2].minor.yy99;
         2300  +  }
         2301  +  yygotominor.yy99 = yymsp[0].minor.yy99;
  2298   2302   }
  2299         -//#line 2298 "parse.c"
         2303  +//#line 2302 "parse.c"
  2300   2304           break;
  2301         -      case 113:
  2302         -//#line 383 "parse.y"
  2303         -{
  2304         -  Expr *pRight = sqlite3Expr(TK_ALL, 0, 0, 0);
  2305         -  Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy258);
  2306         -  yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-3].minor.yy82, sqlite3Expr(TK_DOT, pLeft, pRight, 0), 0);
  2307         -}
         2305  +      case 104:
         2306  +//#line 384 "parse.y"
         2307  +{yygotominor.yy58 = TK_ALL;}
  2308   2308   //#line 2307 "parse.c"
  2309   2309           break;
  2310         -      case 116:
  2311         -//#line 395 "parse.y"
  2312         -{yygotominor.yy258.n = 0;}
  2313         -//#line 2312 "parse.c"
  2314         -        break;
  2315         -      case 117:
  2316         -//#line 407 "parse.y"
  2317         -{yygotominor.yy67 = (SrcList *)sqliteMalloc(sizeof(*yygotominor.yy67));}
  2318         -//#line 2317 "parse.c"
  2319         -        break;
  2320         -      case 118:
  2321         -//#line 408 "parse.y"
  2322         -{yygotominor.yy67 = yymsp[0].minor.yy67;}
  2323         -//#line 2322 "parse.c"
  2324         -        break;
  2325         -      case 119:
  2326         -//#line 413 "parse.y"
  2327         -{
  2328         -   yygotominor.yy67 = yymsp[-1].minor.yy67;
  2329         -   if( yygotominor.yy67 && yygotominor.yy67->nSrc>0 ) yygotominor.yy67->a[yygotominor.yy67->nSrc-1].jointype = yymsp[0].minor.yy412;
  2330         -}
  2331         -//#line 2330 "parse.c"
  2332         -        break;
  2333         -      case 120:
  2334         -//#line 417 "parse.y"
  2335         -{yygotominor.yy67 = 0;}
         2310  +      case 107:
         2311  +//#line 389 "parse.y"
         2312  +{
         2313  +  yygotominor.yy99 = sqlite3SelectNew(yymsp[-6].minor.yy412,yymsp[-5].minor.yy367,yymsp[-4].minor.yy44,yymsp[-3].minor.yy412,yymsp[-2].minor.yy44,yymsp[-1].minor.yy412,yymsp[-7].minor.yy58,yymsp[0].minor.yy112.pLimit,yymsp[0].minor.yy112.pOffset);
         2314  +}
         2315  +//#line 2314 "parse.c"
         2316  +        break;
         2317  +      case 111:
         2318  +      case 247:
         2319  +//#line 410 "parse.y"
         2320  +{yygotominor.yy412 = yymsp[-1].minor.yy412;}
         2321  +//#line 2320 "parse.c"
         2322  +        break;
         2323  +      case 112:
         2324  +      case 139:
         2325  +      case 149:
         2326  +      case 246:
         2327  +//#line 411 "parse.y"
         2328  +{yygotominor.yy412 = 0;}
         2329  +//#line 2328 "parse.c"
         2330  +        break;
         2331  +      case 113:
         2332  +//#line 412 "parse.y"
         2333  +{
         2334  +   yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-2].minor.yy412,yymsp[-1].minor.yy44,yymsp[0].minor.yy144.n?&yymsp[0].minor.yy144:0);
         2335  +}
  2336   2336   //#line 2335 "parse.c"
  2337   2337           break;
  2338         -      case 121:
         2338  +      case 114:
         2339  +//#line 415 "parse.y"
         2340  +{
         2341  +  yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-1].minor.yy412, sqlite3Expr(TK_ALL, 0, 0, 0), 0);
         2342  +}
         2343  +//#line 2342 "parse.c"
         2344  +        break;
         2345  +      case 115:
  2339   2346   //#line 418 "parse.y"
  2340   2347   {
  2341         -  yygotominor.yy67 = sqlite3SrcListAppend(yymsp[-5].minor.yy67,&yymsp[-4].minor.yy258,&yymsp[-3].minor.yy258);
  2342         -  if( yymsp[-2].minor.yy258.n ) sqlite3SrcListAddAlias(yygotominor.yy67,&yymsp[-2].minor.yy258);
  2343         -  if( yymsp[-1].minor.yy2 ){
  2344         -    if( yygotominor.yy67 && yygotominor.yy67->nSrc>1 ){ yygotominor.yy67->a[yygotominor.yy67->nSrc-2].pOn = yymsp[-1].minor.yy2; }
  2345         -    else { sqlite3ExprDelete(yymsp[-1].minor.yy2); }
  2346         -  }
  2347         -  if( yymsp[0].minor.yy240 ){
  2348         -    if( yygotominor.yy67 && yygotominor.yy67->nSrc>1 ){ yygotominor.yy67->a[yygotominor.yy67->nSrc-2].pUsing = yymsp[0].minor.yy240; }
  2349         -    else { sqlite3IdListDelete(yymsp[0].minor.yy240); }
  2350         -  }
         2348  +  Expr *pRight = sqlite3Expr(TK_ALL, 0, 0, 0);
         2349  +  Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy144);
         2350  +  yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-3].minor.yy412, sqlite3Expr(TK_DOT, pLeft, pRight, 0), 0);
  2351   2351   }
  2352   2352   //#line 2351 "parse.c"
  2353   2353           break;
         2354  +      case 118:
         2355  +//#line 430 "parse.y"
         2356  +{yygotominor.yy144.n = 0;}
         2357  +//#line 2356 "parse.c"
         2358  +        break;
         2359  +      case 119:
         2360  +//#line 442 "parse.y"
         2361  +{yygotominor.yy367 = (SrcList *)sqliteMalloc(sizeof(*yygotominor.yy367));}
         2362  +//#line 2361 "parse.c"
         2363  +        break;
         2364  +      case 120:
         2365  +//#line 443 "parse.y"
         2366  +{yygotominor.yy367 = yymsp[0].minor.yy367;}
         2367  +//#line 2366 "parse.c"
         2368  +        break;
         2369  +      case 121:
         2370  +//#line 448 "parse.y"
         2371  +{
         2372  +   yygotominor.yy367 = yymsp[-1].minor.yy367;
         2373  +   if( yygotominor.yy367 && yygotominor.yy367->nSrc>0 ) yygotominor.yy367->a[yygotominor.yy367->nSrc-1].jointype = yymsp[0].minor.yy58;
         2374  +}
         2375  +//#line 2374 "parse.c"
         2376  +        break;
  2354   2377         case 122:
  2355         -//#line 432 "parse.y"
  2356         -{
  2357         -    yygotominor.yy67 = sqlite3SrcListAppend(yymsp[-6].minor.yy67,0,0);
  2358         -    yygotominor.yy67->a[yygotominor.yy67->nSrc-1].pSelect = yymsp[-4].minor.yy459;
  2359         -    if( yymsp[-2].minor.yy258.n ) sqlite3SrcListAddAlias(yygotominor.yy67,&yymsp[-2].minor.yy258);
  2360         -    if( yymsp[-1].minor.yy2 ){
  2361         -      if( yygotominor.yy67 && yygotominor.yy67->nSrc>1 ){ yygotominor.yy67->a[yygotominor.yy67->nSrc-2].pOn = yymsp[-1].minor.yy2; }
  2362         -      else { sqlite3ExprDelete(yymsp[-1].minor.yy2); }
  2363         -    }
  2364         -    if( yymsp[0].minor.yy240 ){
  2365         -      if( yygotominor.yy67 && yygotominor.yy67->nSrc>1 ){ yygotominor.yy67->a[yygotominor.yy67->nSrc-2].pUsing = yymsp[0].minor.yy240; }
  2366         -      else { sqlite3IdListDelete(yymsp[0].minor.yy240); }
  2367         -    }
  2368         -  }
  2369         -//#line 2368 "parse.c"
         2378  +//#line 452 "parse.y"
         2379  +{yygotominor.yy367 = 0;}
         2380  +//#line 2379 "parse.c"
  2370   2381           break;
  2371         -      case 124:
         2382  +      case 123:
  2372   2383   //#line 453 "parse.y"
  2373   2384   {
  2374         -     yygotominor.yy459 = sqlite3SelectNew(0,yymsp[0].minor.yy67,0,0,0,0,0,0,0);
  2375         -  }
  2376         -//#line 2375 "parse.c"
  2377         -        break;
  2378         -      case 125:
  2379         -//#line 459 "parse.y"
  2380         -{yygotominor.yy258.z=0; yygotominor.yy258.n=0;}
  2381         -//#line 2380 "parse.c"
  2382         -        break;
  2383         -      case 127:
  2384         -//#line 464 "parse.y"
  2385         -{yygotominor.yy67 = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy258);}
  2386         -//#line 2385 "parse.c"
  2387         -        break;
  2388         -      case 128:
  2389         -      case 129:
  2390         -//#line 468 "parse.y"
  2391         -{ yygotominor.yy412 = JT_INNER; }
  2392         -//#line 2391 "parse.c"
  2393         -        break;
  2394         -      case 130:
  2395         -//#line 470 "parse.y"
  2396         -{ yygotominor.yy412 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
  2397         -//#line 2396 "parse.c"
  2398         -        break;
  2399         -      case 131:
  2400         -//#line 471 "parse.y"
  2401         -{ yygotominor.yy412 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy258,0); }
  2402         -//#line 2401 "parse.c"
  2403         -        break;
  2404         -      case 132:
  2405         -//#line 473 "parse.y"
  2406         -{ yygotominor.yy412 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy258,&yymsp[-1].minor.yy258); }
  2407         -//#line 2406 "parse.c"
  2408         -        break;
  2409         -      case 133:
  2410         -      case 141:
  2411         -      case 150:
  2412         -      case 157:
  2413         -      case 171:
  2414         -      case 207:
  2415         -      case 232:
  2416         -      case 234:
  2417         -      case 238:
  2418         -//#line 477 "parse.y"
  2419         -{yygotominor.yy2 = yymsp[0].minor.yy2;}
         2385  +  yygotominor.yy367 = sqlite3SrcListAppend(yymsp[-5].minor.yy367,&yymsp[-4].minor.yy144,&yymsp[-3].minor.yy144);
         2386  +  if( yymsp[-2].minor.yy144.n ) sqlite3SrcListAddAlias(yygotominor.yy367,&yymsp[-2].minor.yy144);
         2387  +  if( yymsp[-1].minor.yy44 ){
         2388  +    if( yygotominor.yy367 && yygotominor.yy367->nSrc>1 ){ yygotominor.yy367->a[yygotominor.yy367->nSrc-2].pOn = yymsp[-1].minor.yy44; }
         2389  +    else { sqlite3ExprDelete(yymsp[-1].minor.yy44); }
         2390  +  }
         2391  +  if( yymsp[0].minor.yy258 ){
         2392  +    if( yygotominor.yy367 && yygotominor.yy367->nSrc>1 ){ yygotominor.yy367->a[yygotominor.yy367->nSrc-2].pUsing = yymsp[0].minor.yy258; }
         2393  +    else { sqlite3IdListDelete(yymsp[0].minor.yy258); }
         2394  +  }
         2395  +}
         2396  +//#line 2395 "parse.c"
         2397  +        break;
         2398  +      case 124:
         2399  +//#line 467 "parse.y"
         2400  +{
         2401  +    yygotominor.yy367 = sqlite3SrcListAppend(yymsp[-6].minor.yy367,0,0);
         2402  +    yygotominor.yy367->a[yygotominor.yy367->nSrc-1].pSelect = yymsp[-4].minor.yy99;
         2403  +    if( yymsp[-2].minor.yy144.n ) sqlite3SrcListAddAlias(yygotominor.yy367,&yymsp[-2].minor.yy144);
         2404  +    if( yymsp[-1].minor.yy44 ){
         2405  +      if( yygotominor.yy367 && yygotominor.yy367->nSrc>1 ){ yygotominor.yy367->a[yygotominor.yy367->nSrc-2].pOn = yymsp[-1].minor.yy44; }
         2406  +      else { sqlite3ExprDelete(yymsp[-1].minor.yy44); }
         2407  +    }
         2408  +    if( yymsp[0].minor.yy258 ){
         2409  +      if( yygotominor.yy367 && yygotominor.yy367->nSrc>1 ){ yygotominor.yy367->a[yygotominor.yy367->nSrc-2].pUsing = yymsp[0].minor.yy258; }
         2410  +      else { sqlite3IdListDelete(yymsp[0].minor.yy258); }
         2411  +    }
         2412  +  }
         2413  +//#line 2412 "parse.c"
         2414  +        break;
         2415  +      case 126:
         2416  +//#line 488 "parse.y"
         2417  +{
         2418  +     yygotominor.yy99 = sqlite3SelectNew(0,yymsp[0].minor.yy367,0,0,0,0,0,0,0);
         2419  +  }
  2420   2420   //#line 2419 "parse.c"
  2421   2421           break;
         2422  +      case 127:
         2423  +//#line 494 "parse.y"
         2424  +{yygotominor.yy144.z=0; yygotominor.yy144.n=0;}
         2425  +//#line 2424 "parse.c"
         2426  +        break;
         2427  +      case 129:
         2428  +//#line 499 "parse.y"
         2429  +{yygotominor.yy367 = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy144);}
         2430  +//#line 2429 "parse.c"
         2431  +        break;
         2432  +      case 130:
         2433  +      case 131:
         2434  +//#line 503 "parse.y"
         2435  +{ yygotominor.yy58 = JT_INNER; }
         2436  +//#line 2435 "parse.c"
         2437  +        break;
         2438  +      case 132:
         2439  +//#line 505 "parse.y"
         2440  +{ yygotominor.yy58 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
         2441  +//#line 2440 "parse.c"
         2442  +        break;
         2443  +      case 133:
         2444  +//#line 506 "parse.y"
         2445  +{ yygotominor.yy58 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy144,0); }
         2446  +//#line 2445 "parse.c"
         2447  +        break;
  2422   2448         case 134:
  2423         -      case 149:
  2424         -      case 156:
  2425         -      case 208:
  2426         -      case 233:
  2427         -      case 235:
  2428         -      case 239:
  2429         -//#line 478 "parse.y"
  2430         -{yygotominor.yy2 = 0;}
  2431         -//#line 2430 "parse.c"
         2449  +//#line 508 "parse.y"
         2450  +{ yygotominor.yy58 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy144,&yymsp[-1].minor.yy144); }
         2451  +//#line 2450 "parse.c"
  2432   2452           break;
  2433   2453         case 135:
  2434         -      case 168:
  2435         -//#line 482 "parse.y"
  2436         -{yygotominor.yy240 = yymsp[-1].minor.yy240;}
  2437         -//#line 2436 "parse.c"
         2454  +      case 143:
         2455  +      case 152:
         2456  +      case 159:
         2457  +      case 173:
         2458  +      case 210:
         2459  +      case 235:
         2460  +      case 237:
         2461  +      case 241:
         2462  +//#line 512 "parse.y"
         2463  +{yygotominor.yy44 = yymsp[0].minor.yy44;}
         2464  +//#line 2463 "parse.c"
  2438   2465           break;
  2439   2466         case 136:
  2440         -      case 167:
  2441         -//#line 483 "parse.y"
  2442         -{yygotominor.yy240 = 0;}
  2443         -//#line 2442 "parse.c"
  2444         -        break;
  2445         -      case 138:
  2446         -      case 148:
  2447         -//#line 494 "parse.y"
  2448         -{yygotominor.yy82 = yymsp[0].minor.yy82;}
  2449         -//#line 2448 "parse.c"
  2450         -        break;
  2451         -      case 139:
  2452         -//#line 495 "parse.y"
  2453         -{
  2454         -  yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-4].minor.yy82,yymsp[-2].minor.yy2,yymsp[-1].minor.yy258.n>0?&yymsp[-1].minor.yy258:0);
  2455         -  if( yygotominor.yy82 ) yygotominor.yy82->a[yygotominor.yy82->nExpr-1].sortOrder = yymsp[0].minor.yy412;
  2456         -}
  2457         -//#line 2456 "parse.c"
  2458         -        break;
  2459         -      case 140:
  2460         -//#line 499 "parse.y"
  2461         -{
  2462         -  yygotominor.yy82 = sqlite3ExprListAppend(0,yymsp[-2].minor.yy2,yymsp[-1].minor.yy258.n>0?&yymsp[-1].minor.yy258:0);
  2463         -  if( yygotominor.yy82 && yygotominor.yy82->a ) yygotominor.yy82->a[0].sortOrder = yymsp[0].minor.yy412;
  2464         -}
  2465         -//#line 2464 "parse.c"
  2466         -        break;
  2467         -      case 142:
  2468         -      case 144:
  2469         -//#line 508 "parse.y"
  2470         -{yygotominor.yy412 = SQLITE_SO_ASC;}
  2471         -//#line 2470 "parse.c"
  2472         -        break;
  2473         -      case 143:
  2474         -//#line 509 "parse.y"
  2475         -{yygotominor.yy412 = SQLITE_SO_DESC;}
  2476         -//#line 2475 "parse.c"
  2477         -        break;
  2478         -      case 145:
  2479         -//#line 511 "parse.y"
  2480         -{yygotominor.yy258.z = 0; yygotominor.yy258.n = 0;}
         2467  +      case 151:
         2468  +      case 158:
         2469  +      case 211:
         2470  +      case 236:
         2471  +      case 238:
         2472  +      case 242:
         2473  +//#line 513 "parse.y"
         2474  +{yygotominor.yy44 = 0;}
         2475  +//#line 2474 "parse.c"
         2476  +        break;
         2477  +      case 137:
         2478  +      case 170:
         2479  +//#line 517 "parse.y"
         2480  +{yygotominor.yy258 = yymsp[-1].minor.yy258;}
  2481   2481   //#line 2480 "parse.c"
  2482   2482           break;
  2483         -      case 151:
         2483  +      case 138:
         2484  +      case 169:
         2485  +//#line 518 "parse.y"
         2486  +{yygotominor.yy258 = 0;}
         2487  +//#line 2486 "parse.c"
         2488  +        break;
         2489  +      case 140:
         2490  +      case 150:
  2484   2491   //#line 529 "parse.y"
  2485         -{yygotominor.yy244.pLimit = 0; yygotominor.yy244.pOffset = 0;}
  2486         -//#line 2485 "parse.c"
         2492  +{yygotominor.yy412 = yymsp[0].minor.yy412;}
         2493  +//#line 2492 "parse.c"
  2487   2494           break;
  2488         -      case 152:
         2495  +      case 141:
  2489   2496   //#line 530 "parse.y"
  2490         -{yygotominor.yy244.pLimit = yymsp[0].minor.yy2; yygotominor.yy244.pOffset = 0;}
  2491         -//#line 2490 "parse.c"
  2492         -        break;
  2493         -      case 153:
  2494         -//#line 532 "parse.y"
  2495         -{yygotominor.yy244.pLimit = yymsp[-2].minor.yy2; yygotominor.yy244.pOffset = yymsp[0].minor.yy2;}
  2496         -//#line 2495 "parse.c"
  2497         -        break;
  2498         -      case 154:
  2499         -//#line 534 "parse.y"
  2500         -{yygotominor.yy244.pOffset = yymsp[-2].minor.yy2; yygotominor.yy244.pLimit = yymsp[0].minor.yy2;}
         2497  +{
         2498  +  yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-4].minor.yy412,yymsp[-2].minor.yy44,yymsp[-1].minor.yy144.n>0?&yymsp[-1].minor.yy144:0);
         2499  +  if( yygotominor.yy412 ) yygotominor.yy412->a[yygotominor.yy412->nExpr-1].sortOrder = yymsp[0].minor.yy58;
         2500  +}
  2501   2501   //#line 2500 "parse.c"
  2502   2502           break;
         2503  +      case 142:
         2504  +//#line 534 "parse.y"
         2505  +{
         2506  +  yygotominor.yy412 = sqlite3ExprListAppend(0,yymsp[-2].minor.yy44,yymsp[-1].minor.yy144.n>0?&yymsp[-1].minor.yy144:0);
         2507  +  if( yygotominor.yy412 && yygotominor.yy412->a ) yygotominor.yy412->a[0].sortOrder = yymsp[0].minor.yy58;
         2508  +}
         2509  +//#line 2508 "parse.c"
         2510  +        break;
         2511  +      case 144:
         2512  +      case 146:
         2513  +//#line 543 "parse.y"
         2514  +{yygotominor.yy58 = SQLITE_SO_ASC;}
         2515  +//#line 2514 "parse.c"
         2516  +        break;
         2517  +      case 145:
         2518  +//#line 544 "parse.y"
         2519  +{yygotominor.yy58 = SQLITE_SO_DESC;}
         2520  +//#line 2519 "parse.c"
         2521  +        break;
         2522  +      case 147:
         2523  +//#line 546 "parse.y"
         2524  +{yygotominor.yy144.z = 0; yygotominor.yy144.n = 0;}
         2525  +//#line 2524 "parse.c"
         2526  +        break;
         2527  +      case 153:
         2528  +//#line 564 "parse.y"
         2529  +{yygotominor.yy112.pLimit = 0; yygotominor.yy112.pOffset = 0;}
         2530  +//#line 2529 "parse.c"
         2531  +        break;
         2532  +      case 154:
         2533  +//#line 565 "parse.y"
         2534  +{yygotominor.yy112.pLimit = yymsp[0].minor.yy44; yygotominor.yy112.pOffset = 0;}
         2535  +//#line 2534 "parse.c"
         2536  +        break;
  2503   2537         case 155:
  2504         -//#line 538 "parse.y"
  2505         -{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy67,yymsp[0].minor.yy2);}
  2506         -//#line 2505 "parse.c"
         2538  +//#line 567 "parse.y"
         2539  +{yygotominor.yy112.pLimit = yymsp[-2].minor.yy44; yygotominor.yy112.pOffset = yymsp[0].minor.yy44;}
         2540  +//#line 2539 "parse.c"
  2507   2541           break;
  2508         -      case 158:
  2509         -//#line 549 "parse.y"
  2510         -{sqlite3Update(pParse,yymsp[-3].minor.yy67,yymsp[-1].minor.yy82,yymsp[0].minor.yy2,yymsp[-4].minor.yy412);}
  2511         -//#line 2510 "parse.c"
         2542  +      case 156:
         2543  +//#line 569 "parse.y"
         2544  +{yygotominor.yy112.pOffset = yymsp[-2].minor.yy44; yygotominor.yy112.pLimit = yymsp[0].minor.yy44;}
         2545  +//#line 2544 "parse.c"
  2512   2546           break;
  2513         -      case 159:
  2514         -//#line 555 "parse.y"
  2515         -{yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-4].minor.yy82,yymsp[0].minor.yy2,&yymsp[-2].minor.yy258);}
  2516         -//#line 2515 "parse.c"
         2547  +      case 157:
         2548  +//#line 573 "parse.y"
         2549  +{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy367,yymsp[0].minor.yy44);}
         2550  +//#line 2549 "parse.c"
  2517   2551           break;
  2518   2552         case 160:
  2519         -//#line 556 "parse.y"
  2520         -{yygotominor.yy82 = sqlite3ExprListAppend(0,yymsp[0].minor.yy2,&yymsp[-2].minor.yy258);}
  2521         -//#line 2520 "parse.c"
         2553  +//#line 584 "parse.y"
         2554  +{sqlite3Update(pParse,yymsp[-3].minor.yy367,yymsp[-1].minor.yy412,yymsp[0].minor.yy44,yymsp[-4].minor.yy58);}
         2555  +//#line 2554 "parse.c"
  2522   2556           break;
  2523   2557         case 161:
  2524         -//#line 562 "parse.y"
  2525         -{sqlite3Insert(pParse, yymsp[-5].minor.yy67, yymsp[-1].minor.yy82, 0, yymsp[-4].minor.yy240, yymsp[-7].minor.yy412);}
  2526         -//#line 2525 "parse.c"
         2558  +//#line 590 "parse.y"
         2559  +{yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-4].minor.yy412,yymsp[0].minor.yy44,&yymsp[-2].minor.yy144);}
         2560  +//#line 2559 "parse.c"
  2527   2561           break;
  2528   2562         case 162:
  2529         -//#line 564 "parse.y"
  2530         -{sqlite3Insert(pParse, yymsp[-2].minor.yy67, 0, yymsp[0].minor.yy459, yymsp[-1].minor.yy240, yymsp[-4].minor.yy412);}
  2531         -//#line 2530 "parse.c"
  2532         -        break;
  2533         -      case 165:
  2534         -      case 236:
  2535         -//#line 574 "parse.y"
  2536         -{yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-2].minor.yy82,yymsp[0].minor.yy2,0);}
  2537         -//#line 2536 "parse.c"
  2538         -        break;
  2539         -      case 166:
  2540         -      case 237:
  2541         -//#line 575 "parse.y"
  2542         -{yygotominor.yy82 = sqlite3ExprListAppend(0,yymsp[0].minor.yy2,0);}
  2543         -//#line 2542 "parse.c"
  2544         -        break;
  2545         -      case 169:
  2546         -//#line 584 "parse.y"
  2547         -{yygotominor.yy240 = sqlite3IdListAppend(yymsp[-2].minor.yy240,&yymsp[0].minor.yy258);}
  2548         -//#line 2547 "parse.c"
  2549         -        break;
  2550         -      case 170:
  2551         -//#line 585 "parse.y"
  2552         -{yygotominor.yy240 = sqlite3IdListAppend(0,&yymsp[0].minor.yy258);}
  2553         -//#line 2552 "parse.c"
         2563  +//#line 591 "parse.y"
         2564  +{yygotominor.yy412 = sqlite3ExprListAppend(0,yymsp[0].minor.yy44,&yymsp[-2].minor.yy144);}
         2565  +//#line 2564 "parse.c"
         2566  +        break;
         2567  +      case 163:
         2568  +//#line 597 "parse.y"
         2569  +{sqlite3Insert(pParse, yymsp[-5].minor.yy367, yymsp[-1].minor.yy412, 0, yymsp[-4].minor.yy258, yymsp[-7].minor.yy58);}
         2570  +//#line 2569 "parse.c"
         2571  +        break;
         2572  +      case 164:
         2573  +//#line 599 "parse.y"
         2574  +{sqlite3Insert(pParse, yymsp[-2].minor.yy367, 0, yymsp[0].minor.yy99, yymsp[-1].minor.yy258, yymsp[-4].minor.yy58);}
         2575  +//#line 2574 "parse.c"
         2576  +        break;
         2577  +      case 167:
         2578  +      case 239:
         2579  +//#line 609 "parse.y"
         2580  +{yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-2].minor.yy412,yymsp[0].minor.yy44,0);}
         2581  +//#line 2580 "parse.c"
         2582  +        break;
         2583  +      case 168:
         2584  +      case 240:
         2585  +//#line 610 "parse.y"
         2586  +{yygotominor.yy412 = sqlite3ExprListAppend(0,yymsp[0].minor.yy44,0);}
         2587  +//#line 2586 "parse.c"
         2588  +        break;
         2589  +      case 171:
         2590  +//#line 619 "parse.y"
         2591  +{yygotominor.yy258 = sqlite3IdListAppend(yymsp[-2].minor.yy258,&yymsp[0].minor.yy144);}
         2592  +//#line 2591 "parse.c"
  2554   2593           break;
  2555   2594         case 172:
  2556         -//#line 596 "parse.y"
  2557         -{yygotominor.yy2 = yymsp[-1].minor.yy2; sqlite3ExprSpan(yygotominor.yy2,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
  2558         -//#line 2557 "parse.c"
         2595  +//#line 620 "parse.y"
         2596  +{yygotominor.yy258 = sqlite3IdListAppend(0,&yymsp[0].minor.yy144);}
         2597  +//#line 2596 "parse.c"
  2559   2598           break;
  2560         -      case 173:
  2561         -      case 178:
  2562         -      case 179:
         2599  +      case 174:
         2600  +//#line 631 "parse.y"
         2601  +{yygotominor.yy44 = yymsp[-1].minor.yy44; sqlite3ExprSpan(yygotominor.yy44,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
         2602  +//#line 2601 "parse.c"
         2603  +        break;
         2604  +      case 175:
  2563   2605         case 180:
  2564   2606         case 181:
  2565         -//#line 597 "parse.y"
  2566         -{yygotominor.yy2 = sqlite3Expr(yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
  2567         -//#line 2566 "parse.c"
  2568         -        break;
  2569         -      case 174:
  2570         -      case 175:
  2571         -//#line 598 "parse.y"
  2572         -{yygotominor.yy2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy0);}
  2573         -//#line 2572 "parse.c"
         2607  +      case 182:
         2608  +      case 183:
         2609  +//#line 632 "parse.y"
         2610  +{yygotominor.yy44 = sqlite3Expr(yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
         2611  +//#line 2610 "parse.c"
  2574   2612           break;
  2575   2613         case 176:
  2576         -//#line 600 "parse.y"
  2577         -{
  2578         -  Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy258);
  2579         -  Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy258);
  2580         -  yygotominor.yy2 = sqlite3Expr(TK_DOT, temp1, temp2, 0);
  2581         -}
  2582         -//#line 2581 "parse.c"
  2583         -        break;
  2584   2614         case 177:
  2585         -//#line 605 "parse.y"
         2615  +//#line 633 "parse.y"
         2616  +{yygotominor.yy44 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy0);}
         2617  +//#line 2616 "parse.c"
         2618  +        break;
         2619  +      case 178:
         2620  +//#line 635 "parse.y"
  2586   2621   {
  2587         -  Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-4].minor.yy258);
  2588         -  Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy258);
  2589         -  Expr *temp3 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy258);
         2622  +  Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy144);
         2623  +  Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy144);
         2624  +  yygotominor.yy44 = sqlite3Expr(TK_DOT, temp1, temp2, 0);
         2625  +}
         2626  +//#line 2625 "parse.c"
         2627  +        break;
         2628  +      case 179:
         2629  +//#line 640 "parse.y"
         2630  +{
         2631  +  Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-4].minor.yy144);
         2632  +  Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy144);
         2633  +  Expr *temp3 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy144);
  2590   2634     Expr *temp4 = sqlite3Expr(TK_DOT, temp2, temp3, 0);
  2591         -  yygotominor.yy2 = sqlite3Expr(TK_DOT, temp1, temp4, 0);
         2635  +  yygotominor.yy44 = sqlite3Expr(TK_DOT, temp1, temp4, 0);
  2592   2636   }
  2593         -//#line 2592 "parse.c"
         2637  +//#line 2636 "parse.c"
  2594   2638           break;
  2595         -      case 182:
  2596         -//#line 616 "parse.y"
  2597         -{yygotominor.yy2 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);}
  2598         -//#line 2597 "parse.c"
         2639  +      case 184:
         2640  +//#line 651 "parse.y"
         2641  +{yygotominor.yy44 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);}
         2642  +//#line 2641 "parse.c"
  2599   2643           break;
  2600         -      case 183:
  2601         -//#line 617 "parse.y"
         2644  +      case 185:
         2645  +//#line 652 "parse.y"
  2602   2646   {
  2603   2647     Token *pToken = &yymsp[0].minor.yy0;
  2604         -  Expr *pExpr = yygotominor.yy2 = sqlite3Expr(TK_VARIABLE, 0, 0, pToken);
         2648  +  Expr *pExpr = yygotominor.yy44 = sqlite3Expr(TK_VARIABLE, 0, 0, pToken);
  2605   2649     sqlite3ExprAssignVarNumber(pParse, pExpr);
  2606   2650   }
  2607         -//#line 2606 "parse.c"
  2608         -        break;
  2609         -      case 184:
  2610         -//#line 622 "parse.y"
  2611         -{
  2612         -  yygotominor.yy2 = sqlite3ExprFunction(yymsp[-1].minor.yy82, &yymsp[-3].minor.yy0);
  2613         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
  2614         -}
  2615         -//#line 2614 "parse.c"
  2616         -        break;
  2617         -      case 185:
  2618         -//#line 626 "parse.y"
  2619         -{
  2620         -  yygotominor.yy2 = sqlite3ExprFunction(0, &yymsp[-3].minor.yy0);
  2621         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
  2622         -}
  2623         -//#line 2622 "parse.c"
         2651  +//#line 2650 "parse.c"
  2624   2652           break;
  2625   2653         case 186:
  2626         -//#line 630 "parse.y"
         2654  +//#line 658 "parse.y"
         2655  +{
         2656  +  yygotominor.yy44 = sqlite3Expr(TK_CAST, yymsp[-3].minor.yy44, 0, &yymsp[-1].minor.yy144);
         2657  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
         2658  +}
         2659  +//#line 2658 "parse.c"
         2660  +        break;
         2661  +      case 187:
         2662  +//#line 663 "parse.y"
         2663  +{
         2664  +  yygotominor.yy44 = sqlite3ExprFunction(yymsp[-1].minor.yy412, &yymsp[-3].minor.yy0);
         2665  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
         2666  +}
         2667  +//#line 2666 "parse.c"
         2668  +        break;
         2669  +      case 188:
         2670  +//#line 667 "parse.y"
         2671  +{
         2672  +  yygotominor.yy44 = sqlite3ExprFunction(0, &yymsp[-3].minor.yy0);
         2673  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
         2674  +}
         2675  +//#line 2674 "parse.c"
         2676  +        break;
         2677  +      case 189:
         2678  +//#line 671 "parse.y"
  2627   2679   {
  2628   2680     /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
  2629   2681     ** treated as functions that return constants */
  2630         -  yygotominor.yy2 = sqlite3ExprFunction(0,&yymsp[0].minor.yy0);
  2631         -  if( yygotominor.yy2 ) yygotominor.yy2->op = TK_CONST_FUNC;  
         2682  +  yygotominor.yy44 = sqlite3ExprFunction(0,&yymsp[0].minor.yy0);
         2683  +  if( yygotominor.yy44 ) yygotominor.yy44->op = TK_CONST_FUNC;  
  2632   2684   }
  2633         -//#line 2632 "parse.c"
         2685  +//#line 2684 "parse.c"
  2634   2686           break;
  2635         -      case 187:
  2636         -      case 188:
  2637         -      case 189:
  2638   2687         case 190:
  2639   2688         case 191:
  2640   2689         case 192:
  2641   2690         case 193:
  2642   2691         case 194:
  2643   2692         case 195:
  2644   2693         case 196:
................................................................................
  2646   2695         case 198:
  2647   2696         case 199:
  2648   2697         case 200:
  2649   2698         case 201:
  2650   2699         case 202:
  2651   2700         case 203:
  2652   2701         case 204:
  2653         -//#line 636 "parse.y"
  2654         -{yygotominor.yy2 = sqlite3Expr(yymsp[-1].major, yymsp[-2].minor.yy2, yymsp[0].minor.yy2, 0);}
  2655         -//#line 2654 "parse.c"
  2656         -        break;
  2657   2702         case 205:
  2658         -//#line 655 "parse.y"
  2659         -{yygotominor.yy438.operat0r = yymsp[0].minor.yy0; yygotominor.yy438.not = 0;}
  2660         -//#line 2659 "parse.c"
  2661         -        break;
  2662   2703         case 206:
  2663         -//#line 656 "parse.y"
  2664         -{yygotominor.yy438.operat0r = yymsp[0].minor.yy0; yygotominor.yy438.not = 1;}
  2665         -//#line 2664 "parse.c"
         2704  +      case 207:
         2705  +//#line 677 "parse.y"
         2706  +{yygotominor.yy44 = sqlite3Expr(yymsp[-1].major, yymsp[-2].minor.yy44, yymsp[0].minor.yy44, 0);}
         2707  +//#line 2706 "parse.c"
         2708  +        break;
         2709  +      case 208:
         2710  +//#line 696 "parse.y"
         2711  +{yygotominor.yy432._operator = yymsp[0].minor.yy0; yygotominor.yy432.not = 0;}
         2712  +//#line 2711 "parse.c"
  2666   2713           break;
  2667   2714         case 209:
  2668         -//#line 660 "parse.y"
  2669         -{
  2670         -  ExprList *pList = sqlite3ExprListAppend(0, yymsp[-1].minor.yy2, 0);
  2671         -  pList = sqlite3ExprListAppend(pList, yymsp[-3].minor.yy2, 0);
  2672         -  if( yymsp[0].minor.yy2 ){
  2673         -    pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy2, 0);
  2674         -  }
  2675         -  yygotominor.yy2 = sqlite3ExprFunction(pList, &yymsp[-2].minor.yy438.operat0r);
  2676         -  if( yymsp[-2].minor.yy438.not ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0);
  2677         -  sqlite3ExprSpan(yygotominor.yy2, &yymsp[-3].minor.yy2->span, &yymsp[-1].minor.yy2->span);
  2678         -}
  2679         -//#line 2678 "parse.c"
  2680         -        break;
  2681         -      case 210:
  2682         -//#line 671 "parse.y"
  2683         -{
  2684         -  yygotominor.yy2 = sqlite3Expr(TK_ISNULL, yymsp[-1].minor.yy2, 0, 0);
  2685         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy2->span,&yymsp[0].minor.yy0);
  2686         -}
  2687         -//#line 2686 "parse.c"
  2688         -        break;
  2689         -      case 211:
  2690         -//#line 675 "parse.y"
  2691         -{
  2692         -  yygotominor.yy2 = sqlite3Expr(TK_ISNULL, yymsp[-2].minor.yy2, 0, 0);
  2693         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-2].minor.yy2->span,&yymsp[0].minor.yy0);
  2694         -}
  2695         -//#line 2694 "parse.c"
         2715  +//#line 697 "parse.y"
         2716  +{yygotominor.yy432._operator = yymsp[0].minor.yy0; yygotominor.yy432.not = 1;}
         2717  +//#line 2716 "parse.c"
  2696   2718           break;
  2697   2719         case 212:
  2698         -//#line 679 "parse.y"
         2720  +//#line 701 "parse.y"
  2699   2721   {
  2700         -  yygotominor.yy2 = sqlite3Expr(TK_NOTNULL, yymsp[-1].minor.yy2, 0, 0);
  2701         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy2->span,&yymsp[0].minor.yy0);
         2722  +  ExprList *pList = sqlite3ExprListAppend(0, yymsp[-1].minor.yy44, 0);
         2723  +  pList = sqlite3ExprListAppend(pList, yymsp[-3].minor.yy44, 0);
         2724  +  if( yymsp[0].minor.yy44 ){
         2725  +    pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy44, 0);
         2726  +  }
         2727  +  yygotominor.yy44 = sqlite3ExprFunction(pList, &yymsp[-2].minor.yy432._operator);
         2728  +  if( yymsp[-2].minor.yy432.not ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
         2729  +  sqlite3ExprSpan(yygotominor.yy44, &yymsp[-3].minor.yy44->span, &yymsp[-1].minor.yy44->span);
  2702   2730   }
  2703         -//#line 2702 "parse.c"
         2731  +//#line 2730 "parse.c"
  2704   2732           break;
  2705   2733         case 213:
  2706         -//#line 683 "parse.y"
         2734  +//#line 712 "parse.y"
  2707   2735   {
  2708         -  yygotominor.yy2 = sqlite3Expr(TK_NOTNULL, yymsp[-2].minor.yy2, 0, 0);
  2709         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-2].minor.yy2->span,&yymsp[0].minor.yy0);
         2736  +  yygotominor.yy44 = sqlite3Expr(TK_ISNULL, yymsp[-1].minor.yy44, 0, 0);
         2737  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy44->span,&yymsp[0].minor.yy0);
  2710   2738   }
  2711         -//#line 2710 "parse.c"
         2739  +//#line 2738 "parse.c"
  2712   2740           break;
  2713   2741         case 214:
  2714         -//#line 687 "parse.y"
         2742  +//#line 716 "parse.y"
  2715   2743   {
  2716         -  yygotominor.yy2 = sqlite3Expr(TK_NOTNULL, yymsp[-3].minor.yy2, 0, 0);
  2717         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-3].minor.yy2->span,&yymsp[0].minor.yy0);
         2744  +  yygotominor.yy44 = sqlite3Expr(TK_ISNULL, yymsp[-2].minor.yy44, 0, 0);
         2745  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-2].minor.yy44->span,&yymsp[0].minor.yy0);
  2718   2746   }
  2719         -//#line 2718 "parse.c"
         2747  +//#line 2746 "parse.c"
  2720   2748           break;
  2721   2749         case 215:
         2750  +//#line 720 "parse.y"
         2751  +{
         2752  +  yygotominor.yy44 = sqlite3Expr(TK_NOTNULL, yymsp[-1].minor.yy44, 0, 0);
         2753  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy44->span,&yymsp[0].minor.yy0);
         2754  +}
         2755  +//#line 2754 "parse.c"
         2756  +        break;
  2722   2757         case 216:
  2723         -//#line 691 "parse.y"
         2758  +//#line 724 "parse.y"
  2724   2759   {
  2725         -  yygotominor.yy2 = sqlite3Expr(yymsp[-1].major, yymsp[0].minor.yy2, 0, 0);
  2726         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy2->span);
         2760  +  yygotominor.yy44 = sqlite3Expr(TK_NOTNULL, yymsp[-2].minor.yy44, 0, 0);
         2761  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-2].minor.yy44->span,&yymsp[0].minor.yy0);
  2727   2762   }
  2728         -//#line 2727 "parse.c"
         2763  +//#line 2762 "parse.c"
  2729   2764           break;
  2730   2765         case 217:
  2731         -//#line 699 "parse.y"
         2766  +//#line 728 "parse.y"
  2732   2767   {
  2733         -  yygotominor.yy2 = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy2, 0, 0);
  2734         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy2->span);
         2768  +  yygotominor.yy44 = sqlite3Expr(TK_NOTNULL, yymsp[-3].minor.yy44, 0, 0);
         2769  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-3].minor.yy44->span,&yymsp[0].minor.yy0);
  2735   2770   }
  2736         -//#line 2735 "parse.c"
         2771  +//#line 2770 "parse.c"
  2737   2772           break;
  2738   2773         case 218:
  2739         -//#line 703 "parse.y"
         2774  +      case 219:
         2775  +//#line 732 "parse.y"
  2740   2776   {
  2741         -  yygotominor.yy2 = sqlite3Expr(TK_UPLUS, yymsp[0].minor.yy2, 0, 0);
  2742         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy2->span);
         2777  +  yygotominor.yy44 = sqlite3Expr(yymsp[-1].major, yymsp[0].minor.yy44, 0, 0);
         2778  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy44->span);
  2743   2779   }
  2744         -//#line 2743 "parse.c"
         2780  +//#line 2779 "parse.c"
         2781  +        break;
         2782  +      case 220:
         2783  +//#line 740 "parse.y"
         2784  +{
         2785  +  yygotominor.yy44 = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy44, 0, 0);
         2786  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy44->span);
         2787  +}
         2788  +//#line 2787 "parse.c"
  2745   2789           break;
  2746   2790         case 221:
  2747         -//#line 710 "parse.y"
         2791  +//#line 744 "parse.y"
  2748   2792   {
  2749         -  ExprList *pList = sqlite3ExprListAppend(0, yymsp[-2].minor.yy2, 0);
  2750         -  pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy2, 0);
  2751         -  yygotominor.yy2 = sqlite3Expr(TK_BETWEEN, yymsp[-4].minor.yy2, 0, 0);
  2752         -  if( yygotominor.yy2 ) yygotominor.yy2->pList = pList;
  2753         -  if( yymsp[-3].minor.yy412 ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0);
  2754         -  sqlite3ExprSpan(yygotominor.yy2,&yymsp[-4].minor.yy2->span,&yymsp[0].minor.yy2->span);
         2793  +  yygotominor.yy44 = sqlite3Expr(TK_UPLUS, yymsp[0].minor.yy44, 0, 0);
         2794  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy44->span);
  2755   2795   }
  2756         -//#line 2755 "parse.c"
         2796  +//#line 2795 "parse.c"
  2757   2797           break;
  2758   2798         case 224:
  2759         -//#line 722 "parse.y"
         2799  +//#line 751 "parse.y"
  2760   2800   {
  2761         -    yygotominor.yy2 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy2, 0, 0);
  2762         -    if( yygotominor.yy2 ){
  2763         -      yygotominor.yy2->pList = yymsp[-1].minor.yy82;
  2764         -    }else{
  2765         -      sqlite3ExprListDelete(yymsp[-1].minor.yy82);
  2766         -    }
  2767         -    if( yymsp[-3].minor.yy412 ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0);
  2768         -    sqlite3ExprSpan(yygotominor.yy2,&yymsp[-4].minor.yy2->span,&yymsp[0].minor.yy0);
  2769         -  }
  2770         -//#line 2769 "parse.c"
  2771         -        break;
  2772         -      case 225:
  2773         -//#line 732 "parse.y"
  2774         -{
  2775         -    yygotominor.yy2 = sqlite3Expr(TK_SELECT, 0, 0, 0);
  2776         -    if( yygotominor.yy2 ) yygotominor.yy2->pSelect = yymsp[-1].minor.yy459;
  2777         -    if( !yygotominor.yy2 ) sqlite3SelectDelete(yymsp[-1].minor.yy459);
  2778         -    sqlite3ExprSpan(yygotominor.yy2,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
  2779         -  }
  2780         -//#line 2779 "parse.c"
  2781         -        break;
  2782         -      case 226:
  2783         -//#line 738 "parse.y"
  2784         -{
  2785         -    yygotominor.yy2 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy2, 0, 0);
  2786         -    if( yygotominor.yy2 ) yygotominor.yy2->pSelect = yymsp[-1].minor.yy459;
  2787         -    if( !yygotominor.yy2 ) sqlite3SelectDelete(yymsp[-1].minor.yy459);
  2788         -    if( yymsp[-3].minor.yy412 ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0);
  2789         -    sqlite3ExprSpan(yygotominor.yy2,&yymsp[-4].minor.yy2->span,&yymsp[0].minor.yy0);
  2790         -  }
  2791         -//#line 2790 "parse.c"
         2801  +  ExprList *pList = sqlite3ExprListAppend(0, yymsp[-2].minor.yy44, 0);
         2802  +  pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy44, 0);
         2803  +  yygotominor.yy44 = sqlite3Expr(TK_BETWEEN, yymsp[-4].minor.yy44, 0, 0);
         2804  +  if( yygotominor.yy44 ) yygotominor.yy44->pList = pList;
         2805  +  if( yymsp[-3].minor.yy58 ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
         2806  +  sqlite3ExprSpan(yygotominor.yy44,&yymsp[-4].minor.yy44->span,&yymsp[0].minor.yy44->span);
         2807  +}
         2808  +//#line 2807 "parse.c"
  2792   2809           break;
  2793   2810         case 227:
  2794         -//#line 745 "parse.y"
         2811  +//#line 763 "parse.y"
  2795   2812   {
  2796         -    SrcList *pSrc = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy258);
  2797         -    yygotominor.yy2 = sqlite3Expr(TK_IN, yymsp[-3].minor.yy2, 0, 0);
  2798         -    if( yygotominor.yy2 ) yygotominor.yy2->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0);
  2799         -    if( yymsp[-2].minor.yy412 ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0);
  2800         -    sqlite3ExprSpan(yygotominor.yy2,&yymsp[-3].minor.yy2->span,yymsp[0].minor.yy258.z?&yymsp[0].minor.yy258:&yymsp[-1].minor.yy258);
         2813  +    yygotominor.yy44 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy44, 0, 0);
         2814  +    if( yygotominor.yy44 ){
         2815  +      yygotominor.yy44->pList = yymsp[-1].minor.yy412;
         2816  +    }else{
         2817  +      sqlite3ExprListDelete(yymsp[-1].minor.yy412);
         2818  +    }
         2819  +    if( yymsp[-3].minor.yy58 ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
         2820  +    sqlite3ExprSpan(yygotominor.yy44,&yymsp[-4].minor.yy44->span,&yymsp[0].minor.yy0);
  2801   2821     }
  2802         -//#line 2801 "parse.c"
         2822  +//#line 2821 "parse.c"
  2803   2823           break;
  2804   2824         case 228:
  2805         -//#line 752 "parse.y"
         2825  +//#line 773 "parse.y"
  2806   2826   {
  2807         -    Expr *p = yygotominor.yy2 = sqlite3Expr(TK_EXISTS, 0, 0, 0);
         2827  +    yygotominor.yy44 = sqlite3Expr(TK_SELECT, 0, 0, 0);
         2828  +    if( yygotominor.yy44 ) yygotominor.yy44->pSelect = yymsp[-1].minor.yy99;
         2829  +    if( !yygotominor.yy44 ) sqlite3SelectDelete(yymsp[-1].minor.yy99);
         2830  +    sqlite3ExprSpan(yygotominor.yy44,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
         2831  +  }
         2832  +//#line 2831 "parse.c"
         2833  +        break;
         2834  +      case 229:
         2835  +//#line 779 "parse.y"
         2836  +{
         2837  +    yygotominor.yy44 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy44, 0, 0);
         2838  +    if( yygotominor.yy44 ) yygotominor.yy44->pSelect = yymsp[-1].minor.yy99;
         2839  +    if( !yygotominor.yy44 ) sqlite3SelectDelete(yymsp[-1].minor.yy99);
         2840  +    if( yymsp[-3].minor.yy58 ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
         2841  +    sqlite3ExprSpan(yygotominor.yy44,&yymsp[-4].minor.yy44->span,&yymsp[0].minor.yy0);
         2842  +  }
         2843  +//#line 2842 "parse.c"
         2844  +        break;
         2845  +      case 230:
         2846  +//#line 786 "parse.y"
         2847  +{
         2848  +    SrcList *pSrc = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy144);
         2849  +    yygotominor.yy44 = sqlite3Expr(TK_IN, yymsp[-3].minor.yy44, 0, 0);
         2850  +    if( yygotominor.yy44 ) yygotominor.yy44->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0);
         2851  +    if( yymsp[-2].minor.yy58 ) yygotominor.yy44 = sqlite3Expr(TK_NOT, yygotominor.yy44, 0, 0);
         2852  +    sqlite3ExprSpan(yygotominor.yy44,&yymsp[-3].minor.yy44->span,yymsp[0].minor.yy144.z?&yymsp[0].minor.yy144:&yymsp[-1].minor.yy144);
         2853  +  }
         2854  +//#line 2853 "parse.c"
         2855  +        break;
         2856  +      case 231:
         2857  +//#line 793 "parse.y"
         2858  +{
         2859  +    Expr *p = yygotominor.yy44 = sqlite3Expr(TK_EXISTS, 0, 0, 0);
  2808   2860       if( p ){
  2809         -      p->pSelect = yymsp[-1].minor.yy459;
         2861  +      p->pSelect = yymsp[-1].minor.yy99;
  2810   2862         sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
  2811   2863       }
  2812         -    if( !p ) sqlite3SelectDelete(yymsp[-1].minor.yy459);
         2864  +    if( !p ) sqlite3SelectDelete(yymsp[-1].minor.yy99);
  2813   2865     }
  2814         -//#line 2813 "parse.c"
  2815         -        break;
  2816         -      case 229:
  2817         -//#line 763 "parse.y"
  2818         -{
  2819         -  yygotominor.yy2 = sqlite3Expr(TK_CASE, yymsp[-3].minor.yy2, yymsp[-1].minor.yy2, 0);
  2820         -  if( yygotominor.yy2 ) yygotominor.yy2->pList = yymsp[-2].minor.yy82;
  2821         -  sqlite3ExprSpan(yygotominor.yy2, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
  2822         -}
  2823         -//#line 2822 "parse.c"
  2824         -        break;
  2825         -      case 230:
  2826         -//#line 770 "parse.y"
  2827         -{
  2828         -  yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-4].minor.yy82, yymsp[-2].minor.yy2, 0);
  2829         -  yygotominor.yy82 = sqlite3ExprListAppend(yygotominor.yy82, yymsp[0].minor.yy2, 0);
  2830         -}
  2831         -//#line 2830 "parse.c"
  2832         -        break;
  2833         -      case 231:
  2834         -//#line 774 "parse.y"
  2835         -{
  2836         -  yygotominor.yy82 = sqlite3ExprListAppend(0, yymsp[-2].minor.yy2, 0);
  2837         -  yygotominor.yy82 = sqlite3ExprListAppend(yygotominor.yy82, yymsp[0].minor.yy2, 0);
  2838         -}
  2839         -//#line 2838 "parse.c"
  2840         -        break;
  2841         -      case 240:
  2842         -//#line 799 "parse.y"
  2843         -{
  2844         -  if( yymsp[-9].minor.yy412!=OE_None ) yymsp[-9].minor.yy412 = yymsp[0].minor.yy412;
  2845         -  if( yymsp[-9].minor.yy412==OE_Default) yymsp[-9].minor.yy412 = OE_Abort;
  2846         -  sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy258, &yymsp[-6].minor.yy258, sqlite3SrcListAppend(0,&yymsp[-4].minor.yy258,0),yymsp[-2].minor.yy82,yymsp[-9].minor.yy412, &yymsp[-10].minor.yy0, &yymsp[-1].minor.yy0);
  2847         -}
  2848         -//#line 2847 "parse.c"
  2849         -        break;
  2850         -      case 241:
  2851         -      case 288:
  2852         -//#line 806 "parse.y"
  2853         -{yygotominor.yy412 = OE_Abort;}
  2854         -//#line 2853 "parse.c"
  2855         -        break;
  2856         -      case 242:
  2857         -//#line 807 "parse.y"
  2858         -{yygotominor.yy412 = OE_None;}
  2859         -//#line 2858 "parse.c"
  2860         -        break;
  2861         -      case 245:
  2862         -//#line 817 "parse.y"
  2863         -{
  2864         -  Expr *p = 0;
  2865         -  if( yymsp[-1].minor.yy258.n>0 ){
  2866         -    p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
  2867         -    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char *)yymsp[-1].minor.yy258.z, yymsp[-1].minor.yy258.n);
  2868         -  }
  2869         -  yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-4].minor.yy82, p, &yymsp[-2].minor.yy258);
  2870         -}
  2871         -//#line 2870 "parse.c"
  2872         -        break;
  2873         -      case 246:
  2874         -//#line 825 "parse.y"
  2875         -{
  2876         -  Expr *p = 0;
  2877         -  if( yymsp[-1].minor.yy258.n>0 ){
  2878         -    p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
  2879         -    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char *)yymsp[-1].minor.yy258.z, yymsp[-1].minor.yy258.n);
  2880         -  }
  2881         -  yygotominor.yy82 = sqlite3ExprListAppend(0, p, &yymsp[-2].minor.yy258);
         2866  +//#line 2865 "parse.c"
         2867  +        break;
         2868  +      case 232:
         2869  +//#line 804 "parse.y"
         2870  +{
         2871  +  yygotominor.yy44 = sqlite3Expr(TK_CASE, yymsp[-3].minor.yy44, yymsp[-1].minor.yy44, 0);
         2872  +  if( yygotominor.yy44 ) yygotominor.yy44->pList = yymsp[-2].minor.yy412;
         2873  +  sqlite3ExprSpan(yygotominor.yy44, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
         2874  +}
         2875  +//#line 2874 "parse.c"
         2876  +        break;
         2877  +      case 233:
         2878  +//#line 811 "parse.y"
         2879  +{
         2880  +  yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-4].minor.yy412, yymsp[-2].minor.yy44, 0);
         2881  +  yygotominor.yy412 = sqlite3ExprListAppend(yygotominor.yy412, yymsp[0].minor.yy44, 0);
  2882   2882   }
  2883   2883   //#line 2882 "parse.c"
  2884   2884           break;
  2885         -      case 248:
  2886         -//#line 838 "parse.y"
  2887         -{sqlite3DropIndex(pParse, yymsp[0].minor.yy67);}
  2888         -//#line 2887 "parse.c"
         2885  +      case 234:
         2886  +//#line 815 "parse.y"
         2887  +{
         2888  +  yygotominor.yy412 = sqlite3ExprListAppend(0, yymsp[-2].minor.yy44, 0);
         2889  +  yygotominor.yy412 = sqlite3ExprListAppend(yygotominor.yy412, yymsp[0].minor.yy44, 0);
         2890  +}
         2891  +//#line 2890 "parse.c"
  2889   2892           break;
  2890         -      case 249:
  2891         -      case 250:
  2892         -//#line 842 "parse.y"
  2893         -{sqlite3Vacuum(pParse,0);}
  2894         -//#line 2893 "parse.c"
  2895         -        break;
  2896         -      case 251:
  2897         -      case 253:
  2898         -//#line 848 "parse.y"
  2899         -{sqlite3Pragma(pParse,&yymsp[-3].minor.yy258,&yymsp[-2].minor.yy258,&yymsp[0].minor.yy258,0);}
         2893  +      case 243:
         2894  +//#line 840 "parse.y"
         2895  +{
         2896  +  if( yymsp[-9].minor.yy58!=OE_None ) yymsp[-9].minor.yy58 = yymsp[0].minor.yy58;
         2897  +  if( yymsp[-9].minor.yy58==OE_Default) yymsp[-9].minor.yy58 = OE_Abort;
         2898  +  sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy144, &yymsp[-6].minor.yy144, sqlite3SrcListAppend(0,&yymsp[-4].minor.yy144,0),yymsp[-2].minor.yy412,yymsp[-9].minor.yy58, &yymsp[-10].minor.yy0, &yymsp[-1].minor.yy0);
         2899  +}
  2900   2900   //#line 2899 "parse.c"
  2901   2901           break;
  2902         -      case 252:
  2903         -//#line 849 "parse.y"
  2904         -{sqlite3Pragma(pParse,&yymsp[-3].minor.yy258,&yymsp[-2].minor.yy258,&yymsp[0].minor.yy0,0);}
  2905         -//#line 2904 "parse.c"
  2906         -        break;
  2907         -      case 254:
  2908         -//#line 851 "parse.y"
  2909         -{
  2910         -  sqlite3Pragma(pParse,&yymsp[-3].minor.yy258,&yymsp[-2].minor.yy258,&yymsp[0].minor.yy258,1);
  2911         -}
  2912         -//#line 2911 "parse.c"
  2913         -        break;
  2914         -      case 255:
  2915         -//#line 854 "parse.y"
  2916         -{sqlite3Pragma(pParse,&yymsp[-4].minor.yy258,&yymsp[-3].minor.yy258,&yymsp[-1].minor.yy258,0);}
  2917         -//#line 2916 "parse.c"
  2918         -        break;
  2919         -      case 256:
  2920         -//#line 855 "parse.y"
  2921         -{sqlite3Pragma(pParse,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy258,0,0);}
  2922         -//#line 2921 "parse.c"
  2923         -        break;
  2924         -      case 263:
  2925         -//#line 868 "parse.y"
  2926         -{
  2927         -  Token all;
  2928         -  all.z = yymsp[-3].minor.yy258.z;
  2929         -  all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy258.z) + yymsp[0].minor.yy0.n;
  2930         -  sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy347, &all);
  2931         -}
  2932         -//#line 2931 "parse.c"
  2933         -        break;
  2934         -      case 264:
  2935         -//#line 877 "parse.y"
  2936         -{
  2937         -  sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy258, &yymsp[-6].minor.yy258, yymsp[-5].minor.yy412, yymsp[-4].minor.yy210.a, yymsp[-4].minor.yy210.b, yymsp[-2].minor.yy67, yymsp[-1].minor.yy412, yymsp[0].minor.yy2, yymsp[-9].minor.yy412);
  2938         -  yygotominor.yy258 = (yymsp[-6].minor.yy258.n==0?yymsp[-7].minor.yy258:yymsp[-6].minor.yy258);
  2939         -}
         2902  +      case 244:
         2903  +      case 291:
         2904  +//#line 847 "parse.y"
         2905  +{yygotominor.yy58 = OE_Abort;}
         2906  +//#line 2905 "parse.c"
         2907  +        break;
         2908  +      case 245:
         2909  +//#line 848 "parse.y"
         2910  +{yygotominor.yy58 = OE_None;}
         2911  +//#line 2910 "parse.c"
         2912  +        break;
         2913  +      case 248:
         2914  +//#line 858 "parse.y"
         2915  +{
         2916  +  Expr *p = 0;
         2917  +  if( yymsp[-1].minor.yy144.n>0 ){
         2918  +    p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
         2919  +    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (const char *)yymsp[-1].minor.yy144.z, yymsp[-1].minor.yy144.n);
         2920  +  }
         2921  +  yygotominor.yy412 = sqlite3ExprListAppend(yymsp[-4].minor.yy412, p, &yymsp[-2].minor.yy144);
         2922  +}
         2923  +//#line 2922 "parse.c"
         2924  +        break;
         2925  +      case 249:
         2926  +//#line 866 "parse.y"
         2927  +{
         2928  +  Expr *p = 0;
         2929  +  if( yymsp[-1].minor.yy144.n>0 ){
         2930  +    p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
         2931  +    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (const char *)yymsp[-1].minor.yy144.z, yymsp[-1].minor.yy144.n);
         2932  +  }
         2933  +  yygotominor.yy412 = sqlite3ExprListAppend(0, p, &yymsp[-2].minor.yy144);
         2934  +}
         2935  +//#line 2934 "parse.c"
         2936  +        break;
         2937  +      case 251:
         2938  +//#line 879 "parse.y"
         2939  +{sqlite3DropIndex(pParse, yymsp[0].minor.yy367);}
  2940   2940   //#line 2939 "parse.c"
  2941   2941           break;
  2942         -      case 265:
  2943         -      case 268:
         2942  +      case 252:
         2943  +      case 253:
  2944   2944   //#line 883 "parse.y"
  2945         -{ yygotominor.yy412 = TK_BEFORE; }
         2945  +{sqlite3Vacuum(pParse,0);}
  2946   2946   //#line 2945 "parse.c"
  2947   2947           break;
  2948         -      case 266:
  2949         -//#line 884 "parse.y"
  2950         -{ yygotominor.yy412 = TK_AFTER;  }
  2951         -//#line 2950 "parse.c"
         2948  +      case 254:
         2949  +      case 256:
         2950  +//#line 889 "parse.y"
         2951  +{sqlite3Pragma(pParse,&yymsp[-3].minor.yy144,&yymsp[-2].minor.yy144,&yymsp[0].minor.yy144,0);}
         2952  +//#line 2951 "parse.c"
  2952   2953           break;
  2953         -      case 267:
  2954         -//#line 885 "parse.y"
  2955         -{ yygotominor.yy412 = TK_INSTEAD;}
  2956         -//#line 2955 "parse.c"
  2957         -        break;
  2958         -      case 269:
  2959         -      case 270:
  2960         -      case 271:
         2954  +      case 255:
  2961   2955   //#line 890 "parse.y"
  2962         -{yygotominor.yy210.a = yymsp[0].major; yygotominor.yy210.b = 0;}
  2963         -//#line 2962 "parse.c"
         2956  +{sqlite3Pragma(pParse,&yymsp[-3].minor.yy144,&yymsp[-2].minor.yy144,&yymsp[0].minor.yy0,0);}
         2957  +//#line 2956 "parse.c"
  2964   2958           break;
  2965         -      case 272:
  2966         -//#line 893 "parse.y"
  2967         -{yygotominor.yy210.a = TK_UPDATE; yygotominor.yy210.b = yymsp[0].minor.yy240;}
  2968         -//#line 2967 "parse.c"
         2959  +      case 257:
         2960  +//#line 892 "parse.y"
         2961  +{
         2962  +  sqlite3Pragma(pParse,&yymsp[-3].minor.yy144,&yymsp[-2].minor.yy144,&yymsp[0].minor.yy144,1);
         2963  +}
         2964  +//#line 2963 "parse.c"
  2969   2965           break;
  2970         -      case 273:
  2971         -      case 274:
         2966  +      case 258:
         2967  +//#line 895 "parse.y"
         2968  +{sqlite3Pragma(pParse,&yymsp[-4].minor.yy144,&yymsp[-3].minor.yy144,&yymsp[-1].minor.yy144,0);}
         2969  +//#line 2968 "parse.c"
         2970  +        break;
         2971  +      case 259:
  2972   2972   //#line 896 "parse.y"
  2973         -{ yygotominor.yy412 = TK_ROW; }
         2973  +{sqlite3Pragma(pParse,&yymsp[-1].minor.yy144,&yymsp[0].minor.yy144,0,0);}
  2974   2974   //#line 2973 "parse.c"
  2975   2975           break;
  2976         -      case 275:
  2977         -//#line 898 "parse.y"
  2978         -{ yygotominor.yy412 = TK_STATEMENT; }
  2979         -//#line 2978 "parse.c"
  2980         -        break;
  2981         -      case 276:
  2982         -//#line 901 "parse.y"
  2983         -{ yygotominor.yy2 = 0; }
         2976  +      case 266:
         2977  +//#line 909 "parse.y"
         2978  +{
         2979  +  Token all;
         2980  +  all.z = yymsp[-3].minor.yy144.z;
         2981  +  all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy144.z) + yymsp[0].minor.yy0.n;
         2982  +  sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
         2983  +}
  2984   2984   //#line 2983 "parse.c"
  2985   2985           break;
         2986  +      case 267:
         2987  +//#line 918 "parse.y"
         2988  +{
         2989  +  sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy144, &yymsp[-6].minor.yy144, yymsp[-5].minor.yy58, yymsp[-4].minor.yy234.a, yymsp[-4].minor.yy234.b, yymsp[-2].minor.yy367, yymsp[-1].minor.yy58, yymsp[0].minor.yy44, yymsp[-9].minor.yy58);
         2990  +  yygotominor.yy144 = (yymsp[-6].minor.yy144.n==0?yymsp[-7].minor.yy144:yymsp[-6].minor.yy144);
         2991  +}
         2992  +//#line 2991 "parse.c"
         2993  +        break;
         2994  +      case 268:
         2995  +      case 271:
         2996  +//#line 924 "parse.y"
         2997  +{ yygotominor.yy58 = TK_BEFORE; }
         2998  +//#line 2997 "parse.c"
         2999  +        break;
         3000  +      case 269:
         3001  +//#line 925 "parse.y"
         3002  +{ yygotominor.yy58 = TK_AFTER;  }
         3003  +//#line 3002 "parse.c"
         3004  +        break;
         3005  +      case 270:
         3006  +//#line 926 "parse.y"
         3007  +{ yygotominor.yy58 = TK_INSTEAD;}
         3008  +//#line 3007 "parse.c"
         3009  +        break;
         3010  +      case 272:
         3011  +      case 273:
         3012  +      case 274:
         3013  +//#line 931 "parse.y"
         3014  +{yygotominor.yy234.a = yymsp[0].major; yygotominor.yy234.b = 0;}
         3015  +//#line 3014 "parse.c"
         3016  +        break;
         3017  +      case 275:
         3018  +//#line 934 "parse.y"
         3019  +{yygotominor.yy234.a = TK_UPDATE; yygotominor.yy234.b = yymsp[0].minor.yy258;}
         3020  +//#line 3019 "parse.c"
         3021  +        break;
         3022  +      case 276:
  2986   3023         case 277:
  2987         -//#line 902 "parse.y"
  2988         -{ yygotominor.yy2 = yymsp[0].minor.yy2; }
  2989         -//#line 2988 "parse.c"
         3024  +//#line 937 "parse.y"
         3025  +{ yygotominor.yy58 = TK_ROW; }
         3026  +//#line 3025 "parse.c"
  2990   3027           break;
  2991   3028         case 278:
  2992         -//#line 906 "parse.y"
  2993         -{
  2994         -  yymsp[-2].minor.yy347->pNext = yymsp[0].minor.yy347;
  2995         -  yygotominor.yy347 = yymsp[-2].minor.yy347;
  2996         -}
  2997         -//#line 2996 "parse.c"
         3029  +//#line 939 "parse.y"
         3030  +{ yygotominor.yy58 = TK_STATEMENT; }
         3031  +//#line 3030 "parse.c"
  2998   3032           break;
  2999   3033         case 279:
  3000         -//#line 910 "parse.y"
  3001         -{ yygotominor.yy347 = 0; }
  3002         -//#line 3001 "parse.c"
  3003         -        break;
  3004         -      case 280:
  3005         -//#line 916 "parse.y"
  3006         -{ yygotominor.yy347 = sqlite3TriggerUpdateStep(&yymsp[-3].minor.yy258, yymsp[-1].minor.yy82, yymsp[0].minor.yy2, yymsp[-4].minor.yy412); }
  3007         -//#line 3006 "parse.c"
  3008         -        break;
  3009         -      case 281:
  3010         -//#line 921 "parse.y"
  3011         -{yygotominor.yy347 = sqlite3TriggerInsertStep(&yymsp[-5].minor.yy258, yymsp[-4].minor.yy240, yymsp[-1].minor.yy82, 0, yymsp[-7].minor.yy412);}
  3012         -//#line 3011 "parse.c"
  3013         -        break;
  3014         -      case 282:
  3015         -//#line 924 "parse.y"
  3016         -{yygotominor.yy347 = sqlite3TriggerInsertStep(&yymsp[-2].minor.yy258, yymsp[-1].minor.yy240, 0, yymsp[0].minor.yy459, yymsp[-4].minor.yy412);}
  3017         -//#line 3016 "parse.c"
  3018         -        break;
  3019         -      case 283:
  3020         -//#line 928 "parse.y"
  3021         -{yygotominor.yy347 = sqlite3TriggerDeleteStep(&yymsp[-1].minor.yy258, yymsp[0].minor.yy2);}
  3022         -//#line 3021 "parse.c"
  3023         -        break;
  3024         -      case 284:
  3025         -//#line 931 "parse.y"
  3026         -{yygotominor.yy347 = sqlite3TriggerSelectStep(yymsp[0].minor.yy459); }
  3027         -//#line 3026 "parse.c"
  3028         -        break;
  3029         -      case 285:
  3030         -//#line 934 "parse.y"
  3031         -{
  3032         -  yygotominor.yy2 = sqlite3Expr(TK_RAISE, 0, 0, 0); 
  3033         -  yygotominor.yy2->iColumn = OE_Ignore;
  3034         -  sqlite3ExprSpan(yygotominor.yy2, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
  3035         -}
         3034  +//#line 942 "parse.y"
         3035  +{ yygotominor.yy44 = 0; }
  3036   3036   //#line 3035 "parse.c"
  3037   3037           break;
  3038         -      case 286:
  3039         -//#line 939 "parse.y"
  3040         -{
  3041         -  yygotominor.yy2 = sqlite3Expr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy258); 
  3042         -  yygotominor.yy2->iColumn = yymsp[-3].minor.yy412;
  3043         -  sqlite3ExprSpan(yygotominor.yy2, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
  3044         -}
  3045         -//#line 3044 "parse.c"
         3038  +      case 280:
         3039  +//#line 943 "parse.y"
         3040  +{ yygotominor.yy44 = yymsp[0].minor.yy44; }
         3041  +//#line 3040 "parse.c"
  3046   3042           break;
  3047         -      case 287:
         3043  +      case 281:
  3048   3044   //#line 947 "parse.y"
  3049         -{yygotominor.yy412 = OE_Rollback;}
  3050         -//#line 3049 "parse.c"
  3051         -        break;
  3052         -      case 289:
  3053         -//#line 949 "parse.y"
  3054         -{yygotominor.yy412 = OE_Fail;}
  3055         -//#line 3054 "parse.c"
  3056         -        break;
  3057         -      case 290:
  3058         -//#line 954 "parse.y"
  3059   3045   {
  3060         -  sqlite3DropTrigger(pParse,yymsp[0].minor.yy67);
         3046  +  yymsp[-2].minor.yy203->pNext = yymsp[0].minor.yy203;
         3047  +  yygotominor.yy203 = yymsp[-2].minor.yy203;
  3061   3048   }
  3062         -//#line 3061 "parse.c"
         3049  +//#line 3048 "parse.c"
  3063   3050           break;
  3064         -      case 291:
  3065         -//#line 960 "parse.y"
  3066         -{
  3067         -  sqlite3Attach(pParse, &yymsp[-3].minor.yy258, &yymsp[-1].minor.yy258, yymsp[0].minor.yy132.type, &yymsp[0].minor.yy132.key);
  3068         -}
         3051  +      case 282:
         3052  +//#line 951 "parse.y"
         3053  +{ yygotominor.yy203 = 0; }
         3054  +//#line 3053 "parse.c"
         3055  +        break;
         3056  +      case 283:
         3057  +//#line 957 "parse.y"
         3058  +{ yygotominor.yy203 = sqlite3TriggerUpdateStep(&yymsp[-3].minor.yy144, yymsp[-1].minor.yy412, yymsp[0].minor.yy44, yymsp[-4].minor.yy58); }
         3059  +//#line 3058 "parse.c"
         3060  +        break;
         3061  +      case 284:
         3062  +//#line 962 "parse.y"
         3063  +{yygotominor.yy203 = sqlite3TriggerInsertStep(&yymsp[-5].minor.yy144, yymsp[-4].minor.yy258, yymsp[-1].minor.yy412, 0, yymsp[-7].minor.yy58);}
         3064  +//#line 3063 "parse.c"
         3065  +        break;
         3066  +      case 285:
         3067  +//#line 965 "parse.y"
         3068  +{yygotominor.yy203 = sqlite3TriggerInsertStep(&yymsp[-2].minor.yy144, yymsp[-1].minor.yy258, 0, yymsp[0].minor.yy99, yymsp[-4].minor.yy58);}
  3069   3069   //#line 3068 "parse.c"
  3070   3070           break;
  3071         -      case 292:
  3072         -//#line 964 "parse.y"
  3073         -{ yygotominor.yy132.type = 0; }
         3071  +      case 286:
         3072  +//#line 969 "parse.y"
         3073  +{yygotominor.yy203 = sqlite3TriggerDeleteStep(&yymsp[-1].minor.yy144, yymsp[0].minor.yy44);}
  3074   3074   //#line 3073 "parse.c"
  3075   3075           break;
  3076         -      case 293:
  3077         -//#line 965 "parse.y"
  3078         -{ yygotominor.yy132.type=1; yygotominor.yy132.key = yymsp[0].minor.yy258; }
         3076  +      case 287:
         3077  +//#line 972 "parse.y"
         3078  +{yygotominor.yy203 = sqlite3TriggerSelectStep(yymsp[0].minor.yy99); }
  3079   3079   //#line 3078 "parse.c"
  3080   3080           break;
         3081  +      case 288:
         3082  +//#line 975 "parse.y"
         3083  +{
         3084  +  yygotominor.yy44 = sqlite3Expr(TK_RAISE, 0, 0, 0); 
         3085  +  yygotominor.yy44->iColumn = OE_Ignore;
         3086  +  sqlite3ExprSpan(yygotominor.yy44, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
         3087  +}
         3088  +//#line 3087 "parse.c"
         3089  +        break;
         3090  +      case 289:
         3091  +//#line 980 "parse.y"
         3092  +{
         3093  +  yygotominor.yy44 = sqlite3Expr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy144); 
         3094  +  yygotominor.yy44->iColumn = yymsp[-3].minor.yy58;
         3095  +  sqlite3ExprSpan(yygotominor.yy44, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
         3096  +}
         3097  +//#line 3096 "parse.c"
         3098  +        break;
         3099  +      case 290:
         3100  +//#line 988 "parse.y"
         3101  +{yygotominor.yy58 = OE_Rollback;}
         3102  +//#line 3101 "parse.c"
         3103  +        break;
         3104  +      case 292:
         3105  +//#line 990 "parse.y"
         3106  +{yygotominor.yy58 = OE_Fail;}
         3107  +//#line 3106 "parse.c"
         3108  +        break;
         3109  +      case 293:
         3110  +//#line 995 "parse.y"
         3111  +{
         3112  +  sqlite3DropTrigger(pParse,yymsp[0].minor.yy367);
         3113  +}
         3114  +//#line 3113 "parse.c"
         3115  +        break;
  3081   3116         case 294:
  3082         -//#line 966 "parse.y"
  3083         -{ yygotominor.yy132.type=2; yygotominor.yy132.key = yymsp[0].minor.yy0; }
  3084         -//#line 3083 "parse.c"
         3117  +//#line 1001 "parse.y"
         3118  +{
         3119  +  sqlite3Attach(pParse, &yymsp[-3].minor.yy144, &yymsp[-1].minor.yy144, yymsp[0].minor.yy300.type, &yymsp[0].minor.yy300.key);
         3120  +}
         3121  +//#line 3120 "parse.c"
         3122  +        break;
         3123  +      case 295:
         3124  +//#line 1005 "parse.y"
         3125  +{ yygotominor.yy300.type = 0; }
         3126  +//#line 3125 "parse.c"
         3127  +        break;
         3128  +      case 296:
         3129  +//#line 1006 "parse.y"
         3130  +{ yygotominor.yy300.type=1; yygotominor.yy300.key = yymsp[0].minor.yy144; }
         3131  +//#line 3130 "parse.c"
  3085   3132           break;
  3086   3133         case 297:
  3087         -//#line 972 "parse.y"
  3088         -{
  3089         -  sqlite3Detach(pParse, &yymsp[0].minor.yy258);
  3090         -}
  3091         -//#line 3090 "parse.c"
  3092         -        break;
  3093         -      case 298:
  3094         -//#line 978 "parse.y"
  3095         -{sqlite3Reindex(pParse, 0, 0);}
  3096         -//#line 3095 "parse.c"
  3097         -        break;
  3098         -      case 299:
  3099         -//#line 979 "parse.y"
  3100         -{sqlite3Reindex(pParse, &yymsp[-1].minor.yy258, &yymsp[0].minor.yy258);}
  3101         -//#line 3100 "parse.c"
         3134  +//#line 1007 "parse.y"
         3135  +{ yygotominor.yy300.type=2; yygotominor.yy300.key = yymsp[0].minor.yy0; }
         3136  +//#line 3135 "parse.c"
  3102   3137           break;
  3103   3138         case 300:
  3104         -//#line 984 "parse.y"
         3139  +//#line 1013 "parse.y"
  3105   3140   {
  3106         -  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy67,&yymsp[0].minor.yy258);
         3141  +  sqlite3Detach(pParse, &yymsp[0].minor.yy144);
  3107   3142   }
  3108         -//#line 3107 "parse.c"
         3143  +//#line 3142 "parse.c"
  3109   3144           break;
  3110   3145         case 301:
  3111         -//#line 987 "parse.y"
  3112         -{
  3113         -  sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy258);
  3114         -}
  3115         -//#line 3114 "parse.c"
         3146  +//#line 1019 "parse.y"
         3147  +{sqlite3Reindex(pParse, 0, 0);}
         3148  +//#line 3147 "parse.c"
  3116   3149           break;
  3117   3150         case 302:
  3118         -//#line 990 "parse.y"
         3151  +//#line 1020 "parse.y"
         3152  +{sqlite3Reindex(pParse, &yymsp[-1].minor.yy144, &yymsp[0].minor.yy144);}
         3153  +//#line 3152 "parse.c"
         3154  +        break;
         3155  +      case 303:
         3156  +//#line 1025 "parse.y"
         3157  +{sqlite3Analyze(pParse, 0, 0);}
         3158  +//#line 3157 "parse.c"
         3159  +        break;
         3160  +      case 304:
         3161  +//#line 1026 "parse.y"
         3162  +{sqlite3Analyze(pParse, &yymsp[-1].minor.yy144, &yymsp[0].minor.yy144);}
         3163  +//#line 3162 "parse.c"
         3164  +        break;
         3165  +      case 305:
         3166  +//#line 1031 "parse.y"
         3167  +{
         3168  +  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy367,&yymsp[0].minor.yy144);
         3169  +}
         3170  +//#line 3169 "parse.c"
         3171  +        break;
         3172  +      case 306:
         3173  +//#line 1034 "parse.y"
         3174  +{
         3175  +  sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy144);
         3176  +}
         3177  +//#line 3176 "parse.c"
         3178  +        break;
         3179  +      case 307:
         3180  +//#line 1037 "parse.y"
  3119   3181   {
  3120         -  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy67);
         3182  +  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy367);
  3121   3183   }
  3122         -//#line 3121 "parse.c"
         3184  +//#line 3183 "parse.c"
  3123   3185           break;
  3124   3186     };
  3125   3187     yygoto = yyRuleInfo[yyruleno].lhs;
  3126   3188     yysize = yyRuleInfo[yyruleno].nrhs;
  3127   3189     yypParser->yyidx -= yysize;
  3128   3190     yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
  3129   3191     if( yyact < YYNSTATE ){
................................................................................
  3172   3234   static void yy_syntax_error(
  3173   3235     yyParser *yypParser,           /* The parser */
  3174   3236     int yymajor,                   /* The major type of the error token */
  3175   3237     YYMINORTYPE yyminor            /* The minor type of the error token */
  3176   3238   ){
  3177   3239     sqlite3ParserARG_FETCH;
  3178   3240   #define TOKEN (yyminor.yy0)
  3179         -//#line 23 "parse.y"
         3241  +//#line 34 "parse.y"
  3180   3242   
  3181   3243     if( pParse->zErrMsg==0 ){
  3182   3244       if( TOKEN.z[0] ){
  3183   3245         sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
  3184   3246       }else{
  3185   3247         sqlite3ErrorMsg(pParse, "incomplete SQL statement");
  3186   3248       }
  3187   3249     }
  3188         -//#line 3188 "parse.c"
         3250  +//#line 3250 "parse.c"
  3189   3251     sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
  3190   3252   }
  3191   3253   
  3192   3254   /*
  3193   3255   ** The following is executed when the parser accepts
  3194   3256   */
  3195   3257   static void yy_accept(
................................................................................
  3352   3414       }else{
  3353   3415         yy_accept(yypParser);
  3354   3416         yymajor = YYNOCODE;
  3355   3417       }
  3356   3418     }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
  3357   3419     return;
  3358   3420   }
  3359         -
  3360   3421   }

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

    23     23   #define TK_LP                             23
    24     24   #define TK_RP                             24
    25     25   #define TK_AS                             25
    26     26   #define TK_COMMA                          26
    27     27   #define TK_ID                             27
    28     28   #define TK_ABORT                          28
    29     29   #define TK_AFTER                          29
    30         -#define TK_ASC                            30
    31         -#define TK_ATTACH                         31
    32         -#define TK_BEFORE                         32
    33         -#define TK_CASCADE                        33
    34         -#define TK_CONFLICT                       34
    35         -#define TK_DATABASE                       35
    36         -#define TK_DESC                           36
    37         -#define TK_DETACH                         37
    38         -#define TK_EACH                           38
    39         -#define TK_FAIL                           39
    40         -#define TK_FOR                            40
    41         -#define TK_IGNORE                         41
    42         -#define TK_INITIALLY                      42
    43         -#define TK_INSTEAD                        43
    44         -#define TK_LIKE_KW                        44
    45         -#define TK_MATCH                          45
    46         -#define TK_KEY                            46
    47         -#define TK_OF                             47
    48         -#define TK_OFFSET                         48
    49         -#define TK_PRAGMA                         49
    50         -#define TK_RAISE                          50
    51         -#define TK_REPLACE                        51
    52         -#define TK_RESTRICT                       52
    53         -#define TK_ROW                            53
    54         -#define TK_STATEMENT                      54
    55         -#define TK_TRIGGER                        55
    56         -#define TK_VACUUM                         56
    57         -#define TK_VIEW                           57
    58         -#define TK_REINDEX                        58
    59         -#define TK_RENAME                         59
    60         -#define TK_CTIME_KW                       60
    61         -#define TK_ALTER                          61
    62         -#define TK_OR                             62
    63         -#define TK_AND                            63
    64         -#define TK_NOT                            64
    65         -#define TK_IS                             65
    66         -#define TK_BETWEEN                        66
    67         -#define TK_IN                             67
    68         -#define TK_ISNULL                         68
    69         -#define TK_NOTNULL                        69
    70         -#define TK_NE                             70
    71         -#define TK_EQ                             71
    72         -#define TK_GT                             72
    73         -#define TK_LE                             73
    74         -#define TK_LT                             74
    75         -#define TK_GE                             75
    76         -#define TK_ESCAPE                         76
    77         -#define TK_BITAND                         77
    78         -#define TK_BITOR                          78
    79         -#define TK_LSHIFT                         79
    80         -#define TK_RSHIFT                         80
    81         -#define TK_PLUS                           81
    82         -#define TK_MINUS                          82
    83         -#define TK_STAR                           83
    84         -#define TK_SLASH                          84
    85         -#define TK_REM                            85
    86         -#define TK_CONCAT                         86
    87         -#define TK_UMINUS                         87
    88         -#define TK_UPLUS                          88
    89         -#define TK_BITNOT                         89
    90         -#define TK_STRING                         90
    91         -#define TK_JOIN_KW                        91
    92         -#define TK_CONSTRAINT                     92
    93         -#define TK_DEFAULT                        93
    94         -#define TK_NULL                           94
    95         -#define TK_PRIMARY                        95
    96         -#define TK_UNIQUE                         96
    97         -#define TK_CHECK                          97
    98         -#define TK_REFERENCES                     98
    99         -#define TK_COLLATE                        99
   100         -#define TK_AUTOINCR                       100
   101         -#define TK_ON                             101
   102         -#define TK_DELETE                         102
   103         -#define TK_UPDATE                         103
   104         -#define TK_INSERT                         104
   105         -#define TK_SET                            105
   106         -#define TK_DEFERRABLE                     106
   107         -#define TK_FOREIGN                        107
   108         -#define TK_DROP                           108
   109         -#define TK_UNION                          109
   110         -#define TK_ALL                            110
   111         -#define TK_INTERSECT                      111
   112         -#define TK_EXCEPT                         112
   113         -#define TK_SELECT                         113
   114         -#define TK_DISTINCT                       114
   115         -#define TK_DOT                            115
   116         -#define TK_FROM                           116
   117         -#define TK_JOIN                           117
   118         -#define TK_USING                          118
   119         -#define TK_ORDER                          119
   120         -#define TK_BY                             120
   121         -#define TK_GROUP                          121
   122         -#define TK_HAVING                         122
   123         -#define TK_LIMIT                          123
   124         -#define TK_WHERE                          124
   125         -#define TK_INTO                           125
   126         -#define TK_VALUES                         126
   127         -#define TK_INTEGER                        127
   128         -#define TK_FLOAT                          128
   129         -#define TK_BLOB                           129
   130         -#define TK_REGISTER                       130
   131         -#define TK_VARIABLE                       131
   132         -#define TK_EXISTS                         132
   133         -#define TK_CASE                           133
   134         -#define TK_WHEN                           134
   135         -#define TK_THEN                           135
   136         -#define TK_ELSE                           136
   137         -#define TK_INDEX                          137
   138         -#define TK_TO                             138
   139         -#define TK_ADD                            139
   140         -#define TK_COLUMNKW                       140
           30  +#define TK_ANALYZE                        30
           31  +#define TK_ASC                            31
           32  +#define TK_ATTACH                         32
           33  +#define TK_BEFORE                         33
           34  +#define TK_CASCADE                        34
           35  +#define TK_CAST                           35
           36  +#define TK_CONFLICT                       36
           37  +#define TK_DATABASE                       37
           38  +#define TK_DESC                           38
           39  +#define TK_DETACH                         39
           40  +#define TK_EACH                           40
           41  +#define TK_FAIL                           41
           42  +#define TK_FOR                            42
           43  +#define TK_IGNORE                         43
           44  +#define TK_INITIALLY                      44
           45  +#define TK_INSTEAD                        45
           46  +#define TK_LIKE_KW                        46
           47  +#define TK_MATCH                          47
           48  +#define TK_KEY                            48
           49  +#define TK_OF                             49
           50  +#define TK_OFFSET                         50
           51  +#define TK_PRAGMA                         51
           52  +#define TK_RAISE                          52
           53  +#define TK_REPLACE                        53
           54  +#define TK_RESTRICT                       54
           55  +#define TK_ROW                            55
           56  +#define TK_STATEMENT                      56
           57  +#define TK_TRIGGER                        57
           58  +#define TK_VACUUM                         58
           59  +#define TK_VIEW                           59
           60  +#define TK_REINDEX                        60
           61  +#define TK_RENAME                         61
           62  +#define TK_CTIME_KW                       62
           63  +#define TK_ALTER                          63
           64  +#define TK_OR                             64
           65  +#define TK_AND                            65
           66  +#define TK_NOT                            66
           67  +#define TK_IS                             67
           68  +#define TK_BETWEEN                        68
           69  +#define TK_IN                             69
           70  +#define TK_ISNULL                         70
           71  +#define TK_NOTNULL                        71
           72  +#define TK_NE                             72
           73  +#define TK_EQ                             73
           74  +#define TK_GT                             74
           75  +#define TK_LE                             75
           76  +#define TK_LT                             76
           77  +#define TK_GE                             77
           78  +#define TK_ESCAPE                         78
           79  +#define TK_BITAND                         79
           80  +#define TK_BITOR                          80
           81  +#define TK_LSHIFT                         81
           82  +#define TK_RSHIFT                         82
           83  +#define TK_PLUS                           83
           84  +#define TK_MINUS                          84
           85  +#define TK_STAR                           85
           86  +#define TK_SLASH                          86
           87  +#define TK_REM                            87
           88  +#define TK_CONCAT                         88
           89  +#define TK_UMINUS                         89
           90  +#define TK_UPLUS                          90
           91  +#define TK_BITNOT                         91
           92  +#define TK_STRING                         92
           93  +#define TK_JOIN_KW                        93
           94  +#define TK_CONSTRAINT                     94
           95  +#define TK_DEFAULT                        95
           96  +#define TK_NULL                           96
           97  +#define TK_PRIMARY                        97
           98  +#define TK_UNIQUE                         98
           99  +#define TK_CHECK                          99
          100  +#define TK_REFERENCES                     100
          101  +#define TK_COLLATE                        101
          102  +#define TK_AUTOINCR                       102
          103  +#define TK_ON                             103
          104  +#define TK_DELETE                         104
          105  +#define TK_UPDATE                         105
          106  +#define TK_INSERT                         106
          107  +#define TK_SET                            107
          108  +#define TK_DEFERRABLE                     108
          109  +#define TK_FOREIGN                        109
          110  +#define TK_DROP                           110
          111  +#define TK_UNION                          111
          112  +#define TK_ALL                            112
          113  +#define TK_INTERSECT                      113
          114  +#define TK_EXCEPT                         114
          115  +#define TK_SELECT                         115
          116  +#define TK_DISTINCT                       116
          117  +#define TK_DOT                            117
          118  +#define TK_FROM                           118
          119  +#define TK_JOIN                           119
          120  +#define TK_USING                          120
          121  +#define TK_ORDER                          121
          122  +#define TK_BY                             122
          123  +#define TK_GROUP                          123
          124  +#define TK_HAVING                         124
          125  +#define TK_LIMIT                          125
          126  +#define TK_WHERE                          126
          127  +#define TK_INTO                           127
          128  +#define TK_VALUES                         128
          129  +#define TK_INTEGER                        129
          130  +#define TK_FLOAT                          130
          131  +#define TK_BLOB                           131
          132  +#define TK_REGISTER                       132
          133  +#define TK_VARIABLE                       133
          134  +#define TK_EXISTS                         134
          135  +#define TK_CASE                           135
          136  +#define TK_WHEN                           136
          137  +#define TK_THEN                           137
          138  +#define TK_ELSE                           138
          139  +#define TK_INDEX                          139
          140  +#define TK_TO                             140
          141  +#define TK_ADD                            141
          142  +#define TK_COLUMNKW                       142

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

    10     10   **    May you do good and not evil.
    11     11   **    May you find forgiveness for yourself and forgive others.
    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15     15   ** This file contains code used to implement the PRAGMA command.
    16     16   **
    17         -** $Id: pragma.c,v 1.6 2005/08/01 19:32:14 rmsimpson Exp $
           17  +** $Id: pragma.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <ctype.h>
    22     22   
    23     23   /* Ignore this whole file if pragmas are disabled
    24     24   */
................................................................................
    43     43                                /* 123456789 123456789 */
    44     44     static const char zText[] = "onoffalseyestruefull";
    45     45     static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16};
    46     46     static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4};
    47     47     static const u8 iValue[] =  {1, 0, 0, 0, 1, 1, 2};
    48     48     int i, n;
    49     49     if( isdigit(*z) ){
    50         -    return atoi((char *)z);
           50  +    return atoi((const char *)z);
    51     51     }
    52         -  n = strlen((char *)z);
           52  +  n = strlen((const char *)z);
    53     53     for(i=0; i<sizeof(iLength); i++){
    54         -    if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],(char *)z,n)==0 ){
           54  +    if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],(const char *)z,n)==0 ){
    55     55         return iValue[i];
    56     56       }
    57     57     }
    58     58     return 1;
    59     59   }
    60     60   
    61     61   /*
................................................................................
   165    165         sqlite3 *db = pParse->db;
   166    166         Vdbe *v;
   167    167         v = sqlite3GetVdbe(pParse);
   168    168         if( v ){
   169    169           if( zRight==0 ){
   170    170             returnSingleInt(pParse, p->zName, (db->flags & p->mask)!=0 );
   171    171           }else{
   172         -          if( getBoolean((u8 *)zRight) ){
          172  +          if( getBoolean((const u8 *)zRight) ){
   173    173               db->flags |= p->mask;
   174    174             }else{
   175    175               db->flags &= ~p->mask;
   176    176             }
   177    177           }
   178    178           /* If one of these pragmas is executed, any prepared statements
   179    179           ** need to be recompiled.
................................................................................
   318    318     if( sqlite3StrICmp(zLeft,"auto_vacuum")==0 ){
   319    319       Btree *pBt = pDb->pBt;
   320    320       if( !zRight ){
   321    321         int auto_vacuum = 
   322    322             pBt ? sqlite3BtreeGetAutoVacuum(pBt) : SQLITE_DEFAULT_AUTOVACUUM;
   323    323         returnSingleInt(pParse, "auto_vacuum", auto_vacuum);
   324    324       }else{
   325         -      sqlite3BtreeSetAutoVacuum(pBt, getBoolean((u8 *)zRight));
          325  +      sqlite3BtreeSetAutoVacuum(pBt, getBoolean((const u8 *)zRight));
   326    326       }
   327    327     }else
   328    328   #endif
   329    329   
   330    330   #ifndef SQLITE_OMIT_PAGER_PRAGMAS
   331    331     /*
   332    332     **  PRAGMA [database.]cache_size
................................................................................
   426    426       if( !zRight ){
   427    427         returnSingleInt(pParse, "synchronous", pDb->safety_level-1);
   428    428       }else{
   429    429         if( !db->autoCommit ){
   430    430           sqlite3ErrorMsg(pParse, 
   431    431               "Safety level may not be changed inside a transaction");
   432    432         }else{
   433         -        pDb->safety_level = getSafetyLevel((u8 *)zRight)+1;
          433  +        pDb->safety_level = getSafetyLevel((const u8 *)zRight)+1;
   434    434           sqlite3BtreeSetSafetyLevel(pDb->pBt, pDb->safety_level);
   435    435         }
   436    436       }
   437    437     }else
   438    438   #endif /* SQLITE_OMIT_PAGER_PRAGMAS */
   439    439   
   440    440   #ifndef SQLITE_OMIT_FLAG_PRAGMAS
................................................................................
   582    582           sqlite3VdbeSetColName(v, 1, "seq", P3_STATIC);
   583    583           sqlite3VdbeSetColName(v, 2, "table", P3_STATIC);
   584    584           sqlite3VdbeSetColName(v, 3, "from", P3_STATIC);
   585    585           sqlite3VdbeSetColName(v, 4, "to", P3_STATIC);
   586    586           while(pFK){
   587    587             int j;
   588    588             for(j=0; j<pFK->nCol; j++){
          589  +            char *zCol = pFK->aCol[j].zCol;
   589    590               sqlite3VdbeAddOp(v, OP_Integer, i, 0);
   590    591               sqlite3VdbeAddOp(v, OP_Integer, j, 0);
   591    592               sqlite3VdbeOp3(v, OP_String8, 0, 0, pFK->zTo, 0);
   592    593               sqlite3VdbeOp3(v, OP_String8, 0, 0,
   593    594                                pTab->aCol[pFK->aCol[j].iFrom].zName, 0);
   594         -            sqlite3VdbeOp3(v, OP_String8, 0, 0, pFK->aCol[j].zCol, 0);
          595  +            sqlite3VdbeOp3(v, zCol ? OP_String8 : OP_Null, 0, 0, zCol, 0);
   595    596               sqlite3VdbeAddOp(v, OP_Callback, 5, 0);
   596    597             }
   597    598             ++i;
   598    599             pFK = pFK->pNextFrom;
   599    600           }
   600    601         }
   601    602       }
   602    603     }else
   603    604   #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
   604    605   
   605    606   #ifndef NDEBUG
   606    607     if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){
   607    608       extern void sqlite3ParserTrace(FILE*, char *);
   608         -    if( getBoolean((u8 *)zRight) ){
   609         -      sqlite3ParserTrace(stdout, "parser: ");
   610         -    }else{
   611         -      sqlite3ParserTrace(0, 0);
          609  +    if( zRight ){
          610  +      if( getBoolean(zRight) ){
          611  +        sqlite3ParserTrace(stderr, "parser: ");
          612  +      }else{
          613  +        sqlite3ParserTrace(0, 0);
          614  +      }
   612    615       }
   613    616     }else
   614    617   #endif
          618  +
          619  +  /* Reinstall the LIKE and GLOB functions.  The variant of LIKE
          620  +  ** used will be case sensitive or not depending on the RHS.
          621  +  */
          622  +  if( sqlite3StrICmp(zLeft, "case_sensitive_like")==0 ){
          623  +    if( zRight ){
          624  +      sqlite3RegisterLikeFunctions(db, getBoolean((const u8 *)zRight));
          625  +    }
          626  +  }else
   615    627   
   616    628   #ifndef SQLITE_OMIT_INTEGRITY_CHECK
   617    629     if( sqlite3StrICmp(zLeft, "integrity_check")==0 ){
   618    630       int i, j, addr;
   619    631   
   620    632       /* Code that initializes the integrity check program.  Set the
   621    633       ** error count 0
................................................................................
   930    942     }
   931    943   pragma_out:
   932    944     sqliteFree(zLeft);
   933    945     sqliteFree(zRight);
   934    946   }
   935    947   
   936    948   #endif /* SQLITE_OMIT_PRAGMA || SQLITE_OMIT_PARSER */
   937         -
   938    949   }

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

    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15     15   ** This file contains the implementation of the sqlite3_prepare()
    16     16   ** interface, and routines that contribute to loading the database schema
    17     17   ** from disk.
    18     18   **
    19         -** $Id: prepare.c,v 1.2 2005/08/01 19:32:14 rmsimpson Exp $
           19  +** $Id: prepare.c,v 1.3 2005/08/22 18:22:12 rmsimpson Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   #include "os.h"
    23     23   #include <ctype.h>
    24     24   
    25     25   /*
    26     26   ** Fill the InitData structure with an error message that indicates
................................................................................
   293    293       zSql = sqlite3MPrintf(
   294    294           "SELECT name, rootpage, sql, '%s' FROM '%q'.%s",
   295    295           zDbNum, db->aDb[iDb].zName, zMasterName);
   296    296       sqlite3SafetyOff(db);
   297    297       rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0);
   298    298       sqlite3SafetyOn(db);
   299    299       sqliteFree(zSql);
          300  +#ifndef SQLITE_OMIT_ANALYZE
          301  +    if( rc==SQLITE_OK ){
          302  +      sqlite3AnalysisLoad(db, iDb);
          303  +    }
          304  +#endif
   300    305       sqlite3BtreeCloseCursor(curMain);
   301    306     }
   302    307     if( sqlite3_malloc_failed ){
   303    308       sqlite3SetString(pzErrMsg, "out of memory", (char*)0);
   304    309       rc = SQLITE_NOMEM;
   305    310       sqlite3ResetInternalSchema(db, 0);
   306    311     }
................................................................................
   369    374     int rc = SQLITE_OK;
   370    375     sqlite3 *db = pParse->db;
   371    376     if( !db->init.busy ){
   372    377       if( (db->flags & SQLITE_Initialized)==0 ){
   373    378         rc = sqlite3Init(db, &pParse->zErrMsg);
   374    379       }
   375    380     }
   376         -  assert( rc!=SQLITE_OK || (db->flags & SQLITE_Initialized)||db->init.busy );
          381  +  assert( rc!=SQLITE_OK || (db->flags & SQLITE_Initialized) || db->init.busy );
   377    382     if( rc!=SQLITE_OK ){
   378    383       pParse->rc = rc;
   379    384       pParse->nErr++;
   380    385     }
   381    386     return rc;
   382    387   }
   383    388   
................................................................................
   525    530       int chars_parsed = sqlite3utf8CharLen(zSql8, zTail8-zSql8);
   526    531       *pzTail = (u8 *)zSql + sqlite3utf16ByteLen(zSql, chars_parsed);
   527    532     }
   528    533    
   529    534     return rc;
   530    535   }
   531    536   #endif /* SQLITE_OMIT_UTF16 */
   532         -
   533    537   }

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

   110    110   ** most frequently used conversion types first.
   111    111   */
   112    112   static const char aDigits[] = "0123456789ABCDEF0123456789abcdef";
   113    113   static const char aPrefix[] = "-x0\000X0";
   114    114   static const et_info fmtinfo[] = {
   115    115     {  'd', 10, 1, etRADIX,      0,  0 },
   116    116     {  's',  0, 4, etSTRING,     0,  0 },
          117  +  {  'g',  0, 1, etGENERIC,    30, 0 },
   117    118     {  'z',  0, 6, etDYNSTRING,  0,  0 },
   118    119     {  'q',  0, 4, etSQLESCAPE,  0,  0 },
   119    120     {  'Q',  0, 4, etSQLESCAPE2, 0,  0 },
   120    121     {  'c',  0, 0, etCHARX,      0,  0 },
   121    122     {  'o',  8, 0, etRADIX,      0,  2 },
   122    123     {  'u', 10, 0, etRADIX,      0,  0 },
   123    124     {  'x', 16, 0, etRADIX,      16, 1 },
   124    125     {  'X', 16, 0, etRADIX,      0,  4 },
   125    126     {  'f',  0, 1, etFLOAT,      0,  0 },
   126    127     {  'e',  0, 1, etEXP,        30, 0 },
   127    128     {  'E',  0, 1, etEXP,        14, 0 },
   128         -  {  'g',  0, 1, etGENERIC,    30, 0 },
   129    129     {  'G',  0, 1, etGENERIC,    14, 0 },
   130    130     {  'i', 10, 1, etRADIX,      0,  0 },
   131    131     {  'n',  0, 0, etSIZE,       0,  0 },
   132    132     {  '%',  0, 0, etPERCENT,    0,  0 },
   133    133     {  'p', 16, 0, etPOINTER,    0,  1 },
   134    134     {  'T',  0, 2, etTOKEN,      0,  0 },
   135    135     {  'S',  0, 2, etSRCLIST,    0,  0 },
................................................................................
   209    209     int idx;                   /* A general purpose loop counter */
   210    210     int count;                 /* Total number of characters output */
   211    211     int width;                 /* Width of the current field */
   212    212     etByte flag_leftjustify;   /* True if "-" flag is present */
   213    213     etByte flag_plussign;      /* True if "+" flag is present */
   214    214     etByte flag_blanksign;     /* True if " " flag is present */
   215    215     etByte flag_alternateform; /* True if "#" flag is present */
          216  +  etByte flag_altform2;      /* True if "!" flag is present */
   216    217     etByte flag_zeropad;       /* True if field width constant starts with zero */
   217    218     etByte flag_long;          /* True if "l" flag is present */
   218    219     etByte flag_longlong;      /* True if the "ll" flag is present */
          220  +  etByte done;               /* Loop termination flag */
   219    221     UINT64_TYPE longvalue;     /* Value for integer types */
   220    222     LONGDOUBLE_TYPE realvalue; /* Value for real types */
   221    223     const et_info *infop;      /* Pointer to the appropriate info structure */
   222    224     char buf[etBUFSIZE];       /* Conversion buffer */
   223    225     char prefix;               /* Prefix character.  "+" or "-" or " " or '\0'. */
   224    226     etByte errorflag = 0;      /* True if an error is encountered */
   225    227     etByte xtype;              /* Conversion paradigm */
   226    228     char *zExtra;              /* Extra memory used for etTCLESCAPE conversions */
   227    229     static const char spaces[] =
   228    230      "                                                                         ";
   229    231   #define etSPACESIZE (sizeof(spaces)-1)
   230    232   #ifndef etNOFLOATINGPOINT
   231         -  int  exp;                  /* exponent of real numbers */
          233  +  int  exp, e2;              /* exponent of real numbers */
   232    234     double rounder;            /* Used for rounding floating point values */
   233    235     etByte flag_dp;            /* True if decimal point should be shown */
   234    236     etByte flag_rtz;           /* True if trailing zeros should be removed */
   235    237     etByte flag_exp;           /* True to force display of the exponent */
   236    238     int nsd;                   /* Number of significant digits returned */
   237    239   #endif
   238    240   
................................................................................
   253    255         errorflag = 1;
   254    256         (*func)(arg,"%",1);
   255    257         count++;
   256    258         break;
   257    259       }
   258    260       /* Find out what flags are present */
   259    261       flag_leftjustify = flag_plussign = flag_blanksign = 
   260         -     flag_alternateform = flag_zeropad = 0;
          262  +     flag_alternateform = flag_altform2 = flag_zeropad = 0;
          263  +    done = 0;
   261    264       do{
   262    265         switch( c ){
   263         -        case '-':   flag_leftjustify = 1;     c = 0;   break;
   264         -        case '+':   flag_plussign = 1;        c = 0;   break;
   265         -        case ' ':   flag_blanksign = 1;       c = 0;   break;
   266         -        case '#':   flag_alternateform = 1;   c = 0;   break;
   267         -        case '0':   flag_zeropad = 1;         c = 0;   break;
   268         -        default:                                       break;
          266  +        case '-':   flag_leftjustify = 1;     break;
          267  +        case '+':   flag_plussign = 1;        break;
          268  +        case ' ':   flag_blanksign = 1;       break;
          269  +        case '#':   flag_alternateform = 1;   break;
          270  +        case '!':   flag_altform2 = 1;        break;
          271  +        case '0':   flag_zeropad = 1;         break;
          272  +        default:    done = 1;                 break;
   269    273         }
   270         -    }while( c==0 && (c=(*++fmt))!=0 );
          274  +    }while( !done && (c=(*++fmt))!=0 );
   271    275       /* Get the field width */
   272    276       width = 0;
   273    277       if( c=='*' ){
   274    278         width = va_arg(ap,int);
   275    279         if( width<0 ){
   276    280           flag_leftjustify = 1;
   277    281           width = -width;
................................................................................
   335    339         precision = etBUFSIZE-40;
   336    340       }
   337    341   
   338    342       /*
   339    343       ** At this point, variables are initialized as follows:
   340    344       **
   341    345       **   flag_alternateform          TRUE if a '#' is present.
          346  +    **   flag_altform2               TRUE if a '!' is present.
   342    347       **   flag_plussign               TRUE if a '+' is present.
   343    348       **   flag_leftjustify            TRUE if a '-' is present or if the
   344    349       **                               field width was negative.
   345    350       **   flag_zeropad                TRUE if the width began with 0.
   346    351       **   flag_long                   TRUE if the letter 'l' (ell) prefixed
   347    352       **                               the conversion character.
   348    353       **   flag_longlong               TRUE if the letter 'll' (ell ell) prefixed
................................................................................
   413    418           break;
   414    419         case etFLOAT:
   415    420         case etEXP:
   416    421         case etGENERIC:
   417    422           realvalue = va_arg(ap,double);
   418    423   #ifndef etNOFLOATINGPOINT
   419    424           if( precision<0 ) precision = 6;         /* Set default precision */
   420         -        if( precision>etBUFSIZE-10 ) precision = etBUFSIZE-10;
          425  +        if( precision>etBUFSIZE/2-10 ) precision = etBUFSIZE/2-10;
   421    426           if( realvalue<0.0 ){
   422    427             realvalue = -realvalue;
   423    428             prefix = '-';
   424    429           }else{
   425    430             if( flag_plussign )          prefix = '+';
   426    431             else if( flag_blanksign )    prefix = ' ';
   427    432             else                         prefix = 0;
   428    433           }
   429         -        if( infop->type==etGENERIC && precision>0 ) precision--;
   430         -        rounder = 0.0;
          434  +        if( xtype==etGENERIC && precision>0 ) precision--;
   431    435   #if 0
   432    436           /* Rounding works like BSD when the constant 0.4999 is used.  Wierd! */
   433    437           for(idx=precision, rounder=0.4999; idx>0; idx--, rounder*=0.1);
   434    438   #else
   435    439           /* It makes more sense to use 0.5 */
   436    440           for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1);
   437    441   #endif
   438         -        if( infop->type==etFLOAT ) realvalue += rounder;
          442  +        if( xtype==etFLOAT ) realvalue += rounder;
   439    443           /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
   440    444           exp = 0;
   441    445           if( realvalue>0.0 ){
   442         -          while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }
   443         -          while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; }
          446  +          while( realvalue>1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; }
          447  +          while( realvalue>1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }
          448  +          while( realvalue>10.0 && exp<=350 ){ realvalue *= 0.1; exp++; }
   444    449             while( realvalue<1e-8 && exp>=-350 ){ realvalue *= 1e8; exp-=8; }
   445    450             while( realvalue<1.0 && exp>=-350 ){ realvalue *= 10.0; exp--; }
   446    451             if( exp>350 || exp<-350 ){
   447    452               bufpt = "NaN";
   448    453               length = 3;
   449    454               break;
   450    455             }
................................................................................
   466    471             }else{
   467    472               precision = precision - exp;
   468    473               xtype = etFLOAT;
   469    474             }
   470    475           }else{
   471    476             flag_rtz = 0;
   472    477           }
   473         -        /*
   474         -        ** The "exp+precision" test causes output to be of type etEXP if
   475         -        ** the precision is too large to fit in buf[].
   476         -        */
          478  +        if( xtype==etEXP ){
          479  +          e2 = 0;
          480  +        }else{
          481  +          e2 = exp;
          482  +        }
   477    483           nsd = 0;
   478         -        if( xtype==etFLOAT && exp+precision<etBUFSIZE-30 ){
   479         -          flag_dp = (precision>0 || flag_alternateform);
   480         -          if( prefix ) *(bufpt++) = prefix;         /* Sign */
   481         -          if( exp<0 )  *(bufpt++) = '0';            /* Digits before "." */
   482         -          else for(; exp>=0; exp--) *(bufpt++) = et_getdigit(&realvalue,&nsd);
   483         -          if( flag_dp ) *(bufpt++) = '.';           /* The decimal point */
   484         -          for(exp++; exp<0 && precision>0; precision--, exp++){
   485         -            *(bufpt++) = '0';
   486         -          }
   487         -          while( (precision--)>0 ) *(bufpt++) = et_getdigit(&realvalue,&nsd);
   488         -          *(bufpt--) = 0;                           /* Null terminate */
   489         -          if( flag_rtz && flag_dp ){     /* Remove trailing zeros and "." */
   490         -            while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0;
   491         -            if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0;
          484  +        flag_dp = (precision>0) | flag_alternateform | flag_altform2;
          485  +        /* The sign in front of the number */
          486  +        if( prefix ){
          487  +          *(bufpt++) = prefix;
          488  +        }
          489  +        /* Digits prior to the decimal point */
          490  +        if( e2<0 ){
          491  +          *(bufpt++) = '0';
          492  +        }else{
          493  +          for(; e2>=0; e2--){
          494  +            *(bufpt++) = et_getdigit(&realvalue,&nsd);
   492    495             }
   493         -          bufpt++;                            /* point to next free slot */
   494         -        }else{    /* etEXP or etGENERIC */
   495         -          flag_dp = (precision>0 || flag_alternateform);
   496         -          if( prefix ) *(bufpt++) = prefix;   /* Sign */
   497         -          *(bufpt++) = et_getdigit(&realvalue,&nsd);  /* First digit */
   498         -          if( flag_dp ) *(bufpt++) = '.';     /* Decimal point */
   499         -          while( (precision--)>0 ) *(bufpt++) = et_getdigit(&realvalue,&nsd);
   500         -          bufpt--;                            /* point to last digit */
   501         -          if( flag_rtz && flag_dp ){          /* Remove tail zeros */
   502         -            while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0;
   503         -            if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0;
   504         -          }
   505         -          bufpt++;                            /* point to next free slot */
   506         -          if( exp || flag_exp ){
   507         -            *(bufpt++) = aDigits[infop->charset];
   508         -            if( exp<0 ){ *(bufpt++) = '-'; exp = -exp; } /* sign of exp */
   509         -            else       { *(bufpt++) = '+'; }
   510         -            if( exp>=100 ){
   511         -              *(bufpt++) = (exp/100)+'0';                /* 100's digit */
   512         -              exp %= 100;
          496  +        }
          497  +        /* The decimal point */
          498  +        if( flag_dp ){
          499  +          *(bufpt++) = '.';
          500  +        }
          501  +        /* "0" digits after the decimal point but before the first
          502  +        ** significant digit of the number */
          503  +        for(e2++; e2<0 && precision>0; precision--, e2++){
          504  +          *(bufpt++) = '0';
          505  +        }
          506  +        /* Significant digits after the decimal point */
          507  +        while( (precision--)>0 ){
          508  +          *(bufpt++) = et_getdigit(&realvalue,&nsd);
          509  +        }
          510  +        /* Remove trailing zeros and the "." if no digits follow the "." */
          511  +        if( flag_rtz && flag_dp ){
          512  +          while( bufpt[-1]=='0' ) *(--bufpt) = 0;
          513  +          assert( bufpt>buf );
          514  +          if( bufpt[-1]=='.' ){
          515  +            if( flag_altform2 ){
          516  +              *(bufpt++) = '0';
          517  +            }else{
          518  +              *(--bufpt) = 0;
   513    519               }
   514         -            *(bufpt++) = exp/10+'0';                     /* 10's digit */
   515         -            *(bufpt++) = exp%10+'0';                     /* 1's digit */
          520  +          }
          521  +        }
          522  +        /* Add the "eNNN" suffix */
          523  +        if( flag_exp || (xtype==etEXP && exp) ){
          524  +          *(bufpt++) = aDigits[infop->charset];
          525  +          if( exp<0 ){
          526  +            *(bufpt++) = '-'; exp = -exp;
          527  +          }else{
          528  +            *(bufpt++) = '+';
          529  +          }
          530  +          if( exp>=100 ){
          531  +            *(bufpt++) = (exp/100)+'0';                /* 100's digit */
          532  +            exp %= 100;
   516    533             }
          534  +          *(bufpt++) = exp/10+'0';                     /* 10's digit */
          535  +          *(bufpt++) = exp%10+'0';                     /* 1's digit */
   517    536           }
          537  +        *bufpt = 0;
          538  +
   518    539           /* The converted number is in buf[] and zero terminated. Output it.
   519    540           ** Note that the number is in the usual order, not reversed as with
   520    541           ** integer conversions. */
   521    542           length = bufpt-buf;
   522    543           bufpt = buf;
   523    544   
   524    545           /* Special case:  Add leading zeros if the flag_zeropad flag is
................................................................................
   563    584           }else if( xtype==etDYNSTRING ){
   564    585             zExtra = bufpt;
   565    586           }
   566    587           length = strlen(bufpt);
   567    588           if( precision>=0 && precision<length ) length = precision;
   568    589           break;
   569    590         case etSQLESCAPE:
   570         -      case etSQLESCAPE2:
   571         -        {
   572         -          int i, j, n, c, isnull;
   573         -          int needQuote;
   574         -          char *arg = va_arg(ap,char*);
   575         -          isnull = arg==0;
   576         -          if( isnull ) arg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
   577         -          for(i=n=0; (c=arg[i])!=0; i++){
   578         -            if( c=='\'' )  n++;
   579         -          }
   580         -          needQuote = !isnull && xtype==etSQLESCAPE2;
   581         -          n += i + 1 + needQuote*2;
   582         -          if( n>etBUFSIZE ){
   583         -            bufpt = zExtra = (char *)sqliteMalloc( n );
   584         -            if( bufpt==0 ) return -1;
   585         -          }else{
   586         -            bufpt = buf;
   587         -          }
   588         -          j = 0;
   589         -          if( needQuote ) bufpt[j++] = '\'';
   590         -          for(i=0; (c=arg[i])!=0; i++){
   591         -            bufpt[j++] = c;
   592         -            if( c=='\'' ) bufpt[j++] = c;
   593         -          }
   594         -          if( needQuote ) bufpt[j++] = '\'';
   595         -          bufpt[j] = 0;
   596         -          length = j;
   597         -          if( precision>=0 && precision<length ) length = precision;
          591  +      case etSQLESCAPE2: {
          592  +        int i, j, n, c, isnull;
          593  +        int needQuote;
          594  +        char *arg = va_arg(ap,char*);
          595  +        isnull = arg==0;
          596  +        if( isnull ) arg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
          597  +        for(i=n=0; (c=arg[i])!=0; i++){
          598  +          if( c=='\'' )  n++;
          599  +        }
          600  +        needQuote = !isnull && xtype==etSQLESCAPE2;
          601  +        n += i + 1 + needQuote*2;
          602  +        if( n>etBUFSIZE ){
          603  +          bufpt = zExtra = (char *)sqliteMalloc( n );
          604  +          if( bufpt==0 ) return -1;
          605  +        }else{
          606  +          bufpt = buf;
          607  +        }
          608  +        j = 0;
          609  +        if( needQuote ) bufpt[j++] = '\'';
          610  +        for(i=0; (c=arg[i])!=0; i++){
          611  +          bufpt[j++] = c;
          612  +          if( c=='\'' ) bufpt[j++] = c;
   598    613           }
          614  +        if( needQuote ) bufpt[j++] = '\'';
          615  +        bufpt[j] = 0;
          616  +        length = j;
          617  +        if( precision>=0 && precision<length ) length = precision;
   599    618           break;
          619  +      }
   600    620         case etTOKEN: {
   601    621           Token *pToken = va_arg(ap, Token*);
   602    622           if( pToken && pToken->z ){
   603         -          (*func)(arg, (char *)pToken->z, pToken->n);
          623  +          (*func)(arg, (const char *)pToken->z, pToken->n);
   604    624           }
   605    625           length = width = 0;
   606    626           break;
   607    627         }
   608    628         case etSRCLIST: {
   609    629           SrcList *pSrc = va_arg(ap, SrcList*);
   610    630           int k = va_arg(ap, int);
   611         -        struct SrcList::SrcList_item *pItem = &pSrc->a[k];
          631  +		struct SrcList::SrcList_item *pItem = &pSrc->a[k];
   612    632           assert( k>=0 && k<pSrc->nSrc );
   613    633           if( pItem->zDatabase && pItem->zDatabase[0] ){
   614    634             (*func)(arg, pItem->zDatabase, strlen(pItem->zDatabase));
   615    635             (*func)(arg, ".", 1);
   616    636           }
   617    637           (*func)(arg, pItem->zName, strlen(pItem->zName));
   618    638           length = width = 0;
................................................................................
   828    848     va_start(ap, zFormat);
   829    849     base_vprintf(0, 0, zBuf, sizeof(zBuf), zFormat, ap);
   830    850     va_end(ap);
   831    851     fprintf(stdout,"%d: %s", getpid(), zBuf);
   832    852     fflush(stdout);
   833    853   }
   834    854   #endif
   835         -
   836    855   }

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

    14     14   *************************************************************************
    15     15   ** This file contains code to implement a pseudo-random number
    16     16   ** generator (PRNG) for SQLite.
    17     17   **
    18     18   ** Random numbers are used by some of the database backends in order
    19     19   ** to generate random integer keys for tables or random filenames.
    20     20   **
    21         -** $Id: random.c,v 1.6 2005/08/01 19:32:14 rmsimpson Exp $
           21  +** $Id: random.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    22     22   */
    23     23   #include "sqliteInt.h"
    24     24   #include "os.h"
    25     25   
    26     26   
    27     27   /*
    28     28   ** Get a single 8-bit random value from the RC4 PRNG.  The Mutex
................................................................................
    97     97     unsigned char *zBuf = (unsigned char *)pBuf;
    98     98     sqlite3OsEnterMutex();
    99     99     while( N-- ){
   100    100       *(zBuf++) = randomByte();
   101    101     }
   102    102     sqlite3OsLeaveMutex();
   103    103   }
   104         -
   105    104   }

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

    11     11   **    May you find forgiveness for yourself and forgive others.
    12     12   **    May you share freely, never taking more than you give.
    13     13   **
    14     14   *************************************************************************
    15     15   ** This file contains C code routines that are called by the parser
    16     16   ** to handle SELECT statements in SQLite.
    17     17   **
    18         -** $Id: select.c,v 1.6 2005/08/01 19:32:14 rmsimpson Exp $
           18  +** $Id: select.c,v 1.7 2005/08/22 18:22:12 rmsimpson Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21         -#include "../Interop.h"
           21  +#include "../interop.h"
    22     22   
    23     23   /*
    24     24   ** Allocate a new Select structure and return a pointer to that
    25     25   ** structure.
    26     26   */
    27     27   Select *sqlite3SelectNew(
    28     28     ExprList *pEList,     /* which columns to include in the result */
................................................................................
    84     84   ** a join type, but put an error in the pParse structure.
    85     85   */
    86     86   int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){
    87     87     int jointype = 0;
    88     88     Token *apAll[3];
    89     89     Token *p;
    90     90     static const struct {
    91         -    const char *zKeyword;
           91  +    const char zKeyword[8];
    92     92       u8 nChar;
    93     93       u8 code;
    94     94     } keywords[] = {
    95     95       { "natural", 7, JT_NATURAL },
    96     96       { "left",    4, JT_LEFT|JT_OUTER },
    97     97       { "right",   5, JT_RIGHT|JT_OUTER },
    98     98