System.Data.SQLite

Check-in [1eef5ec724]
Login

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

Overview
Comment:3.14 code merge
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 1eef5ec724761830204f413041df6f1166612cfc
User & Date: rmsimpson 2005-03-11 15:03:28.000
Context
2005-03-11
21:39
1.08 check-in: 40c497decf user: rmsimpson tags: sourceforge
15:03
3.14 code merge check-in: 1eef5ec724 user: rmsimpson tags: sourceforge
2005-03-09
22:57
Was not meant to be committed in the first place, superceded by SQLiteStatement check-in: df0aff485f user: rmsimpson tags: sourceforge
Changes
Unified Diff Ignore Whitespace Patch
Changes to SQLite.Interop/src/alter.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that used to generate VDBE code
** that implements the ALTER TABLE command.
**
** $Id: alter.c,v 1.1 2005/03/01 16:04:26 rmsimpson Exp $
*/
#include "sqliteInt.h"

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







|







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

/*
** The code in this file only exists if we are not omitting the
** ALTER TABLE logic from the build.
*/
Changes to SQLite.Interop/src/attach.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: attach.c,v 1.1 2005/03/01 16:04:26 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** This routine is called by the parser to process an ATTACH statement:
**
**     ATTACH DATABASE filename AS dbname













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: attach.c,v 1.2 2005/03/11 15:03:28 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** This routine is called by the parser to process an ATTACH statement:
**
**     ATTACH DATABASE filename AS dbname
Changes to SQLite.Interop/src/auth.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains code used to implement the sqlite3_set_authorizer()
** API.  This facility is an optional feature of the library.  Embedded
** systems that do not need this facility may omit it by recompiling
** the library with -DSQLITE_OMIT_AUTHORIZATION=1
**
** $Id: auth.c,v 1.1 2005/03/01 16:04:26 rmsimpson Exp $
*/
#include "sqliteInt.h"

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







|







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

/*
** All of the code in this file may be omitted by defining a single
** macro.
*/
Changes to SQLite.Interop/src/btree.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
** 2004 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.1 2005/03/01 16:04:27 rmsimpson Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
** 2004 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.2 2005/03/11 15:03:28 rmsimpson Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
1839
1840
1841
1842
1843
1844
1845
1846



1847
1848
1849
1850
1851
1852
1853
    /* If iDbPage is a pointer map page, or the pending-byte page, skip it. */
    if( PTRMAP_ISPAGE(pgsz, iDbPage) || iDbPage==PENDING_BYTE_PAGE(pBt) ){
      continue;
    }

    rc = ptrmapGet(pBt, iDbPage, &eType, &iPtrPage);
    if( rc!=SQLITE_OK ) goto autovacuum_out;
    assert( eType!=PTRMAP_ROOTPAGE );




    /* If iDbPage is free, do not swap it.  */
    if( eType==PTRMAP_FREEPAGE ){
      continue;
    }
    rc = getPage(pBt, iDbPage, &pDbMemPage);
    if( rc!=SQLITE_OK ) goto autovacuum_out;







|
>
>
>







1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
    /* If iDbPage is a pointer map page, or the pending-byte page, skip it. */
    if( PTRMAP_ISPAGE(pgsz, iDbPage) || iDbPage==PENDING_BYTE_PAGE(pBt) ){
      continue;
    }

    rc = ptrmapGet(pBt, iDbPage, &eType, &iPtrPage);
    if( rc!=SQLITE_OK ) goto autovacuum_out;
    if( eType==PTRMAP_ROOTPAGE ){
      rc = SQLITE_CORRUPT;
      goto autovacuum_out;
    }

    /* If iDbPage is free, do not swap it.  */
    if( eType==PTRMAP_FREEPAGE ){
      continue;
    }
    rc = getPage(pBt, iDbPage, &pDbMemPage);
    if( rc!=SQLITE_OK ) goto autovacuum_out;
2371
2372
2373
2374
2375
2376
2377



2378
2379
2380
2381
2382
2383
2384
** Return SQLITE_OK on success or an error code if anything goes
** wrong.  An error is returned if "offset+amt" is larger than
** the available payload.
*/
int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
  assert( pCur->isValid );
  assert( pCur->pPage!=0 );



  assert( pCur->pPage->intKey==0 );
  assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
  return getPayload(pCur, offset, amt, (unsigned char*)pBuf, 0);
}

/*
** Read part of the data associated with cursor pCur.  Exactly







>
>
>







2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
** Return SQLITE_OK on success or an error code if anything goes
** wrong.  An error is returned if "offset+amt" is larger than
** the available payload.
*/
int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
  assert( pCur->isValid );
  assert( pCur->pPage!=0 );
  if( pCur->pPage->intKey ){
    return SQLITE_CORRUPT;
  }
  assert( pCur->pPage->intKey==0 );
  assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
  return getPayload(pCur, offset, amt, (unsigned char*)pBuf, 0);
}

/*
** Read part of the data associated with cursor pCur.  Exactly
4686
4687
4688
4689
4690
4691
4692




4693
4694

4695
4696
4697
4698
4699
4700
4701

      releasePage(pPageMove);
      rc = getPage(pBt, pgnoRoot, &pRoot);
      if( rc!=SQLITE_OK ){
        return rc;
      }
      rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);




      assert( eType!=PTRMAP_ROOTPAGE );
      assert( eType!=PTRMAP_FREEPAGE );

      if( rc!=SQLITE_OK ){
        releasePage(pRoot);
        return rc;
      }
      rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove);
      releasePage(pRoot);
      if( rc!=SQLITE_OK ){







>
>
>
>


>







4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712

      releasePage(pPageMove);
      rc = getPage(pBt, pgnoRoot, &pRoot);
      if( rc!=SQLITE_OK ){
        return rc;
      }
      rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);
      if( rc!=SQLITE_OK || eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){
        releasePage(pRoot);
        return rc;
      }
      assert( eType!=PTRMAP_ROOTPAGE );
      assert( eType!=PTRMAP_FREEPAGE );
      rc = sqlite3pager_write(pRoot->aData);
      if( rc!=SQLITE_OK ){
        releasePage(pRoot);
        return rc;
      }
      rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove);
      releasePage(pRoot);
      if( rc!=SQLITE_OK ){
Changes to SQLite.Interop/src/btree.h.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite B-Tree file
** subsystem.  See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: btree.h,v 1.1 2005/03/01 16:04:27 rmsimpson Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_

/* TODO: This definition is just included so other modules compile. It
** needs to be revisited.
*/







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite B-Tree file
** subsystem.  See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: btree.h,v 1.2 2005/03/11 15:03:29 rmsimpson Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_

/* TODO: This definition is just included so other modules compile. It
** needs to be revisited.
*/
Changes to SQLite.Interop/src/build.c.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
**     CREATE INDEX
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**
** $Id: build.c,v 1.1 2005/03/01 16:04:28 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

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







|







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

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Initialize the pParse structure as needed.
Changes to SQLite.Interop/src/date.c.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This file contains the C functions that implement date and time
** functions for SQLite.  
**
** There is only one exported symbol in this file - the function
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: date.c,v 1.1 2005/03/01 16:04:28 rmsimpson Exp $
**
** NOTES:
**
** SQLite processes all times and dates as Julian Day numbers.  The
** dates and times are stored as the number of days since noon
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
** calendar system.







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This file contains the C functions that implement date and time
** functions for SQLite.  
**
** There is only one exported symbol in this file - the function
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: date.c,v 1.2 2005/03/11 15:03:29 rmsimpson Exp $
**
** NOTES:
**
** SQLite processes all times and dates as Julian Day numbers.  The
** dates and times are stored as the number of days since noon
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
** calendar system.
Changes to SQLite.Interop/src/delete.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** in order to generate code for DELETE FROM statements.
**
** $Id: delete.c,v 1.1 2005/03/01 16:04:29 rmsimpson Exp $
*/
#include "sqliteInt.h"

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







|







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

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

439
440
441
442
443
  sqlite3VdbeAddOp(v, OP_Recno, iCur, 0);
  for(j=0; j<pIdx->nColumn; j++){
    int idx = pIdx->aiColumn[j];
    if( idx==pTab->iPKey ){
      sqlite3VdbeAddOp(v, OP_Dup, j, 0);
    }else{
      sqlite3VdbeAddOp(v, OP_Column, iCur, idx);

    }
  }
  sqlite3VdbeAddOp(v, OP_MakeRecord, pIdx->nColumn, (1<<24));
  sqlite3IndexAffinityStr(v, pIdx);
}







>





432
433
434
435
436
437
438
439
440
441
442
443
444
  sqlite3VdbeAddOp(v, OP_Recno, iCur, 0);
  for(j=0; j<pIdx->nColumn; j++){
    int idx = pIdx->aiColumn[j];
    if( idx==pTab->iPKey ){
      sqlite3VdbeAddOp(v, OP_Dup, j, 0);
    }else{
      sqlite3VdbeAddOp(v, OP_Column, iCur, idx);
      sqlite3ColumnDefault(v, pTab, idx);
    }
  }
  sqlite3VdbeAddOp(v, OP_MakeRecord, pIdx->nColumn, (1<<24));
  sqlite3IndexAffinityStr(v, pIdx);
}
Changes to SQLite.Interop/src/expr.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.1 2005/03/01 16:04:29 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

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







|







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

/*
** Return the 'affinity' of the expression pExpr if any.
**
399
400
401
402
403
404
405

406
407
408
409
410
411
412
    assert( pNew->token.z==0 );
  }
  pNew->span.z = 0;
  pNew->pLeft = sqlite3ExprDup(p->pLeft);
  pNew->pRight = sqlite3ExprDup(p->pRight);
  pNew->pList = sqlite3ExprListDup(p->pList);
  pNew->pSelect = sqlite3SelectDup(p->pSelect);

  return pNew;
}
void sqlite3TokenCopy(Token *pTo, Token *pFrom){
  if( pTo->dyn ) sqliteFree((char*)pTo->z);
  if( pFrom->z ){
    pTo->n = pFrom->n;
    pTo->z = sqliteStrNDup(pFrom->z, pFrom->n);







>







399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
    assert( pNew->token.z==0 );
  }
  pNew->span.z = 0;
  pNew->pLeft = sqlite3ExprDup(p->pLeft);
  pNew->pRight = sqlite3ExprDup(p->pRight);
  pNew->pList = sqlite3ExprListDup(p->pList);
  pNew->pSelect = sqlite3SelectDup(p->pSelect);
  pNew->pTab = p->pTab;
  return pNew;
}
void sqlite3TokenCopy(Token *pTo, Token *pFrom){
  if( pTo->dyn ) sqliteFree((char*)pTo->z);
  if( pFrom->z ){
    pTo->n = pFrom->n;
    pTo->z = sqliteStrNDup(pFrom->z, pFrom->n);
843
844
845
846
847
848
849

850
851
852
853
854
855
856
        cntTab++;
        for(j=0; j < pTab->nCol; j++, pCol++) {
          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
            cnt++;
            pExpr->iColumn = j==pTab->iPKey ? -1 : j;
            pExpr->affinity = pTab->aCol[j].affinity;
            pExpr->pColl = pTab->aCol[j].pColl;

            break;
          }
        }
      }
    }
#endif /* !defined(SQLITE_OMIT_TRIGGER) */








>







844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
        cntTab++;
        for(j=0; j < pTab->nCol; j++, pCol++) {
          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
            cnt++;
            pExpr->iColumn = j==pTab->iPKey ? -1 : j;
            pExpr->affinity = pTab->aCol[j].affinity;
            pExpr->pColl = pTab->aCol[j].pColl;
            pExpr->pTab = pTab;
            break;
          }
        }
      }
    }
#endif /* !defined(SQLITE_OMIT_TRIGGER) */

954
955
956
957
958
959
960



961
962
963
964
965
966
967
  pExpr->pLeft = 0;
  sqlite3ExprDelete(pExpr->pRight);
  pExpr->pRight = 0;
  pExpr->op = TK_COLUMN;
  if( cnt==1 ){
    assert( pNC!=0 );
    sqlite3AuthRead(pParse, pExpr, pNC->pSrcList);



  }
  return cnt!=1;
}

/*
** pExpr is a node that defines a function of some kind.  It might
** be a syntactic function like "count(x)" or it might be a function







>
>
>







956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
  pExpr->pLeft = 0;
  sqlite3ExprDelete(pExpr->pRight);
  pExpr->pRight = 0;
  pExpr->op = TK_COLUMN;
  if( cnt==1 ){
    assert( pNC!=0 );
    sqlite3AuthRead(pParse, pExpr, pNC->pSrcList);
    if( pMatch && !pMatch->pSelect ){
      pExpr->pTab = pMatch->pTab;
    }
  }
  return cnt!=1;
}

/*
** pExpr is a node that defines a function of some kind.  It might
** be a syntactic function like "count(x)" or it might be a function
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
  op = pExpr->op;
  switch( op ){
    case TK_COLUMN: {
      if( !pParse->fillAgg && pExpr->iAgg>=0 ){
        sqlite3VdbeAddOp(v, OP_AggGet, pExpr->iAggCtx, pExpr->iAgg);
      }else if( pExpr->iColumn>=0 ){
        sqlite3VdbeAddOp(v, OP_Column, pExpr->iTable, pExpr->iColumn);
#ifndef NDEBUG
        if( pExpr->span.z && pExpr->span.n>0 && pExpr->span.n<100 ){
          VdbeComment((v, "# %T", &pExpr->span));
        }
#endif
      }else{
        sqlite3VdbeAddOp(v, OP_Recno, pExpr->iTable, 0);
      }
      break;
    }
    case TK_INTEGER: {
      codeInteger(v, pExpr->token.z, pExpr->token.n);







<
<
|
<
<







1386
1387
1388
1389
1390
1391
1392


1393


1394
1395
1396
1397
1398
1399
1400
  op = pExpr->op;
  switch( op ){
    case TK_COLUMN: {
      if( !pParse->fillAgg && pExpr->iAgg>=0 ){
        sqlite3VdbeAddOp(v, OP_AggGet, pExpr->iAggCtx, pExpr->iAgg);
      }else if( pExpr->iColumn>=0 ){
        sqlite3VdbeAddOp(v, OP_Column, pExpr->iTable, pExpr->iColumn);


        sqlite3ColumnDefault(v, pExpr->pTab, pExpr->iColumn);


      }else{
        sqlite3VdbeAddOp(v, OP_Recno, pExpr->iTable, 0);
      }
      break;
    }
    case TK_INTEGER: {
      codeInteger(v, pExpr->token.z, pExpr->token.n);
Changes to SQLite.Interop/src/func.c.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This file contains the C functions that implement various SQL
** functions of SQLite.  
**
** There is only one exported symbol in this file - the function
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: func.c,v 1.1 2005/03/01 16:04:29 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include "vdbeInt.h"







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This file contains the C functions that implement various SQL
** functions of SQLite.  
**
** There is only one exported symbol in this file - the function
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: func.c,v 1.2 2005/03/11 15:03:29 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include "vdbeInt.h"
Changes to SQLite.Interop/src/hash.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the implementation of generic hash-tables
** used in SQLite.
**
** $Id: hash.c,v 1.1 2005/03/01 16:04:29 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <assert.h>

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







|







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

/* Turn bulk memory into a hash table object by initializing the
** fields of the Hash structure.
**
Changes to SQLite.Interop/src/hash.h.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the header file for the generic hash-table implemenation
** used in SQLite.
**
** $Id: hash.h,v 1.1 2005/03/01 16:04:29 rmsimpson Exp $
*/
#ifndef _SQLITE_HASH_H_
#define _SQLITE_HASH_H_

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







|







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

/* Forward declarations of structures. */
typedef struct Hash Hash;
typedef struct HashElem HashElem;
Changes to SQLite.Interop/src/insert.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.1 2005/03/01 16:04:30 rmsimpson Exp $
*/
#include "sqliteInt.h"

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







|







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

/*
** Set P3 of the most recently inserted opcode to a column affinity
** string for index pIdx. A column affinity string has one character
** for each column in the table, according to the affinity of the column:
Changes to SQLite.Interop/src/legacy.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: legacy.c,v 1.1 2005/03/01 16:04:30 rmsimpson Exp $
*/

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

/*







|







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

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

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

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







|







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

/*
** The following constant value is used by the SQLITE_BIGENDIAN and
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271

272
273
274

275
276
277
278
279
280
281
282
283
  if( iDb==0 ){
    db->file_format = meta[1];
    if( db->file_format==0 ){
      /* This happens if the database was initially empty */
      db->file_format = 1;
    }

    if( db->file_format==2 ){
      /* File format 2 is treated exactly as file format 1. New 
      ** databases are created with file format 1.
      */ 
      db->file_format = 1;
    }
  }

  /*
  ** file_format==1    Version 3.0.0.
  ** file_format==2    Version 3.1.3.

  **
  ** Version 3.0 can only use files with file_format==1. Version 3.1.3
  ** can read and write files with file_format==1 or file_format==2.

  */
  if( meta[1]>2 ){
    sqlite3BtreeCloseCursor(curMain);
    sqlite3SetString(pzErrMsg, "unsupported file format", (char*)0);
    return SQLITE_ERROR;
  }

  sqlite3BtreeSetCacheSize(db->aDb[iDb].pBt, db->aDb[iDb].cache_size);








|










>



>

|







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
  if( iDb==0 ){
    db->file_format = meta[1];
    if( db->file_format==0 ){
      /* This happens if the database was initially empty */
      db->file_format = 1;
    }

    if( db->file_format==2 || db->file_format==3 ){
      /* File format 2 is treated exactly as file format 1. New 
      ** databases are created with file format 1.
      */ 
      db->file_format = 1;
    }
  }

  /*
  ** file_format==1    Version 3.0.0.
  ** file_format==2    Version 3.1.3.
  ** file_format==3    Version 3.1.4.
  **
  ** Version 3.0 can only use files with file_format==1. Version 3.1.3
  ** can read and write files with file_format==1 or file_format==2.
  ** Version 3.1.4 can read and write file formats 1, 2 and 3.
  */
  if( meta[1]>3 ){
    sqlite3BtreeCloseCursor(curMain);
    sqlite3SetString(pzErrMsg, "unsupported file format", (char*)0);
    return SQLITE_ERROR;
  }

  sqlite3BtreeSetCacheSize(db->aDb[iDb].pBt, db->aDb[iDb].cache_size);

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




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



|
|
|








|











|


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

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







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











48








49


























50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

74
75
76
77
78





79
80
81
82
83


84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

111
112
113


114
115
116
117

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* Automatically generated.  Do not edit */
/* See the mkopcodeh.awk script for details */
#define OP_ContextPop                           1
#define OP_IntegrityCk                          2
#define OP_DropTrigger                          3
#define OP_DropIndex                            4
#define OP_Recno                                5
#define OP_KeyAsData                            6
#define OP_Delete                               7
#define OP_MoveGt                               8
#define OP_VerifyCookie                         9
#define OP_Push                                10
#define OP_Dup                                 11
#define OP_Blob                                12
#define OP_IdxGT                               13
#define OP_IdxRecno                            14
#define OP_RowKey                              15
#define OP_PutStrKey                           16
#define OP_IsUnique                            17
#define OP_SetNumColumns                       18
#define OP_Eq                                  73   /* same as TK_EQ       */
#define OP_Expire                              19
#define OP_IdxIsNull                           20
#define OP_NullRow                             21
#define OP_OpenPseudo                          22
#define OP_OpenWrite                           23
#define OP_OpenRead                            24
#define OP_Transaction                         25
#define OP_AutoCommit                          26
#define OP_Negative                            89   /* same as TK_UMINUS   */
#define OP_Pop                                 27
#define OP_Halt                                28
#define OP_Vacuum                              29
#define OP_ListRead                            30
#define OP_RowData                             31
#define OP_NotExists                           32
#define OP_MoveLe                              33
#define OP_SetCookie                           34
#define OP_Variable                            35
#define OP_AggNext                             36
#define OP_AggReset                            37
#define OP_Sort                                38
#define OP_AggContextPush                      39
#define OP_IdxDelete                           40
#define OP_ResetCount                          41
#define OP_OpenTemp                            42
#define OP_NotNull                             71   /* same as TK_NOTNULL  */











#define OP_Ge                                  77   /* same as TK_GE       */








#define OP_Remainder                           87   /* same as TK_REM      */


























#define OP_Divide                              86   /* same as TK_SLASH    */
#define OP_Integer                             43
#define OP_AggSet                              44
#define OP_CreateIndex                         45
#define OP_IdxPut                              46
#define OP_MoveLt                              47
#define OP_And                                 65   /* same as TK_AND      */
#define OP_ShiftLeft                           81   /* same as TK_LSHIFT   */
#define OP_Real                               130   /* same as TK_FLOAT    */
#define OP_Return                              48
#define OP_MemLoad                             49
#define OP_SortNext                            50
#define OP_IdxLT                               51
#define OP_Rewind                              52
#define OP_Gt                                  74   /* same as TK_GT       */
#define OP_AddImm                              53
#define OP_Subtract                            84   /* same as TK_MINUS    */
#define OP_AggFunc                             54
#define OP_AggInit                             55
#define OP_MemIncr                             56
#define OP_ListReset                           57
#define OP_Clear                               58
#define OP_PutIntKey                           59
#define OP_IsNull                              70   /* same as TK_ISNULL   */

#define OP_If                                  60
#define OP_Callback                            61
#define OP_SortReset                           62
#define OP_SortPut                             63
#define OP_AggContextPop                       67





#define OP_Last                                68
#define OP_NotFound                            69
#define OP_MakeRecord                          78
#define OP_BitAnd                              79   /* same as TK_BITAND   */
#define OP_Add                                 83   /* same as TK_PLUS     */


#define OP_HexBlob                            131   /* same as TK_BLOB     */
#define OP_String                              90
#define OP_Goto                                93
#define OP_AggFocus                            94
#define OP_IfMemPos                            95
#define OP_DropTable                           96
#define OP_Column                              97
#define OP_Noop                                98
#define OP_Not                                 66   /* same as TK_NOT      */
#define OP_Le                                  75   /* same as TK_LE       */
#define OP_BitOr                               80   /* same as TK_BITOR    */
#define OP_Multiply                            85   /* same as TK_STAR     */
#define OP_String8                             92   /* same as TK_STRING   */
#define OP_AggGet                              99
#define OP_CreateTable                        100
#define OP_NewRecno                           101
#define OP_Found                              102
#define OP_Distinct                           103
#define OP_Close                              104
#define OP_Statement                          105
#define OP_IfNot                              106
#define OP_Pull                               107
#define OP_MemMax                             108
#define OP_MemStore                           109
#define OP_Next                               110
#define OP_Prev                               111
#define OP_MoveGe                             112

#define OP_Lt                                  76   /* same as TK_LT       */
#define OP_Ne                                  72   /* same as TK_NE       */
#define OP_MustBeInt                          113


#define OP_ForceInt                           114
#define OP_ShiftRight                          82   /* same as TK_RSHIFT   */
#define OP_CollSeq                            115
#define OP_Gosub                              116

#define OP_ContextPush                        117
#define OP_ListRewind                         118
#define OP_ListWrite                          119
#define OP_ParseSchema                        120
#define OP_Destroy                            121
#define OP_IdxGE                              122
#define OP_FullKey                            123
#define OP_ReadCookie                         124
#define OP_BitNot                              91   /* same as TK_BITNOT   */
#define OP_AbsValue                           125
#define OP_Or                                  64   /* same as TK_OR       */
#define OP_Function                           126
#define OP_Concat                              88   /* same as TK_CONCAT   */

/* The following opcode values are never used */
#define OP_NotUsed_127                        127
#define OP_NotUsed_128                        128
#define OP_NotUsed_129                        129


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

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

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

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

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

>
|
|
|
|
|
>
>
>
>
>
|
|
|
|
|
>
>
|
|
|
|
|
<
<
<
|

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

|
|
>

<
|
>
>
|
|
|
|
>
|
|
|
<
<
|
<
<

|
<
|
<





1
2
3
4
5
6
7
8

9
10
11




12

13
14
15




16




















17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

66

67






68
69

70

71
72
73




74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97



98
99
100
101

102
103
104
105
106
107

108
109
110

111
112
113
114
115

116
117
118
119
120
121
122
123
124
125
126


127


128
129

130

131
132
133
134
135
/* Automatically generated.  Do not edit */
/* See the mkopcodeh.awk script for details */
#define OP_MemLoad                              1
#define OP_HexBlob                            131   /* same as TK_BLOB     */
#define OP_Column                               2
#define OP_SetCookie                            3
#define OP_IfMemPos                             4
#define OP_Real                               130   /* same as TK_FLOAT    */

#define OP_MoveGt                               5
#define OP_Ge                                  77   /* same as TK_GE       */
#define OP_AggFocus                             6




#define OP_RowKey                               7

#define OP_IdxRecno                             8
#define OP_AggNext                              9
#define OP_Eq                                  73   /* same as TK_EQ       */




#define OP_OpenWrite                           10




















#define OP_NotNull                             71   /* same as TK_NOTNULL  */
#define OP_If                                  11
#define OP_PutStrKey                           12
#define OP_String8                             92   /* same as TK_STRING   */
#define OP_Pop                                 13
#define OP_SortPut                             14
#define OP_AggContextPush                      15
#define OP_CollSeq                             16
#define OP_OpenRead                            17
#define OP_Expire                              18
#define OP_SortReset                           19
#define OP_AutoCommit                          20
#define OP_Gt                                  74   /* same as TK_GT       */
#define OP_Sort                                21
#define OP_ListRewind                          22
#define OP_IntegrityCk                         23
#define OP_Function                            24
#define OP_Subtract                            84   /* same as TK_MINUS    */
#define OP_And                                 65   /* same as TK_AND      */
#define OP_Noop                                25
#define OP_Return                              26
#define OP_Remainder                           87   /* same as TK_REM      */
#define OP_Multiply                            85   /* same as TK_STAR     */
#define OP_Variable                            27
#define OP_String                              28
#define OP_ParseSchema                         29
#define OP_PutIntKey                           30
#define OP_AggFunc                             31
#define OP_Close                               32
#define OP_ListWrite                           33
#define OP_CreateIndex                         34
#define OP_IsUnique                            35
#define OP_IdxIsNull                           36
#define OP_NotFound                            37
#define OP_MustBeInt                           38
#define OP_Halt                                39
#define OP_IdxLT                               40
#define OP_AddImm                              41
#define OP_Statement                           42
#define OP_RowData                             43
#define OP_MemMax                              44
#define OP_Push                                45
#define OP_Or                                  64   /* same as TK_OR       */
#define OP_KeyAsData                           46
#define OP_NotExists                           47
#define OP_OpenTemp                            48
#define OP_MemIncr                             49
#define OP_Gosub                               50
#define OP_Divide                              86   /* same as TK_SLASH    */

#define OP_AggSet                              51

#define OP_Integer                             52






#define OP_SortNext                            53
#define OP_Prev                                54

#define OP_Concat                              88   /* same as TK_CONCAT   */

#define OP_BitAnd                              79   /* same as TK_BITAND   */
#define OP_CreateTable                         55
#define OP_Last                                56




#define OP_IsNull                              70   /* same as TK_ISNULL   */
#define OP_ShiftRight                          82   /* same as TK_RSHIFT   */
#define OP_ResetCount                          57
#define OP_Callback                            58
#define OP_ContextPush                         59
#define OP_DropTrigger                         60
#define OP_DropIndex                           61
#define OP_FullKey                             62
#define OP_IdxGE                               63
#define OP_IdxDelete                           67
#define OP_Vacuum                              68
#define OP_MoveLe                              69
#define OP_IfNot                               78
#define OP_DropTable                           90
#define OP_MakeRecord                          93
#define OP_Delete                              94
#define OP_AggContextPop                       95
#define OP_ListRead                            96
#define OP_ListReset                           97
#define OP_ShiftLeft                           81   /* same as TK_LSHIFT   */
#define OP_Dup                                 98
#define OP_Goto                                99
#define OP_Clear                              100
#define OP_IdxGT                              101



#define OP_MoveLt                             102
#define OP_Le                                  75   /* same as TK_LE       */
#define OP_VerifyCookie                       103
#define OP_Pull                               104

#define OP_Not                                 66   /* same as TK_NOT      */
#define OP_SetNumColumns                      105
#define OP_AbsValue                           106
#define OP_Transaction                        107
#define OP_Negative                            89   /* same as TK_UMINUS   */
#define OP_Ne                                  72   /* same as TK_NE       */

#define OP_AggGet                             108
#define OP_ContextPop                         109
#define OP_BitOr                               80   /* same as TK_BITOR    */

#define OP_Next                               110
#define OP_AggInit                            111
#define OP_Distinct                           112
#define OP_NewRecno                           113
#define OP_Lt                                  76   /* same as TK_LT       */

#define OP_AggReset                           114
#define OP_Destroy                            115
#define OP_ReadCookie                         116
#define OP_ForceInt                           117
#define OP_Recno                              118
#define OP_OpenPseudo                         119
#define OP_Blob                               120
#define OP_Add                                 83   /* same as TK_PLUS     */
#define OP_MemStore                           121
#define OP_Rewind                             122
#define OP_MoveGe                             123


#define OP_IdxPut                             124


#define OP_BitNot                              91   /* same as TK_BITNOT   */
#define OP_Found                              125

#define OP_NullRow                            126


/* The following opcode values are never used */
#define OP_NotUsed_127                        127
#define OP_NotUsed_128                        128
#define OP_NotUsed_129                        129
Changes to SQLite.Interop/src/os.h.
49
50
51
52
53
54
55







56
57
58
59
60
61
62
#endif
#if OS_UNIX
# include "os_unix.h"
#endif
#if OS_WIN
# include "os_win.h"
#endif








/*
** Temporary files are named starting with this prefix followed by 16 random
** alphanumeric characters, and no file extension. They are stored in the
** OS's standard temporary file directory, and are deleted prior to exit.
** If sqlite is being embedded in another program, you may wish to change the
** prefix to reflect your program's name, so that if your program exits







>
>
>
>
>
>
>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#endif
#if OS_UNIX
# include "os_unix.h"
#endif
#if OS_WIN
# include "os_win.h"
#endif

/* If the SET_FULLSYNC macro is not defined above, then make it
** a no-op
*/
#ifndef SET_FULLSYNC
# define SET_FULLSYNC(x,y)
#endif

/*
** Temporary files are named starting with this prefix followed by 16 random
** alphanumeric characters, and no file extension. They are stored in the
** OS's standard temporary file directory, and are deleted prior to exit.
** If sqlite is being embedded in another program, you may wish to change the
** prefix to reflect your program's name, so that if your program exits
Changes to SQLite.Interop/src/os_unix.c.
683
684
685
686
687
688
689










690
691
692
693
694
695
696
697
698
699
700
701
702














703
704
705
706
707

708




709

710
711
712


713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746




747
748
749
750
751
752
753
*/
int sqlite3OsSeek(OsFile *id, i64 offset){
  assert( id->isOpen );
  SEEK(offset/1024 + 1);
  lseek(id->h, offset, SEEK_SET);
  return SQLITE_OK;
}











/*
** The fsync() system call does not work as advertised on many
** unix systems.  The following procedure is an attempt to make
** it work better.
**
** The SQLITE_NO_SYNC macro disables all fsync()s.  This is useful
** for testing when we want to run through the test suite quickly.
** You are strongly advised *not* to deploy with SQLITE_NO_SYNC
** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash
** or power failure will likely corrupt the database file.
*/
static int full_fsync(int fd){














#ifdef SQLITE_NO_SYNC
  return SQLITE_OK;
#else
  int rc;
#ifdef F_FULLFSYNC

  rc = fcntl(fd, F_FULLFSYNC, 0);




  if( rc ) rc = fsync(fd);

#else
  rc = fsync(fd);
#endif


  return rc;
#endif
}

/*
** Make sure all writes to a particular file are committed to disk.
**
** Under Unix, also make sure that the directory entry for the file
** has been created by fsync-ing the directory that contains the file.
** If we do not do this and we encounter a power failure, the directory
** entry for the journal might not exist after we reboot.  The next
** SQLite to access the file will not know that the journal exists (because
** the directory entry for the journal was never created) and the transaction
** will not roll back - possibly leading to database corruption.
*/
int sqlite3OsSync(OsFile *id){
  assert( id->isOpen );
  SimulateIOError(SQLITE_IOERR);
  TRACE2("SYNC    %-3d\n", id->h);
  if( full_fsync(id->h) ){
    return SQLITE_IOERR;
  }
  if( id->dirfd>=0 ){
    TRACE2("DIRSYNC %-3d\n", id->dirfd);
    full_fsync(id->dirfd);
    close(id->dirfd);  /* Only need to sync once, so close the directory */
    id->dirfd = -1;    /* when we are done. */
  }
  return SQLITE_OK;
}

/*
** Sync the directory zDirname. This is a no-op on operating systems other
** than UNIX.




*/
int sqlite3OsSyncDirectory(const char *zDirname){
  int fd;
  int r;
  SimulateIOError(SQLITE_IOERR);
  fd = open(zDirname, O_RDONLY|O_BINARY, 0644);
  TRACE3("DIRSYNC %-3d (%s)\n", fd, zDirname);







>
>
>
>
>
>
>
>
>
>












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

|

|

>
|
>
>
>
>

>


|
>
>

<

















|




|









>
>
>
>







683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745

746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
*/
int sqlite3OsSeek(OsFile *id, i64 offset){
  assert( id->isOpen );
  SEEK(offset/1024 + 1);
  lseek(id->h, offset, SEEK_SET);
  return SQLITE_OK;
}

#ifdef SQLITE_TEST
/*
** Count the number of fullsyncs and normal syncs.  This is used to test
** that syncs and fullsyncs are occuring at the right times.
*/
int sqlite3_sync_count = 0;
int sqlite3_fullsync_count = 0;
#endif


/*
** The fsync() system call does not work as advertised on many
** unix systems.  The following procedure is an attempt to make
** it work better.
**
** The SQLITE_NO_SYNC macro disables all fsync()s.  This is useful
** for testing when we want to run through the test suite quickly.
** You are strongly advised *not* to deploy with SQLITE_NO_SYNC
** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash
** or power failure will likely corrupt the database file.
*/
static int full_fsync(int fd, int fullSync){
  int rc;

  /* Record the number of times that we do a normal fsync() and 
  ** FULLSYNC.  This is used during testing to verify that this procedure
  ** gets called with the correct arguments.
  */
#ifdef SQLITE_TEST
  if( fullSync ) sqlite3_fullsync_count++;
  sqlite3_sync_count++;
#endif

  /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a
  ** no-op
  */
#ifdef SQLITE_NO_SYNC
  rc = SQLITE_OK;
#else

#ifdef F_FULLFSYNC
  if( fullSync ){
    rc = fcntl(fd, F_FULLSYNC, 0);
  }else{
    rc = 1;
  }
  /* If the FULLSYNC failed, try to do a normal fsync() */
  if( rc ) rc = fsync(fd);

#else
  rc = fsync(fd);
#endif /* defined(F_FULLSYNC) */
#endif /* defined(SQLITE_NO_SYNC) */

  return rc;

}

/*
** Make sure all writes to a particular file are committed to disk.
**
** Under Unix, also make sure that the directory entry for the file
** has been created by fsync-ing the directory that contains the file.
** If we do not do this and we encounter a power failure, the directory
** entry for the journal might not exist after we reboot.  The next
** SQLite to access the file will not know that the journal exists (because
** the directory entry for the journal was never created) and the transaction
** will not roll back - possibly leading to database corruption.
*/
int sqlite3OsSync(OsFile *id){
  assert( id->isOpen );
  SimulateIOError(SQLITE_IOERR);
  TRACE2("SYNC    %-3d\n", id->h);
  if( full_fsync(id->h, id->fullSync) ){
    return SQLITE_IOERR;
  }
  if( id->dirfd>=0 ){
    TRACE2("DIRSYNC %-3d\n", id->dirfd);
    full_fsync(id->dirfd, id->fullSync);
    close(id->dirfd);  /* Only need to sync once, so close the directory */
    id->dirfd = -1;    /* when we are done. */
  }
  return SQLITE_OK;
}

/*
** Sync the directory zDirname. This is a no-op on operating systems other
** than UNIX.
**
** This is used to make sure the master journal file has truely been deleted
** before making changes to individual journals on a multi-database commit.
** The F_FULLSYNC option is not needed here.
*/
int sqlite3OsSyncDirectory(const char *zDirname){
  int fd;
  int r;
  SimulateIOError(SQLITE_IOERR);
  fd = open(zDirname, O_RDONLY|O_BINARY, 0644);
  TRACE3("DIRSYNC %-3d (%s)\n", fd, zDirname);
Changes to SQLite.Interop/src/os_unix.h.
64
65
66
67
68
69
70

71
72
73





74
75
76
77
78
79
80
struct OsFile {
  struct Pager *pPager;     /* The pager that owns this OsFile.  Might be 0 */
  struct openCnt *pOpen;    /* Info about all open fd's on this inode */
  struct lockInfo *pLock;   /* Info about locks on this inode */
  int h;                    /* The file descriptor */
  unsigned char locktype;   /* The type of lock held on this fd */
  unsigned char isOpen;     /* True if needs to be closed */

  int dirfd;                /* File descriptor for the directory */
};






/*
** Maximum number of characters in a temporary file name
*/
#define SQLITE_TEMPNAME_SIZE 200

/*
** Minimum interval supported by sqlite3OsSleep().







>



>
>
>
>
>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
struct OsFile {
  struct Pager *pPager;     /* The pager that owns this OsFile.  Might be 0 */
  struct openCnt *pOpen;    /* Info about all open fd's on this inode */
  struct lockInfo *pLock;   /* Info about locks on this inode */
  int h;                    /* The file descriptor */
  unsigned char locktype;   /* The type of lock held on this fd */
  unsigned char isOpen;     /* True if needs to be closed */
  unsigned char fullSync;   /* Use F_FULLSYNC if available */
  int dirfd;                /* File descriptor for the directory */
};

/*
** A macro to set the OsFile.fullSync flag, if it exists.
*/
#define SET_FULLSYNC(x,y)  ((x).fullSync = (y))

/*
** Maximum number of characters in a temporary file name
*/
#define SQLITE_TEMPNAME_SIZE 200

/*
** Minimum interval supported by sqlite3OsSleep().
Changes to SQLite.Interop/src/pager.c.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.1 2005/03/01 16:04:31 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include "pager.h"
#include <assert.h>
#include <string.h>








|







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

2555
2556
2557
2558
2559
2560
2561


2562
2563
2564
2565
2566
2567
2568
  rc = sqlite3OsOpenExclusive(pPager->zJournal, &pPager->jfd,pPager->tempFile);
  pPager->journalOff = 0;
  pPager->setMaster = 0;
  pPager->journalHdr = 0;
  if( rc!=SQLITE_OK ){
    goto failed_to_open_journal;
  }


  sqlite3OsOpenDirectory(pPager->zDirectory, &pPager->jfd);
  pPager->journalOpen = 1;
  pPager->journalStarted = 0;
  pPager->needSync = 0;
  pPager->alwaysRollback = 0;
  pPager->nRec = 0;
  if( pPager->errMask!=0 ){







>
>







2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
  rc = sqlite3OsOpenExclusive(pPager->zJournal, &pPager->jfd,pPager->tempFile);
  pPager->journalOff = 0;
  pPager->setMaster = 0;
  pPager->journalHdr = 0;
  if( rc!=SQLITE_OK ){
    goto failed_to_open_journal;
  }
  SET_FULLSYNC(pPager->jfd, pPager->fullSync);
  SET_FULLSYNC(pPager->fd, pPager->fullSync);
  sqlite3OsOpenDirectory(pPager->zDirectory, &pPager->jfd);
  pPager->journalOpen = 1;
  pPager->journalStarted = 0;
  pPager->needSync = 0;
  pPager->alwaysRollback = 0;
  pPager->nRec = 0;
  if( pPager->errMask!=0 ){
3402
3403
3404
3405
3406
3407
3408
3409


3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
** by this routine. The same applies to the page pData refers to on entry to
** this routine.
**
** References to the page refered to by pData remain valid. Updating any
** meta-data associated with page pData (i.e. data stored in the nExtra bytes
** allocated along with the page) is the responsibility of the caller.
**
** A transaction must be active when this routine is called, however it is 


** illegal to call this routine if a statment transaction is active.
*/
int sqlite3pager_movepage(Pager *pPager, void *pData, Pgno pgno){
  PgHdr *pPg = DATA_TO_PGHDR(pData);
  PgHdr *pPgOld; 
  int h;
  Pgno needSyncPgno = 0;

  assert( !pPager->stmtInUse );
  assert( pPg->nRef>0 );

  TRACE5("MOVE %d page %d (needSync=%d) moves to %d\n", 
      PAGERID(pPager), pPg->pgno, pPg->needSync, pgno);

  if( pPg->needSync ){
    needSyncPgno = pPg->pgno;







|
>
>
|







<







3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421

3422
3423
3424
3425
3426
3427
3428
** by this routine. The same applies to the page pData refers to on entry to
** this routine.
**
** References to the page refered to by pData remain valid. Updating any
** meta-data associated with page pData (i.e. data stored in the nExtra bytes
** allocated along with the page) is the responsibility of the caller.
**
** A transaction must be active when this routine is called. It used to be
** required that a statement transaction was not active, but this restriction
** has been removed (CREATE INDEX needs to move a page when a statement
** transaction is active).
*/
int sqlite3pager_movepage(Pager *pPager, void *pData, Pgno pgno){
  PgHdr *pPg = DATA_TO_PGHDR(pData);
  PgHdr *pPgOld; 
  int h;
  Pgno needSyncPgno = 0;


  assert( pPg->nRef>0 );

  TRACE5("MOVE %d page %d (needSync=%d) moves to %d\n", 
      PAGERID(pPager), pPg->pgno, pPg->needSync, pgno);

  if( pPg->needSync ){
    needSyncPgno = pPg->pgno;
Changes to SQLite.Interop/src/pager.h.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite page cache
** subsystem.  The page cache subsystem reads and writes a file a page
** at a time and provides a journal for rollback.
**
** @(#) $Id: pager.h,v 1.1 2005/03/01 16:04:31 rmsimpson Exp $
*/

/*
** The default size of a database page.
*/
#ifndef SQLITE_DEFAULT_PAGE_SIZE
# define SQLITE_DEFAULT_PAGE_SIZE 1024







|







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

/*
** The default size of a database page.
*/
#ifndef SQLITE_DEFAULT_PAGE_SIZE
# define SQLITE_DEFAULT_PAGE_SIZE 1024
Changes to SQLite.Interop/src/parse.c.
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
**                     shifting non-terminals after a reduce.
**  yy_default[]       Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   263,  261,  261,  154,  124,  126,  128,  130,  132,  134,
 /*    10 */   136,  138,  140,  142,  350,  567,  145,  641,  261,  369,
 /*    20 */   144,  114,  116,  112,  118,    7,  124,  126,  128,  130,
 /*    30 */   132,  134,  136,  138,  140,  142,  136,  138,  140,  142,
 /*    40 */   110,   94,  146,  157,  162,  167,  156,  161,  120,  122,
 /*    50 */   114,  116,  112,  118,    9,  124,  126,  128,  130,  132,
 /*    60 */   134,  136,  138,  140,  142,  574,  223,  262,  262,  124,
 /*    70 */   126,  128,  130,  132,  134,  136,  138,  140,  142,   13,
 /*    80 */    96,  145,   13,    2,  262,  144,    4,   78,  371,   92,
 /*    90 */    10,  373,  380,  385,  132,  134,  136,  138,  140,  142,
 /*   100 */    75,    3,  562,  388,  296,  110,   94,  146,  157,  162,
 /*   110 */   167,  156,  161,  120,  122,  114,  116,  112,  118,   77,
 /*   120 */   124,  126,  128,  130,  132,  134,  136,  138,  140,  142,
 /*   130 */   145,   65,  573,   13,  144,   11,  371,   66,  292,  373,
 /*   140 */   380,  385,  870,    1,  563,   14,   15,    4,   14,   15,
 /*   150 */   172,  388,   51,  665,  110,   94,  146,  157,  162,  167,
 /*   160 */   156,  161,  120,  122,  114,  116,  112,  118,   72,  124,
 /*   170 */   126,  128,  130,  132,  134,  136,  138,  140,  142,   51,
 /*   180 */    37,  341,   40,   59,   67,   69,  305,  336,  107,  106,
 /*   190 */   108,  847,  572,   34,  338,   96,  366,  349,   13,   14,
 /*   200 */    15,  371,   12,  145,  373,  380,  385,  144,  564,   40,
 /*   210 */    59,   67,   69,  305,  336,   75,  388,    3,  562,  190,
 /*   220 */   345,  338,   44,   45,   95,  460,  802,  110,   94,  146,
 /*   230 */   157,  162,  167,  156,  161,  120,  122,  114,  116,  112,
 /*   240 */   118,  575,  124,  126,  128,  130,  132,  134,  136,  138,
 /*   250 */   140,  142,   20,   48,  800,  364,  362,  101,  102,  367,
 /*   260 */   499,  295,   49,  596,   14,   15,  191,   32,   33,   27,
 /*   270 */   148,  403,   96,   50,  147,  534,   46,  145,  494,  466,
 /*   280 */   456,  144,  580,  279,   36,  340,   47,  399,  309,   81,
 /*   290 */   368,  401,   75,  335,  398,  505,  176,  501,  150,  151,
 /*   300 */   197,  110,   94,  146,  157,  162,  167,  156,  161,  120,
 /*   310 */   122,  114,  116,  112,  118,   77,  124,  126,  128,  130,
 /*   320 */   132,  134,  136,  138,  140,  142,  149,  280,  258,  169,
 /*   330 */    96,   39,  281,   13,  298,  367,   96,  175,   22,  335,
 /*   340 */    28,  145,  188,  402,   33,  144,  217,    6,    5,  171,
 /*   350 */    75,  173,  174,   25,  176,  581,   75,   57,   58,  507,
 /*   360 */   235,  351,  356,  357,  265,  110,   94,  146,  157,  162,
 /*   370 */   167,  156,  161,  120,  122,  114,  116,  112,  118,  503,
 /*   380 */   124,  126,  128,  130,  132,  134,  136,  138,  140,  142,
 /*   390 */   457,   77,  243,  294,   48,  227,  236,  293,  297,   14,
 /*   400 */    15,  288,   96,   49,  217,  152,  222,  163,  168,  278,
 /*   410 */    24,   13,  687,   13,   50,  145,  518,  201,  152,  144,
 /*   420 */   163,  168,   75,  358,  582,  171,  176,  173,  174,  263,
 /*   430 */   171,  261,  173,  174,  354,  356,  357,  588,  211,  110,
 /*   440 */    94,  146,  157,  162,  167,  156,  161,  120,  122,  114,
 /*   450 */   116,  112,  118,  654,  124,  126,  128,  130,  132,  134,
 /*   460 */   136,  138,  140,  142,  303,   13,  688,   96,  250,  817,
 /*   470 */    96,   16,   17,   18,  246,   81,  216,   14,   15,   14,
 /*   480 */    15,  145,   13,  406,  435,  144,   13,   75,  487,  387,
 /*   490 */    75,  493,  248,  258,  235,  660,  358,  262,  310,  852,
 /*   500 */   171,   26,  173,  174,  253,  110,   94,  146,  157,  162,
 /*   510 */   167,  156,  161,  120,  122,  114,  116,  112,  118,  397,
 /*   520 */   124,  126,  128,  130,  132,  134,  136,  138,  140,  142,
 /*   530 */   229,   14,   15,  489,  250,  152,  252,  163,  168,  171,
 /*   540 */   839,  173,  174,  360,  361,   96,  145,  533,   14,   15,
 /*   550 */   144,  866,   14,   15,  801,  442,  312,  275,  255,  453,
 /*   560 */   850,  338,  251,  535,  536,   75,  662,  247,   13,  493,
 /*   570 */   110,   94,  146,  157,  162,  167,  156,  161,  120,  122,
 /*   580 */   114,  116,  112,  118,  845,  124,  126,  128,  130,  132,
 /*   590 */   134,  136,  138,  140,  142,  726,   96,  171,   96,  173,
 /*   600 */   174,  171,  252,  173,  174,  152,  583,  163,  168,   42,
 /*   610 */   720,  525,   96,  145,  441,  271,   75,  144,   75,  170,
 /*   620 */   302,  640,   91,   31,  358,  313,  320,  322,  251,  432,
 /*   630 */   434,  433,   75,  844,   14,   15,  176,  110,   94,  146,
 /*   640 */   157,  162,  167,  156,  161,  120,  122,  114,  116,  112,
 /*   650 */   118,   77,  124,  126,  128,  130,  132,  134,  136,  138,
 /*   660 */   140,  142,  171,   96,  173,  174,  331,   52,  171,   96,
 /*   670 */   173,  174,   96,  195,  213,  207,   29,  348,  145,   54,
 /*   680 */   310,  318,  144,   75,  455,  342,  217,   93,   83,   75,
 /*   690 */    30,  452,   75,  109,  587,  286,  111,  171,  265,  173,
 /*   700 */   174,  319,  110,   94,  146,  157,  162,  167,  156,  161,
 /*   710 */   120,  122,  114,  116,  112,  118,   77,  124,  126,  128,
 /*   720 */   130,  132,  134,  136,  138,  140,  142,  244,   96,  187,
 /*   730 */    96,   96,  810,  331,  214,  266,  215,   35,  312,   96,
 /*   740 */    96,  479,  328,  145,  623,   38,  327,  144,   75,  455,
 /*   750 */    75,   75,  113,  689,  115,  117,  315,  461,  426,   75,
 /*   760 */    75,   77,  463,  119,  121,  407,  325,  110,  165,  146,
 /*   770 */   157,  162,  167,  156,  161,  120,  122,  114,  116,  112,
 /*   780 */   118,   77,  124,  126,  128,  130,  132,  134,  136,  138,
 /*   790 */   140,  142,   42,   96,   96,   96,   96,  824,  273,  159,
 /*   800 */   415,   96,  410,  272,   96,  273,  479,   41,  145,  332,
 /*   810 */   537,   43,  144,   75,   75,   75,   75,  123,  125,  127,
 /*   820 */   129,   75,  465,   64,   75,  131,   53,  463,  133,  158,
 /*   830 */   317,  316,  265,   94,  146,  157,  162,  167,  156,  161,
 /*   840 */   120,  122,  114,  116,  112,  118,  219,  124,  126,  128,
 /*   850 */   130,  132,  134,  136,  138,  140,  142,   96,  689,   96,
 /*   860 */    96,  532,   96,  331,  299,   96,  215,   96,   96,  283,
 /*   870 */    96,  261,  219,   96,  145,   96,  840,   75,  144,   75,
 /*   880 */    75,  135,   75,  137,  139,   75,  141,   75,   75,  143,
 /*   890 */    75,  153,  155,   75,  164,   75,  376,  166,   56,  178,
 /*   900 */   146,  157,  162,  167,  156,  161,  120,  122,  114,  116,
 /*   910 */   112,  118,  652,  124,  126,  128,  130,  132,  134,  136,
 /*   920 */   138,  140,  142,   76,   96,   96,   96,   71,  438,  364,
 /*   930 */   362,  437,   96,   96,   96,   96,  331,  262,  233,  332,
 /*   940 */    96,   55,  331,  439,   75,   75,   75,  331,  180,  182,
 /*   950 */   184,  199,   75,   75,   75,   75,  196,  198,  208,  210,
 /*   960 */    75,  107,  106,  108,  212,  720,  326,  177,  327,  382,
 /*   970 */   430,  431,  107,  106,  108,  391,  548,   61,   96,   96,
 /*   980 */   449,  471,  458,   45,  183,  181,  300,   96,  476,  352,
 /*   990 */    96,  353,  179,   73,   74,  343,  346,   95,   75,   75,
 /*  1000 */   290,   96,  224,  240,  345,  275,   42,   75,   95,   76,
 /*  1010 */    75,  245,  332,   71,  277,  383,  275,  327,  332,   96,
 /*  1020 */    75,   75,  404,  332,  287,  386,   96,  392,  421,  327,
 /*  1030 */   101,  102,  103,  104,  105,  185,  189,  199,   96,   75,
 /*  1040 */    96,  101,  102,  427,  414,   60,   75,  107,  106,  108,
 /*  1050 */   474,  470,  486,  177,   77,  450,  421,  327,   75,  484,
 /*  1060 */    75,  273,  478,  436,  491,  492,  423,  490,  421,  421,
 /*  1070 */   183,  181,  421,  421,  483,  421,   77,  421,  179,   73,
 /*  1080 */    74,  476,  244,   95,   77,   81,  526,  860,  490,  421,
 /*  1090 */   689,  522,   62,   64,  500,   70,  597,   63,  523,   68,
 /*  1100 */   598,   76,   81,   79,   81,   71,  502,  504,   84,   80,
 /*  1110 */   506,  510,  244,  514,  239,  520,  101,  102,  103,  104,
 /*  1120 */   105,  185,  189,   77,  546,  241,   82,  558,   86,  199,
 /*  1130 */    85,  225,   90,   87,   97,   88,   99,  142,   89,  107,
 /*  1140 */   106,  108,  160,   98,  516,  177,  100,  218,  666,  667,
 /*  1150 */   668,  186,  209,  193,  192,  194,  200,  204,  203,  202,
 /*  1160 */   206,  205,  183,  181,  219,  220,  221,  226,  228,  232,
 /*  1170 */   179,   73,   74,  230,  233,   95,  234,  231,  237,  242,
 /*  1180 */   238,  215,  260,  249,  257,  276,  267,  254,  256,  259,
 /*  1190 */   264,  269,  270,   76,  274,  282,  301,   71,  219,  268,
 /*  1200 */   285,  291,  284,  306,  324,  307,  311,  308,  101,  102,
 /*  1210 */   103,  104,  105,  185,  189,  803,  355,  329,  375,  304,
 /*  1220 */   314,  199,  321,  337,  330,  365,  334,  372,  309,  333,
 /*  1230 */   323,  107,  106,  108,  344,  339,  347,  177,  374,  378,
 /*  1240 */   400,  359,  370,  377,  381,  379,  384,  389,  363,  390,
 /*  1250 */   393,  394,  396,   54,  183,  181,  289,  408,  395,  409,
 /*  1260 */   411,  413,  179,   73,   74,  412,  416,   95,  417,  420,
 /*  1270 */   428,  422,  832,  429,  443,  440,  444,  837,  838,   76,
 /*  1280 */   446,  445,  448,   71,  451,  808,  809,  459,  454,  447,
 /*  1290 */   418,  727,  728,  831,  464,  462,  846,  457,  469,  419,
 /*  1300 */   101,  102,  103,  104,  105,  185,  189,  199,  467,  468,
 /*  1310 */   472,  473,  475,  424,  848,  477,  480,  107,  106,  108,
 /*  1320 */   425,  482,  488,  177,  485,  849,  481,  495,  496,  851,
 /*  1330 */   659,  661,  816,  858,  497,  509,  511,  719,  513,  515,
 /*  1340 */   183,  181,  722,  517,  725,  519,  521,  524,  179,   73,
 /*  1350 */    74,  818,  528,   95,  530,  819,  820,  531,  538,  821,
 /*  1360 */     8,  822,  539,  823,  549,   19,   21,   23,  405,  541,
 /*  1370 */   542,  544,  543,  859,  547,  861,  862,  865,  545,  540,
 /*  1380 */   551,  867,  557,  555,  552,  550,  101,  102,  103,  104,
 /*  1390 */   105,  185,  189,  554,  560,  559,  561,  868,  529,  545,
 /*  1400 */   460,  545,  545,  545,  545,  527,  545,  553,  545,  545,
 /*  1410 */   545,  545,  556,  545,  545,  545,  545,  545,  545,  545,
 /*  1420 */   545,  545,  545,  545,  545,  545,  545,  545,  545,  545,
 /*  1430 */   545,  545,  545,  545,  545,  545,  545,  545,  545,  545,
 /*  1440 */   545,  545,  545,  545,  545,  545,  545,  545,  545,  545,
 /*  1450 */   545,  545,  545,  508,  512,  456,  545,  545,  545,  498,
 /*  1460 */   545,  545,  545,  545,   81,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */    24,   26,   26,   78,   79,   80,   81,   82,   83,   84,
 /*    10 */    85,   86,   87,   88,   22,    9,   40,   23,   26,   25,
 /*    20 */    44,   74,   75,   76,   77,    9,   79,   80,   81,   82,
 /*    30 */    83,   84,   85,   86,   87,   88,   85,   86,   87,   88,
 /*    40 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,
 /*    50 */    74,   75,   76,   77,  148,   79,   80,   81,   82,   83,
 /*    60 */    84,   85,   86,   87,   88,    9,   25,   92,   92,   79,
 /*    70 */    80,   81,   82,   83,   84,   85,   86,   87,   88,   26,
 /*    80 */   150,   40,   26,  144,   92,   44,  147,  157,   94,   48,
 /*    90 */   149,   97,   98,   99,   83,   84,   85,   86,   87,   88,
 /*   100 */   170,    9,   10,  109,  174,   64,   65,   66,   67,   68,
 /*   110 */    69,   70,   71,   72,   73,   74,   75,   76,   77,  189,
 /*   120 */    79,   80,   81,   82,   83,   84,   85,   86,   87,   88,
 /*   130 */    40,   29,    9,   26,   44,   12,   94,   35,   85,   97,
 /*   140 */    98,   99,  142,  143,  144,   92,   93,  147,   92,   93,
 /*   150 */   112,  109,   66,  115,   64,   65,   66,   67,   68,   69,
 /*   160 */    70,   71,   72,   73,   74,   75,   76,   77,   22,   79,
 /*   170 */    80,   81,   82,   83,   84,   85,   86,   87,   88,   66,
 /*   180 */    94,   95,   96,   97,   98,   99,  100,  101,   60,   61,
 /*   190 */    62,   17,    9,  160,  108,  150,  163,  164,   26,   92,
 /*   200 */    93,   94,  150,   40,   97,   98,   99,   44,    0,   96,
 /*   210 */    97,   98,   99,  100,  101,  170,  109,    9,   10,  174,
 /*   220 */    92,  108,  186,  187,   96,   51,  136,   64,   65,   66,
 /*   230 */    67,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   240 */    77,    9,   79,   80,   81,   82,   83,   84,   85,   86,
 /*   250 */    87,   88,  149,   18,   17,   83,   84,  129,  130,  150,
 /*   260 */    20,   23,   27,  117,   92,   93,  221,  158,  159,   22,
 /*   270 */    40,   24,  150,   38,   44,  103,   41,   40,  104,  105,
 /*   280 */   106,   44,    9,  157,  168,  169,   51,  177,  178,  115,
 /*   290 */   181,  182,  170,  177,  184,   55,  174,   57,   68,   69,
 /*   300 */   137,   64,   65,   66,   67,   68,   69,   70,   71,   72,
 /*   310 */    73,   74,   75,   76,   77,  189,   79,   80,   81,   82,
 /*   320 */    83,   84,   85,   86,   87,   88,   96,  201,  202,   22,
 /*   330 */   150,  169,  206,   26,  212,  150,  150,   23,  149,  177,
 /*   340 */   155,   40,   23,  158,  159,   44,  224,  145,  146,  111,
 /*   350 */   170,  113,  114,  151,  174,    9,  170,   13,   14,  157,
 /*   360 */   174,  165,  166,  167,  163,   64,   65,   66,   67,   68,
 /*   370 */    69,   70,   71,   72,   73,   74,   75,   76,   77,  139,
 /*   380 */    79,   80,   81,   82,   83,   84,   85,   86,   87,   88,
 /*   390 */    64,  189,  212,  112,   18,  209,  210,  116,   23,   92,
 /*   400 */    93,  200,  150,   27,  224,  217,  218,  219,  220,   22,
 /*   410 */   149,   26,   23,   26,   38,   40,  214,   41,  217,   44,
 /*   420 */   219,  220,  170,  227,    9,  111,  174,  113,  114,   24,
 /*   430 */   111,   26,  113,  114,  165,  166,  167,    9,  137,   64,
 /*   440 */    65,   66,   67,   68,   69,   70,   71,   72,   73,   74,
 /*   450 */    75,   76,   77,  127,   79,   80,   81,   82,   83,   84,
 /*   460 */    85,   86,   87,   88,   23,   26,   23,  150,   25,    9,
 /*   470 */   150,   13,   14,   15,   25,  115,  224,   92,   93,   92,
 /*   480 */    93,   40,   26,  153,   47,   44,   26,  170,  128,  171,
 /*   490 */   170,  174,  201,  202,  174,    9,  227,   92,   45,    9,
 /*   500 */   111,  152,  113,  114,  119,   64,   65,   66,   67,   68,
 /*   510 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   66,
 /*   520 */    79,   80,   81,   82,   83,   84,   85,   86,   87,   88,
 /*   530 */   210,   92,   93,  216,   25,  217,   93,  219,  220,  111,
 /*   540 */   103,  113,  114,  129,  130,  150,   40,  150,   92,   93,
 /*   550 */    44,    9,   92,   93,   17,  225,  103,  150,  119,  229,
 /*   560 */     9,  108,  119,  166,  167,  170,    9,  118,   26,  174,
 /*   570 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,
 /*   580 */    74,   75,   76,   77,   11,   79,   80,   81,   82,   83,
 /*   590 */    84,   85,   86,   87,   88,    9,  150,  111,  150,  113,
 /*   600 */   114,  111,   93,  113,  114,  217,    9,  219,  220,  103,
 /*   610 */     9,  216,  150,   40,   21,  208,  170,   44,  170,  157,
 /*   620 */   174,   23,  174,   25,  227,  104,  105,  106,  119,  104,
 /*   630 */   105,  106,  170,   11,   92,   93,  174,   64,   65,   66,
 /*   640 */    67,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   650 */    77,  189,   79,   80,   81,   82,   83,   84,   85,   86,
 /*   660 */    87,   88,  111,  150,  113,  114,  150,   96,  111,  150,
 /*   670 */   113,  114,  150,  136,  212,  138,  156,  162,   40,  108,
 /*   680 */    45,   32,   44,  170,  157,  170,  224,  174,  192,  170,
 /*   690 */    23,   98,  170,  174,    9,  199,  174,  111,  163,  113,
 /*   700 */   114,   52,   64,   65,   66,   67,   68,   69,   70,   71,
 /*   710 */    72,   73,   74,   75,   76,   77,  189,   79,   80,   81,
 /*   720 */    82,   83,   84,   85,   86,   87,   88,  126,  150,  157,
 /*   730 */   150,  150,  139,  150,   23,  200,   25,  161,  103,  150,
 /*   740 */   150,  214,  226,   40,   23,  150,   25,   44,  170,  157,
 /*   750 */   170,  170,  174,   24,  174,  174,  107,  230,  136,  170,
 /*   760 */   170,  189,  235,  174,  174,   20,  183,   64,   65,   66,
 /*   770 */    67,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   780 */    77,  189,   79,   80,   81,   82,   83,   84,   85,   86,
 /*   790 */    87,   88,  103,  150,  150,  150,  150,    9,   25,   66,
 /*   800 */    55,  150,   57,   23,  150,   25,  214,  171,   40,  226,
 /*   810 */    22,   33,   44,  170,  170,  170,  170,  174,  174,  174,
 /*   820 */   174,  170,  230,  102,  170,  174,  171,  235,  174,   96,
 /*   830 */    95,   96,  163,   65,   66,   67,   68,   69,   70,   71,
 /*   840 */    72,   73,   74,   75,   76,   77,  117,   79,   80,   81,
 /*   850 */    82,   83,   84,   85,   86,   87,   88,  150,  103,  150,
 /*   860 */   150,   73,  150,  150,   23,  150,   25,  150,  150,  200,
 /*   870 */   150,   26,  117,  150,   40,  150,  103,  170,   44,  170,
 /*   880 */   170,  174,  170,  174,  174,  170,  174,  170,  170,  174,
 /*   890 */   170,  174,  174,  170,  174,  170,  183,  174,   42,  174,
 /*   900 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
 /*   910 */    76,   77,    9,   79,   80,   81,   82,   83,   84,   85,
 /*   920 */    86,   87,   88,   22,  150,  150,  150,   26,   28,   83,
 /*   930 */    84,   31,  150,  150,  150,  150,  150,   92,   26,  226,
 /*   940 */   150,  180,  150,   43,  170,  170,  170,  150,  174,  174,
 /*   950 */   174,   50,  170,  170,  170,  170,  174,  174,  174,  174,
 /*   960 */   170,   60,   61,   62,  174,    9,   23,   66,   25,  183,
 /*   970 */    53,   54,   60,   61,   62,  183,  131,  172,  150,  150,
 /*   980 */   183,   25,  186,  187,   83,   84,   85,  150,  150,   23,
 /*   990 */   150,   25,   91,   92,   93,   83,   84,   96,  170,  170,
 /*  1000 */   150,  150,  174,  174,   92,  150,  103,  170,   96,   22,
 /*  1010 */   170,  174,  226,   26,  174,   23,  150,   25,  226,  150,
 /*  1020 */   170,  170,  157,  226,  174,  174,  150,   23,  150,   25,
 /*  1030 */   129,  130,  131,  132,  133,  134,  135,   50,  150,  170,
 /*  1040 */   150,  129,  130,  174,  157,   46,  170,   60,   61,   62,
 /*  1050 */   174,  213,  157,   66,  189,   23,  150,   25,  170,   23,
 /*  1060 */   170,   25,  174,  208,  174,   23,  188,   25,  150,  150,
 /*  1070 */    83,   84,  150,  150,  208,  150,  189,  150,   91,   92,
 /*  1080 */    93,  150,  126,   96,  189,  115,   23,    9,   25,  150,
 /*  1090 */     9,  157,  171,  102,  188,   22,  117,  173,  128,  171,
 /*  1100 */   117,   22,  115,  190,  115,   26,  188,  188,  193,  189,
 /*  1110 */   188,  188,  126,  188,  124,  188,  129,  130,  131,  132,
 /*  1120 */   133,  134,  135,  189,   46,  123,  191,  188,  195,   50,
 /*  1130 */   194,  121,  125,  196,  117,  197,  117,   88,  198,   60,
 /*  1140 */    61,   62,   96,  150,  213,   66,  150,  150,  115,  115,
 /*  1150 */   115,   22,  136,  223,  222,   17,   22,   25,  187,   23,
 /*  1160 */    23,  150,   83,   84,  117,  150,  154,  122,   25,  101,
 /*  1170 */    91,   92,   93,  211,   26,   96,  162,  172,  211,  122,
 /*  1180 */   172,   25,  154,  203,  119,  103,  204,  150,  150,  150,
 /*  1190 */   150,  120,   22,   22,  150,   23,   23,   26,  117,  205,
 /*  1200 */   205,  117,  204,  150,   22,  175,  150,  176,  129,  130,
 /*  1210 */   131,  132,  133,  134,  135,  136,   23,  211,   22,  171,
 /*  1220 */   179,   50,  179,  162,  172,  163,  172,  150,  178,  211,
 /*  1230 */   179,   60,   61,   62,  170,  180,  170,   66,   46,   23,
 /*  1240 */   182,  228,  182,  173,   22,  171,  171,   46,  228,   22,
 /*  1250 */   100,  150,  176,  108,   83,   84,   85,  150,  175,  154,
 /*  1260 */   150,   24,   91,   92,   93,  154,  150,   96,  154,  103,
 /*  1270 */    39,  154,   11,   37,  139,   47,  150,  103,  103,   22,
 /*  1280 */   103,  154,   22,   26,  171,    9,  139,  185,   11,  150,
 /*  1290 */   231,  127,  127,    9,    9,   17,   17,   64,  107,  232,
 /*  1300 */   129,  130,  131,  132,  133,  134,  135,   50,  185,  150,
 /*  1310 */   150,   73,  194,  233,    9,   73,  127,   60,   61,   62,
 /*  1320 */   234,   22,   22,   66,  215,    9,  150,  118,  150,    9,
 /*  1330 */     9,    9,    9,    9,  194,  118,  194,    9,  185,  107,
 /*  1340 */    83,   84,    9,  194,    9,  127,  215,   22,   91,   92,
 /*  1350 */    93,    9,  150,   96,  150,    9,    9,  154,  150,    9,
 /*  1360 */    11,    9,   23,    9,   34,   16,   17,   18,   19,  236,
 /*  1370 */   163,  150,   24,    9,  163,    9,    9,    9,  237,   30,
 /*  1380 */   236,    9,   20,  154,  150,   36,  129,  130,  131,  132,
 /*  1390 */   133,  134,  135,  150,  140,   59,  150,    9,   49,  238,
 /*  1400 */    51,  238,  238,  238,  238,   56,  238,   58,  238,  238,
 /*  1410 */   238,  238,   63,  238,  238,  238,  238,  238,  238,  238,
 /*  1420 */   238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
 /*  1430 */   238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
 /*  1440 */   238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
 /*  1450 */   238,  238,  238,  104,  105,  106,  238,  238,  238,  110,
 /*  1460 */   238,  238,  238,  238,  115,
};
#define YY_SHIFT_USE_DFLT (-76)
static const short yy_shift_ofst[] = {
 /*     0 */    92,  208,  -76,  -76, 1349,    6,   16,  -76,  458,  123,
 /*    10 */   183,   56,  232,  -76,  -76,  -76,  -76,  -76,  -76,  123,
 /*    20 */   273,  123,  346,  123,  415,  247,  597,  456,  598,  667,
 /*    30 */   685,  107,  -76,  -25,  -76,   86,  -76,  456,  113,  -76,
 /*    40 */   689,  -76,  778,  235,  -76,  -76,  -76,  -76,  -76,  -76,
 /*    50 */   -76,  571,  689,  -76,  856,  -76,  344,  -76,  -76,  999,
 /*    60 */   102,  689,  991,  -76,  -76,  -76,  -76,  689,  -76, 1073,
 /*    70 */  1257,  146,  901,  979,  983,  -76,  987,  -76,  238,  989,
 /*    80 */   -76,  281,  -76,  449,  986, 1002,  990, 1010, 1007,  -76,
 /*    90 */  1257,   41, 1257,  638, 1257,  -76, 1017,  456, 1019,  456,
 /*   100 */   -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  834,
 /*   110 */  1257,  768, 1257,  -10, 1257,  -10, 1257,  -10, 1257,  -10,
 /*   120 */  1257,  -53, 1257,  -53, 1257,   11, 1257,   11, 1257,   11,
 /*   130 */  1257,   11, 1257,  -49, 1257,  -49, 1257, 1049, 1257, 1049,
 /*   140 */  1257, 1049, 1257,  -76,  -76,  -76,  230,  -76,  -76,  -76,
 /*   150 */   -76,  -76, 1257,  -75, 1257,  -10,  -76,  733,  -76, 1046,
 /*   160 */   -76,  -76,  -76, 1257,  703, 1257,  -53,  -76,  307,  987,
 /*   170 */   314,   38, 1033, 1034, 1035,  -76,  638, 1257,  834, 1257,
 /*   180 */   -76, 1257,  -76, 1257,  -76, 1129,  989,  319,  -76, 1079,
 /*   190 */    90, 1016,  537, 1138,  -76, 1257,  163, 1257,  638, 1134,
 /*   200 */   376, 1136,  -76, 1132,  456, 1137,  -76, 1257,  237, 1257,
 /*   210 */   301, 1257,  638,  711,  -76, 1257,  -76,  -76, 1047,  456,
 /*   220 */   -76,  -76,  -76, 1257,  638, 1045, 1257, 1143, 1257, 1068,
 /*   230 */   102,  -76, 1148,  -76,  -76,  638, 1068,  102,  -76, 1257,
 /*   240 */   638, 1057, 1257, 1156, 1257,  638,  -76,  -76,  509,  -76,
 /*   250 */   -76,  -76,  385,  -76,  439,  -76, 1065,  -76,  387, 1047,
 /*   260 */   405,  -76,  -76,  456,  -76,  -76, 1082, 1071,  -76, 1170,
 /*   270 */   456,  780,  -76,  456,  -76,  -76, 1257,  638,  989,  389,
 /*   280 */   443, 1172,  405, 1082, 1071,  -76, 1171,  -24,  -76,  -76,
 /*   290 */  1084,   53,  -76,  -76,  -76,  -76,  375,  -76,  841,  -76,
 /*   300 */  1173,  -76,  441,  689,  -76,  456, 1182,  -76,  635,  -76,
 /*   310 */   456,  -76,  521,  649,  -76,  735,  -76,  -76,  -76,  -76,
 /*   320 */   649,  -76,  649,  -76,  456,  943,  -76,  456, 1068,  102,
 /*   330 */   -76,  -76, 1068,  102,  -76,  -76, 1148,  -76,  856,  -76,
 /*   340 */   -76,  912,  -76,  128,  -76,  -76,  128,  -76,  -76,   -8,
 /*   350 */   846,  966,  -76,  846, 1193,  -76,  -76,  -76,  414,  -76,
 /*   360 */   -76,  -76,  414,  -76,  -76,  -76,  -76,  -76,   -6,   42,
 /*   370 */   -76,  456,  -76, 1192, 1196,  456,  721, 1216,  689,  -76,
 /*   380 */  1222,  456,  992,  689,  -76, 1257,  506,  -76, 1201, 1227,
 /*   390 */   456, 1004, 1150,  456, 1182,  -76,  453, 1145,  -76,  -76,
 /*   400 */   -76,  -76,  -76,  989,  428,  593,  745,  456, 1047,  -76,
 /*   410 */   456,  729, 1237,  989,  486,  456, 1047,  900,  525, 1166,
 /*   420 */   456, 1047,  -76, 1231,  622, 1261, 1257,  573, 1236,  917,
 /*   430 */   -76,  -76, 1174, 1175,  437,  456,  773,  -76,  -76, 1228,
 /*   440 */   -76,  -76, 1135,  456,  755, 1177,  456, 1260,  456, 1032,
 /*   450 */   903, 1276, 1147, 1277,  174,  490,  326,  235,  -76, 1164,
 /*   460 */  1165, 1278, 1284, 1285,  174, 1279, 1233,  456, 1191,  456,
 /*   470 */   956,  456, 1238, 1257,  638, 1305, 1242, 1257,  638, 1189,
 /*   480 */   456, 1299,  456, 1036,  -76,  360,  551, 1300, 1257, 1042,
 /*   490 */  1257,  638, 1316,  638, 1209,  456,  601, 1320,  240,  456,
 /*   500 */  1321,  456, 1322,  456, 1323,  456, 1324,  557, 1217,  456,
 /*   510 */   601, 1328, 1233,  456, 1232,  456,  956, 1333, 1218,  456,
 /*   520 */  1299,  970,  586, 1325, 1257, 1063, 1335,  460, 1342,  456,
 /*   530 */  1047,  788,  172, 1346, 1347, 1350, 1352,  456, 1339, 1354,
 /*   540 */  1330,  -25, 1348,  456, 1078, 1364,  845, 1366, 1367,  -76,
 /*   550 */  1330,  456, 1368,  542, 1081, 1372, 1362,  456, 1336, 1254,
 /*   560 */   456, 1388,  -76,  -76,
};
#define YY_REDUCE_USE_DFLT (-95)
static const short yy_reduce_ofst[] = {
 /*     0 */     0,  -61,  -95,  -95,  202,  -95,  -95,  -95,  -94,  -59,
 /*    10 */   -95,   52,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  103,
 /*    20 */   -95,  189,  -95,  261,  -95,  349,  -95,  185,  520,  -95,
 /*    30 */   -95,  109,  -95,   33,  576,  116,  -95,  595,  162,  -95,
 /*    40 */   636,  -95,  -95,   36,  -95,  -95,  -95,  -95,  -95,  -95,
 /*    50 */   -95,  -95,  655,  -95,  761,  -95,  -95,  -95,  -95,  -95,
 /*    60 */   805,  921,  924,  -95,  -95,  -95,  -95,  928,  -95,  -95,
 /*    70 */   446,  -95,  122,  -95,  -95,  -95,  -70,  -95,  913,  920,
 /*    80 */   -95,  935,  496,  915,  936,  933,  937,  938,  940,  -95,
 /*    90 */   448,  388,  513,  388,  519,  -95,  -95,  993,  -95,  996,
 /*   100 */   -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  388,
 /*   110 */   522,  388,  578,  388,  580,  388,  581,  388,  589,  388,
 /*   120 */   590,  388,  643,  388,  644,  388,  645,  388,  646,  388,
 /*   130 */   651,  388,  654,  388,  707,  388,  709,  388,  710,  388,
 /*   140 */   712,  388,  715,  388,  -95,  -95,  -95,  -95,  -95,  -95,
 /*   150 */   -95,  -95,  717,  188,  718,  388,  -95,  -95,  -95,  -95,
 /*   160 */   -95,  -95,  -95,  720,  388,  723,  388,  -95,  997,  462,
 /*   170 */   913,  -95,  -95,  -95,  -95,  -95,  388,  725,  388,  774,
 /*   180 */   388,  775,  388,  776,  388,  -95,  572,  913,  -95,   45,
 /*   190 */   388,  932,  930,  -95,  -95,  782,  388,  783,  388,  -95,
 /*   200 */   971,  -95,  -95,  -95, 1011,  -95,  -95,  784,  388,  785,
 /*   210 */   388,  790,  388,  -95,  -95,  252,  -95,  -95, 1012, 1015,
 /*   220 */   -95,  -95,  -95,  828,  388,  -95,  186,  -95,  320,  962,
 /*   230 */  1005,  -95, 1014,  -95,  -95,  388,  967, 1008,  -95,  829,
 /*   240 */   388,  -95,  180,  -95,  837,  388,  -95,  291,  980,  -95,
 /*   250 */   -95,  -95, 1037,  -95, 1038,  -95,  -95,  -95, 1039, 1028,
 /*   260 */   535,  -95,  -95, 1040,  -95,  -95,  982,  994,  -95,  -95,
 /*   270 */   407,  -95,  -95, 1044,  -95,  -95,  840,  388,  126,  913,
 /*   280 */   980,  -95,  669,  998,  995,  -95,  850,  201,  -95,  -95,
 /*   290 */   -95,  993,  -95,  -95,  -95,  -95,  388,  -95,  -95,  -95,
 /*   300 */   -95,  -95,  388, 1048,  -95, 1053, 1030, 1031, 1050,  -95,
 /*   310 */  1056,  -95,  -95, 1041,  -95,  -95,  -95,  -95,  -95,  -95,
 /*   320 */  1043,  -95, 1051,  -95,  583,  -95,  -95,  516, 1006, 1052,
 /*   330 */   -95,  -95, 1018, 1054,  -95,  -95, 1061,  -95, 1055,  -95,
 /*   340 */   -95,  515,  -95, 1064,  -95,  -95, 1066,  -95,  -95, 1062,
 /*   350 */   196,  -95,  -95,  269,  -95,  -95,  -95,  -95, 1013,  -95,
 /*   360 */   -95,  -95, 1020,  -95,  -95,  -95,  -95,  -95, 1058, 1060,
 /*   370 */   -95, 1077,  -95,  -95,  -95,  713, 1070,  -95, 1074,  -95,
 /*   380 */   -95,  786,  -95, 1075,  -95,  851,  318,  -95,  -95,  -95,
 /*   390 */   792,  -95,  -95, 1101, 1083, 1076,  110,  -95,  -95,  -95,
 /*   400 */   -95,  -95,  -95,  865,  913,  330,  -95, 1107, 1105,  -95,
 /*   410 */  1110, 1111,  -95,  887,  913, 1116, 1114, 1059, 1067,  -95,
 /*   420 */   878, 1117,  -95, 1080, 1086,  -95,  869,  388,  -95,  -95,
 /*   430 */   -95,  -95,  -95,  -95,  -95,  855,  -95,  -95,  -95,  -95,
 /*   440 */   -95,  -95,  -95, 1126, 1127,  -95, 1139,  -95,  797,  -95,
 /*   450 */  1113,  -95,  -95,  -95,  527,  913, 1102,  796,  -95,  -95,
 /*   460 */   -95,  -95,  -95,  -95,  592,  -95, 1123, 1159,  -95,  838,
 /*   470 */  1118, 1160,  -95,  876,  388,  -95,  -95,  888,  388,  -95,
 /*   480 */  1176, 1109,  866,  -95,  -95,  895,  913,  -95,  317,  -95,
 /*   490 */   890,  388,  -95,  388,  -95, 1178, 1140,  -95,  -95,  906,
 /*   500 */   -95,  918,  -95,  919,  -95,  922,  -95,  913,  -95,  923,
 /*   510 */  1142,  -95, 1153,  925,  -95,  931, 1149,  -95,  -95,  927,
 /*   520 */  1131,  934,  913,  -95,  395,  -95,  -95, 1202,  -95, 1204,
 /*   530 */  1203,  -95,  397,  -95,  -95,  -95,  -95, 1208,  -95,  -95,
 /*   540 */  1133, 1207,  -95, 1221, 1141,  -95, 1211,  -95,  -95,  -95,
 /*   550 */  1144, 1234,  -95, 1243, 1229,  -95,  -95,  939,  -95,  -95,
 /*   560 */  1246,  -95,  -95,  -95,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */   570,  570,  565,  568,  869,  869,  869,  569,  576,  869,
 /*    10 */   869,  869,  869,  596,  597,  598,  577,  578,  579,  869,
 /*    20 */   869,  869,  869,  869,  869,  869,  869,  869,  869,  869,
 /*    30 */   869,  869,  589,  599,  608,  591,  607,  869,  869,  609,
 /*    40 */   652,  615,  869,  869,  653,  656,  657,  658,  855,  856,







|
|
|


|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|


|
|
|
|
|


|
|
|
|
|

|
|
|
|
|

|
|
|
|
|
|
|
|
|
|

|

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

|
|
|
|
|
|
|
|
|
|








|
|
|


|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|


|
|
|
|
|


|
|
|
|
|

|
|
|
|
|

|
|
|
|
|
|
|
|
|
|

|

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

|
|
|
|
|
|
|
|
|
|









|
|
|
|
|
|
|
|
|
|



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

|

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







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
**                     shifting non-terminals after a reduce.
**  yy_default[]       Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   263,    9,  261,  154,  124,  126,  128,  130,  132,  134,
 /*    10 */   136,  138,  140,  142,    3,  562,  145,  641,   83,  369,
 /*    20 */   144,  114,  116,  112,  118,  286,  124,  126,  128,  130,
 /*    30 */   132,  134,  136,  138,  140,  142,  136,  138,  140,  142,
 /*    40 */   110,   94,  146,  157,  162,  167,  156,  161,  120,  122,
 /*    50 */   114,  116,  112,  118,  567,  124,  126,  128,  130,  132,
 /*    60 */   134,  136,  138,  140,  142,    7,  223,  407,  262,  124,
 /*    70 */   126,  128,  130,  132,  134,  136,  138,  140,  142,  399,
 /*    80 */   309,  145,  870,    1,  563,  144,  398,    4,  371,   92,
 /*    90 */   435,  373,  380,  385,  132,  134,  136,  138,  140,  142,
 /*   100 */   279,   10,  415,  388,  410,  110,   94,  146,  157,  162,
 /*   110 */   167,  156,  161,  120,  122,  114,  116,  112,  118,   96,
 /*   120 */   124,  126,  128,  130,  132,  134,  136,  138,  140,  142,
 /*   130 */   145,  574,   77,   13,  144,  152,  222,  163,  168,   75,
 /*   140 */    44,   45,  367,  176,  280,  258,  839,   28,   13,  281,
 /*   150 */   402,   33,  233,   13,  110,   94,  146,  157,  162,  167,
 /*   160 */   156,  161,  120,  122,  114,  116,  112,  118,  572,  124,
 /*   170 */   126,  128,  130,  132,  134,  136,  138,  140,  142,  421,
 /*   180 */   371,  298,  720,  373,  380,  385,  107,  106,  108,  107,
 /*   190 */   106,  108,  169,  217,  295,  388,   13,  575,  471,   14,
 /*   200 */    15,  371,  175,  145,  373,  380,  385,  144,    2,  343,
 /*   210 */   346,    4,  292,   13,   14,   15,  388,  423,  345,   14,
 /*   220 */    15,  345,   95,  261,   12,   95,  802,  110,   94,  146,
 /*   230 */   157,  162,  167,  156,  161,  120,  122,  114,  116,  112,
 /*   240 */   118,   51,  124,  126,  128,  130,  132,  134,  136,  138,
 /*   250 */   140,  142,   36,  340,  800,  101,  102,  103,  101,  102,
 /*   260 */   103,  335,   14,   15,  847,  152,  188,  163,  168,   37,
 /*   270 */   341,   40,   59,   67,   69,  305,  336,  145,  265,   14,
 /*   280 */    15,  144,  171,  338,  173,  174,  351,  356,  357,  262,
 /*   290 */   171,   34,  173,  174,  366,  349,   51,   72,  460,  244,
 /*   300 */   197,  110,   94,  146,  157,  162,  167,  156,  161,  120,
 /*   310 */   122,  114,  116,  112,  118,  288,  124,  126,  128,  130,
 /*   320 */   132,  134,  136,  138,  140,  142,   40,   59,   67,   69,
 /*   330 */   305,  336,  152,   13,  163,  168,  248,  258,  338,   96,
 /*   340 */    96,  145,   16,   17,   18,  144,  687,  170,  358,    6,
 /*   350 */     5,  494,  466,  456,  171,   25,  173,  174,   20,   75,
 /*   360 */    75,  507,   81,  176,  176,  110,   94,  146,  157,  162,
 /*   370 */   167,  156,  161,  120,  122,  114,  116,  112,  118,   77,
 /*   380 */   124,  126,  128,  130,  132,  134,  136,  138,  140,  142,
 /*   390 */   364,  362,  596,   77,  623,  367,  327,   48,  297,   14,
 /*   400 */    15,  243,  213,   32,   33,   96,   49,  688,   96,  250,
 /*   410 */   534,   96,  278,  217,  217,  145,   13,   50,  518,  144,
 /*   420 */    46,   52,  354,  356,  357,   75,  368,  401,   75,  190,
 /*   430 */    47,   75,  235,   54,  171,  235,  173,  174,  211,  110,
 /*   440 */    94,  146,  157,  162,  167,  156,  161,  120,  122,  114,
 /*   450 */   116,  112,  118,  387,  124,  126,  128,  130,  132,  134,
 /*   460 */   136,  138,  140,  142,  303,   13,   48,  227,  236,   13,
 /*   470 */    96,  229,   96,   64,  294,   49,  191,  252,  293,  406,
 /*   480 */    96,  145,   14,   15,  358,  144,   50,   78,  564,  201,
 /*   490 */    75,  580,   75,  801,  176,  588,  493,    3,  562,  152,
 /*   500 */    75,  163,  168,  251,  296,  110,   94,  146,  157,  162,
 /*   510 */   167,  156,  161,  120,  122,  114,  116,  112,  118,   77,
 /*   520 */   124,  126,  128,  130,  132,  134,  136,  138,  140,  142,
 /*   530 */   660,   14,   15,   96,   81,   14,   15,  817,  489,   96,
 /*   540 */   310,   39,  250,  263,  216,  261,  145,  487,  533,  335,
 /*   550 */   144,  442,  350,   75,   13,  453,  261,  302,  253,   75,
 /*   560 */   852,  397,  255,  493,  535,  536,  573,  499,  850,   11,
 /*   570 */   110,   94,  146,  157,  162,  167,  156,  161,  120,  122,
 /*   580 */   114,  116,  112,  118,  845,  124,  126,  128,  130,  132,
 /*   590 */   134,  136,  138,  140,  142,   65,  662,  171,  312,  173,
 /*   600 */   174,   66,  505,  338,  501,  525,  866,   57,   58,   42,
 /*   610 */   252,  262,  195,  145,  207,  172,  441,  144,  665,  455,
 /*   620 */    14,   15,  262,   13,  640,  358,   31,  726,  313,  320,
 /*   630 */   322,  421,  171,  844,  173,  174,  251,  110,   94,  146,
 /*   640 */   157,  162,  167,  156,  161,  120,  122,  114,  116,  112,
 /*   650 */   118,   77,  124,  126,  128,  130,  132,  134,  136,  138,
 /*   660 */   140,  142,  171,   96,  173,  174,  432,  434,  433,  500,
 /*   670 */   171,  318,  173,  174,  581,   96,  479,   27,  145,  403,
 /*   680 */   310,  824,  144,   75,  455,   22,  503,   91,  246,   14,
 /*   690 */    15,  319,  461,  452,  537,   75,  582,  463,  171,   93,
 /*   700 */   173,  174,  110,   94,  146,  157,  162,  167,  156,  161,
 /*   710 */   120,  122,  114,  116,  112,  118,   77,  124,  126,  128,
 /*   720 */   130,  132,  134,  136,  138,  140,  142,  265,   96,  171,
 /*   730 */    96,  173,  174,  331,  810,   96,   96,  214,  312,  215,
 /*   740 */   275,  479,  272,  145,  273,  532,  315,  144,   75,  299,
 /*   750 */    75,  215,  109,  348,  111,   75,   75,  465,  426,  113,
 /*   760 */   115,  342,  463,  265,  266,  187,  325,  110,  165,  146,
 /*   770 */   157,  162,  167,  156,  161,  120,  122,  114,  116,  112,
 /*   780 */   118,  247,  124,  126,  128,  130,  132,  134,  136,  138,
 /*   790 */   140,  142,   26,   96,   96,   96,   96,   77,  271,  159,
 /*   800 */   283,   96,   96,   96,   96,  326,  275,  327,  145,  332,
 /*   810 */   364,  362,  144,   75,   75,   75,   75,  117,  119,  121,
 /*   820 */   123,   75,   75,   75,   75,  125,  127,  129,  131,  158,
 /*   830 */   317,  316,   24,   94,  146,  157,  162,  167,  156,  161,
 /*   840 */   120,  122,  114,  116,  112,  118,   96,  124,  126,  128,
 /*   850 */   130,  132,  134,  136,  138,  140,  142,   96,  331,   96,
 /*   860 */    96,  331,   96,  331,  436,   96,   75,   96,   96,  273,
 /*   870 */   133,  360,  361,   96,  145,   96,  583,   75,  144,   75,
 /*   880 */    75,  135,   75,  137,  139,   75,  141,   75,   75,  143,
 /*   890 */   689,  153,  155,   75,  376,   75,  382,  164,  331,  166,
 /*   900 */   146,  157,  162,  167,  156,  161,  120,  122,  114,  116,
 /*   910 */   112,  118,  261,  124,  126,  128,  130,  132,  134,  136,
 /*   920 */   138,  140,  142,   76,   96,   96,  438,   71,  457,  437,
 /*   930 */    96,  391,   29,   96,  328,   96,   96,  332,  352,  332,
 /*   940 */   353,  439,  148,  689,   75,   75,  147,  840,  178,  180,
 /*   950 */    75,  199,   96,   75,  182,   75,   75,  184,  652,  196,
 /*   960 */   198,  107,  106,  108,  383,  720,  327,  177,  404,  860,
 /*   970 */   150,  151,   75,   30,  332,   96,  208,  392,  262,  327,
 /*   980 */   430,  431,  476,  219,  183,  181,  300,   96,   96,  587,
 /*   990 */    96,  654,  179,   73,   74,   75,   96,   95,  149,  210,
 /*  1000 */    77,   96,  290,   96,   96,  331,  546,   75,   75,   76,
 /*  1010 */    75,  212,  224,   71,  240,  689,   75,  548,  414,   96,
 /*  1020 */   245,   75,   75,   75,   75,  277,  287,  386,  427,  219,
 /*  1030 */   101,  102,  103,  104,  105,  185,  189,  199,  449,   75,
 /*  1040 */    96,  275,   96,  474,  450,  470,  327,  107,  106,  108,
 /*  1050 */    77,  219,   42,  177,  458,   45,  484,  486,  273,  492,
 /*  1060 */    75,  490,   75,  476,  478,  522,  491,   35,  421,  421,
 /*  1070 */   183,  181,  421,  421,  421,  421,  421,   81,  179,   73,
 /*  1080 */    74,  332,  244,   95,  526,   38,  490,   42,   41,   77,
 /*  1090 */   523,   43,   53,   56,   55,   60,   64,   77,   70,  483,
 /*  1100 */    61,   76,   81,   62,   63,   71,  502,  504,   68,  597,
 /*  1110 */   506,  510,  514,  520,  558,  598,  101,  102,  103,  104,
 /*  1120 */   105,  185,  189,   79,   81,   80,  516,  244,  241,  199,
 /*  1130 */    82,   84,  239,  225,   85,   90,   97,   86,   98,  107,
 /*  1140 */   106,  108,   87,   89,   88,  177,   99,  100,  142,  160,
 /*  1150 */   218,  186,  666,  667,  668,  194,  209,  200,  203,  202,
 /*  1160 */   206,  205,  183,  181,  204,  192,  220,  193,  221,  219,
 /*  1170 */   179,   73,   74,  228,  232,   95,  226,  230,  231,  233,
 /*  1180 */   234,  237,  215,  257,  242,  238,  249,  276,  260,  267,
 /*  1190 */   254,  256,  259,   76,  264,  269,  268,   71,  270,  284,
 /*  1200 */   274,  282,  291,  301,  285,  306,  304,  324,  101,  102,
 /*  1210 */   103,  104,  105,  185,  189,  803,  311,  355,  307,  374,
 /*  1220 */   375,  199,  308,  309,  359,  337,  314,  321,  329,  330,
 /*  1230 */   363,  107,  106,  108,  333,  323,  372,  177,  344,  334,
 /*  1240 */   347,  365,  378,  379,  381,  339,  389,  377,  384,  390,
 /*  1250 */   393,  400,  394,  370,  183,  181,  289,  395,  408,  396,
 /*  1260 */    54,  409,  179,   73,   74,  411,  412,   95,  413,  416,
 /*  1270 */   417,  420,  422,  428,  832,  429,  440,  837,  838,   76,
 /*  1280 */   443,  444,  445,   71,  446,  451,  448,  808,  809,  459,
 /*  1290 */   418,  454,  447,  727,  728,  831,  462,  464,  846,  457,
 /*  1300 */   101,  102,  103,  104,  105,  185,  189,  199,  467,  468,
 /*  1310 */   469,  475,  419,  472,  424,  473,  848,  107,  106,  108,
 /*  1320 */   477,  425,  480,  177,  482,  485,  488,  481,  849,  495,
 /*  1330 */   851,  659,  496,  661,  497,  816,  858,  511,  509,  719,
 /*  1340 */   183,  181,  722,  513,  515,  517,  725,  521,  179,   73,
 /*  1350 */    74,  519,  528,   95,  524,  818,  530,  819,  531,  820,
 /*  1360 */     8,  821,  822,  538,  539,   19,   21,   23,  405,  823,
 /*  1370 */   549,  542,  859,  544,  861,  543,  862,  547,  552,  540,
 /*  1380 */   541,  865,  545,  551,  555,  550,  101,  102,  103,  104,
 /*  1390 */   105,  185,  189,  554,  867,  557,  560,  559,  529,  561,
 /*  1400 */   460,  868,  545,  545,  545,  527,  545,  553,  545,  545,
 /*  1410 */   545,  545,  556,  545,  545,  545,  545,  545,  545,  545,
 /*  1420 */   545,  545,  545,  545,  545,  545,  545,  545,  545,  545,
 /*  1430 */   545,  545,  545,  545,  545,  545,  545,  545,  545,  545,
 /*  1440 */   545,  545,  545,  545,  545,  545,  545,  545,  545,  545,
 /*  1450 */   545,  545,  545,  508,  512,  456,  545,  545,  545,  498,
 /*  1460 */   545,  545,  545,  545,   81,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */    24,  148,   26,   78,   79,   80,   81,   82,   83,   84,
 /*    10 */    85,   86,   87,   88,    9,   10,   40,   23,  192,   25,
 /*    20 */    44,   74,   75,   76,   77,  199,   79,   80,   81,   82,
 /*    30 */    83,   84,   85,   86,   87,   88,   85,   86,   87,   88,
 /*    40 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,
 /*    50 */    74,   75,   76,   77,    9,   79,   80,   81,   82,   83,
 /*    60 */    84,   85,   86,   87,   88,    9,   25,   20,   92,   79,
 /*    70 */    80,   81,   82,   83,   84,   85,   86,   87,   88,  177,
 /*    80 */   178,   40,  142,  143,  144,   44,  184,  147,   94,   48,
 /*    90 */    47,   97,   98,   99,   83,   84,   85,   86,   87,   88,
 /*   100 */   157,  149,   55,  109,   57,   64,   65,   66,   67,   68,
 /*   110 */    69,   70,   71,   72,   73,   74,   75,   76,   77,  150,
 /*   120 */    79,   80,   81,   82,   83,   84,   85,   86,   87,   88,
 /*   130 */    40,    9,  189,   26,   44,  217,  218,  219,  220,  170,
 /*   140 */   186,  187,  150,  174,  201,  202,  103,  155,   26,  206,
 /*   150 */   158,  159,   26,   26,   64,   65,   66,   67,   68,   69,
 /*   160 */    70,   71,   72,   73,   74,   75,   76,   77,    9,   79,
 /*   170 */    80,   81,   82,   83,   84,   85,   86,   87,   88,  150,
 /*   180 */    94,  212,    9,   97,   98,   99,   60,   61,   62,   60,
 /*   190 */    61,   62,   22,  224,   23,  109,   26,    9,   25,   92,
 /*   200 */    93,   94,   23,   40,   97,   98,   99,   44,  144,   83,
 /*   210 */    84,  147,   85,   26,   92,   93,  109,  188,   92,   92,
 /*   220 */    93,   92,   96,   26,  150,   96,  136,   64,   65,   66,
 /*   230 */    67,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   240 */    77,   66,   79,   80,   81,   82,   83,   84,   85,   86,
 /*   250 */    87,   88,  168,  169,   17,  129,  130,  131,  129,  130,
 /*   260 */   131,  177,   92,   93,   17,  217,   23,  219,  220,   94,
 /*   270 */    95,   96,   97,   98,   99,  100,  101,   40,  163,   92,
 /*   280 */    93,   44,  111,  108,  113,  114,  165,  166,  167,   92,
 /*   290 */   111,  160,  113,  114,  163,  164,   66,   22,   51,  126,
 /*   300 */   137,   64,   65,   66,   67,   68,   69,   70,   71,   72,
 /*   310 */    73,   74,   75,   76,   77,  200,   79,   80,   81,   82,
 /*   320 */    83,   84,   85,   86,   87,   88,   96,   97,   98,   99,
 /*   330 */   100,  101,  217,   26,  219,  220,  201,  202,  108,  150,
 /*   340 */   150,   40,   13,   14,   15,   44,   23,  157,  227,  145,
 /*   350 */   146,  104,  105,  106,  111,  151,  113,  114,  149,  170,
 /*   360 */   170,  157,  115,  174,  174,   64,   65,   66,   67,   68,
 /*   370 */    69,   70,   71,   72,   73,   74,   75,   76,   77,  189,
 /*   380 */    79,   80,   81,   82,   83,   84,   85,   86,   87,   88,
 /*   390 */    83,   84,  117,  189,   23,  150,   25,   18,   23,   92,
 /*   400 */    93,  212,  212,  158,  159,  150,   27,   23,  150,   25,
 /*   410 */   103,  150,   22,  224,  224,   40,   26,   38,  214,   44,
 /*   420 */    41,   96,  165,  166,  167,  170,  181,  182,  170,  174,
 /*   430 */    51,  170,  174,  108,  111,  174,  113,  114,  137,   64,
 /*   440 */    65,   66,   67,   68,   69,   70,   71,   72,   73,   74,
 /*   450 */    75,   76,   77,  171,   79,   80,   81,   82,   83,   84,
 /*   460 */    85,   86,   87,   88,   23,   26,   18,  209,  210,   26,
 /*   470 */   150,  210,  150,  102,  112,   27,  221,   93,  116,  153,
 /*   480 */   150,   40,   92,   93,  227,   44,   38,  157,    0,   41,
 /*   490 */   170,    9,  170,   17,  174,    9,  174,    9,   10,  217,
 /*   500 */   170,  219,  220,  119,  174,   64,   65,   66,   67,   68,
 /*   510 */    69,   70,   71,   72,   73,   74,   75,   76,   77,  189,
 /*   520 */    79,   80,   81,   82,   83,   84,   85,   86,   87,   88,
 /*   530 */     9,   92,   93,  150,  115,   92,   93,    9,  216,  150,
 /*   540 */    45,  169,   25,   24,  224,   26,   40,  128,  150,  177,
 /*   550 */    44,  225,   22,  170,   26,  229,   26,  174,  119,  170,
 /*   560 */     9,   66,  119,  174,  166,  167,    9,   20,    9,   12,
 /*   570 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,
 /*   580 */    74,   75,   76,   77,   11,   79,   80,   81,   82,   83,
 /*   590 */    84,   85,   86,   87,   88,   29,    9,  111,  103,  113,
 /*   600 */   114,   35,   55,  108,   57,  216,    9,   13,   14,  103,
 /*   610 */    93,   92,  136,   40,  138,  112,   21,   44,  115,  157,
 /*   620 */    92,   93,   92,   26,   23,  227,   25,    9,  104,  105,
 /*   630 */   106,  150,  111,   11,  113,  114,  119,   64,   65,   66,
 /*   640 */    67,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   650 */    77,  189,   79,   80,   81,   82,   83,   84,   85,   86,
 /*   660 */    87,   88,  111,  150,  113,  114,  104,  105,  106,  188,
 /*   670 */   111,   32,  113,  114,    9,  150,  214,   22,   40,   24,
 /*   680 */    45,    9,   44,  170,  157,  149,  139,  174,   25,   92,
 /*   690 */    93,   52,  230,   98,   22,  170,    9,  235,  111,  174,
 /*   700 */   113,  114,   64,   65,   66,   67,   68,   69,   70,   71,
 /*   710 */    72,   73,   74,   75,   76,   77,  189,   79,   80,   81,
 /*   720 */    82,   83,   84,   85,   86,   87,   88,  163,  150,  111,
 /*   730 */   150,  113,  114,  150,  139,  150,  150,   23,  103,   25,
 /*   740 */   150,  214,   23,   40,   25,   73,  107,   44,  170,   23,
 /*   750 */   170,   25,  174,  162,  174,  170,  170,  230,  136,  174,
 /*   760 */   174,  170,  235,  163,  200,  157,  183,   64,   65,   66,
 /*   770 */    67,   68,   69,   70,   71,   72,   73,   74,   75,   76,
 /*   780 */    77,  118,   79,   80,   81,   82,   83,   84,   85,   86,
 /*   790 */    87,   88,  152,  150,  150,  150,  150,  189,  208,   66,
 /*   800 */   200,  150,  150,  150,  150,   23,  150,   25,   40,  226,
 /*   810 */    83,   84,   44,  170,  170,  170,  170,  174,  174,  174,
 /*   820 */   174,  170,  170,  170,  170,  174,  174,  174,  174,   96,
 /*   830 */    95,   96,  149,   65,   66,   67,   68,   69,   70,   71,
 /*   840 */    72,   73,   74,   75,   76,   77,  150,   79,   80,   81,
 /*   850 */    82,   83,   84,   85,   86,   87,   88,  150,  150,  150,
 /*   860 */   150,  150,  150,  150,  208,  150,  170,  150,  150,   25,
 /*   870 */   174,  129,  130,  150,   40,  150,    9,  170,   44,  170,
 /*   880 */   170,  174,  170,  174,  174,  170,  174,  170,  170,  174,
 /*   890 */    24,  174,  174,  170,  183,  170,  183,  174,  150,  174,
 /*   900 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
 /*   910 */    76,   77,   26,   79,   80,   81,   82,   83,   84,   85,
 /*   920 */    86,   87,   88,   22,  150,  150,   28,   26,   64,   31,
 /*   930 */   150,  183,  156,  150,  226,  150,  150,  226,   23,  226,
 /*   940 */    25,   43,   40,    9,  170,  170,   44,  103,  174,  174,
 /*   950 */   170,   50,  150,  170,  174,  170,  170,  174,    9,  174,
 /*   960 */   174,   60,   61,   62,   23,    9,   25,   66,  157,    9,
 /*   970 */    68,   69,  170,   23,  226,  150,  174,   23,   92,   25,
 /*   980 */    53,   54,  150,  117,   83,   84,   85,  150,  150,    9,
 /*   990 */   150,  127,   91,   92,   93,  170,  150,   96,   96,  174,
 /*  1000 */   189,  150,  150,  150,  150,  150,   46,  170,  170,   22,
 /*  1010 */   170,  174,  174,   26,  174,  103,  170,  131,  157,  150,
 /*  1020 */   174,  170,  170,  170,  170,  174,  174,  174,  174,  117,
 /*  1030 */   129,  130,  131,  132,  133,  134,  135,   50,  183,  170,
 /*  1040 */   150,  150,  150,  174,   23,  213,   25,   60,   61,   62,
 /*  1050 */   189,  117,  103,   66,  186,  187,   23,  157,   25,   23,
 /*  1060 */   170,   25,  170,  150,  174,  157,  174,  161,  150,  150,
 /*  1070 */    83,   84,  150,  150,  150,  150,  150,  115,   91,   92,
 /*  1080 */    93,  226,  126,   96,   23,  150,   25,  103,  171,  189,
 /*  1090 */   128,   33,  171,   42,  180,   46,  102,  189,   22,  208,
 /*  1100 */   172,   22,  115,  171,  173,   26,  188,  188,  171,  117,
 /*  1110 */   188,  188,  188,  188,  188,  117,  129,  130,  131,  132,
 /*  1120 */   133,  134,  135,  190,  115,  189,  213,  126,  123,   50,
 /*  1130 */   191,  193,  124,  121,  194,  125,  117,  195,  150,   60,
 /*  1140 */    61,   62,  196,  198,  197,   66,  117,  150,   88,   96,
 /*  1150 */   150,   22,  115,  115,  115,   17,  136,   22,  187,   23,
 /*  1160 */    23,  150,   83,   84,   25,  222,  150,  223,  154,  117,
 /*  1170 */    91,   92,   93,   25,  101,   96,  122,  211,  172,   26,
 /*  1180 */   162,  211,   25,  119,  122,  172,  203,  103,  154,  204,
 /*  1190 */   150,  150,  150,   22,  150,  120,  205,   26,   22,  204,
 /*  1200 */   150,   23,  117,   23,  205,  150,  171,   22,  129,  130,
 /*  1210 */   131,  132,  133,  134,  135,  136,  150,   23,  175,   46,
 /*  1220 */    22,   50,  176,  178,  228,  162,  179,  179,  211,  172,
 /*  1230 */   228,   60,   61,   62,  211,  179,  150,   66,  170,  172,
 /*  1240 */   170,  163,   23,  171,   22,  180,   46,  173,  171,   22,
 /*  1250 */   100,  182,  150,  182,   83,   84,   85,  175,  150,  176,
 /*  1260 */   108,  154,   91,   92,   93,  150,  154,   96,   24,  150,
 /*  1270 */   154,  103,  154,   39,   11,   37,   47,  103,  103,   22,
 /*  1280 */   139,  150,  154,   26,  103,  171,   22,    9,  139,  185,
 /*  1290 */   231,   11,  150,  127,  127,    9,   17,    9,   17,   64,
 /*  1300 */   129,  130,  131,  132,  133,  134,  135,   50,  185,  150,
 /*  1310 */   107,  194,  232,  150,  233,   73,    9,   60,   61,   62,
 /*  1320 */    73,  234,  127,   66,   22,  215,   22,  150,    9,  118,
 /*  1330 */     9,    9,  150,    9,  194,    9,    9,  194,  118,    9,
 /*  1340 */    83,   84,    9,  185,  107,  194,    9,  215,   91,   92,
 /*  1350 */    93,  127,  150,   96,   22,    9,  150,    9,  154,    9,
 /*  1360 */    11,    9,    9,  150,   23,   16,   17,   18,   19,    9,
 /*  1370 */    34,  163,    9,  150,    9,   24,    9,  163,  150,   30,
 /*  1380 */   236,    9,  237,  236,  154,   36,  129,  130,  131,  132,
 /*  1390 */   133,  134,  135,  150,    9,   20,  140,   59,   49,  150,
 /*  1400 */    51,    9,  238,  238,  238,   56,  238,   58,  238,  238,
 /*  1410 */   238,  238,   63,  238,  238,  238,  238,  238,  238,  238,
 /*  1420 */   238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
 /*  1430 */   238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
 /*  1440 */   238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
 /*  1450 */   238,  238,  238,  104,  105,  106,  238,  238,  238,  110,
 /*  1460 */   238,  238,  238,  238,  115,
};
#define YY_SHIFT_USE_DFLT (-76)
static const short yy_shift_ofst[] = {
 /*     0 */     5,  488,  -76,  -76, 1349,   45,   56,  -76,  329,  557,
 /*    10 */   159,  122,  188,  -76,  -76,  -76,  -76,  -76,  -76,  557,
 /*    20 */   482,  557,  665,  557,  687,  655,  867,  187,  601,  950,
 /*    30 */   980,  107,  -76,  197,  -76,  175,  -76,  187,  230,  -76,
 /*    40 */   984,  -76, 1058,  379,  -76,  -76,  -76,  -76,  -76,  -76,
 /*    50 */   -76,  325,  984,  -76, 1051,  -76,  594,  -76,  -76, 1049,
 /*    60 */   566,  984,  994,  -76,  -76,  -76,  -76,  984,  -76, 1076,
 /*    70 */  1257,  275,  901,  992,  998,  -76,  987,  -76,  171, 1009,
 /*    80 */   -76,  362,  -76,  663, 1001, 1005, 1008, 1012, 1010,  -76,
 /*    90 */  1257,   41, 1257,  638, 1257,  -76, 1019,  187, 1029,  187,
 /*   100 */   -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  834,
 /*   110 */  1257,  768, 1257,  -10, 1257,  -10, 1257,  -10, 1257,  -10,
 /*   120 */  1257,  -53, 1257,  -53, 1257,   11, 1257,   11, 1257,   11,
 /*   130 */  1257,   11, 1257,  -49, 1257,  -49, 1257, 1060, 1257, 1060,
 /*   140 */  1257, 1060, 1257,  -76,  -76,  -76,  902,  -76,  -76,  -76,
 /*   150 */   -76,  -76, 1257,  -75, 1257,  -10,  -76,  733,  -76, 1053,
 /*   160 */   -76,  -76,  -76, 1257,  703, 1257,  -53,  -76,  170,  987,
 /*   170 */   179,  503, 1037, 1038, 1039,  -76,  638, 1257,  834, 1257,
 /*   180 */   -76, 1257,  -76, 1257,  -76, 1129, 1009,  243,  -76, 1079,
 /*   190 */    90, 1020,  476, 1138,  -76, 1257,  163, 1257,  638, 1135,
 /*   200 */   448, 1136,  -76, 1139,  187, 1137,  -76, 1257,  237, 1257,
 /*   210 */   301, 1257,  638,  714,  -76, 1257,  -76,  -76, 1052,  187,
 /*   220 */   -76,  -76,  -76, 1257,  638, 1054, 1257, 1148, 1257, 1073,
 /*   230 */   566,  -76, 1153,  -76,  -76,  638, 1073,  566,  -76, 1257,
 /*   240 */   638, 1062, 1257, 1157, 1257,  638,  -76,  -76,  517,  -76,
 /*   250 */   -76,  -76,  439,  -76,  443,  -76, 1064,  -76,  390, 1052,
 /*   260 */   519,  -76,  -76,  187,  -76,  -76, 1084, 1075,  -76, 1176,
 /*   270 */   187,  719,  -76,  187,  -76,  -76, 1257,  638, 1009,  323,
 /*   280 */   384, 1178,  519, 1084, 1075,  -76, 1171,  -24,  -76,  -76,
 /*   290 */  1085,  127,  -76,  -76,  -76,  -76,  375,  -76,  726,  -76,
 /*   300 */  1180,  -76,  441,  984,  -76,  187, 1185,  -76,  635,  -76,
 /*   310 */   187,  -76,  524,  639,  -76,  735,  -76,  -76,  -76,  -76,
 /*   320 */   639,  -76,  639,  -76,  187,  782,  -76,  187, 1073,  566,
 /*   330 */   -76,  -76, 1073,  566,  -76,  -76, 1153,  -76, 1051,  -76,
 /*   340 */   -76,  126,  -76,  129,  -76,  -76,  129,  -76,  -76,  530,
 /*   350 */   727,  915,  -76,  727, 1194,  -76,  -76,  -76,  742,  -76,
 /*   360 */   -76,  -76,  742,  -76,  -76,  -76,  -76,  -76,   -6,   86,
 /*   370 */   -76,  187,  -76, 1173, 1198,  187,  371, 1219,  984,  -76,
 /*   380 */  1222,  187,  941,  984,  -76, 1257,  506,  -76, 1200, 1227,
 /*   390 */   187,  954, 1150,  187, 1185,  -76,  495, 1152,  -76,  -76,
 /*   400 */   -76,  -76,  -76, 1009,  486,  595,   47,  187, 1052,  -76,
 /*   410 */   187,  866, 1244, 1009,  521,  187, 1052,  898,  562, 1168,
 /*   420 */   187, 1052,  -76, 1234,  622, 1263, 1257,  573, 1238,  927,
 /*   430 */   -76,  -76, 1174, 1175,   43,  187,  844,  -76,  -76, 1229,
 /*   440 */   -76,  -76, 1141,  187,  912, 1181,  187, 1264,  187, 1021,
 /*   450 */   949, 1278, 1149, 1280,  247,  551,  864,  379,  -76, 1166,
 /*   460 */  1167, 1279, 1286, 1288,  247, 1281, 1235,  187, 1203,  187,
 /*   470 */   173,  187, 1242, 1257,  638, 1307, 1247, 1257,  638, 1195,
 /*   480 */   187, 1302,  187, 1033,  -76,  419,  559, 1304, 1257, 1036,
 /*   490 */  1257,  638, 1319,  638, 1211,  187,  956, 1321,  547,  187,
 /*   500 */  1322,  187, 1324,  187, 1326,  187, 1327,  587, 1220,  187,
 /*   510 */   956, 1330, 1235,  187, 1237,  187,  173, 1333, 1224,  187,
 /*   520 */  1302,  962,  618, 1332, 1257, 1061, 1337,  528, 1346,  187,
 /*   530 */  1052,  672,  307, 1348, 1350, 1352, 1353,  187, 1341, 1360,
 /*   540 */  1336,  197, 1351,  187,  960, 1363,  886, 1365, 1367,  -76,
 /*   550 */  1336,  187, 1372,  597,  934, 1385, 1375,  187, 1338, 1256,
 /*   560 */   187, 1392,  -76,  -76,
};
#define YY_REDUCE_USE_DFLT (-175)
static const short yy_reduce_ofst[] = {
 /*     0 */   -60,   64, -175, -175,  204, -175, -175, -175, -147,  -48,
 /*    10 */  -175,   74, -175, -175, -175, -175, -175, -175, -175,  209,
 /*    20 */  -175,  536, -175,  683, -175,  640, -175,   -8,  776, -175,
 /*    30 */  -175,  245, -175,  131,  906,   84, -175,  935,  372, -175,
 /*    40 */   917, -175, -175,  -46, -175, -175, -175, -175, -175, -175,
 /*    50 */  -175, -175,  921, -175,  914, -175, -175, -175, -175, -175,
 /*    60 */   928,  932,  931, -175, -175, -175, -175,  937, -175, -175,
 /*    70 */   383, -175,  -31, -175, -175, -175,  330, -175,  933,  936,
 /*    80 */  -175,  939, -174,  938,  940,  942,  946,  947,  945, -175,
 /*    90 */   513,   48,  525,   48,  578, -175, -175,  988, -175,  997,
 /*   100 */  -175, -175, -175, -175, -175, -175, -175, -175, -175,   48,
 /*   110 */   580,   48,  585,   48,  586,   48,  643,   48,  644,   48,
 /*   120 */   645,   48,  646,   48,  651,   48,  652,   48,  653,   48,
 /*   130 */   654,   48,  696,   48,  707,   48,  709,   48,  710,   48,
 /*   140 */   712,   48,  715,   48, -175, -175, -175, -175, -175, -175,
 /*   150 */  -175, -175,  717,  -82,  718,   48, -175, -175, -175, -175,
 /*   160 */  -175, -175, -175,  723,   48,  725,   48, -175, 1000,  190,
 /*   170 */   933, -175, -175, -175, -175, -175,   48,  774,   48,  775,
 /*   180 */    48,  780,   48,  783,   48, -175,  608,  933, -175,  255,
 /*   190 */    48,  943,  944, -175, -175,  785,   48,  786,   48, -175,
 /*   200 */   971, -175, -175, -175, 1011, -175, -175,  802,   48,  825,
 /*   210 */    48,  837,   48, -175, -175,  320, -175, -175, 1014, 1016,
 /*   220 */  -175, -175, -175,  838,   48, -175,  258, -175,  261,  966,
 /*   230 */  1006, -175, 1018, -175, -175,   48,  970, 1013, -175,  840,
 /*   240 */    48, -175,  189, -175,  846,   48, -175,  135,  983, -175,
 /*   250 */  -175, -175, 1040, -175, 1041, -175, -175, -175, 1042, 1034,
 /*   260 */   564, -175, -175, 1044, -175, -175,  985,  991, -175, -175,
 /*   270 */   590, -175, -175, 1050, -175, -175,  851,   48,  -57,  933,
 /*   280 */   983, -175,  600,  995,  999, -175,  852,  115, -175, -175,
 /*   290 */  -175,  988, -175, -175, -175, -175,   48, -175, -175, -175,
 /*   300 */  -175, -175,   48, 1035, -175, 1055, 1043, 1046, 1045, -175,
 /*   310 */  1066, -175, -175, 1047, -175, -175, -175, -175, -175, -175,
 /*   320 */  1048, -175, 1056, -175,  583, -175, -175,  708, 1017, 1057,
 /*   330 */  -175, -175, 1023, 1067, -175, -175, 1063, -175, 1065, -175,
 /*   340 */  -175,  591, -175, 1068, -175, -175, 1070, -175, -175, 1078,
 /*   350 */   121, -175, -175,  257, -175, -175, -175, -175,  996, -175,
 /*   360 */  -175, -175, 1002, -175, -175, -175, -175, -175, 1069, 1071,
 /*   370 */  -175, 1086, -175, -175, -175,  711, 1074, -175, 1072, -175,
 /*   380 */  -175,  713, -175, 1077, -175,  853,  282, -175, -175, -175,
 /*   390 */   748, -175, -175, 1102, 1082, 1083,  -98, -175, -175, -175,
 /*   400 */  -175, -175, -175,  811,  933,  326, -175, 1108, 1107, -175,
 /*   410 */  1115, 1112, -175,  861,  933, 1119, 1116, 1059, 1080, -175,
 /*   420 */    29, 1118, -175, 1081, 1087, -175,  854,   48, -175, -175,
 /*   430 */  -175, -175, -175, -175, -175,  656, -175, -175, -175, -175,
 /*   440 */  -175, -175, -175, 1131, 1128, -175, 1142, -175,  855, -175,
 /*   450 */  1114, -175, -175, -175,  462,  933, 1104,  868, -175, -175,
 /*   460 */  -175, -175, -175, -175,  527, -175, 1123, 1159, -175,  832,
 /*   470 */  1117, 1163, -175,  869,   48, -175, -175,  890,   48, -175,
 /*   480 */  1177, 1110,  891, -175, -175,  900,  933, -175,  322, -175,
 /*   490 */   892,   48, -175,   48, -175, 1182, 1140, -175, -175,  481,
 /*   500 */  -175,  918, -175,  919, -175,  922, -175,  933, -175,  923,
 /*   510 */  1143, -175, 1158,  924, -175,  913, 1151, -175, -175,  925,
 /*   520 */  1132,  908,  933, -175,  389, -175, -175, 1202, -175, 1206,
 /*   530 */  1204, -175,  398, -175, -175, -175, -175, 1213, -175, -175,
 /*   540 */  1144, 1208, -175, 1223, 1145, -175, 1214, -175, -175, -175,
 /*   550 */  1147, 1228, -175, 1243, 1230, -175, -175,  926, -175, -175,
 /*   560 */  1249, -175, -175, -175,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */   570,  570,  565,  568,  869,  869,  869,  569,  576,  869,
 /*    10 */   869,  869,  869,  596,  597,  598,  577,  578,  579,  869,
 /*    20 */   869,  869,  869,  869,  869,  869,  869,  869,  869,  869,
 /*    30 */   869,  869,  589,  599,  608,  591,  607,  869,  869,  609,
 /*    40 */   652,  615,  869,  869,  653,  656,  657,  658,  855,  856,
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
 /* 174 */ "expr ::= ID",
 /* 175 */ "expr ::= JOIN_KW",
 /* 176 */ "expr ::= nm DOT nm",
 /* 177 */ "expr ::= nm DOT nm DOT nm",
 /* 178 */ "term ::= INTEGER",
 /* 179 */ "term ::= FLOAT",
 /* 180 */ "term ::= STRING",
 /* 181 */ "expr ::= BLOB",
 /* 182 */ "expr ::= REGISTER",
 /* 183 */ "expr ::= VARIABLE",
 /* 184 */ "expr ::= ID LP exprlist RP",
 /* 185 */ "expr ::= ID LP STAR RP",
 /* 186 */ "term ::= CTIME",
 /* 187 */ "term ::= CDATE",
 /* 188 */ "term ::= CTIMESTAMP",







|







1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
 /* 174 */ "expr ::= ID",
 /* 175 */ "expr ::= JOIN_KW",
 /* 176 */ "expr ::= nm DOT nm",
 /* 177 */ "expr ::= nm DOT nm DOT nm",
 /* 178 */ "term ::= INTEGER",
 /* 179 */ "term ::= FLOAT",
 /* 180 */ "term ::= STRING",
 /* 181 */ "term ::= BLOB",
 /* 182 */ "expr ::= REGISTER",
 /* 183 */ "expr ::= VARIABLE",
 /* 184 */ "expr ::= ID LP exprlist RP",
 /* 185 */ "expr ::= ID LP STAR RP",
 /* 186 */ "term ::= CTIME",
 /* 187 */ "term ::= CDATE",
 /* 188 */ "term ::= CTIMESTAMP",
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
  { 174, 1 },
  { 174, 1 },
  { 174, 3 },
  { 174, 5 },
  { 170, 1 },
  { 170, 1 },
  { 170, 1 },
  { 174, 1 },
  { 174, 1 },
  { 174, 1 },
  { 174, 4 },
  { 174, 4 },
  { 170, 1 },
  { 170, 1 },
  { 170, 1 },







|







1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
  { 174, 1 },
  { 174, 1 },
  { 174, 3 },
  { 174, 5 },
  { 170, 1 },
  { 170, 1 },
  { 170, 1 },
  { 170, 1 },
  { 174, 1 },
  { 174, 1 },
  { 174, 4 },
  { 174, 4 },
  { 170, 1 },
  { 170, 1 },
  { 170, 1 },
Changes to SQLite.Interop/src/pragma.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.1 2005/03/01 16:04:34 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/* Ignore this whole file if pragmas are disabled
*/













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.2 2005/03/11 15:03:30 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/* Ignore this whole file if pragmas are disabled
*/
75
76
77
78
79
80
81

82

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

101

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

132
133
134
135
136
137
138
    return 1;
  }else if( sqlite3StrICmp(z, "memory")==0 ){
    return 2;
  }else{
    return 0;
  }
}



/*
** Invalidate temp storage, either when the temp storage is changed
** from default, or when 'file' and the temp_store_directory has changed
*/
static int invalidateTempStorage(Parse *pParse){
  sqlite3 *db = pParse->db;
  if( db->aDb[1].pBt!=0 ){
    if( db->flags & SQLITE_InTrans ){
      sqlite3ErrorMsg(pParse, "temporary storage cannot be changed "
        "from within a transaction");
      return SQLITE_ERROR;
    }
    sqlite3BtreeClose(db->aDb[1].pBt);
    db->aDb[1].pBt = 0;
    sqlite3ResetInternalSchema(db, 0);
  }
  return SQLITE_OK;
}



/*
** If the TEMP database is open, close it and mark the database schema
** as needing reloading.  This must be done when using the TEMP_STORE
** or DEFAULT_TEMP_STORE pragmas.
*/
static int changeTempStorage(Parse *pParse, const char *zStorageType){
  int ts = getTempStore(zStorageType);
  sqlite3 *db = pParse->db;
  if( db->temp_store==ts ) return SQLITE_OK;
  if( invalidateTempStorage( pParse ) != SQLITE_OK ){
    return SQLITE_ERROR;
  }
  db->temp_store = ts;
  return SQLITE_OK;
}
#endif

/*
** Generate code to return a single integer value.
*/
static void returnSingleInt(Parse *pParse, const char *zLabel, int value){
  Vdbe *v = sqlite3GetVdbe(pParse);
  sqlite3VdbeAddOp(v, OP_Integer, value, 0);
  if( pParse->explain==0 ){
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, zLabel, P3_STATIC);
  }
  sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
}


/*
** Check to see if zRight and zLeft refer to a pragma that queries
** or changes one of the flags in db->flags.  Return 1 if so and 0 if not.
** Also, implement the pragma.
*/
static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
  static const struct sPragmaType {







>

>


















>

>















|














>







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
    return 1;
  }else if( sqlite3StrICmp(z, "memory")==0 ){
    return 2;
  }else{
    return 0;
  }
}
#endif /* SQLITE_PAGER_PRAGMAS */

#ifndef SQLITE_OMIT_PAGER_PRAGMAS
/*
** Invalidate temp storage, either when the temp storage is changed
** from default, or when 'file' and the temp_store_directory has changed
*/
static int invalidateTempStorage(Parse *pParse){
  sqlite3 *db = pParse->db;
  if( db->aDb[1].pBt!=0 ){
    if( db->flags & SQLITE_InTrans ){
      sqlite3ErrorMsg(pParse, "temporary storage cannot be changed "
        "from within a transaction");
      return SQLITE_ERROR;
    }
    sqlite3BtreeClose(db->aDb[1].pBt);
    db->aDb[1].pBt = 0;
    sqlite3ResetInternalSchema(db, 0);
  }
  return SQLITE_OK;
}
#endif /* SQLITE_PAGER_PRAGMAS */

#ifndef SQLITE_OMIT_PAGER_PRAGMAS
/*
** If the TEMP database is open, close it and mark the database schema
** as needing reloading.  This must be done when using the TEMP_STORE
** or DEFAULT_TEMP_STORE pragmas.
*/
static int changeTempStorage(Parse *pParse, const char *zStorageType){
  int ts = getTempStore(zStorageType);
  sqlite3 *db = pParse->db;
  if( db->temp_store==ts ) return SQLITE_OK;
  if( invalidateTempStorage( pParse ) != SQLITE_OK ){
    return SQLITE_ERROR;
  }
  db->temp_store = ts;
  return SQLITE_OK;
}
#endif /* SQLITE_PAGER_PRAGMAS */

/*
** Generate code to return a single integer value.
*/
static void returnSingleInt(Parse *pParse, const char *zLabel, int value){
  Vdbe *v = sqlite3GetVdbe(pParse);
  sqlite3VdbeAddOp(v, OP_Integer, value, 0);
  if( pParse->explain==0 ){
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, zLabel, P3_STATIC);
  }
  sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
}

#ifndef SQLITE_OMIT_FLAG_PRAGMAS
/*
** Check to see if zRight and zLeft refer to a pragma that queries
** or changes one of the flags in db->flags.  Return 1 if so and 0 if not.
** Also, implement the pragma.
*/
static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
  static const struct sPragmaType {
173
174
175
176
177
178
179

180
181
182
183
184
185
186
        sqlite3VdbeAddOp(v, OP_Expire, 0, 0);
      }
      return 1;
    }
  }
  return 0;
}


/*
** Process a pragma statement.  
**
** Pragmas are of this form:
**
**      PRAGMA [database.]id [= value]







>







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
        sqlite3VdbeAddOp(v, OP_Expire, 0, 0);
      }
      return 1;
    }
  }
  return 0;
}
#endif /* SQLITE_OMIT_FLAG_PRAGMAS */

/*
** Process a pragma statement.  
**
** Pragmas are of this form:
**
**      PRAGMA [database.]id [= value]
424
425
426
427
428
429
430

431
432
433
434

435
436
437
438
439
440
441
        pDb->safety_level = getSafetyLevel(zRight)+1;
        sqlite3BtreeSetSafetyLevel(pDb->pBt, pDb->safety_level);
      }
    }
  }else
#endif /* SQLITE_OMIT_PAGER_PRAGMAS */


  if( flagPragma(pParse, zLeft, zRight) ){
    /* The flagPragma() subroutine also generates any necessary code
    ** there is nothing more to do here */
  }else


#ifndef SQLITE_OMIT_SCHEMA_PRAGMAS
  /*
  **   PRAGMA table_info(<table>)
  **
  ** Return a single row for each column of the named table. The columns of
  ** the returned data set are:







>




>







430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
        pDb->safety_level = getSafetyLevel(zRight)+1;
        sqlite3BtreeSetSafetyLevel(pDb->pBt, pDb->safety_level);
      }
    }
  }else
#endif /* SQLITE_OMIT_PAGER_PRAGMAS */

#ifndef SQLITE_OMIT_FLAG_PRAGMAS
  if( flagPragma(pParse, zLeft, zRight) ){
    /* The flagPragma() subroutine also generates any necessary code
    ** there is nothing more to do here */
  }else
#endif /* SQLITE_OMIT_FLAG_PRAGMAS */

#ifndef SQLITE_OMIT_SCHEMA_PRAGMAS
  /*
  **   PRAGMA table_info(<table>)
  **
  ** Return a single row for each column of the named table. The columns of
  ** the returned data set are:
Changes to SQLite.Interop/src/random.c.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** This file contains code to implement a pseudo-random number
** generator (PRNG) for SQLite.
**
** Random numbers are used by some of the database backends in order
** to generate random integer keys for tables or random filenames.
**
** $Id: random.c,v 1.1 2005/03/01 16:04:34 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"


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







|







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


/*
** Get a single 8-bit random value from the RC4 PRNG.  The Mutex
Changes to SQLite.Interop/src/select.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.1 2005/03/01 16:04:35 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "../interop.h"

/*
** Allocate a new Select structure and return a pointer to that
** structure.







|







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

/*
** Allocate a new Select structure and return a pointer to that
** structure.
Changes to SQLite.Interop/src/shell.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.1 2005/03/01 16:04:35 rmsimpson Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.2 2005/03/11 15:03:31 rmsimpson Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
  struct callback_data *p = (struct callback_data *)pArg;

  if( nArg!=3 ) return 1;
  zTable = azArg[0];
  zType = azArg[1];
  zSql = azArg[2];
  
  if( strcasecmp(zTable,"sqlite_sequence")!=0 ){
    fprintf(p->out, "%s;\n", zSql);
  }else{
    fprintf(p->out, "DELETE FROM sqlite_sequence;\n");
  }

  if( strcmp(zType, "table")==0 ){
    sqlite3_stmt *pTableInfo = 0;







|







652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
  struct callback_data *p = (struct callback_data *)pArg;

  if( nArg!=3 ) return 1;
  zTable = azArg[0];
  zType = azArg[1];
  zSql = azArg[2];
  
  if( strcmp(zTable,"sqlite_sequence")!=0 ){
    fprintf(p->out, "%s;\n", zSql);
  }else{
    fprintf(p->out, "DELETE FROM sqlite_sequence;\n");
  }

  if( strcmp(zType, "table")==0 ){
    sqlite3_stmt *pTableInfo = 0;
Changes to SQLite.Interop/src/sqlite3.h.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the SQLite library
** presents to client programs.
**
** @(#) $Id: sqlite3.h,v 1.1 2005/03/01 16:04:36 rmsimpson Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.
*/
#ifdef __cplusplus
extern "C" {
#endif

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

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

/*
** The version string is also compiled into the library so that a program
** can check to make sure that the lib*.a file and the *.h file are from
** the same version.  The sqlite3_libversion() function returns a pointer
** to the sqlite3_version variable - useful in DLLs which cannot access
** global variables.







|


















|
















|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the SQLite library
** presents to client programs.
**
** @(#) $Id: sqlite3.h,v 1.2 2005/03/11 15:03:31 rmsimpson Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.
*/
#ifdef __cplusplus
extern "C" {
#endif

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

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

/*
** The version string is also compiled into the library so that a program
** can check to make sure that the lib*.a file and the *.h file are from
** the same version.  The sqlite3_libversion() function returns a pointer
** to the sqlite3_version variable - useful in DLLs which cannot access
** global variables.
Changes to SQLite.Interop/src/sqliteInt.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.1 2005/03/01 16:04:36 rmsimpson Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_

/*
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it.  If the OS lacks













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.2 2005/03/11 15:03:31 rmsimpson Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_

/*
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it.  If the OS lacks
801
802
803
804
805
806
807




808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826

827
828
829
830
831
832
833
** gives a different answer at different times during statement processing
** then iTable is the address of a subroutine that computes the subquery.
**
** The Expr.pSelect field points to a SELECT statement.  The SELECT might
** be the right operand of an IN operator.  Or, if a scalar SELECT appears
** in an expression the opcode is TK_SELECT and Expr.pSelect is the only
** operand.




*/
struct Expr {
  u8 op;                 /* Operation performed by this node */
  char affinity;         /* The affinity of the column or 0 if not a column */
  u8 iDb;                /* Database referenced by this expression */
  u8 flags;              /* Various flags.  See below */
  CollSeq *pColl;        /* The collation type of the column or 0 */
  Expr *pLeft, *pRight;  /* Left and right subnodes */
  ExprList *pList;       /* A list of expressions used as function arguments
                         ** or in "<expr> IN (<expr-list)" */
  Token token;           /* An operand token */
  Token span;            /* Complete text of the expression */
  int iTable, iColumn;   /* When op==TK_COLUMN, then this expr node means the
                         ** iColumn-th field of the iTable-th table. */
  int iAgg;              /* When op==TK_COLUMN and pParse->fillAgg==FALSE, pull
                         ** result from the iAgg-th element of the aggregator */
  int iAggCtx;           /* The value to pass as P1 of OP_AggGet. */
  Select *pSelect;       /* When the expression is a sub-select.  Also the
                         ** right side of "<expr> IN (<select>)" */

};

/*
** The following are the meanings of bits in the Expr.flags field.
*/
#define EP_FromJoin     0x0001  /* Originated in ON or USING clause of a join */
#define EP_Agg          0x0002  /* Contains one or more aggregate functions */







>
>
>
>



















>







801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
** gives a different answer at different times during statement processing
** then iTable is the address of a subroutine that computes the subquery.
**
** The Expr.pSelect field points to a SELECT statement.  The SELECT might
** be the right operand of an IN operator.  Or, if a scalar SELECT appears
** in an expression the opcode is TK_SELECT and Expr.pSelect is the only
** operand.
**
** If the Expr is of type OP_Column, and the table it is selecting from
** is a disk table or the "old.*" pseudo-table, then pTab points to the
** corresponding table definition.
*/
struct Expr {
  u8 op;                 /* Operation performed by this node */
  char affinity;         /* The affinity of the column or 0 if not a column */
  u8 iDb;                /* Database referenced by this expression */
  u8 flags;              /* Various flags.  See below */
  CollSeq *pColl;        /* The collation type of the column or 0 */
  Expr *pLeft, *pRight;  /* Left and right subnodes */
  ExprList *pList;       /* A list of expressions used as function arguments
                         ** or in "<expr> IN (<expr-list)" */
  Token token;           /* An operand token */
  Token span;            /* Complete text of the expression */
  int iTable, iColumn;   /* When op==TK_COLUMN, then this expr node means the
                         ** iColumn-th field of the iTable-th table. */
  int iAgg;              /* When op==TK_COLUMN and pParse->fillAgg==FALSE, pull
                         ** result from the iAgg-th element of the aggregator */
  int iAggCtx;           /* The value to pass as P1 of OP_AggGet. */
  Select *pSelect;       /* When the expression is a sub-select.  Also the
                         ** right side of "<expr> IN (<select>)" */
  Table *pTab;           /* Table for OP_Column expressions. */
};

/*
** The following are the meanings of bits in the Expr.flags field.
*/
#define EP_FromJoin     0x0001  /* Originated in ON or USING clause of a join */
#define EP_Agg          0x0002  /* Contains one or more aggregate functions */
1532
1533
1534
1535
1536
1537
1538


1539
1540
1541
1542
1543
1544
1545
1546
1547
1548

1549
1550

const void *sqlite3ValueText(sqlite3_value*, u8);
int sqlite3ValueBytes(sqlite3_value*, u8);
void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, void(*)(void*));
void sqlite3ValueFree(sqlite3_value*);
sqlite3_value *sqlite3ValueNew();
sqlite3_value *sqlite3GetTransientValue(sqlite3*db);


extern const unsigned char sqlite3UpperToLower[];
void sqlite3RootPageMoved(Db*, int, int);
void sqlite3Reindex(Parse*, Token*, Token*);
void sqlite3AlterFunctions(sqlite3*);
void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
int sqlite3GetToken(const unsigned char *, int *);
void sqlite3NestedParse(Parse*, const char*, ...);
void sqlite3ExpirePreparedStatements(sqlite3*);
void sqlite3CodeSubselect(Parse *, Expr *);
int sqlite3SelectResolve(Parse *, Select *, NameContext *);


#endif







>
>










>


1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558

const void *sqlite3ValueText(sqlite3_value*, u8);
int sqlite3ValueBytes(sqlite3_value*, u8);
void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, void(*)(void*));
void sqlite3ValueFree(sqlite3_value*);
sqlite3_value *sqlite3ValueNew();
sqlite3_value *sqlite3GetTransientValue(sqlite3*db);
int sqlite3ValueFromExpr(Expr *, u8, u8, sqlite3_value **);
void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
extern const unsigned char sqlite3UpperToLower[];
void sqlite3RootPageMoved(Db*, int, int);
void sqlite3Reindex(Parse*, Token*, Token*);
void sqlite3AlterFunctions(sqlite3*);
void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
int sqlite3GetToken(const unsigned char *, int *);
void sqlite3NestedParse(Parse*, const char*, ...);
void sqlite3ExpirePreparedStatements(sqlite3*);
void sqlite3CodeSubselect(Parse *, Expr *);
int sqlite3SelectResolve(Parse *, Select *, NameContext *);
void sqlite3ColumnDefault(Vdbe *, Table *, int);

#endif
Changes to SQLite.Interop/src/tclsqlite.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** A TCL Interface to SQLite
**
** $Id: tclsqlite.c,v 1.1 2005/03/01 16:04:36 rmsimpson Exp $
*/
#ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */

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













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** A TCL Interface to SQLite
**
** $Id: tclsqlite.c,v 1.2 2005/03/11 15:03:31 rmsimpson Exp $
*/
#ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */

#include "sqliteInt.h"
#include "hash.h"
#include "tcl.h"
#include <stdlib.h>
725
726
727
728
729
730
731

732
733
734
735
736
737
738
739
740

741
742
743
744
745
746
747
  /*    $db complete SQL
  **
  ** Return TRUE if SQL is a complete SQL statement.  Return FALSE if
  ** additional lines of input are needed.  This is similar to the
  ** built-in "info complete" command of Tcl.
  */
  case DB_COMPLETE: {

    Tcl_Obj *pResult;
    int isComplete;
    if( objc!=3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "SQL");
      return TCL_ERROR;
    }
    isComplete = sqlite3_complete( Tcl_GetStringFromObj(objv[2], 0) );
    pResult = Tcl_GetObjResult(interp);
    Tcl_SetBooleanObj(pResult, isComplete);

    break;
  }

  /*
  **    $db errorcode
  **
  ** Return the numeric error code that was returned by the most recent







>









>







725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
  /*    $db complete SQL
  **
  ** Return TRUE if SQL is a complete SQL statement.  Return FALSE if
  ** additional lines of input are needed.  This is similar to the
  ** built-in "info complete" command of Tcl.
  */
  case DB_COMPLETE: {
#ifndef SQLITE_OMIT_COMPLETE
    Tcl_Obj *pResult;
    int isComplete;
    if( objc!=3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "SQL");
      return TCL_ERROR;
    }
    isComplete = sqlite3_complete( Tcl_GetStringFromObj(objv[2], 0) );
    pResult = Tcl_GetObjResult(interp);
    Tcl_SetBooleanObj(pResult, isComplete);
#endif
    break;
  }

  /*
  **    $db errorcode
  **
  ** Return the numeric error code that was returned by the most recent
Changes to SQLite.Interop/src/tokenize.c.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** An tokenizer for SQL
**
** This file contains C code that splits an SQL input string up into
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.1 2005/03/01 16:04:37 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include <stdlib.h>

/*







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** An tokenizer for SQL
**
** This file contains C code that splits an SQL input string up into
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.2 2005/03/11 15:03:31 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include <stdlib.h>

/*
427
428
429
430
431
432
433





434
435
436
437
438
439
440
  sqliteFree(pParse->apVarExpr);
  if( nErr>0 && (pParse->rc==SQLITE_OK || pParse->rc==SQLITE_DONE) ){
    pParse->rc = SQLITE_ERROR;
  }
  return nErr;
}






/*
** Token types used by the sqlite3_complete() routine.  See the header
** comments on that procedure for additional information.
*/
#define tkSEMI    0
#define tkWS      1
#define tkOTHER   2







>
>
>
>
>







427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
  sqliteFree(pParse->apVarExpr);
  if( nErr>0 && (pParse->rc==SQLITE_OK || pParse->rc==SQLITE_DONE) ){
    pParse->rc = SQLITE_ERROR;
  }
  return nErr;
}

/* The sqlite3_complete() API may be omitted (to save code space) by
** defining the following symbol.
*/
#ifndef SQLITE_OMIT_COMPLETE

/*
** Token types used by the sqlite3_complete() routine.  See the header
** comments on that procedure for additional information.
*/
#define tkSEMI    0
#define tkWS      1
#define tkOTHER   2
658
659
660
661
662
663
664

  if( zSql8 ){
    rc = sqlite3_complete(zSql8);
  }
  sqlite3ValueFree(pVal);
  return rc;
}
#endif /* SQLITE_OMIT_UTF16 */








>
663
664
665
666
667
668
669
670
  if( zSql8 ){
    rc = sqlite3_complete(zSql8);
  }
  sqlite3ValueFree(pVal);
  return rc;
}
#endif /* SQLITE_OMIT_UTF16 */
#endif /* SQLITE_OMIT_COMPLETE */
Changes to SQLite.Interop/src/update.c.
8
9
10
11
12
13
14
15
16
17



































18
19
20
21
22
23
24
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.1 2005/03/01 16:04:37 rmsimpson Exp $
*/
#include "sqliteInt.h"




































/*
** Process an UPDATE statement.
**
**   UPDATE OR IGNORE table_wxyz SET a=b, c=d WHERE e<5 AND f NOT NULL;
**          \_______/ \________/     \______/       \________________/
*            onError   pTabList      pChanges             pWhere







|


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







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.2 2005/03/11 15:03:31 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** The most recently coded instruction was an OP_Column to retrieve column
** 'i' of table pTab. This routine sets the P3 parameter of the 
** OP_Column to the default value, if any.
**
** The default value of a column is specified by a DEFAULT clause in the 
** column definition. This was either supplied by the user when the table
** was created, or added later to the table definition by an ALTER TABLE
** command. If the latter, then the row-records in the table btree on disk
** may not contain a value for the column and the default value, taken
** from the P3 parameter of the OP_Column instruction, is returned instead.
** If the former, then all row-records are guaranteed to include a value
** for the column and the P3 value is not required.
**
** Column definitions created by an ALTER TABLE command may only have 
** literal default values specified: a number, null or a string. (If a more
** complicated default expression value was provided, it is evaluated 
** when the ALTER TABLE is executed and one of the literal values written
** into the sqlite_master table.)
**
** Therefore, the P3 parameter is only required if the default value for
** the column is a literal number, string or null. The sqlite3ValueFromExpr()
** function is capable of transforming these types of expressions into
** sqlite3_value objects.
*/
void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i){
  if( pTab && !pTab->pSelect ){
    sqlite3_value *pValue;
    u8 enc = sqlite3VdbeDb(v)->enc;
    Column *pCol = &pTab->aCol[i];
    sqlite3ValueFromExpr(pCol->pDflt, enc, pCol->affinity, &pValue);
    sqlite3VdbeChangeP3(v, -1, (const char *)pValue, P3_MEM);
  }
}

/*
** Process an UPDATE statement.
**
**   UPDATE OR IGNORE table_wxyz SET a=b, c=d WHERE e<5 AND f NOT NULL;
**          \_______/ \________/     \______/       \________________/
*            onError   pTabList      pChanges             pWhere
290
291
292
293
294
295
296

297
298
299
300
301
302
303
      if( i==pTab->iPKey ){
        sqlite3VdbeAddOp(v, OP_String8, 0, 0);
        continue;
      }
      j = aXRef[i];
      if( j<0 ){
        sqlite3VdbeAddOp(v, OP_Column, iCur, i);

      }else{
        sqlite3ExprCodeAndCache(pParse, pChanges->a[j].pExpr);
      }
    }
    sqlite3VdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
    if( !isView ){
      sqlite3TableAffinityStr(v, pTab);







>







325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
      if( i==pTab->iPKey ){
        sqlite3VdbeAddOp(v, OP_String8, 0, 0);
        continue;
      }
      j = aXRef[i];
      if( j<0 ){
        sqlite3VdbeAddOp(v, OP_Column, iCur, i);
        sqlite3ColumnDefault(v, pTab, i);
      }else{
        sqlite3ExprCodeAndCache(pParse, pChanges->a[j].pExpr);
      }
    }
    sqlite3VdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
    if( !isView ){
      sqlite3TableAffinityStr(v, pTab);
374
375
376
377
378
379
380

381
382
383
384
385
386
387
      if( i==pTab->iPKey ){
        sqlite3VdbeAddOp(v, OP_String8, 0, 0);
        continue;
      }
      j = aXRef[i];
      if( j<0 ){
        sqlite3VdbeAddOp(v, OP_Column, iCur, i);

      }else{
        sqlite3ExprCode(pParse, pChanges->a[j].pExpr);
      }
    }

    /* Do constraint checks
    */







>







410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
      if( i==pTab->iPKey ){
        sqlite3VdbeAddOp(v, OP_String8, 0, 0);
        continue;
      }
      j = aXRef[i];
      if( j<0 ){
        sqlite3VdbeAddOp(v, OP_Column, iCur, i);
        sqlite3ColumnDefault(v, pTab, i);
      }else{
        sqlite3ExprCode(pParse, pChanges->a[j].pExpr);
      }
    }

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







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used to translate between UTF-8, 
** UTF-16, UTF-16BE, and UTF-16LE.
**
** $Id: utf.c,v 1.2 2005/03/11 15:03:31 rmsimpson Exp $
**
** Notes on UTF-8:
**
**   Byte-0    Byte-1    Byte-2    Byte-3    Value
**  0xxxxxxx                                 00000000 00000000 0xxxxxxx
**  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx
**  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx
Changes to SQLite.Interop/src/util.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.1 2005/03/01 16:04:37 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>

#if SQLITE_MEMDEBUG>2 && defined(__GLIBC__)
#include <execinfo.h>







|







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

#if SQLITE_MEMDEBUG>2 && defined(__GLIBC__)
#include <execinfo.h>
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
  do{
    i++;
    v >>= 7;
  }while( v!=0 && i<9 );
  return i;
}

#if (!defined(SQLITE_OMIT_BLOB_LITERAL) && !defined(SQLITE_HAS_CODEC)) \
    || defined(SQLITE_TEST)
/*
** Translate a single byte of Hex into an integer.
*/
static int hexToInt(int h){
  if( h>='0' && h<='9' ){
    return h - '0';
  }else if( h>='a' && h<='f' ){
    return h - 'a' + 10;
  }else{
    assert( h>='A' && h<='F' );
    return h - 'A' + 10;
  }
}
#endif /* (!SQLITE_OMIT_BLOB_LITERAL && !SQLITE_HAS_CODEC) || SQLITE_TEST */

#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)
/*
** Convert a BLOB literal of the form "x'hhhhhh'" into its binary
** value.  Return a pointer to its binary value.  Space to hold the
** binary value has been obtained from malloc and must be freed by
** the calling routine.







|














|







898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
  do{
    i++;
    v >>= 7;
  }while( v!=0 && i<9 );
  return i;
}

#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC) \
    || defined(SQLITE_TEST)
/*
** Translate a single byte of Hex into an integer.
*/
static int hexToInt(int h){
  if( h>='0' && h<='9' ){
    return h - '0';
  }else if( h>='a' && h<='f' ){
    return h - 'a' + 10;
  }else{
    assert( h>='A' && h<='F' );
    return h - 'A' + 10;
  }
}
#endif /* !SQLITE_OMIT_BLOB_LITERAL || SQLITE_HAS_CODEC || SQLITE_TEST */

#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)
/*
** Convert a BLOB literal of the form "x'hhhhhh'" into its binary
** value.  Return a pointer to its binary value.  Space to hold the
** binary value has been obtained from malloc and must be freed by
** the calling routine.
Changes to SQLite.Interop/src/vacuum.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains code used to implement the VACUUM command.
**
** Most of the code in this file may be omitted by defining the
** SQLITE_OMIT_VACUUM macro.
**
** $Id: vacuum.c,v 1.1 2005/03/01 16:04:37 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"

#ifndef SQLITE_OMIT_VACUUM
/*
** Generate a random name of 20 character in length.







|







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

#ifndef SQLITE_OMIT_VACUUM
/*
** Generate a random name of 20 character in length.
Changes to SQLite.Interop/src/vdbe.c.
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.1 2005/03/01 16:04:38 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*







|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.2 2005/03/11 15:03:31 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
298
299
300
301
302
303
304








305
306
307
308
309
310
311
        if( ((double)pRec->i)==pRec->r ){
          pRec->flags |= MEM_Int;
        }
      }
    }
  }
}









#ifdef SQLITE_DEBUG
/*
** Write a nice string representation of the contents of cell pMem
** into buffer zBuf, length nBuf.
*/
void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf, int nBuf){







>
>
>
>
>
>
>
>







298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
        if( ((double)pRec->i)==pRec->r ){
          pRec->flags |= MEM_Int;
        }
      }
    }
  }
}

/*
** Exported version of applyAffinity(). This one works on sqlite3_value*, 
** not the internal Mem* type.
*/
void sqlite3ValueApplyAffinity(sqlite3_value *pVal, u8 affinity, u8 enc){
  applyAffinity((Mem *)pVal, affinity, enc);
}

#ifdef SQLITE_DEBUG
/*
** Write a nice string representation of the contents of cell pMem
** into buffer zBuf, length nBuf.
*/
void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf, int nBuf){
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
  if( (!pC->keyAsData && pC->zeroData) || (pC->keyAsData && pC->intKey) ){
    rc = SQLITE_CORRUPT;
    goto abort_due_to_error;
  }
  break;
}

/* Opcode: Column P1 P2 *
**
** Interpret the data that cursor P1 points to as a structure built using
** the MakeRecord instruction.  (See the MakeRecord opcode for additional
** information about the format of the data.) Push onto the stack the value
** of the P2-th column contained in the data. If there are less that (P2+1) 
** values in the record, push a NULL onto the stack.
**







|







1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
  if( (!pC->keyAsData && pC->zeroData) || (pC->keyAsData && pC->intKey) ){
    rc = SQLITE_CORRUPT;
    goto abort_due_to_error;
  }
  break;
}

/* Opcode: Column P1 P2 P3
**
** Interpret the data that cursor P1 points to as a structure built using
** the MakeRecord instruction.  (See the MakeRecord opcode for additional
** information about the format of the data.) Push onto the stack the value
** of the P2-th column contained in the data. If there are less that (P2+1) 
** values in the record, push a NULL onto the stack.
**
1907
1908
1909
1910
1911
1912
1913



1914

1915
1916
1917
1918
1919
1920
1921
        goto op_column_out;
      }
      zData = sMem.z;
    }
    sqlite3VdbeSerialGet(zData, aType[p2], pTos);
    pTos->enc = db->enc;
  }else{



    pTos->flags = MEM_Null;

  }

  /* If we dynamically allocated space to hold the data (in the
  ** sqlite3VdbeMemFromBtree() call above) then transfer control of that
  ** dynamically allocated space over to the pTos structure rather.
  ** This prevents a memory copy.
  */







>
>
>
|
>







1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
        goto op_column_out;
      }
      zData = sMem.z;
    }
    sqlite3VdbeSerialGet(zData, aType[p2], pTos);
    pTos->enc = db->enc;
  }else{
    if( pOp->p3 ){
      sqlite3VdbeMemShallowCopy(pTos, (Mem *)(pOp->p3), MEM_Static);
    }else{
      pTos->flags = MEM_Null;
    }
  }

  /* If we dynamically allocated space to hold the data (in the
  ** sqlite3VdbeMemFromBtree() call above) then transfer control of that
  ** dynamically allocated space over to the pTos structure rather.
  ** This prevents a memory copy.
  */
Changes to SQLite.Interop/src/vdbe.h.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** Header file for the Virtual DataBase Engine (VDBE)
**
** This header defines the interface to the virtual database engine
** or VDBE.  The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
** $Id: vdbe.h,v 1.1 2005/03/01 16:04:38 rmsimpson Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
#include <stdio.h>

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







|







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

/*
** A single VDBE is an opaque structure named "Vdbe".  Only routines
65
66
67
68
69
70
71

72
73
74
75
76
77
78
#define P3_DYNAMIC  (-1)  /* Pointer to a string obtained from sqliteMalloc() */
#define P3_STATIC   (-2)  /* Pointer to a static string */
#define P3_POINTER  (-3)  /* P3 is a pointer to some structure or object */
#define P3_COLLSEQ  (-4)  /* P3 is a pointer to a CollSeq structure */
#define P3_FUNCDEF  (-5)  /* P3 is a pointer to a FuncDef structure */
#define P3_KEYINFO  (-6)  /* P3 is a pointer to a KeyInfo structure */
#define P3_VDBEFUNC (-7)  /* P3 is a pointer to a VdbeFunc structure */


/* When adding a P3 argument using P3_KEYINFO, a copy of the KeyInfo structure
** is made.  That copy is freed when the Vdbe is finalized.  But if the
** argument is P3_KEYINFO_HANDOFF, the passed in pointer is used.  It still
** gets freed when the Vdbe is finalized so it still should be obtained
** from a single sqliteMalloc().  But no copy is made and the calling
** function should *not* try to free the KeyInfo.







>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#define P3_DYNAMIC  (-1)  /* Pointer to a string obtained from sqliteMalloc() */
#define P3_STATIC   (-2)  /* Pointer to a static string */
#define P3_POINTER  (-3)  /* P3 is a pointer to some structure or object */
#define P3_COLLSEQ  (-4)  /* P3 is a pointer to a CollSeq structure */
#define P3_FUNCDEF  (-5)  /* P3 is a pointer to a FuncDef structure */
#define P3_KEYINFO  (-6)  /* P3 is a pointer to a KeyInfo structure */
#define P3_VDBEFUNC (-7)  /* P3 is a pointer to a VdbeFunc structure */
#define P3_MEM      (-8)  /* P3 is a pointer to a Mem*    structure */

/* When adding a P3 argument using P3_KEYINFO, a copy of the KeyInfo structure
** is made.  That copy is freed when the Vdbe is finalized.  But if the
** argument is P3_KEYINFO_HANDOFF, the passed in pointer is used.  It still
** gets freed when the Vdbe is finalized so it still should be obtained
** from a single sqliteMalloc().  But no copy is made and the calling
** function should *not* try to free the KeyInfo.
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
int sqlite3VdbeCurrentAddr(Vdbe*);
void sqlite3VdbeTrace(Vdbe*,FILE*);
int sqlite3VdbeReset(Vdbe*);
int sqliteVdbeSetVariables(Vdbe*,int,const char**);
void sqlite3VdbeSetNumCols(Vdbe*,int);
int sqlite3VdbeSetColName(Vdbe*, int, const char *, int);
void sqlite3VdbeCountChanges(Vdbe*);


#ifndef NDEBUG
  void sqlite3VdbeComment(Vdbe*, const char*, ...);
# define VdbeComment(X)  sqlite3VdbeComment X
#else
# define VdbeComment(X)
#endif

#endif







>









117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
int sqlite3VdbeCurrentAddr(Vdbe*);
void sqlite3VdbeTrace(Vdbe*,FILE*);
int sqlite3VdbeReset(Vdbe*);
int sqliteVdbeSetVariables(Vdbe*,int,const char**);
void sqlite3VdbeSetNumCols(Vdbe*,int);
int sqlite3VdbeSetColName(Vdbe*, int, const char *, int);
void sqlite3VdbeCountChanges(Vdbe*);
sqlite3 *sqlite3VdbeDb(Vdbe*);

#ifndef NDEBUG
  void sqlite3VdbeComment(Vdbe*, const char*, ...);
# define VdbeComment(X)  sqlite3VdbeComment X
#else
# define VdbeComment(X)
#endif

#endif
Changes to SQLite.Interop/src/vdbeaux.c.
1416
1417
1418
1419
1420
1421
1422



1423
1424
1425
1426
1427
1428
1429
        sqliteFree(pOp->p3);
      }
      if( pOp->p3type==P3_VDBEFUNC ){
        VdbeFunc *pVdbeFunc = (VdbeFunc *)pOp->p3;
        sqlite3VdbeDeleteAuxData(pVdbeFunc, 0);
        sqliteFree(pVdbeFunc);
      }



    }
    sqliteFree(p->aOp);
  }
  releaseMemArray(p->aVar, p->nVar);
  sqliteFree(p->aLabel);
  sqliteFree(p->aStack);
  releaseMemArray(p->aColName, p->nResColumn*2);







>
>
>







1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
        sqliteFree(pOp->p3);
      }
      if( pOp->p3type==P3_VDBEFUNC ){
        VdbeFunc *pVdbeFunc = (VdbeFunc *)pOp->p3;
        sqlite3VdbeDeleteAuxData(pVdbeFunc, 0);
        sqliteFree(pVdbeFunc);
      }
      if( pOp->p3type==P3_MEM ){
        sqlite3ValueFree((sqlite3_value*)pOp->p3);
      }
    }
    sqliteFree(p->aOp);
  }
  releaseMemArray(p->aVar, p->nVar);
  sqliteFree(p->aLabel);
  sqliteFree(p->aStack);
  releaseMemArray(p->aColName, p->nResColumn*2);
1843
1844
1845
1846
1847
1848
1849







*/
void sqlite3ExpirePreparedStatements(sqlite3 *db){
  Vdbe *p;
  for(p = db->pVdbe; p; p=p->pNext){
    p->expired = 1;
  }
}














>
>
>
>
>
>
>
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
*/
void sqlite3ExpirePreparedStatements(sqlite3 *db){
  Vdbe *p;
  for(p = db->pVdbe; p; p=p->pNext){
    p->expired = 1;
  }
}

/*
** Return the database associated with the Vdbe.
*/
sqlite3 *sqlite3VdbeDb(Vdbe *v){
  return v->db;
}
Changes to SQLite.Interop/src/vdbemem.c.
695
696
697
698
699
700
701


































































702
703
704
705
706
707
708
  Mem *p = sqliteMalloc(sizeof(*p));
  if( p ){
    p->flags = MEM_Null;
    p->type = SQLITE_NULL;
  }
  return p;
}



































































/*
** Change the string value of an sqlite3_value object
*/
void sqlite3ValueSetStr(
  sqlite3_value *v, 
  int n, 







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







695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
  Mem *p = sqliteMalloc(sizeof(*p));
  if( p ){
    p->flags = MEM_Null;
    p->type = SQLITE_NULL;
  }
  return p;
}

/*
** Create a new sqlite3_value object, containing the value of pExpr.
**
** This only works for very simple expressions that consist of one constant
** token (i.e. "5", "5.1", "NULL", "'a string'"). If the expression can
** be converted directly into a value, then the value is allocated and
** a pointer written to *ppVal. The caller is responsible for deallocating
** the value by passing it to sqlite3ValueFree() later on. If the expression
** cannot be converted to a value, then *ppVal is set to NULL.
*/
int sqlite3ValueFromExpr(
  Expr *pExpr, 
  u8 enc, 
  u8 affinity,
  sqlite3_value **ppVal
){
  int op;
  char *zVal = 0;
  sqlite3_value *pVal = 0;

  if( !pExpr ){
    *ppVal = 0;
    return SQLITE_OK;
  }
  op = pExpr->op;

  if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
    zVal = sqliteStrNDup(pExpr->token.z, pExpr->token.n);
    pVal = sqlite3ValueNew();
    if( !zVal || !pVal ) goto no_mem;
    sqlite3Dequote(zVal);
    sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, sqlite3FreeX);
    if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){
      sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, enc);
    }else{
      sqlite3ValueApplyAffinity(pVal, affinity, enc);
    }
  }else if( op==TK_UMINUS ) {
    if( SQLITE_OK==sqlite3ValueFromExpr(pExpr->pLeft, enc, affinity, &pVal) ){
      pVal->i = -1 * pVal->i;
      pVal->r = -1.0 * pVal->r;
    }
  }
#ifndef SQLITE_OMIT_BLOB_LITERAL
  else if( op==TK_BLOB ){
    int nVal;
    pVal = sqlite3ValueNew();
    zVal = sqliteStrNDup(pExpr->token.z+1, pExpr->token.n-1);
    if( !zVal || !pVal ) goto no_mem;
    sqlite3Dequote(zVal);
    nVal = strlen(zVal)/2;
    sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(zVal), nVal, 0, sqlite3FreeX);
    sqliteFree(zVal);
  }
#endif

  *ppVal = pVal;
  return SQLITE_OK;

no_mem:
  sqliteFree(zVal);
  sqlite3ValueFree(pVal);
  *ppVal = 0;
  return SQLITE_NOMEM;
}

/*
** Change the string value of an sqlite3_value object
*/
void sqlite3ValueSetStr(
  sqlite3_value *v, 
  int n, 
Changes to SQLite.Interop/src/where.c.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements.  This module is reponsible for
** generating the code that loops through a table looking for applicable
** rows.  Indices are selected and used to speed the search when doing
** so is applicable.  Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.1 2005/03/01 16:04:39 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** The query generator uses an array of instances of this structure to
** help it analyze the subexpressions of the WHERE clause.  Each WHERE
** clause subexpression is separated from the others by an AND operator.







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements.  This module is reponsible for
** generating the code that loops through a table looking for applicable
** rows.  Indices are selected and used to speed the search when doing
** so is applicable.  Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.2 2005/03/11 15:03:32 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** The query generator uses an array of instances of this structure to
** help it analyze the subexpressions of the WHERE clause.  Each WHERE
** clause subexpression is separated from the others by an AND operator.
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
      start = sqlite3VdbeCurrentAddr(v);
      pLevel->op = bRev ? OP_Prev : OP_Next;
      pLevel->p1 = iCur;
      pLevel->p2 = start;
      if( testOp!=OP_Noop ){
        sqlite3VdbeAddOp(v, OP_Recno, iCur, 0);
        sqlite3VdbeAddOp(v, OP_MemLoad, pLevel->iMem, 0);
        sqlite3VdbeAddOp(v, testOp, 0, brk);
      }
    }else if( pIdx==0 ){
      /* Case 4:  There is no usable index.  We must do a complete
      **          scan of the entire database table.
      */
      int start;
      int opRewind;







|







1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
      start = sqlite3VdbeCurrentAddr(v);
      pLevel->op = bRev ? OP_Prev : OP_Next;
      pLevel->p1 = iCur;
      pLevel->p2 = start;
      if( testOp!=OP_Noop ){
        sqlite3VdbeAddOp(v, OP_Recno, iCur, 0);
        sqlite3VdbeAddOp(v, OP_MemLoad, pLevel->iMem, 0);
        sqlite3VdbeAddOp(v, testOp, (int)(('n'<<8)&0x0000FF00), brk);
      }
    }else if( pIdx==0 ){
      /* Case 4:  There is no usable index.  We must do a complete
      **          scan of the entire database table.
      */
      int start;
      int opRewind;