/ Check-in [d00b71ec]
Login

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

Overview
Comment:Merge latest trunk changes into this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sessions-rebase
Files: files | file ages | folders
SHA3-256: d00b71ecf857bc6d903442d91418d5a313c584dcdd8e9c8ff3b5d940dd45bcc5
User & Date: dan 2018-03-21 20:13:56
Context
2018-03-22
11:15
Remove some unused code from the sessions module. check-in: a09518ab user: dan tags: sessions-rebase
2018-03-21
20:13
Merge latest trunk changes into this branch. check-in: d00b71ec user: dan tags: sessions-rebase
19:46
Fix some documentation and other issues with the code on this branch. check-in: a9ec6862 user: dan tags: sessions-rebase
19:25
Add the optfuzz.c program for verifying the query planner using a fuzzer. This is an initial code check-in. check-in: 3fb21251 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

  2087   2087   
  2088   2088   keywordhash.h:	$(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
  2089   2089   	.\mkkeywordhash.exe > keywordhash.h
  2090   2090   
  2091   2091   # Source files that go into making shell.c
  2092   2092   SHELL_SRC = \
  2093   2093   	$(TOP)\src\shell.c.in \
  2094         -        $(TOP)\ext\misc\appendvfs.c \
         2094  +	$(TOP)\ext\misc\appendvfs.c \
  2095   2095   	$(TOP)\ext\misc\shathree.c \
  2096   2096   	$(TOP)\ext\misc\fileio.c \
  2097   2097   	$(TOP)\ext\misc\completion.c \
  2098   2098   	$(TOP)\ext\expert\sqlite3expert.c \
  2099   2099   	$(TOP)\ext\expert\sqlite3expert.h \
  2100   2100   	$(TOP)\src\test_windirent.c
  2101   2101   

Changes to ext/misc/completion.c.

    74     74   #define COMPLETION_KEYWORDS      1
    75     75   #define COMPLETION_PRAGMAS       2
    76     76   #define COMPLETION_FUNCTIONS     3
    77     77   #define COMPLETION_COLLATIONS    4
    78     78   #define COMPLETION_INDEXES       5
    79     79   #define COMPLETION_TRIGGERS      6
    80     80   #define COMPLETION_DATABASES     7
    81         -#define COMPLETION_TABLES        8
           81  +#define COMPLETION_TABLES        8    /* Also VIEWs and TRIGGERs */
    82     82   #define COMPLETION_COLUMNS       9
    83     83   #define COMPLETION_MODULES       10
    84     84   #define COMPLETION_EOF           11
    85     85   
    86     86   /*
    87     87   ** The completionConnect() method is invoked to create a new
    88     88   ** completion_vtab that describes the completion virtual table.
................................................................................
   246    246             char *zSql = 0;
   247    247             const char *zSep = "";
   248    248             sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
   249    249             while( sqlite3_step(pS2)==SQLITE_ROW ){
   250    250               const char *zDb = (const char*)sqlite3_column_text(pS2, 1);
   251    251               zSql = sqlite3_mprintf(
   252    252                  "%z%s"
   253         -               "SELECT name FROM \"%w\".sqlite_master"
   254         -               " WHERE type='table'",
          253  +               "SELECT name FROM \"%w\".sqlite_master",
   255    254                  zSql, zSep, zDb
   256    255               );
   257    256               if( zSql==0 ) return SQLITE_NOMEM;
   258    257               zSep = " UNION ";
   259    258             }
   260    259             sqlite3_finalize(pS2);
   261    260             sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);

Changes to ext/misc/fileio.c.

   154    154     va_list ap;
   155    155     va_start(ap, zFmt);
   156    156     zMsg = sqlite3_vmprintf(zFmt, ap);
   157    157     sqlite3_result_error(ctx, zMsg, -1);
   158    158     sqlite3_free(zMsg);
   159    159     va_end(ap);
   160    160   }
          161  +
          162  +#if defined(_WIN32)
          163  +/*
          164  +** This function is designed to convert a Win32 FILETIME structure into the
          165  +** number of seconds since the Unix Epoch (1970-01-01 00:00:00 UTC).
          166  +*/
          167  +static sqlite3_uint64 fileTimeToUnixTime(
          168  +  LPFILETIME pFileTime
          169  +){
          170  +  SYSTEMTIME epochSystemTime;
          171  +  ULARGE_INTEGER epochIntervals;
          172  +  FILETIME epochFileTime;
          173  +  ULARGE_INTEGER fileIntervals;
          174  +
          175  +  memset(&epochSystemTime, 0, sizeof(SYSTEMTIME));
          176  +  epochSystemTime.wYear = 1970;
          177  +  epochSystemTime.wMonth = 1;
          178  +  epochSystemTime.wDay = 1;
          179  +  SystemTimeToFileTime(&epochSystemTime, &epochFileTime);
          180  +  epochIntervals.LowPart = epochFileTime.dwLowDateTime;
          181  +  epochIntervals.HighPart = epochFileTime.dwHighDateTime;
          182  +
          183  +  fileIntervals.LowPart = pFileTime->dwLowDateTime;
          184  +  fileIntervals.HighPart = pFileTime->dwHighDateTime;
          185  +
          186  +  return (fileIntervals.QuadPart - epochIntervals.QuadPart) / 10000000;
          187  +}
          188  +
          189  +/*
          190  +** This function attempts to normalize the time values found in the stat()
          191  +** buffer to UTC.  This is necessary on Win32, where the runtime library
          192  +** appears to return these values as local times.
          193  +*/
          194  +static void statTimesToUtc(
          195  +  const char *zPath,
          196  +  struct stat *pStatBuf
          197  +){
          198  +  HANDLE hFindFile;
          199  +  WIN32_FIND_DATAW fd;
          200  +  LPWSTR zUnicodeName;
          201  +  extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
          202  +  zUnicodeName = sqlite3_win32_utf8_to_unicode(zPath);
          203  +  if( zUnicodeName ){
          204  +    memset(&fd, 0, sizeof(WIN32_FIND_DATA));
          205  +    hFindFile = FindFirstFileW(zUnicodeName, &fd);
          206  +    if( hFindFile!=NULL ){
          207  +      pStatBuf->st_ctime = (time_t)fileTimeToUnixTime(&fd.ftCreationTime);
          208  +      pStatBuf->st_atime = (time_t)fileTimeToUnixTime(&fd.ftLastAccessTime);
          209  +      pStatBuf->st_mtime = (time_t)fileTimeToUnixTime(&fd.ftLastWriteTime);
          210  +      FindClose(hFindFile);
          211  +    }
          212  +    sqlite3_free(zUnicodeName);
          213  +  }
          214  +}
          215  +#endif
          216  +
          217  +/*
          218  +** This function is used in place of stat().  On Windows, special handling
          219  +** is required in order for the included time to be returned as UTC.  On all
          220  +** other systems, this function simply calls stat().
          221  +*/
          222  +static int fileStat(
          223  +  const char *zPath,
          224  +  struct stat *pStatBuf
          225  +){
          226  +#if defined(_WIN32)
          227  +  int rc = stat(zPath, pStatBuf);
          228  +  if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
          229  +  return rc;
          230  +#else
          231  +  return stat(zPath, pStatBuf);
          232  +#endif
          233  +}
          234  +
          235  +/*
          236  +** This function is used in place of lstat().  On Windows, special handling
          237  +** is required in order for the included time to be returned as UTC.  On all
          238  +** other systems, this function simply calls lstat().
          239  +*/
          240  +static int fileLinkStat(
          241  +  const char *zPath,
          242  +  struct stat *pStatBuf
          243  +){
          244  +#if defined(_WIN32)
          245  +  int rc = lstat(zPath, pStatBuf);
          246  +  if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
          247  +  return rc;
          248  +#else
          249  +  return lstat(zPath, pStatBuf);
          250  +#endif
          251  +}
   161    252   
   162    253   /*
   163    254   ** Argument zFile is the name of a file that will be created and/or written
   164    255   ** by SQL function writefile(). This function ensures that the directory
   165    256   ** zFile will be written to exists, creating it if required. The permissions
   166    257   ** for any path components created by this function are set to (mode&0777).
   167    258   **
................................................................................
   186    277         struct stat sStat;
   187    278         int rc2;
   188    279   
   189    280         for(; zCopy[i]!='/' && i<nCopy; i++);
   190    281         if( i==nCopy ) break;
   191    282         zCopy[i] = '\0';
   192    283   
   193         -      rc2 = stat(zCopy, &sStat);
          284  +      rc2 = fileStat(zCopy, &sStat);
   194    285         if( rc2!=0 ){
   195    286           if( mkdir(zCopy, mode & 0777) ) rc = SQLITE_ERROR;
   196    287         }else{
   197    288           if( !S_ISDIR(sStat.st_mode) ) rc = SQLITE_ERROR;
   198    289         }
   199    290         zCopy[i] = '/';
   200    291         i++;
................................................................................
   228    319         if( mkdir(zFile, mode) ){
   229    320           /* The mkdir() call to create the directory failed. This might not
   230    321           ** be an error though - if there is already a directory at the same
   231    322           ** path and either the permissions already match or can be changed
   232    323           ** to do so using chmod(), it is not an error.  */
   233    324           struct stat sStat;
   234    325           if( errno!=EEXIST
   235         -         || 0!=stat(zFile, &sStat)
          326  +         || 0!=fileStat(zFile, &sStat)
   236    327            || !S_ISDIR(sStat.st_mode)
   237    328            || ((sStat.st_mode&0777)!=(mode&0777) && 0!=chmod(zFile, mode&0777))
   238    329           ){
   239    330             return 1;
   240    331           }
   241    332         }
   242    333       }else{
................................................................................
   275    366   
   276    367       GetSystemTime(&currentTime);
   277    368       SystemTimeToFileTime(&currentTime, &lastAccess);
   278    369       intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
   279    370       lastWrite.dwLowDateTime = (DWORD)intervals;
   280    371       lastWrite.dwHighDateTime = intervals >> 32;
   281    372       zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
          373  +    if( zUnicodeName==0 ){
          374  +      return 1;
          375  +    }
   282    376       hFile = CreateFileW(
   283    377         zUnicodeName, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING,
   284    378         FILE_FLAG_BACKUP_SEMANTICS, NULL
   285    379       );
   286    380       sqlite3_free(zUnicodeName);
   287    381       if( hFile!=INVALID_HANDLE_VALUE ){
   288    382         BOOL bResult = SetFileTime(hFile, NULL, &lastAccess, &lastWrite);
   289    383         CloseHandle(hFile);
   290    384         return !bResult;
   291    385       }else{
   292    386         return 1;
   293    387       }
   294         -#elif defined(AT_FDCWD) && 0 /* utimensat() is not univerally available */
          388  +#elif defined(AT_FDCWD) && 0 /* utimensat() is not universally available */
   295    389       /* Recent unix */
   296    390       struct timespec times[2];
   297    391       times[0].tv_nsec = times[1].tv_nsec = 0;
   298    392       times[0].tv_sec = time(0);
   299    393       times[1].tv_sec = mtime;
   300    394       if( utimensat(AT_FDCWD, zFile, times, AT_SYMLINK_NOFOLLOW) ){
   301    395         return 1;
................................................................................
   492    586     }
   493    587     sqlite3_free(pCur->zPath);
   494    588     sqlite3_free(pCur->aLvl);
   495    589     pCur->aLvl = 0;
   496    590     pCur->zPath = 0;
   497    591     pCur->zBase = 0;
   498    592     pCur->nBase = 0;
          593  +  pCur->nLvl = 0;
   499    594     pCur->iLvl = -1;
   500    595     pCur->iRowid = 1;
   501    596   }
   502    597   
   503    598   /*
   504    599   ** Destructor for an fsdir_cursor.
   505    600   */
................................................................................
   563    658         if( pEntry->d_name[0]=='.' ){
   564    659          if( pEntry->d_name[1]=='.' && pEntry->d_name[2]=='\0' ) continue;
   565    660          if( pEntry->d_name[1]=='\0' ) continue;
   566    661         }
   567    662         sqlite3_free(pCur->zPath);
   568    663         pCur->zPath = sqlite3_mprintf("%s/%s", pLvl->zDir, pEntry->d_name);
   569    664         if( pCur->zPath==0 ) return SQLITE_NOMEM;
   570         -      if( lstat(pCur->zPath, &pCur->sStat) ){
          665  +      if( fileLinkStat(pCur->zPath, &pCur->sStat) ){
   571    666           fsdirSetErrmsg(pCur, "cannot stat file: %s", pCur->zPath);
   572    667           return SQLITE_ERROR;
   573    668         }
   574    669         return SQLITE_OK;
   575    670       }
   576    671       closedir(pLvl->pDir);
   577    672       sqlite3_free(pLvl->zDir);
................................................................................
   697    792     }else{
   698    793       pCur->zPath = sqlite3_mprintf("%s", zDir);
   699    794     }
   700    795   
   701    796     if( pCur->zPath==0 ){
   702    797       return SQLITE_NOMEM;
   703    798     }
   704         -  if( lstat(pCur->zPath, &pCur->sStat) ){
          799  +  if( fileLinkStat(pCur->zPath, &pCur->sStat) ){
   705    800       fsdirSetErrmsg(pCur, "cannot stat file: %s", pCur->zPath);
   706    801       return SQLITE_ERROR;
   707    802     }
   708    803   
   709    804     return SQLITE_OK;
   710    805   }
   711    806   

Changes to ext/misc/zipfile.c.

  1495   1495   */
  1496   1496   static u32 zipfileGetTime(sqlite3_value *pVal){
  1497   1497     if( pVal==0 || sqlite3_value_type(pVal)==SQLITE_NULL ){
  1498   1498       return zipfileTime();
  1499   1499     }
  1500   1500     return (u32)sqlite3_value_int64(pVal);
  1501   1501   }
         1502  +
         1503  +/*
         1504  +** Unless it is NULL, entry pOld is currently part of the pTab->pFirstEntry
         1505  +** linked list.  Remove it from the list and free the object.
         1506  +*/
         1507  +static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){
         1508  +  if( pOld ){
         1509  +    ZipfileEntry **pp;
         1510  +    for(pp=&pTab->pFirstEntry; (*pp)!=pOld; pp=&((*pp)->pNext));
         1511  +    *pp = (*pp)->pNext;
         1512  +    zipfileEntryFree(pOld);
         1513  +  }
         1514  +}
  1502   1515   
  1503   1516   /*
  1504   1517   ** xUpdate method.
  1505   1518   */
  1506   1519   static int zipfileUpdate(
  1507   1520     sqlite3_vtab *pVtab, 
  1508   1521     int nVal, 
................................................................................
  1520   1533     int nPath = 0;                  /* strlen(zPath) */
  1521   1534     const u8 *pData = 0;            /* Pointer to buffer containing content */
  1522   1535     int nData = 0;                  /* Size of pData buffer in bytes */
  1523   1536     int iMethod = 0;                /* Compression method for new entry */
  1524   1537     u8 *pFree = 0;                  /* Free this */
  1525   1538     char *zFree = 0;                /* Also free this */
  1526   1539     ZipfileEntry *pOld = 0;
         1540  +  ZipfileEntry *pOld2 = 0;
         1541  +  int bUpdate = 0;                /* True for an update that modifies "name" */
  1527   1542     int bIsDir = 0;
  1528   1543     u32 iCrc32 = 0;
  1529   1544   
  1530   1545     if( pTab->pWriteFd==0 ){
  1531   1546       rc = zipfileBegin(pVtab);
  1532   1547       if( rc!=SQLITE_OK ) return rc;
  1533   1548     }
  1534   1549   
  1535   1550     /* If this is a DELETE or UPDATE, find the archive entry to delete. */
  1536   1551     if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){
  1537   1552       const char *zDelete = (const char*)sqlite3_value_text(apVal[0]);
  1538   1553       int nDelete = (int)strlen(zDelete);
         1554  +    if( nVal>1 ){
         1555  +      const char *zUpdate = (const char*)sqlite3_value_text(apVal[1]);
         1556  +      if( zUpdate && zipfileComparePath(zUpdate, zDelete, nDelete)!=0 ){
         1557  +        bUpdate = 1;
         1558  +      }
         1559  +    }
  1539   1560       for(pOld=pTab->pFirstEntry; 1; pOld=pOld->pNext){
  1540   1561         if( zipfileComparePath(pOld->cds.zFile, zDelete, nDelete)==0 ){
  1541   1562           break;
  1542   1563         }
  1543   1564         assert( pOld->pNext );
  1544   1565       }
  1545   1566     }
................................................................................
  1609   1630           zFree = sqlite3_mprintf("%s/", zPath);
  1610   1631           if( zFree==0 ){ rc = SQLITE_NOMEM; }
  1611   1632           zPath = (const char*)zFree;
  1612   1633           nPath++;
  1613   1634         }
  1614   1635       }
  1615   1636   
  1616         -    /* Check that we're not inserting a duplicate entry */
  1617         -    if( pOld==0 && rc==SQLITE_OK ){
         1637  +    /* Check that we're not inserting a duplicate entry -OR- updating an
         1638  +    ** entry with a path, thereby making it into a duplicate. */
         1639  +    if( (pOld==0 || bUpdate) && rc==SQLITE_OK ){
  1618   1640         ZipfileEntry *p;
  1619   1641         for(p=pTab->pFirstEntry; p; p=p->pNext){
  1620   1642           if( zipfileComparePath(p->cds.zFile, zPath, nPath)==0 ){
  1621   1643             switch( sqlite3_vtab_on_conflict(pTab->db) ){
  1622   1644               case SQLITE_IGNORE: {
  1623   1645                 goto zipfile_update_done;
  1624   1646               }
  1625   1647               case SQLITE_REPLACE: {
  1626         -              pOld = p;
         1648  +              pOld2 = p;
  1627   1649                 break;
  1628   1650               }
  1629   1651               default: {
  1630   1652                 zipfileTableErr(pTab, "duplicate name: \"%s\"", zPath);
  1631   1653                 rc = SQLITE_CONSTRAINT;
  1632   1654                 break;
  1633   1655               }
................................................................................
  1657   1679           pNew->mUnixTime = (u32)mTime;
  1658   1680           rc = zipfileAppendEntry(pTab, pNew, pData, nData);
  1659   1681           zipfileAddEntry(pTab, pOld, pNew);
  1660   1682         }
  1661   1683       }
  1662   1684     }
  1663   1685   
  1664         -  if( rc==SQLITE_OK && pOld ){
  1665         -    ZipfileEntry **pp;
         1686  +  if( rc==SQLITE_OK && (pOld || pOld2) ){
  1666   1687       ZipfileCsr *pCsr;
  1667   1688       for(pCsr=pTab->pCsrList; pCsr; pCsr=pCsr->pCsrNext){
  1668         -      if( pCsr->pCurrent==pOld ){
  1669         -        pCsr->pCurrent = pOld->pNext;
         1689  +      if( pCsr->pCurrent && (pCsr->pCurrent==pOld || pCsr->pCurrent==pOld2) ){
         1690  +        pCsr->pCurrent = pCsr->pCurrent->pNext;
  1670   1691           pCsr->bNoop = 1;
  1671   1692         }
  1672   1693       }
  1673         -    for(pp=&pTab->pFirstEntry; (*pp)!=pOld; pp=&((*pp)->pNext));
  1674         -    *pp = (*pp)->pNext;
  1675         -    zipfileEntryFree(pOld);
         1694  +
         1695  +    zipfileRemoveEntryFromList(pTab, pOld);
         1696  +    zipfileRemoveEntryFromList(pTab, pOld2);
  1676   1697     }
  1677   1698   
  1678   1699   zipfile_update_done:
  1679   1700     sqlite3_free(pFree);
  1680   1701     sqlite3_free(zFree);
  1681   1702     return rc;
  1682   1703   }

Changes to src/build.c.

  1866   1866     if( pEnd==0 && pSelect==0 ){
  1867   1867       return;
  1868   1868     }
  1869   1869     assert( !db->mallocFailed );
  1870   1870     p = pParse->pNewTable;
  1871   1871     if( p==0 ) return;
  1872   1872   
  1873         -  assert( !db->init.busy || !pSelect );
  1874         -
  1875   1873     /* If the db->init.busy is 1 it means we are reading the SQL off the
  1876   1874     ** "sqlite_master" or "sqlite_temp_master" table on the disk.
  1877   1875     ** So do not write to the disk again.  Extract the root page number
  1878   1876     ** for the table from the db->init.newTnum field.  (The page number
  1879   1877     ** should have been put there by the sqliteOpenCb routine.)
  1880   1878     **
  1881   1879     ** If the root page number is 1, that means this is the sqlite_master
  1882   1880     ** table itself.  So mark it read-only.
  1883   1881     */
  1884   1882     if( db->init.busy ){
         1883  +    if( pSelect ){
         1884  +      sqlite3ErrorMsg(pParse, "");
         1885  +      return;
         1886  +    }
  1885   1887       p->tnum = db->init.newTnum;
  1886   1888       if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
  1887   1889     }
  1888   1890   
  1889   1891     /* Special processing for WITHOUT ROWID Tables */
  1890   1892     if( tabOpts & TF_WithoutRowid ){
  1891   1893       if( (p->tabFlags & TF_Autoincrement) ){

Changes to src/ctime.c.

   184    184   #if SQLITE_ENABLE_ATOMIC_WRITE
   185    185     "ENABLE_ATOMIC_WRITE",
   186    186   #endif
   187    187   #if SQLITE_ENABLE_BATCH_ATOMIC_WRITE
   188    188     "ENABLE_BATCH_ATOMIC_WRITE",
   189    189   #endif
   190    190   #if SQLITE_ENABLE_CEROD
   191         -  "ENABLE_CEROD",
          191  +  "ENABLE_CEROD=" CTIMEOPT_VAL(SQLITE_ENABLE_CEROD),
   192    192   #endif
   193    193   #if SQLITE_ENABLE_COLUMN_METADATA
   194    194     "ENABLE_COLUMN_METADATA",
   195    195   #endif
   196    196   #if SQLITE_ENABLE_COLUMN_USED_MASK
   197    197     "ENABLE_COLUMN_USED_MASK",
   198    198   #endif

Changes to src/insert.c.

   206    206   **
   207    207   ** There is at most one AutoincInfo structure per table even if the
   208    208   ** same table is autoincremented multiple times due to inserts within
   209    209   ** triggers.  A new AutoincInfo structure is created if this is the
   210    210   ** first use of table pTab.  On 2nd and subsequent uses, the original
   211    211   ** AutoincInfo structure is used.
   212    212   **
   213         -** Three memory locations are allocated:
          213  +** Four consecutive registers are allocated:
   214    214   **
   215         -**   (1)  Register to hold the name of the pTab table.
   216         -**   (2)  Register to hold the maximum ROWID of pTab.
   217         -**   (3)  Register to hold the rowid in sqlite_sequence of pTab
          215  +**   (1)  The name of the pTab table.
          216  +**   (2)  The maximum ROWID of pTab.
          217  +**   (3)  The rowid in sqlite_sequence of pTab
          218  +**   (4)  The original value of the max ROWID in pTab, or NULL if none
   218    219   **
   219    220   ** The 2nd register is the one that is returned.  That is all the
   220    221   ** insert routine needs to know about.
   221    222   */
   222    223   static int autoIncBegin(
   223    224     Parse *pParse,      /* Parsing context */
   224    225     int iDb,            /* Index of the database holding pTab */
................................................................................
   238    239         if( pInfo==0 ) return 0;
   239    240         pInfo->pNext = pToplevel->pAinc;
   240    241         pToplevel->pAinc = pInfo;
   241    242         pInfo->pTab = pTab;
   242    243         pInfo->iDb = iDb;
   243    244         pToplevel->nMem++;                  /* Register to hold name of table */
   244    245         pInfo->regCtr = ++pToplevel->nMem;  /* Max rowid register */
   245         -      pToplevel->nMem++;                  /* Rowid in sqlite_sequence */
          246  +      pToplevel->nMem +=2;       /* Rowid in sqlite_sequence + orig max val */
   246    247       }
   247    248       memId = pInfo->regCtr;
   248    249     }
   249    250     return memId;
   250    251   }
   251    252   
   252    253   /*
................................................................................
   266    267     assert( sqlite3IsToplevel(pParse) );
   267    268   
   268    269     assert( v );   /* We failed long ago if this is not so */
   269    270     for(p = pParse->pAinc; p; p = p->pNext){
   270    271       static const int iLn = VDBE_OFFSET_LINENO(2);
   271    272       static const VdbeOpList autoInc[] = {
   272    273         /* 0  */ {OP_Null,    0,  0, 0},
   273         -      /* 1  */ {OP_Rewind,  0,  9, 0},
          274  +      /* 1  */ {OP_Rewind,  0, 10, 0},
   274    275         /* 2  */ {OP_Column,  0,  0, 0},
   275         -      /* 3  */ {OP_Ne,      0,  7, 0},
          276  +      /* 3  */ {OP_Ne,      0,  9, 0},
   276    277         /* 4  */ {OP_Rowid,   0,  0, 0},
   277    278         /* 5  */ {OP_Column,  0,  1, 0},
   278         -      /* 6  */ {OP_Goto,    0,  9, 0},
   279         -      /* 7  */ {OP_Next,    0,  2, 0},
   280         -      /* 8  */ {OP_Integer, 0,  0, 0},
   281         -      /* 9  */ {OP_Close,   0,  0, 0} 
          279  +      /* 6  */ {OP_AddImm,  0,  0, 0},
          280  +      /* 7  */ {OP_Copy,    0,  0, 0},
          281  +      /* 8  */ {OP_Goto,    0, 11, 0},
          282  +      /* 9  */ {OP_Next,    0,  2, 0},
          283  +      /* 10 */ {OP_Integer, 0,  0, 0},
          284  +      /* 11 */ {OP_Close,   0,  0, 0} 
   282    285       };
   283    286       VdbeOp *aOp;
   284    287       pDb = &db->aDb[p->iDb];
   285    288       memId = p->regCtr;
   286    289       assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
   287    290       sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
   288    291       sqlite3VdbeLoadString(v, memId-1, p->pTab->zName);
   289    292       aOp = sqlite3VdbeAddOpList(v, ArraySize(autoInc), autoInc, iLn);
   290    293       if( aOp==0 ) break;
   291    294       aOp[0].p2 = memId;
   292         -    aOp[0].p3 = memId+1;
          295  +    aOp[0].p3 = memId+2;
   293    296       aOp[2].p3 = memId;
   294    297       aOp[3].p1 = memId-1;
   295    298       aOp[3].p3 = memId;
   296    299       aOp[3].p5 = SQLITE_JUMPIFNULL;
   297    300       aOp[4].p2 = memId+1;
   298    301       aOp[5].p3 = memId;
   299         -    aOp[8].p2 = memId;
          302  +    aOp[6].p1 = memId;
          303  +    aOp[7].p2 = memId+2;
          304  +    aOp[7].p1 = memId;
          305  +    aOp[10].p2 = memId;
   300    306     }
   301    307   }
   302    308   
   303    309   /*
   304    310   ** Update the maximum rowid for an autoincrement calculation.
   305    311   **
   306    312   ** This routine should be called when the regRowid register holds a
................................................................................
   339    345       VdbeOp *aOp;
   340    346       Db *pDb = &db->aDb[p->iDb];
   341    347       int iRec;
   342    348       int memId = p->regCtr;
   343    349   
   344    350       iRec = sqlite3GetTempReg(pParse);
   345    351       assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
          352  +    sqlite3VdbeAddOp3(v, OP_Le, memId+2, sqlite3VdbeCurrentAddr(v)+7, memId);
          353  +    VdbeCoverage(v);
   346    354       sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
   347    355       aOp = sqlite3VdbeAddOpList(v, ArraySize(autoIncEnd), autoIncEnd, iLn);
   348    356       if( aOp==0 ) break;
   349    357       aOp[0].p1 = memId+1;
   350    358       aOp[1].p2 = memId+1;
   351    359       aOp[2].p1 = memId-1;
   352    360       aOp[2].p3 = iRec;

Changes to src/pager.c.

   695    695     int pageSize;               /* Number of bytes in a page */
   696    696     Pgno mxPgno;                /* Maximum allowed size of the database */
   697    697     i64 journalSizeLimit;       /* Size limit for persistent journal files */
   698    698     char *zFilename;            /* Name of the database file */
   699    699     char *zJournal;             /* Name of the journal file */
   700    700     int (*xBusyHandler)(void*); /* Function to call when busy */
   701    701     void *pBusyHandlerArg;      /* Context argument for xBusyHandler */
   702         -  int aStat[3];               /* Total cache hits, misses and writes */
          702  +  int aStat[4];               /* Total cache hits, misses, writes, spills */
   703    703   #ifdef SQLITE_TEST
   704    704     int nRead;                  /* Database pages read */
   705    705   #endif
   706    706     void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */
   707    707     int (*xGet)(Pager*,Pgno,DbPage**,int); /* Routine to fetch a patch */
   708    708   #ifdef SQLITE_HAS_CODEC
   709    709     void *(*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */
................................................................................
   723    723   ** Indexes for use with Pager.aStat[]. The Pager.aStat[] array contains
   724    724   ** the values accessed by passing SQLITE_DBSTATUS_CACHE_HIT, CACHE_MISS 
   725    725   ** or CACHE_WRITE to sqlite3_db_status().
   726    726   */
   727    727   #define PAGER_STAT_HIT   0
   728    728   #define PAGER_STAT_MISS  1
   729    729   #define PAGER_STAT_WRITE 2
          730  +#define PAGER_STAT_SPILL 3
   730    731   
   731    732   /*
   732    733   ** The following global variables hold counters used for
   733    734   ** testing purposes only.  These variables do not exist in
   734    735   ** a non-testing build.  These variables are not thread-safe.
   735    736   */
   736    737   #ifdef SQLITE_TEST
................................................................................
  4614   4615     if( pPager->doNotSpill
  4615   4616      && ((pPager->doNotSpill & (SPILLFLAG_ROLLBACK|SPILLFLAG_OFF))!=0
  4616   4617         || (pPg->flags & PGHDR_NEED_SYNC)!=0)
  4617   4618     ){
  4618   4619       return SQLITE_OK;
  4619   4620     }
  4620   4621   
         4622  +  pPager->aStat[PAGER_STAT_SPILL]++;
  4621   4623     pPg->pDirty = 0;
  4622   4624     if( pagerUseWal(pPager) ){
  4623   4625       /* Write a single frame for this page to the log. */
  4624   4626       rc = subjournalPageIfRequired(pPg); 
  4625   4627       if( rc==SQLITE_OK ){
  4626   4628         rc = pagerWalFrames(pPager, pPg, 0, 0);
  4627   4629       }
................................................................................
  6734   6736     a[9] = pPager->nRead;
  6735   6737     a[10] = pPager->aStat[PAGER_STAT_WRITE];
  6736   6738     return a;
  6737   6739   }
  6738   6740   #endif
  6739   6741   
  6740   6742   /*
  6741         -** Parameter eStat must be either SQLITE_DBSTATUS_CACHE_HIT or
  6742         -** SQLITE_DBSTATUS_CACHE_MISS. Before returning, *pnVal is incremented by the
         6743  +** Parameter eStat must be one of SQLITE_DBSTATUS_CACHE_HIT, _MISS, _WRITE,
         6744  +** or _WRITE+1.  The SQLITE_DBSTATUS_CACHE_WRITE+1 case is a translation
         6745  +** of SQLITE_DBSTATUS_CACHE_SPILL.  The _SPILL case is not contiguous because
         6746  +** it was added later.
         6747  +**
         6748  +** Before returning, *pnVal is incremented by the
  6743   6749   ** current cache hit or miss count, according to the value of eStat. If the 
  6744   6750   ** reset parameter is non-zero, the cache hit or miss count is zeroed before 
  6745   6751   ** returning.
  6746   6752   */
  6747   6753   void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){
  6748   6754   
  6749   6755     assert( eStat==SQLITE_DBSTATUS_CACHE_HIT
  6750   6756          || eStat==SQLITE_DBSTATUS_CACHE_MISS
  6751   6757          || eStat==SQLITE_DBSTATUS_CACHE_WRITE
         6758  +       || eStat==SQLITE_DBSTATUS_CACHE_WRITE+1
  6752   6759     );
  6753   6760   
  6754   6761     assert( SQLITE_DBSTATUS_CACHE_HIT+1==SQLITE_DBSTATUS_CACHE_MISS );
  6755   6762     assert( SQLITE_DBSTATUS_CACHE_HIT+2==SQLITE_DBSTATUS_CACHE_WRITE );
  6756         -  assert( PAGER_STAT_HIT==0 && PAGER_STAT_MISS==1 && PAGER_STAT_WRITE==2 );
         6763  +  assert( PAGER_STAT_HIT==0 && PAGER_STAT_MISS==1
         6764  +           && PAGER_STAT_WRITE==2 && PAGER_STAT_SPILL==3 );
  6757   6765   
  6758         -  *pnVal += pPager->aStat[eStat - SQLITE_DBSTATUS_CACHE_HIT];
         6766  +  eStat -= SQLITE_DBSTATUS_CACHE_HIT;
         6767  +  *pnVal += pPager->aStat[eStat];
  6759   6768     if( reset ){
  6760         -    pPager->aStat[eStat - SQLITE_DBSTATUS_CACHE_HIT] = 0;
         6769  +    pPager->aStat[eStat] = 0;
  6761   6770     }
  6762   6771   }
  6763   6772   
  6764   6773   /*
  6765   6774   ** Return true if this is an in-memory or temp-file backed pager.
  6766   6775   */
  6767   6776   int sqlite3PagerIsMemdb(Pager *pPager){

Changes to src/parse.y.

   519    519     ** then extract the first few alphanumeric characters from within that
   520    520     ** comment to be the zSelName value.  Otherwise, the label is #N where
   521    521     ** is an integer that is incremented with each SELECT statement seen.
   522    522     */
   523    523     if( A!=0 ){
   524    524       const char *z = s.z+6;
   525    525       int i;
   526         -    sqlite3_snprintf(sizeof(A->zSelName), A->zSelName, "#%d",
   527         -                     ++pParse->nSelect);
          526  +    sqlite3_snprintf(sizeof(A->zSelName), A->zSelName,"#%d",++pParse->nSelect);
   528    527       while( z[0]==' ' ) z++;
   529    528       if( z[0]=='/' && z[1]=='*' ){
   530    529         z += 2;
   531    530         while( z[0]==' ' ) z++;
   532    531         for(i=0; sqlite3Isalnum(z[i]); i++){}
   533    532         sqlite3_snprintf(sizeof(A->zSelName), A->zSelName, "%.*s", i, z);
   534    533       }

Changes to src/prepare.c.

    25     25     const char *zExtra   /* Error information */
    26     26   ){
    27     27     sqlite3 *db = pData->db;
    28     28     if( !db->mallocFailed && (db->flags & SQLITE_WriteSchema)==0 ){
    29     29       char *z;
    30     30       if( zObj==0 ) zObj = "?";
    31     31       z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
    32         -    if( zExtra ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
           32  +    if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
    33     33       sqlite3DbFree(db, *pData->pzErrMsg);
    34     34       *pData->pzErrMsg = z;
    35     35     }
    36     36     pData->rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_CORRUPT_BKPT;
    37     37   }
    38     38   
    39     39   /*

Changes to src/select.c.

    17     17   /*
    18     18   ** Trace output macros
    19     19   */
    20     20   #if SELECTTRACE_ENABLED
    21     21   /***/ int sqlite3SelectTrace = 0;
    22     22   # define SELECTTRACE(K,P,S,X)  \
    23     23     if(sqlite3SelectTrace&(K))   \
    24         -    sqlite3DebugPrintf("%*s%s.%p: ",(P)->nSelectIndent*2-2,"",\
    25         -        (S)->zSelName,(S)),\
           24  +    sqlite3DebugPrintf("%s/%p: ",(S)->zSelName,(S)),\
    26     25       sqlite3DebugPrintf X
    27     26   #else
    28     27   # define SELECTTRACE(K,P,S,X)
    29     28   #endif
    30     29   
    31     30   
    32     31   /*
................................................................................
  4909   4908       );
  4910   4909     }
  4911   4910   }
  4912   4911   #else
  4913   4912   # define explainSimpleCount(a,b,c)
  4914   4913   #endif
  4915   4914   
  4916         -/*
  4917         -** Context object for havingToWhereExprCb().
  4918         -*/
  4919         -struct HavingToWhereCtx {
  4920         -  Expr **ppWhere;
  4921         -  ExprList *pGroupBy;
  4922         -};
  4923         -
  4924   4915   /*
  4925   4916   ** sqlite3WalkExpr() callback used by havingToWhere().
  4926   4917   **
  4927   4918   ** If the node passed to the callback is a TK_AND node, return 
  4928   4919   ** WRC_Continue to tell sqlite3WalkExpr() to iterate through child nodes.
  4929   4920   **
  4930   4921   ** Otherwise, return WRC_Prune. In this case, also check if the 
  4931   4922   ** sub-expression matches the criteria for being moved to the WHERE
  4932   4923   ** clause. If so, add it to the WHERE clause and replace the sub-expression
  4933   4924   ** within the HAVING expression with a constant "1".
  4934   4925   */
  4935   4926   static int havingToWhereExprCb(Walker *pWalker, Expr *pExpr){
  4936   4927     if( pExpr->op!=TK_AND ){
  4937         -    struct HavingToWhereCtx *p = pWalker->u.pHavingCtx;
  4938         -    if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, p->pGroupBy) ){
         4928  +    Select *pS = pWalker->u.pSelect;
         4929  +    if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){
  4939   4930         sqlite3 *db = pWalker->pParse->db;
  4940   4931         Expr *pNew = sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[1], 0);
  4941   4932         if( pNew ){
  4942         -        Expr *pWhere = *(p->ppWhere);
         4933  +        Expr *pWhere = pS->pWhere;
  4943   4934           SWAP(Expr, *pNew, *pExpr);
  4944   4935           pNew = sqlite3ExprAnd(db, pWhere, pNew);
  4945         -        *(p->ppWhere) = pNew;
         4936  +        pS->pWhere = pNew;
         4937  +        pWalker->eCode = 1;
  4946   4938         }
  4947   4939       }
  4948   4940       return WRC_Prune;
  4949   4941     }
  4950   4942     return WRC_Continue;
  4951   4943   }
  4952   4944   
................................................................................
  4961   4953   **
  4962   4954   **   SELECT * FROM <tables> WHERE a=? AND b=? GROUP BY b HAVING c=?
  4963   4955   **
  4964   4956   ** A term of the HAVING expression is eligible for transfer if it consists
  4965   4957   ** entirely of constants and expressions that are also GROUP BY terms that
  4966   4958   ** use the "BINARY" collation sequence.
  4967   4959   */
  4968         -static void havingToWhere(
  4969         -  Parse *pParse,
  4970         -  ExprList *pGroupBy,
  4971         -  Expr *pHaving, 
  4972         -  Expr **ppWhere
  4973         -){
  4974         -  struct HavingToWhereCtx sCtx;
         4960  +static void havingToWhere(Parse *pParse, Select *p){
  4975   4961     Walker sWalker;
  4976         -
  4977         -  sCtx.ppWhere = ppWhere;
  4978         -  sCtx.pGroupBy = pGroupBy;
  4979         -
  4980   4962     memset(&sWalker, 0, sizeof(sWalker));
  4981   4963     sWalker.pParse = pParse;
  4982   4964     sWalker.xExprCallback = havingToWhereExprCb;
  4983         -  sWalker.u.pHavingCtx = &sCtx;
  4984         -  sqlite3WalkExpr(&sWalker, pHaving);
         4965  +  sWalker.u.pSelect = p;
         4966  +  sqlite3WalkExpr(&sWalker, p->pHaving);
         4967  +#if SELECTTRACE_ENABLED
         4968  +  if( sWalker.eCode && (sqlite3SelectTrace & 0x100)!=0 ){
         4969  +    SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
         4970  +    sqlite3TreeViewSelect(0, p, 0);
         4971  +  }
         4972  +#endif
  4985   4973   }
  4986   4974   
  4987   4975   /*
  4988   4976   ** Check to see if the pThis entry of pTabList is a self-join of a prior view.
  4989   4977   ** If it is, then return the SrcList_item for the prior view.  If it is not,
  4990   4978   ** then return 0.
  4991   4979   */
................................................................................
  5138   5126     db = pParse->db;
  5139   5127     if( p==0 || db->mallocFailed || pParse->nErr ){
  5140   5128       return 1;
  5141   5129     }
  5142   5130     if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
  5143   5131     memset(&sAggInfo, 0, sizeof(sAggInfo));
  5144   5132   #if SELECTTRACE_ENABLED
  5145         -  pParse->nSelectIndent++;
  5146   5133     SELECTTRACE(1,pParse,p, ("begin processing:\n"));
  5147   5134     if( sqlite3SelectTrace & 0x100 ){
  5148   5135       sqlite3TreeViewSelect(0, p, 0);
  5149   5136     }
  5150   5137   #endif
  5151   5138   
  5152   5139     assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistFifo );
................................................................................
  5259   5246     ** procedure.
  5260   5247     */
  5261   5248     if( p->pPrior ){
  5262   5249       rc = multiSelect(pParse, p, pDest);
  5263   5250       explainSetInteger(pParse->iSelectId, iRestoreSelectId);
  5264   5251   #if SELECTTRACE_ENABLED
  5265   5252       SELECTTRACE(1,pParse,p,("end compound-select processing\n"));
  5266         -    pParse->nSelectIndent--;
  5267   5253   #endif
  5268   5254       return rc;
  5269   5255     }
  5270   5256   #endif
  5271   5257   
  5272   5258     /* For each term in the FROM clause, do two things:
  5273   5259     ** (1) Authorized unreferenced tables
................................................................................
  5333   5319       */
  5334   5320       pParse->nHeight += sqlite3SelectExprHeight(p);
  5335   5321   
  5336   5322       /* Make copies of constant WHERE-clause terms in the outer query down
  5337   5323       ** inside the subquery.  This can help the subquery to run more efficiently.
  5338   5324       */
  5339   5325       if( (pItem->fg.jointype & JT_OUTER)==0
         5326  +     && OptimizationEnabled(db, SQLITE_PushDown)
  5340   5327        && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor)
  5341   5328       ){
  5342   5329   #if SELECTTRACE_ENABLED
  5343   5330         if( sqlite3SelectTrace & 0x100 ){
  5344   5331           SELECTTRACE(0x100,pParse,p,("After WHERE-clause push-down:\n"));
  5345   5332           sqlite3TreeViewSelect(0, p, 0);
  5346   5333         }
  5347   5334   #endif
         5335  +    }else{
         5336  +      SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
  5348   5337       }
  5349   5338   
  5350   5339       zSavedAuthContext = pParse->zAuthContext;
  5351   5340       pParse->zAuthContext = pItem->zName;
  5352   5341   
  5353   5342       /* Generate code to implement the subquery
  5354   5343       **
................................................................................
  5543   5532     if( !isAgg && pGroupBy==0 ){
  5544   5533       /* No aggregate functions and no GROUP BY clause */
  5545   5534       u16 wctrlFlags = (sDistinct.isTnct ? WHERE_WANT_DISTINCT : 0);
  5546   5535       assert( WHERE_USE_LIMIT==SF_FixedLimit );
  5547   5536       wctrlFlags |= p->selFlags & SF_FixedLimit;
  5548   5537   
  5549   5538       /* Begin the database scan. */
         5539  +    SELECTTRACE(1,pParse,p,("WhereBegin\n"));
  5550   5540       pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, sSort.pOrderBy,
  5551   5541                                  p->pEList, wctrlFlags, p->nSelectRow);
  5552   5542       if( pWInfo==0 ) goto select_end;
  5553   5543       if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){
  5554   5544         p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo);
  5555   5545       }
  5556   5546       if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){
................................................................................
  5644   5634       sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0;
  5645   5635       sAggInfo.pGroupBy = pGroupBy;
  5646   5636       sqlite3ExprAnalyzeAggList(&sNC, pEList);
  5647   5637       sqlite3ExprAnalyzeAggList(&sNC, sSort.pOrderBy);
  5648   5638       if( pHaving ){
  5649   5639         if( pGroupBy ){
  5650   5640           assert( pWhere==p->pWhere );
  5651         -        havingToWhere(pParse, pGroupBy, pHaving, &p->pWhere);
         5641  +        assert( pHaving==p->pHaving );
         5642  +        assert( pGroupBy==p->pGroupBy );
         5643  +        havingToWhere(pParse, p);
  5652   5644           pWhere = p->pWhere;
  5653   5645         }
  5654   5646         sqlite3ExprAnalyzeAggregates(&sNC, pHaving);
  5655   5647       }
  5656   5648       sAggInfo.nAccumulator = sAggInfo.nColumn;
  5657   5649       if( p->pGroupBy==0 && p->pHaving==0 && sAggInfo.nFunc==1 ){
  5658   5650         minMaxFlag = minMaxQuery(db, sAggInfo.aFunc[0].pExpr, &pMinMaxOrderBy);
................................................................................
  5731   5723   
  5732   5724         /* Begin a loop that will extract all source rows in GROUP BY order.
  5733   5725         ** This might involve two separate loops with an OP_Sort in between, or
  5734   5726         ** it might be a single loop that uses an index to extract information
  5735   5727         ** in the right order to begin with.
  5736   5728         */
  5737   5729         sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);
         5730  +      SELECTTRACE(1,pParse,p,("WhereBegin\n"));
  5738   5731         pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0,
  5739   5732             WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0), 0
  5740   5733         );
  5741   5734         if( pWInfo==0 ) goto select_end;
  5742   5735         if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){
  5743   5736           /* The optimizer is able to deliver rows in group by order so
  5744   5737           ** we do not have to sort.  The OP_OpenEphemeral table will be
................................................................................
  5986   5979           ** minMaxFlag will have been previously set to either
  5987   5980           ** WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX and pMinMaxOrderBy will
  5988   5981           ** be an appropriate ORDER BY expression for the optimization.
  5989   5982           */
  5990   5983           assert( minMaxFlag==WHERE_ORDERBY_NORMAL || pMinMaxOrderBy!=0 );
  5991   5984           assert( pMinMaxOrderBy==0 || pMinMaxOrderBy->nExpr==1 );
  5992   5985   
         5986  +        SELECTTRACE(1,pParse,p,("WhereBegin\n"));
  5993   5987           pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy,
  5994   5988                                      0, minMaxFlag, 0);
  5995   5989           if( pWInfo==0 ){
  5996   5990             goto select_end;
  5997   5991           }
  5998   5992           updateAccumulator(pParse, &sAggInfo);
  5999   5993           if( sqlite3WhereIsOrdered(pWInfo)>0 ){
................................................................................
  6041   6035   select_end:
  6042   6036     explainSetInteger(pParse->iSelectId, iRestoreSelectId);
  6043   6037     sqlite3ExprListDelete(db, pMinMaxOrderBy);
  6044   6038     sqlite3DbFree(db, sAggInfo.aCol);
  6045   6039     sqlite3DbFree(db, sAggInfo.aFunc);
  6046   6040   #if SELECTTRACE_ENABLED
  6047   6041     SELECTTRACE(1,pParse,p,("end processing\n"));
  6048         -  pParse->nSelectIndent--;
  6049   6042   #endif
  6050   6043     return rc;
  6051   6044   }

Changes to src/shell.c.in.

  2282   2282       sqlite3_stmt *pStmt = pArg->pStmt;
  2283   2283       char z[100];
  2284   2284       nCol = sqlite3_column_count(pStmt);
  2285   2285       raw_printf(out, "%-36s %d\n", "Number of output columns:", nCol);
  2286   2286       for(i=0; i<nCol; i++){
  2287   2287         sqlite3_snprintf(sizeof(z),z,"Column %d %nname:", i, &x);
  2288   2288         utf8_printf(out, "%-36s %s\n", z, sqlite3_column_name(pStmt,i));
         2289  +#ifndef SQLITE_OMIT_DECLTYPE
  2289   2290         sqlite3_snprintf(30, z+x, "declared type:");
  2290   2291         utf8_printf(out, "%-36s %s\n", z, sqlite3_column_decltype(pStmt, i));
  2291         -  #ifdef SQLITE_ENABLE_COLUMN_METADATA
         2292  +#endif
         2293  +#ifdef SQLITE_ENABLE_COLUMN_METADATA
  2292   2294         sqlite3_snprintf(30, z+x, "database name:");
  2293   2295         utf8_printf(out, "%-36s %s\n", z, sqlite3_column_database_name(pStmt,i));
  2294   2296         sqlite3_snprintf(30, z+x, "table name:");
  2295   2297         utf8_printf(out, "%-36s %s\n", z, sqlite3_column_table_name(pStmt,i));
  2296   2298         sqlite3_snprintf(30, z+x, "origin name:");
  2297   2299         utf8_printf(out, "%-36s %s\n", z, sqlite3_column_origin_name(pStmt,i));
  2298         -  #endif
         2300  +#endif
  2299   2301       }
  2300         -    }
         2302  +  }
  2301   2303   
  2302   2304     displayStatLine(pArg, "Memory Used:",
  2303   2305        "%lld (max %lld) bytes", SQLITE_STATUS_MEMORY_USED, bReset);
  2304   2306     displayStatLine(pArg, "Number of Outstanding Allocations:",
  2305   2307        "%lld (max %lld)", SQLITE_STATUS_MALLOC_COUNT, bReset);
  2306   2308     if( pArg->shellFlgs & SHFLG_Pagecache ){
  2307   2309       displayStatLine(pArg, "Number of Pcache Pages Used:",
................................................................................
  2349   2351       iHiwtr = iCur = -1;
  2350   2352       sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
  2351   2353       raw_printf(pArg->out, "Page cache misses:                   %d\n", iCur);
  2352   2354       iHiwtr = iCur = -1;
  2353   2355       sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
  2354   2356       raw_printf(pArg->out, "Page cache writes:                   %d\n", iCur);
  2355   2357       iHiwtr = iCur = -1;
         2358  +    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_SPILL, &iCur, &iHiwtr, 1);
         2359  +    raw_printf(pArg->out, "Page cache spills:                   %d\n", iCur);
         2360  +    iHiwtr = iCur = -1;
  2356   2361       sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
  2357   2362       raw_printf(pArg->out, "Schema Heap Usage:                   %d bytes\n",
  2358   2363               iCur);
  2359   2364       iHiwtr = iCur = -1;
  2360   2365       sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset);
  2361   2366       raw_printf(pArg->out, "Statement Heap/Lookaside Usage:      %d bytes\n",
  2362   2367               iCur);
................................................................................
  2870   2875               explain_data_prepare(pArg, pExplain);
  2871   2876               exec_prepared_stmt(pArg, pExplain);
  2872   2877               explain_data_delete(pArg);
  2873   2878             }
  2874   2879             sqlite3_finalize(pExplain);
  2875   2880             sqlite3_free(zEQP);
  2876   2881           }
  2877         -        sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, triggerEQP, 0);
         2882  +        if( pArg->autoEQP>=AUTOEQP_trigger && triggerEQP==0 ){
         2883  +          sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 0, 0);
         2884  +          /* Reprepare pStmt before reactiving trace modes */
         2885  +          sqlite3_finalize(pStmt);
         2886  +          sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
         2887  +        }
  2878   2888           restore_debug_trace_modes();
  2879   2889         }
  2880   2890   
  2881   2891         if( pArg ){
  2882   2892           pArg->cMode = pArg->mode;
  2883   2893           if( pArg->autoExplain
  2884   2894            && sqlite3_column_count(pStmt)==8

Changes to src/sqlite.h.in.

  2050   2050   **
  2051   2051   ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
  2052   2052   ** <dd> Usually, when a database in wal mode is closed or detached from a 
  2053   2053   ** database handle, SQLite checks if this will mean that there are now no 
  2054   2054   ** connections at all to the database. If so, it performs a checkpoint 
  2055   2055   ** operation before closing the connection. This option may be used to
  2056   2056   ** override this behaviour. The first parameter passed to this operation
  2057         -** is an integer - non-zero to disable checkpoints-on-close, or zero (the
  2058         -** default) to enable them. The second parameter is a pointer to an integer
         2057  +** is an integer - positive to disable checkpoints-on-close, or zero (the
         2058  +** default) to enable them, and negative to leave the setting unchanged.
         2059  +** The second parameter is a pointer to an integer
  2059   2060   ** into which is written 0 or 1 to indicate whether checkpoints-on-close
  2060   2061   ** have been disabled - 0 if they are not disabled, 1 if they are.
  2061   2062   ** </dd>
         2063  +**
  2062   2064   ** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt>
  2063   2065   ** <dd>^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
  2064   2066   ** the [query planner stability guarantee] (QPSG).  When the QPSG is active,
  2065   2067   ** a single SQL query statement will always use the same algorithm regardless
  2066   2068   ** of values of [bound parameters].)^ The QPSG disables some query optimizations
  2067   2069   ** that look at the values of bound parameters, which can make some queries
  2068   2070   ** slower.  But the QPSG has the advantage of more predictable behavior.  With
  2069   2071   ** the QPSG active, SQLite will always use the same query plan in the field as
  2070   2072   ** was used during testing in the lab.
         2073  +** The first argument to this setting is an integer which is 0 to disable 
         2074  +** the QPSG, positive to enable QPSG, or negative to leave the setting
         2075  +** unchanged. The second parameter is a pointer to an integer into which
         2076  +** is written 0 or 1 to indicate whether the QPSG is disabled or enabled
         2077  +** following this call.
  2071   2078   ** </dd>
         2079  +**
  2072   2080   ** <dt>SQLITE_DBCONFIG_TRIGGER_EQP</dt>
  2073   2081   ** <dd> By default, the output of EXPLAIN QUERY PLAN commands does not 
  2074   2082   ** include output for any operations performed by trigger programs. This
  2075   2083   ** option is used to set or clear (the default) a flag that governs this
  2076   2084   ** behavior. The first parameter passed to this operation is an integer -
  2077         -** non-zero to enable output for trigger programs, or zero to disable it.
         2085  +** positive to enable output for trigger programs, or zero to disable it,
         2086  +** or negative to leave the setting unchanged.
  2078   2087   ** The second parameter is a pointer to an integer into which is written 
  2079   2088   ** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if 
  2080   2089   ** it is not disabled, 1 if it is.  
  2081   2090   ** </dd>
  2082   2091   ** </dl>
  2083   2092   */
  2084   2093   #define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */
................................................................................
  7225   7234   ** wal file in wal mode databases, or the number of pages written to the
  7226   7235   ** database file in rollback mode databases. Any pages written as part of
  7227   7236   ** transaction rollback or database recovery operations are not included.
  7228   7237   ** If an IO or other error occurs while writing a page to disk, the effect
  7229   7238   ** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
  7230   7239   ** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
  7231   7240   ** </dd>
         7241  +**
         7242  +** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt>
         7243  +** <dd>This parameter returns the number of dirty cache entries that have
         7244  +** been written to disk in the middle of a transaction due to the page
         7245  +** cache overflowing. Transactions are more efficient if they are written
         7246  +** to disk all at once. When pages spill mid-transaction, that introduces
         7247  +** additional overhead. This parameter can be used help identify
         7248  +** inefficiencies that can be resolve by increasing the cache size.
         7249  +** </dd>
  7232   7250   **
  7233   7251   ** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt>
  7234   7252   ** <dd>This parameter returns zero for the current value if and only if
  7235   7253   ** all foreign key constraints (deferred or immediate) have been
  7236   7254   ** resolved.)^  ^The highwater mark is always 0.
  7237   7255   ** </dd>
  7238   7256   ** </dl>
................................................................................
  7245   7263   #define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE  5
  7246   7264   #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL  6
  7247   7265   #define SQLITE_DBSTATUS_CACHE_HIT            7
  7248   7266   #define SQLITE_DBSTATUS_CACHE_MISS           8
  7249   7267   #define SQLITE_DBSTATUS_CACHE_WRITE          9
  7250   7268   #define SQLITE_DBSTATUS_DEFERRED_FKS        10
  7251   7269   #define SQLITE_DBSTATUS_CACHE_USED_SHARED   11
  7252         -#define SQLITE_DBSTATUS_MAX                 11   /* Largest defined DBSTATUS */
         7270  +#define SQLITE_DBSTATUS_CACHE_SPILL         12
         7271  +#define SQLITE_DBSTATUS_MAX                 12   /* Largest defined DBSTATUS */
  7253   7272   
  7254   7273   
  7255   7274   /*
  7256   7275   ** CAPI3REF: Prepared Statement Status
  7257   7276   ** METHOD: sqlite3_stmt
  7258   7277   **
  7259   7278   ** ^(Each prepared statement maintains various
................................................................................
  8835   8854   ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
  8836   8855   ** in the P argument is held in memory obtained from [sqlite3_malloc64()]
  8837   8856   ** and that SQLite should take ownership of this memory and automatically
  8838   8857   ** free it when it has finished using it.  Without this flag, the caller
  8839   8858   ** is resposible for freeing any dynamically allocated memory.
  8840   8859   **
  8841   8860   ** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
  8842         -** grow the size of the database usign calls to [sqlite3_realloc64()].  This
         8861  +** grow the size of the database using calls to [sqlite3_realloc64()].  This
  8843   8862   ** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
  8844   8863   ** Without this flag, the deserialized database cannot increase in size beyond
  8845   8864   ** the number of bytes specified by the M parameter.
  8846   8865   **
  8847   8866   ** The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
  8848   8867   ** should be treated as read-only.
  8849   8868   */

Changes to src/sqliteInt.h.

  1528   1528   #define SQLITE_OrderByIdxJoin 0x0040   /* ORDER BY of joins via index */
  1529   1529   #define SQLITE_Transitive     0x0080   /* Transitive constraints */
  1530   1530   #define SQLITE_OmitNoopJoin   0x0100   /* Omit unused tables in joins */
  1531   1531   #define SQLITE_CountOfView    0x0200   /* The count-of-view optimization */
  1532   1532   #define SQLITE_CursorHints    0x0400   /* Add OP_CursorHint opcodes */
  1533   1533   #define SQLITE_Stat34         0x0800   /* Use STAT3 or STAT4 data */
  1534   1534      /* TH3 expects the Stat34  ^^^^^^ value to be 0x0800.  Don't change it */
         1535  +#define SQLITE_PushDown       0x1000   /* The push-down optimization */
  1535   1536   #define SQLITE_AllOpts        0xffff   /* All optimizations */
  1536   1537   
  1537   1538   /*
  1538   1539   ** Macros for testing whether or not optimizations are enabled or disabled.
  1539   1540   */
  1540   1541   #define OptimizationDisabled(db, mask)  (((db)->dbOptFlags&(mask))!=0)
  1541   1542   #define OptimizationEnabled(db, mask)   (((db)->dbOptFlags&(mask))==0)
................................................................................
  2989   2990     yDbMask writeMask;   /* Start a write transaction on these databases */
  2990   2991     yDbMask cookieMask;  /* Bitmask of schema verified databases */
  2991   2992     int regRowid;        /* Register holding rowid of CREATE TABLE entry */
  2992   2993     int regRoot;         /* Register holding root page number for new objects */
  2993   2994     int nMaxArg;         /* Max args passed to user function by sub-program */
  2994   2995   #if SELECTTRACE_ENABLED
  2995   2996     int nSelect;         /* Number of SELECT statements seen */
  2996         -  int nSelectIndent;   /* How far to indent SELECTTRACE() output */
  2997   2997   #endif
  2998   2998   #ifndef SQLITE_OMIT_SHARED_CACHE
  2999   2999     int nTableLock;        /* Number of locks in aTableLock */
  3000   3000     TableLock *aTableLock; /* Required table locks for shared-cache mode */
  3001   3001   #endif
  3002   3002     AutoincInfo *pAinc;  /* Information about AUTOINCREMENT counters */
  3003   3003     Parse *pToplevel;    /* Parse structure for main program (or NULL) */
................................................................................
  3353   3353       int n;                                    /* A counter */
  3354   3354       int iCur;                                 /* A cursor number */
  3355   3355       SrcList *pSrcList;                        /* FROM clause */
  3356   3356       struct SrcCount *pSrcCount;               /* Counting column references */
  3357   3357       struct CCurHint *pCCurHint;               /* Used by codeCursorHint() */
  3358   3358       int *aiCol;                               /* array of column indexes */
  3359   3359       struct IdxCover *pIdxCover;               /* Check for index coverage */
  3360         -    struct IdxExprTrans *pIdxTrans;           /* Convert indexed expr to column */
         3360  +    struct IdxExprTrans *pIdxTrans;           /* Convert idxed expr to column */
  3361   3361       ExprList *pGroupBy;                       /* GROUP BY clause */
  3362         -    struct HavingToWhereCtx *pHavingCtx;      /* HAVING to WHERE clause ctx */
         3362  +    Select *pSelect;                          /* HAVING to WHERE clause ctx */
  3363   3363     } u;
  3364   3364   };
  3365   3365   
  3366   3366   /* Forward declarations */
  3367   3367   int sqlite3WalkExpr(Walker*, Expr*);
  3368   3368   int sqlite3WalkExprList(Walker*, ExprList*);
  3369   3369   int sqlite3WalkSelect(Walker*, Select*);

Changes to src/status.c.

   333    333       }
   334    334   
   335    335       /*
   336    336       ** Set *pCurrent to the total cache hits or misses encountered by all
   337    337       ** pagers the database handle is connected to. *pHighwater is always set 
   338    338       ** to zero.
   339    339       */
          340  +    case SQLITE_DBSTATUS_CACHE_SPILL:
          341  +      op = SQLITE_DBSTATUS_CACHE_WRITE+1;
          342  +      /* Fall through into the next case */
   340    343       case SQLITE_DBSTATUS_CACHE_HIT:
   341    344       case SQLITE_DBSTATUS_CACHE_MISS:
   342    345       case SQLITE_DBSTATUS_CACHE_WRITE:{
   343    346         int i;
   344    347         int nRet = 0;
   345    348         assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 );
   346    349         assert( SQLITE_DBSTATUS_CACHE_WRITE==SQLITE_DBSTATUS_CACHE_HIT+2 );

Changes to src/test_malloc.c.

  1379   1379       { "LOOKASIDE_MISS_SIZE", SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE },
  1380   1380       { "LOOKASIDE_MISS_FULL", SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL },
  1381   1381       { "CACHE_HIT",           SQLITE_DBSTATUS_CACHE_HIT           },
  1382   1382       { "CACHE_MISS",          SQLITE_DBSTATUS_CACHE_MISS          },
  1383   1383       { "CACHE_WRITE",         SQLITE_DBSTATUS_CACHE_WRITE         },
  1384   1384       { "DEFERRED_FKS",        SQLITE_DBSTATUS_DEFERRED_FKS        },
  1385   1385       { "CACHE_USED_SHARED",   SQLITE_DBSTATUS_CACHE_USED_SHARED   },
         1386  +    { "CACHE_SPILL",         SQLITE_DBSTATUS_CACHE_SPILL         },
  1386   1387     };
  1387   1388     Tcl_Obj *pResult;
  1388   1389     if( objc!=4 ){
  1389   1390       Tcl_WrongNumArgs(interp, 1, objv, "DB PARAMETER RESETFLAG");
  1390   1391       return TCL_ERROR;
  1391   1392     }
  1392   1393     if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;

Changes to src/treeview.c.

   133    133     pView = sqlite3TreeViewPush(pView, moreToFollow);
   134    134     if( p->pWith ){
   135    135       sqlite3TreeViewWith(pView, p->pWith, 1);
   136    136       cnt = 1;
   137    137       sqlite3TreeViewPush(pView, 1);
   138    138     }
   139    139     do{
          140  +#if SELECTTRACE_ENABLED
          141  +    sqlite3TreeViewLine(pView,
          142  +      "SELECT%s%s (%s/%p) selFlags=0x%x nSelectRow=%d",
          143  +      ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
          144  +      ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""),
          145  +      p->zSelName, p, p->selFlags,
          146  +      (int)p->nSelectRow
          147  +    );
          148  +#else
   140    149       sqlite3TreeViewLine(pView, "SELECT%s%s (0x%p) selFlags=0x%x nSelectRow=%d",
   141    150         ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
   142    151         ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""), p, p->selFlags,
   143    152         (int)p->nSelectRow
   144    153       );
          154  +#endif
   145    155       if( cnt++ ) sqlite3TreeViewPop(pView);
   146    156       if( p->pPrior ){
   147    157         n = 1000;
   148    158       }else{
   149    159         n = 0;
   150    160         if( p->pSrc && p->pSrc->nSrc ) n++;
   151    161         if( p->pWhere ) n++;

Changes to src/vdbe.c.

  4283   4283     VdbeFrame *pFrame;     /* Root frame of VDBE */
  4284   4284   
  4285   4285     v = 0;
  4286   4286     res = 0;
  4287   4287     pOut = out2Prerelease(p, pOp);
  4288   4288     assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  4289   4289     pC = p->apCsr[pOp->p1];
         4290  +  if( !pC->isTable ){
         4291  +    rc = SQLITE_CORRUPT_BKPT;
         4292  +    goto abort_due_to_error;
         4293  +  }
  4290   4294     assert( pC!=0 );
  4291   4295     assert( pC->eCurType==CURTYPE_BTREE );
  4292   4296     assert( pC->uc.pCursor!=0 );
  4293   4297     {
  4294   4298       /* The next rowid or record number (different terms for the same
  4295   4299       ** thing) is obtained in a two-step algorithm.
  4296   4300       **

Changes to src/vdbeapi.c.

  1664   1664   /*
  1665   1665   ** Return the value of a status counter for a prepared statement
  1666   1666   */
  1667   1667   int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
  1668   1668     Vdbe *pVdbe = (Vdbe*)pStmt;
  1669   1669     u32 v;
  1670   1670   #ifdef SQLITE_ENABLE_API_ARMOR
  1671         -  if( !pStmt ){
         1671  +  if( !pStmt 
         1672  +   || (op!=SQLITE_STMTSTATUS_MEMUSED && (op<0||op>=ArraySize(pVdbe->aCounter)))
         1673  +  ){
  1672   1674       (void)SQLITE_MISUSE_BKPT;
  1673   1675       return 0;
  1674   1676     }
  1675   1677   #endif
  1676   1678     if( op==SQLITE_STMTSTATUS_MEMUSED ){
  1677   1679       sqlite3 *db = pVdbe->db;
  1678   1680       sqlite3_mutex_enter(db->mutex);

Changes to test/dbstatus.test.

   411    411       do_cacheused_test 4.2.3 db2 { 4568 4568 }
   412    412       sqlite3 db file:test.db?cache=shared
   413    413       do_cacheused_test 4.2.4 db2 { 4568 2284 }
   414    414       db2 close
   415    415     }
   416    416   }
   417    417   
          418  +#-------------------------------------------------------------------------
          419  +# Test that passing an out-of-range value to sqlite3_stmt_status does
          420  +# not cause a crash.
          421  +reset_db
          422  +do_execsql_test 5.0 {
          423  +  CREATE TABLE t1(x, y);
          424  +  INSERT INTO t1 VALUES(1, 2);
          425  +  INSERT INTO t1 VALUES(3, 4);
          426  +}
          427  +
          428  +do_test 5.1 {
          429  +  set ::stmt [sqlite3_prepare db "SELECT * FROM t1" -1 dummy]
          430  +  sqlite3_step $::stmt
          431  +  sqlite3_step $::stmt
          432  +  sqlite3_step $::stmt
          433  +  sqlite3_reset $::stmt
          434  +} {SQLITE_OK}
          435  +
          436  +ifcapable api_armor {
          437  +  do_test 5.2 { sqlite3_stmt_status $::stmt -1 0 } 0
          438  +}
          439  +do_test 5.3 { sqlite3_stmt_status $::stmt  0 0 } 0
          440  +do_test 5.4 { 
          441  +  expr [sqlite3_stmt_status $::stmt 99 0]>0 
          442  +} 1
          443  +foreach {tn id res} {
          444  +  1 SQLITE_STMTSTATUS_MEMUSED 1
          445  +  2 SQLITE_STMTSTATUS_FULLSCAN_STEP 1
          446  +  3 SQLITE_STMTSTATUS_SORT 0
          447  +  4 SQLITE_STMTSTATUS_AUTOINDEX 0
          448  +  5 SQLITE_STMTSTATUS_VM_STEP 1
          449  +  6 SQLITE_STMTSTATUS_REPREPARE 0
          450  +  7 SQLITE_STMTSTATUS_RUN 1
          451  +} {
          452  +if {$tn==2} breakpoint
          453  +  do_test 5.5.$tn { expr [sqlite3_stmt_status $::stmt $id 0]>0 } $res
          454  +}
          455  +
          456  +sqlite3_finalize $::stmt
   418    457   finish_test

Changes to test/dbstatus2.test.

    32     32     set nMiss [sqlite3_db_status $db CACHE_MISS $reset]
    33     33     list $nHit $nMiss
    34     34   }
    35     35   
    36     36   proc db_write {db {reset 0}} {
    37     37     sqlite3_db_status $db CACHE_WRITE $reset
    38     38   }
           39  +
           40  +proc db_spill {db {reset 0}} {
           41  +  sqlite3_db_status $db CACHE_SPILL $reset
           42  +}
    39     43   
    40     44   do_test 1.1 {
    41     45     db close
    42     46     sqlite3 db test.db
    43     47     execsql { PRAGMA mmap_size = 0 }
    44     48     expr {[file size test.db] / 1024}
    45     49   } 6
................................................................................
    94     98   }
    95     99   do_test 2.7 { 
    96    100     execsql { INSERT INTO t1 VALUES(5, randomblob(600)) }
    97    101     db_write db
    98    102   } {0 4 0}
    99    103   do_test 2.8 { db_write db 1 } {0 4 0}
   100    104   do_test 2.9 { db_write db 0 } {0 0 0}
          105  +
          106  +do_test 3.0 { db_spill db 1 } {0 0 0}
          107  +do_test 3.1 { db_spill db 0 } {0 0 0}
          108  +do_execsql_test 3.2 {
          109  +  PRAGMA journal_mode=DELETE;
          110  +  PRAGMA cache_size=3;
          111  +  UPDATE t1 SET b=randomblob(1000);
          112  +} {delete}
          113  +do_test 3.3 { db_spill db 0 } {0 8 0}
   101    114    
   102    115   finish_test

Changes to test/join5.test.

   160    160     INSERT INTO x3 VALUES('c', NULL);
   161    161     SELECT * FROM x1 LEFT JOIN x2 JOIN x3 WHERE x3.d = x2.b;
   162    162   } {}
   163    163   
   164    164   # Ticket https://www.sqlite.org/src/tktview/c2a19d81652f40568c770c43 on
   165    165   # 2015-08-20.  LEFT JOIN and the push-down optimization.
   166    166   #
   167         -do_execsql_test join6-4.1 {
          167  +do_execsql_test join5-4.1 {
   168    168     SELECT *
   169    169     FROM (
   170    170         SELECT 'apple' fruit
   171    171         UNION ALL SELECT 'banana'
   172    172     ) a
   173    173     JOIN (
   174    174         SELECT 'apple' fruit
   175    175         UNION ALL SELECT 'banana'
   176    176     ) b ON a.fruit=b.fruit
   177    177     LEFT JOIN (
   178    178         SELECT 1 isyellow
   179    179     ) c ON b.fruit='banana';
   180    180   } {apple apple {} banana banana 1}
   181         -do_execsql_test join6-4.2 {
          181  +do_execsql_test join5-4.2 {
   182    182     SELECT *
   183    183       FROM (SELECT 'apple' fruit UNION ALL SELECT 'banana')
   184    184            LEFT JOIN (SELECT 1) ON fruit='banana';
   185    185   } {apple {} banana 1}
   186    186   
   187    187   #-------------------------------------------------------------------------
   188    188   do_execsql_test 5.0 {

Added test/optfuzz-db01.c.

            1  +/* content of file testdb01.db */
            2  +unsigned char data001[] = {
            3  +  83, 81, 76,105,116,101, 32,102,111,114,109, 97,116, 32, 51,  0,  2,  0,  1,
            4  +   1,  0, 64, 32, 32,  0,  0,  0,  2,  0,  0,  0, 35,  0,  0,  0,  0,  0,  0,
            5  +   0,  0,  0,  0,  0, 31,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,
            6  +   0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
            7  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
            8  +   2,  0, 46, 32,152,  5,  0,  0,  0,  7,  1,221,  0,  0,  0,  0, 35,  1,251,
            9  +   1,246,  1,241,  1,236,  1,231,  1,226,  1,221, 84,  4,  7, 23, 17, 17,  1,
           10  + 129, 19,116, 97, 98,108,101,116, 52,116, 52,  5, 67, 82, 69, 65, 84, 69, 32,
           11  +  84, 65, 66, 76, 69, 32,116, 52, 40, 97, 32, 73, 78, 84, 32, 85, 78, 73, 81,
           12  +  85, 69, 32, 78, 79, 84, 32, 78, 85, 76, 76, 44, 32, 98, 32, 73, 78, 84, 32,
           13  +  85, 78, 73, 81, 85, 69, 32, 78, 79, 84, 32, 78, 85, 76, 76, 44, 99, 44,100,
           14  +  44,101, 41, 35,  6,  6, 23, 55, 17,  1,  0,105,110,100,101,120,115,113,108,
           15  + 105,116,101, 95, 97,117,116,111,105,110,100,101,120, 95,116, 52, 95, 50,116,
           16  +  52,  7, 35,  5,  6, 23, 55, 17,  1,  0,105,110,100,101,120,115,113,108,105,
           17  + 116,101, 95, 97,117,116,111,105,110,100,101,120, 95,116, 52, 95, 49,116, 52,
           18  +   6, 42,  3,  6, 23, 17, 17,  1, 65,116, 97, 98,108,101,116, 51,116, 51,  4,
           19  +  67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 51, 40, 97, 44, 98,
           20  +  44, 99, 44,100, 44,101, 41, 95,  2,  7, 23, 17, 17,  1,129, 41,116, 97, 98,
           21  + 108,101,116, 50,116, 50,  3, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69,
           22  +  32,116, 50, 40, 97, 32, 73, 78, 84, 44, 32, 98, 32, 73, 78, 84, 44, 32, 99,
           23  +  32, 73, 78, 84, 44,100, 32, 73, 78, 84, 44,101, 32, 73, 78, 84, 44, 80, 82,
           24  +  73, 77, 65, 82, 89, 32, 75, 69, 89, 40, 98, 44, 97, 41, 41, 87, 73, 84, 72,
           25  +  79, 85, 84, 32, 82, 79, 87, 73, 68, 83,  1,  7, 23, 17, 17,  1,129, 17,116,
           26  +  97, 98,108,101,116, 49,116, 49,  2, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66,
           27  +  76, 69, 32,116, 49, 40, 97, 32, 73, 78, 84, 69, 71, 69, 82, 32, 80, 82, 73,
           28  +  77, 65,  0,  0,  0, 34, 32,  0,  0,  0, 33, 29,  0,  0,  0, 32, 26,  0,  0,
           29  +   0, 31, 23,  0,  0,  0, 30, 19,  0,  0,  0, 11, 14,  0,  0,  0,  9,  7,  5,
           30  +   0,  0,  0,  1,  1,251,  0,  0,  0,  0, 16,  1,251,  1,195,  1,180,  1,166,
           31  +   1,151,  1,136,  1,121,  1,105,  1, 91,  1, 76,  1, 61,  1, 46,  1, 29,  1,
           32  +  14,  0,252,  0,238,  0,224,  0,209,  0,194,  0,177,  0,157,  0,143,  0,128,
           33  +   0,110,  0, 94,  0, 78,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
           34  +   0, 14, 28,  6,  0,  1,  1,  1, 23, 17, 67, 31,119,111,114,107,115, 14, 27,
           35  +   6,  0,  1,  1,  1, 23, 22, 71,  3, 97,110,103,101,108, 16, 26,  6,  0,  1,
           36  +   1,  1, 27, 40, 98, 17,109,111,114,110,105,110,103, 13, 25,  6,  0,  1,  1,
           37  +   1, 21, 10,  7, 19,103,111,110,101, 12, 24,  6,  0,  1,  1,  9, 21, 43, 46,
           38  + 119, 97,121,115, 18, 23,  6,  0,  1,  1,  1, 31,  6, 37, 31,115, 97, 99,114,
           39  + 105,102,105, 99,101, 15, 22,  6,  0,  1,  1,  1, 25, 45, 71, 28,116,104,111,
           40  + 117,103,104, 13, 21,  6,  0,  1,  1,  1, 21, 22, 92, 18,115,111,109,101, 13,
           41  +  20,  6,  0,  9,  1,  1, 23,  2, 45, 97, 98,111,118,101, 12, 19,  6,  0,  1,
           42  +   1,  8, 21,  4, 58,119, 97,121,115, 12, 18,  6,  0,  1,  1,  1, 19, 44, 19,
           43  +  43,119, 97,114, 16, 17,  6,  0,  1,  1,  1, 27, 29, 74, 36, 98,101,116,119,
           44  + 101,101,110, 13, 16,  6,  0,  1,  1,  1, 21, 44, 52, 19,112,111,111,114, 15,
           45  +  15,  6,  0,  1,  1,  1, 25,  6,  3, 11,116,101,109,112,108,101, 13, 14,  6,
           46  +   0,  1,  1,  1, 21, 35, 48, 27,100,105,101,100, 13, 13,  6,  0,  1,  1,  1,
           47  +  21,  4, 21, 39,100,111,116,104, 13, 12,  6,  0,  1,  1,  1, 21,  4, 38, 36,
           48  + 115,101,110,100, 12, 11,  6,  0,  1,  1,  1, 19, 13, 48, 22,115,105,120, 14,
           49  +  10,  6,  0,  1,  1,  1, 23, 41, 89, 14,115,101,114,118,101, 13,  9,  6,  0,
           50  +   8,  1,  1, 23, 16, 50, 98,101,103, 97,116, 13,  8,  6,  0,  1,  1,  1, 21,
           51  +  42, 49, 34,115,101,110,100, 13,  7,  6,  0,  1,  1,  1, 21, 21, 91, 38,110,
           52  + 101, 97,114, 12,  6,  6,  0,  1,  1,  1, 19,  2, 37, 11, 99, 97,110, 13,  5,
           53  +   6,  0,  1,  1,  1, 21, 25, 27, 28,103,111,110,101, 13,  4,  6,  0,  1,  1,
           54  +   1, 21, 41, 32, 35,110,101, 97,114, 14,  3,  6,  0,  1,  1,  1, 23, 32, 24,
           55  +  26,115,101,114,118,101, 13,  2,  6,  0,  1,  1,  1, 21, 45, 14, 39,115, 97,
           56  + 118,101, 13,  1,  6,  0,  1,  1,  1, 21, 40, 68,  0,  0,  0, 15, 28,  2,  0,
           57  +   0,  0,  1,  1,238,  0,  0,  0,  0, 22,  1,238,  1,197,  1,181,  1,166,  1,
           58  + 151,  1,137,  1,121,  1,104,  1, 84,  1, 73,  1, 59,  1, 41,  1, 26,  1, 11,
           59  +   0,253,  0,238,  0,223,  0,207,  0,191,  0,175,  0,159,  0,144,  0,129,  0,
           60  + 113,  0, 97,  0, 82,  0, 68,  0,  0, 13,  6,  1,  1,  1,  1, 19, 26, 34, 15,
           61  +  20, 97,114,107, 14,  6,  1,  1,  1,  1, 21, 25,  5, 27, 28,103,111,110,101,
           62  +  15,  6,  1,  1,  1,  1, 23, 22, 47, 16, 40, 97,110,103,101,114, 15,  6,  1,
           63  +   1,  1,  1, 23, 22, 27, 71,  3, 97,110,103,101,108, 14,  6,  1,  1,  1,  1,
           64  +  21, 22, 21, 92, 18,115,111,109,101, 14,  6,  1,  1,  1,  1, 21, 21,  7, 91,
           65  +  38,110,101, 97,114, 15,  6,  1,  1,  1,  1, 23, 20, 42, 18,  5, 98,101,103,
           66  +  97,116, 15,  6,  1,  1,  1,  1, 23, 17, 37, 66, 18,100,119,101,108,116, 15,
           67  +   6,  1,  1,  1,  1, 23, 17, 28, 67, 31,119,111,114,107,115, 15,  6,  1,  1,
           68  +   1,  8, 25, 16, 32,  7,112,108, 97, 99,101,115, 14,  6,  1,  1,  1,  1, 21,
           69  +  16, 30, 81, 25,119, 97,108,107, 14,  6,  1,  1,  1,  1, 21, 14, 40, 30, 26,
           70  + 115,101,110,100, 13,  6,  1,  1,  1,  1, 19, 13, 11, 48, 22,115,105,120, 14,
           71  +   6,  1,  1,  1,  1, 21, 10, 38, 97, 34,115,104,101,119, 14,  6,  1,  1,  1,
           72  +   1, 21, 10, 25,  7, 19,103,111,110,101, 17,  6,  1,  1,  1,  1, 27,  9, 50,
           73  +  92, 29,116,104,101,114,101,105,110, 13,  6,  1,  1,  1,  1, 19,  9, 49, 51,
           74  +  38,111,105,108, 10,  6,  1,  1,  1,  1,  0,  7, 33, 72, 31, 19,  6,  1,  1,
           75  +   1,  1, 31,  6, 23, 37, 31,115, 97, 99,114,105,102,105, 99,101, 16,  6,  1,
           76  +   1,  1,  1, 25,  6, 15,  3, 11,116,101,109,112,108,101, 15,  6,  1,  1,  1,
           77  +   1, 23,  5, 43, 23, 41, 98,101,103, 97,116, 13,  6,  1,  1,  1,  8, 21,  4,
           78  +  19, 58,119, 97,121,115, 14,  6,  1,  1,  1,  1, 21,  4, 13, 21, 39,100,111,
           79  + 116,104, 14,  6,  1,  1,  1,  1, 21,  4, 12, 38, 36,115,101,110,100, 15,  6,
           80  +   1,  1,  1,  1, 23,  3, 39, 21, 45, 98,101,103, 97,116, 13,  6,  1,  1,  1,
           81  +   1, 19,  2,  6, 37, 11, 99, 97,110, 14,  6,  9,  1,  1,  1, 23, 20,  2, 45,
           82  +  97, 98,111,118,101, 14,  6,  8,  1,  1,  1, 23, 36, 52, 17, 99,104,  0,  0,
           83  +   0, 21, 13,  6,  1,  1,  1,  1, 19, 26, 34, 15, 20, 97,114,107, 13,  0,  0,
           84  +   0, 35,  0, 92,  0,  1,244,  1,232,  1,216,  1,204,  1,186,  1,171,  1,160,
           85  +   1,149,  1,138,  1,128,  1,117,  1,106,  1, 92,  1, 76,  1, 65,  1, 49,  1,
           86  +  32,  1, 21,  1, 10,  0,255,  0,241,  0,225,  0,214,  0,203,  0,192,  0,180,
           87  +   0,168,  0,156,  0,144,  0,132,  0,124,  0,116,  0,108,  0,100,  0, 92,  0,
           88  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6, 35,  6,  0,  0,  0,
           89  +   0,  0,  6, 34,  6,  0,  0,  0,  0,  0,  6, 33,  6,  0,  0,  0,  0,  0,  6,
           90  +  32,  6,  0,  0,  0,  0,  0,  6, 31,  6,  0,  0,  0,  0,  0, 10, 30,  6,  1,
           91  +   1,  1,  1,  0, 48, 37, 93,  7, 10, 29,  6,  1,  1,  1,  1,  0, 28, 17, 67,
           92  +  31, 10, 28,  6,  1,  1,  1,  1,  0, 22, 45, 71, 28, 10, 27,  6,  1,  1,  1,
           93  +   1,  0, 12,  4, 38, 36, 10, 26,  6,  1,  1,  1,  1,  0, 49,  9, 51, 38,  9,
           94  +  25,  6,  1,  1,  1,  0,  0, 17, 29, 74,  9, 24,  6,  1,  1,  1,  0,  0, 47,
           95  +  22, 16,  9, 23,  6,  1,  1,  1,  0,  0, 32, 16,  7, 14, 22,  6,  1,  1,  1,
           96  +   0, 23, 42, 20, 18, 98,101,103, 97,116, 12, 21,  6,  1,  1,  1,  0, 19, 34,
           97  +  26, 15, 97,114,107,  9, 20,  6,  1,  1,  0,  1,  0, 49,  9, 38,  9, 19,  6,
           98  +   1,  1,  0,  1,  0, 44, 48,  9,  9, 18,  6,  1,  1,  0,  1,  0, 21, 22, 18,
           99  +  15, 17,  6,  1,  1,  0,  1, 25, 35, 38, 22, 99,117, 98,105,116,115, 14, 16,
          100  +   6,  1,  1,  0,  1, 23, 37, 17, 18,100,119,101,108,116,  9, 15,  6,  1,  0,
          101  +   1,  1,  0, 49, 51, 38, 14, 14,  6,  1,  0,  1,  1, 23, 10, 89, 14,115,101,
          102  + 114,118,101, 12, 13,  6,  9,  0,  1,  1, 21, 68, 32,100,111,116,104,  9, 12,
          103  +   6,  1,  0,  1,  1,  0, 47, 16, 40,  9, 11,  6,  1,  0,  1,  1,  0, 25,  7,
          104  +  19,  8, 10,  6,  0,  1,  1,  8,  0, 16,  7,  9,  9,  6,  0,  1,  1,  1,  0,
          105  +  16, 81, 25,  9,  8,  6,  0,  1,  1,  1,  0,  7, 72, 31,  9,  7,  6,  0,  1,
          106  +   1,  1,  0,  6, 37, 31, 13,  6,  6,  0,  1,  1,  1, 21, 21, 91, 38,110,101,
          107  +  97,114, 16,  5,  6,  1,  1,  1,  1, 25, 15,  6,  3, 11,116,101,109,112,108,
          108  + 101, 10,  4,  6,  1,  1,  1,  1,  0, 21, 22, 92, 18, 14,  3,  6,  1,  1,  1,
          109  +   1, 21,  4, 41, 32, 35,110,101, 97,114, 10,  2,  6,  1,  1,  1,  1,  0, 46,
          110  +  28, 88, 22, 10,  1,  6,  1,  1,  1,  1,  0, 17, 29, 74, 36, 13,  0,  0,  0,
          111  +  15,  1, 71,  0,  1,243,  1,230,  1,217,  1,204,  1,191,  1,179,  1,167,  1,
          112  + 155,  1,143,  1,131,  1,119,  1,107,  1, 95,  1, 83,  1, 71,  0,  0,  0,  0,
          113  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          114  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          115  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          116  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          117  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          118  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          119  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          120  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          121  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          122  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          123  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          124  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          125  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          126  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          127  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          128  +  10, 15,  6,  1,  1,  1,  1,  0, 48, 37, 93,  7, 10, 14,  6,  1,  1,  1,  1,
          129  +   0, 22, 45, 71, 28, 10, 13,  6,  1,  1,  1,  1,  0, 12,  4, 38, 36, 10, 12,
          130  +   6,  1,  1,  1,  0,  1, 32, 16,  7, 79, 10, 11,  6,  1,  1,  1,  0,  1, 42,
          131  +  20, 18, 19, 10, 10,  6,  1,  1,  1,  0,  1, 34, 26, 15, 13, 10,  9,  6,  1,
          132  +   1,  0,  1,  1, 49,  9, 38, 97, 10,  8,  6,  1,  1,  0,  1,  1, 44, 48,  9,
          133  +  90, 10,  7,  6,  1,  1,  0,  1,  1, 35, 38, 22, 33, 10,  6,  6,  1,  1,  0,
          134  +   1,  1, 37, 17, 18, 18, 11,  5,  6,  1,  1,  1,  1,  1, 15,  6,  3, 11, 43,
          135  +  11,  4,  6,  1,  1,  1,  1,  1, 21, 22, 92, 18, 62, 11,  3,  6,  1,  1,  1,
          136  +   1,  1,  4, 41, 32, 35, 36, 11,  2,  6,  1,  1,  1,  1,  1, 46, 28, 88, 22,
          137  +  77, 11,  1,  6,  1,  1,  1,  1,  1, 17, 29, 74, 36, 61, 10,  0,  0,  0, 15,
          138  +   1,167,  0,  1,250,  1,244,  1,238,  1,233,  1,227,  1,221,  1,215,  1,209,
          139  +   1,203,  1,197,  1,191,  1,185,  1,179,  1,173,  1,167,  0,  0,  0,  0,  0,
          140  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          141  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          142  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          143  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          144  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          145  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          146  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          147  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          148  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          149  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          150  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          151  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          152  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          153  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          154  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          155  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          156  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          157  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          158  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          159  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          160  +   5,  3,  1,  1, 49,  9,  5,  3,  1,  1, 48, 15,  5,  3,  1,  1, 46,  2,  5,
          161  +   3,  1,  1, 44,  8,  5,  3,  1,  1, 42, 11,  5,  3,  1,  1, 37,  6,  5,  3,
          162  +   1,  1, 35,  7,  5,  3,  1,  1, 34, 10,  5,  3,  1,  1, 32, 12,  5,  3,  1,
          163  +   1, 22, 14,  5,  3,  1,  1, 21,  4,  4,  3,  1,  9, 17,  5,  3,  1,  1, 15,
          164  +   5,  5,  3,  1,  1, 12, 13,  5,  3,  1,  1,  4,  3, 10,  0,  0,  0, 15,  1,
          165  + 167,  0,  1,250,  1,244,  1,238,  1,232,  1,226,  1,220,  1,214,  1,208,  1,
          166  + 202,  1,197,  1,191,  1,185,  1,179,  1,173,  1,167,  0,  0,  0,  0,  0,  0,
          167  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          168  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          169  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          170  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          171  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          172  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          173  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          174  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          175  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          176  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          177  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          178  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          179  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          180  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          181  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          182  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          183  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          184  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          185  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          186  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,
          187  +   3,  1,  1, 48,  8,  5,  3,  1,  1, 45, 14,  5,  3,  1,  1, 41,  3,  5,  3,
          188  +   1,  1, 38,  7,  5,  3,  1,  1, 37, 15,  4,  3,  1,  9, 29,  5,  3,  1,  1,
          189  +  28,  2,  5,  3,  1,  1, 26, 10,  5,  3,  1,  1, 22,  4,  5,  3,  1,  1, 20,
          190  +  11,  5,  3,  1,  1, 17,  6,  5,  3,  1,  1, 16, 12,  5,  3,  1,  1,  9,  9,
          191  +   5,  3,  1,  1,  6,  5,  5,  3,  1,  1,  4, 13,  5,  0,  0,  0,  2,  1,246,
          192  +   0,  0,  0,  0, 27,  1,251,  1,246,  1,168,  1,148,  1,130,  1,107,  1, 86,
          193  +   1, 65,  1, 44,  1, 27,  1, 14,  0,250,  0,224,  0,205,  0,184,  0,165,  0,
          194  + 145,  0,123,  0,106,  0, 86,  0, 67,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          195  +   0,  0,  0, 17, 23,  6,  0, 23,  1,  1, 21,107,110,111,119,110, 52, 19,112,
          196  + 111,111,114, 18, 22,  6,  0, 23,  1,  1, 23, 97, 98,111,118,101, 24, 26,115,
          197  + 101,114,118,101, 15, 21,  6,  0, 19,  1,  1, 21,119, 97,114, 52, 19,112,111,
          198  + 111,114, 20, 20,  6,  0, 27,  1,  8, 25,110,111,116,104,105,110,103,  7,112,
          199  + 108, 97, 99,101,115, 18, 19,  6,  0, 23,  1,  1, 23, 98,101,103, 97,116, 90,
          200  +  27,116,114,117,116,104, 17, 18,  6,  0, 23,  1,  1, 21,100,119,101,108,116,
          201  +  21, 39,100,111,116,104, 19, 17,  6,  0, 27,  1,  1, 21,109,111,114,110,105,
          202  + 110,103, 52, 19,112,111,111,114, 17, 16,  6,  0, 21,  1,  1, 23,115,104,101,
          203  + 119, 90, 27,116,114,117,116,104, 24, 15,  6,  0, 27,  1,  1, 31,116,104,101,
          204  + 114,101,105,110, 37, 31,115, 97, 99,114,105,102,105, 99,101, 18, 14,  6,  0,
          205  +  23,  1,  8, 25,115,109,111,116,101,  7,112,108, 97, 99,101,115, 11, 13,  6,
          206  +   0, 19,  1,  1,  0, 97,114,107, 72, 31, 15, 12,  6,  0, 21,  1,  8, 21,119,
          207  + 105,110,101, 58,119, 97,121,115, 19, 11,  6,  0, 21,  1,  1, 27,115,111,109,
          208  + 101, 98, 17,109,111,114,110,105,110,103, 19, 10,  6,  0, 27,  1,  1, 21, 98,
          209  + 101,116,119,101,101,110, 92, 18,115,111,109,101, 19,  9,  6,  0, 21,  1,  1,
          210  +  27,115, 97,118,101, 74, 36, 98,101,116,119,101,101,110, 21,  8,  6,  0, 25,
          211  +   1,  1, 27,116,104,111,117,103,104, 98, 17,109,111,114,110,105,110,103, 16,
          212  +   7,  6,  0, 21,  1,  1, 21,115,101,110,100, 49, 34,115,101,110,100, 18,  6,
          213  +   6,  0, 25,  1,  1, 21,119,105,115,100,111,109, 38, 36,115,101,110,100, 16,
          214  +   5,  6,  0, 23,  1,  9, 21, 97,110,103,101,114, 46,119, 97,121,115, 14,  4,
          215  +   6,  0, 19,  1,  1, 19, 99, 97,110, 19, 43,119, 97,114, 16,  3,  6,  0, 23,
          216  +   1,  1, 19,111,102,102,101,114, 48, 22,115,105,120, 16,  2,  6,  0, 23,  1,
          217  +   8, 21,119,111,114,107,115, 58,119, 97,121,115, 16,  1,  6,  0, 23,  1,  1,
          218  +  19,  0,  0,  0, 26, 45,  0,  0,  0, 25, 23, 13,  0,  0,  0,  7,  0, 48,  0,
          219  +   1,171,  1, 74,  1, 30,  0,126,  0,249,  0,212,  0, 48,  0, 81,  0,  0, 84,
          220  +   4,  7, 23, 17, 17,  1,129, 19,116, 97, 98,108,101,116, 52,116, 52,  5, 67,
          221  +  82, 69, 76,  7,  7, 23, 17, 17,  1,129,  3,116, 97, 98,108,101,116, 53,116,
          222  +  53,  8, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 53, 40, 97,
          223  +  32, 73, 78, 84, 69, 71, 69, 82, 32, 80, 82, 73, 77, 65, 82, 89, 32, 75, 69,
          224  +  89, 44, 32, 98, 32, 84, 69, 88, 84, 32, 85, 78, 73, 81, 85, 69, 44, 99, 44,
          225  + 100, 44,101, 41, 84,  4,  7, 23, 17, 17,  1,129, 19,116, 97, 98,108,101,116,
          226  +  52,116, 52,  5, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 52,
          227  +  40, 97, 32, 73, 78, 84, 32, 85, 78, 73, 81, 85, 69, 32, 78, 79, 84, 32, 78,
          228  +  85, 76, 76, 44, 32, 98, 32, 73, 78, 84, 32, 85, 78, 73, 81, 85, 69, 32, 78,
          229  +  79, 84, 32, 78, 85, 76, 76, 44, 99, 44,100, 44,101, 41, 35,  6,  6, 23, 55,
          230  +  17,  1,  0,105,110,100,101,120,115,113,108,105,116,101, 95, 97,117,116,111,
          231  + 105,110,100,101,120, 95,116, 52, 95, 50,116, 52,  7, 35,  5,  6, 23, 55, 17,
          232  +   1,  0,105,110,100,101,120,115,113,108,105,116,101, 95, 97,117,116,111,105,
          233  + 110,100,101,120, 95,116, 52, 95, 49,116, 52,  6, 42,  3,  6, 23, 17, 17,  1,
          234  +  65,116, 97, 98,108,101,116, 51,116, 51,  4, 67, 82, 69, 65, 84, 69, 32, 84,
          235  +  65, 66, 76, 69, 32,116, 51, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 95,
          236  +   2,  7, 23, 17, 17,  1,129, 41,116, 97, 98,108,101,116, 50,116, 50,  3, 67,
          237  +  82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 50, 40, 97, 32, 73, 78,
          238  +  84, 44, 32, 98, 32, 73, 78, 84, 44, 32, 99, 32, 73, 78, 84, 44,100, 32, 73,
          239  +  78, 84, 44,101, 32, 73, 78, 84, 44, 80, 82, 73, 77, 65, 82, 89, 32, 75, 69,
          240  +  89, 40, 98, 44, 97, 41, 41, 87, 73, 84, 72, 79, 85, 84, 32, 82, 79, 87, 73,
          241  +  68, 83,  1,  7, 23, 17, 17,  1,129, 17,116, 97, 98,108,101,116, 49,116, 49,
          242  +   2, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 49, 40, 97, 32,
          243  +  73, 78, 84, 69, 71, 69, 82, 32, 80, 82, 73, 77, 65, 82, 89, 32, 75, 69, 89,
          244  +  44, 32, 98, 32, 73, 78, 84, 44, 32, 99, 32, 73, 78, 84, 44, 32,100, 32, 73,
          245  +  78, 84, 44, 32,101, 32, 73, 78, 84, 41,  2,  0,  0,  0,  1,  1,243,  0,  0,
          246  +   0,  0, 29,  1,243,  1,218,  1,209,  1,199,  1,187,  1,179,  1,169,  1,158,
          247  +   1,145,  1,136,  1,127,  1,117,  1,107,  1, 98,  1, 82,  1, 72,  1, 63,  1,
          248  +  51,  1, 42,  1, 30,  1, 20,  1, 12,  1,  3,  0,248,  0,239,  0,225,  0,216,
          249  +   0,207,  0,197,  0,188,  0,180,  0,170,  0,161,  0,152,  0,141,  0,129,  0,
          250  + 118,  0,106,  0, 97,  0,  0,  0,  0,  0,  0,  0,  8,  3, 21,  1,116,114,101,
          251  + 101, 49, 11,  3, 27,  1,116,104,121,115,101,108,102, 27, 10,  3, 25,  1,116,
          252  + 104,111,117,103,104,  8, 11,  3, 27,  1,116,104,101,114,101,105,110, 15, 10,
          253  +   3, 25,  1,116,101,109,112,108,101, 43,  8,  3, 21,  1,116,101,108,108, 25,
          254  +   8,  3, 21,  1,115,111,109,101, 11,  9,  3, 23,  1,115,109,111,116,101, 14,
          255  +   7,  3, 19,  1,115,105,120, 48,  8,  3, 21,  1,115,104,101,119, 16,  9,  3,
          256  +  23,  1,115,101,114,118,101, 37,  8,  3, 21,  1,115,101,110,100,  7,  8,  3,
          257  +  21,  1,115, 97,118,101,  9, 13,  3, 31,  1,115, 97, 99,114,105,102,105, 99,
          258  + 101, 24,  8,  3, 21,  1,112,111,111,114, 40, 10,  3, 25,  1,112,108, 97, 99,
          259  + 101,115, 28,  8,  3, 21,  1,112, 97,114,116, 30,  7,  3, 19,  1,111,105,108,
          260  +  46,  9,  3, 23,  1,111,102,102,101,114,  3, 11,  3, 27,  1,110,111,116,104,
          261  + 105,110,103, 20,  8,  3, 21,  1,110,101, 97,114, 36, 11,  3, 27,  1,109,111,
          262  + 114,110,105,110,103, 17,  8,  3, 21,  1,108,111,110,103, 35,  9,  3, 23,  1,
          263  + 107,110,111,119,110, 23, 15,  3, 35,  1,105,110,104, 97, 98,105,116, 97,110,
          264  + 116,115, 45,  8,  3, 21,  1,103,111,110,101, 32,  9,  3, 23,  1,102,114,117,
          265  + 105,116, 38,  9,  3, 23,  1,100,119,101,108,116, 18,  8,  3, 21,  1,100,111,
          266  + 116,104, 39,  8,  3, 21,  1,100,105,101,100, 47, 12,  3, 29,  1,100,101,112,
          267  +  97,114,116,101,100, 26, 10,  3, 25,  1, 99,117, 98,105,116,115, 33,  9,  3,
          268  +  23,  1, 99,104,105,108,100, 42,  7,  3, 19,  1, 99, 97,110,  4, 11,  3, 27,
          269  +   1, 98,101,116,119,101,101,110, 10,  9,  3, 23,  1, 98,101,103, 97,116, 19,
          270  +   8,  3, 21,  1, 98,101, 97,114, 29,  7,  3, 19,  1, 97,114,107, 13,  9,  3,
          271  +  23,  1, 97,110,103,101,114,  5,  9,  3, 23,  1, 97,110,103,  0,  0,  0, 28,
          272  +   8,  3, 21,  1,116,114,101,101, 49, 13,  1,104,  0,  7,  0, 24,  0,  1, 67,
          273  +   1, 13,  0,225,  0,177,  0,109,  1,171,  0, 24,  0,  0, 83, 14,  7, 21, 19,
          274  +  19,  8,129, 17,118,105,101,119,118, 50, 48,118, 50, 48, 67, 82, 69, 65, 84,
          275  +  69, 32, 86, 73, 69, 87, 32,118, 50, 48, 40, 97, 44, 98, 44, 99, 44,100, 44,
          276  + 101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,
          277  + 100, 44,101, 32, 70, 82, 79, 77, 32,116, 50, 32, 87, 72, 69, 82, 69, 32, 97,
          278  +  60, 62, 50, 53, 66, 12,  6, 21, 19, 19,  8,113,118,105,101,119,118, 48, 48,
          279  + 118, 48, 48, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 48, 48, 40,
          280  +  97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67,
          281  +  84, 32, 49, 44, 49, 44, 49, 44, 49, 44, 39,111,110,101, 39, 46, 11,  6, 23,
          282  +  21, 17,  1, 69,105,110,100,101,120,116, 50,101,100,116, 50, 14, 67, 82, 69,
          283  +  65, 84, 69, 32, 73, 78, 68, 69, 88, 32,116, 50,101,100, 32, 79, 78, 32,116,
          284  +  50, 40,101, 44,100, 41, 42, 10,  6, 23, 19, 17,  1, 63,105,110,100,101,120,
          285  + 116, 49,101,116, 49, 13, 67, 82, 69, 65, 84, 69, 32, 73, 78, 68, 69, 88, 32,
          286  + 116, 49,101, 32, 79, 78, 32,116, 49, 40,101, 41, 52,  9,  6, 23, 21, 17,  1,
          287  +  81,105,110,100,101,120,116, 51,120, 49,116, 51, 12, 67, 82, 69, 65, 84, 69,
          288  +  32, 73, 78, 68, 69, 88, 32,116, 51,120, 49, 32, 79, 78, 32,116, 51, 40, 97,
          289  +  44, 98, 44, 99, 44,100, 44,101, 41, 35,  8,  6, 23, 55, 17,  1,  0,105,110,
          290  + 100,101,120,115,113,108,105,116,101, 95, 97,117,116,111,105,110,100,101,120,
          291  +  95,116, 53, 95, 49,116, 53, 10,  0,  0,  0, 67, 17, 17,  1,129,  3,116, 97,
          292  +  98,108,101,116, 53,116, 53,  8, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76,
          293  +  69, 32,116, 53, 40, 97, 32, 73, 78, 84, 69, 71, 69, 82, 32, 80, 82, 73, 77,
          294  +  65, 82, 89, 32, 75, 69, 89, 44, 32, 98, 32, 84, 69, 88, 84, 32, 85, 78, 83,
          295  +  13,  7, 21, 19, 19,  8,129, 17,118,105,101,119,118, 49, 48,118, 49, 48, 67,
          296  +  82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 49, 48, 40, 97, 44, 98, 44,
          297  +  99, 44,100, 44,101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44,
          298  +  98, 44, 99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 49, 32, 87, 72, 69,
          299  +  82, 69, 32, 97, 60, 62, 50, 53,  2,  0,  0,  0,  1,  1,240,  0,  0,  0,  0,
          300  +  24,  1,240,  1,220,  1,211,  1,199,  1,187,  1,176,  1,164,  1,148,  1,133,
          301  +   1,116,  1, 99,  1, 86,  1, 67,  1, 55,  1, 43,  1, 31,  1, 18,  1,  5,  0,
          302  + 249,  0,236,  0,224,  0,209,  0,191,  0,174,  0,157,  0,145,  0,132,  0,120,
          303  +   0,108,  0, 95,  0, 83,  0,  0,  0,  0,  0,  0,  0,  0,  0, 11,  7,  1,  0,
          304  +   1,  1,  0,  1, 49, 51, 38, 15, 12,  7,  1,  1,  1,  1,  0,  1, 48, 37, 93,
          305  +   7, 30, 11,  7,  1,  1,  1,  0,  0,  1, 47, 22, 16, 24, 11,  7,  1,  0,  1,
          306  +   1,  0,  1, 47, 16, 40, 12, 12,  7,  1,  1,  1,  1,  0,  1, 46, 28, 88, 22,
          307  +   2, 11,  7,  1,  1,  0,  1,  0,  1, 44, 48,  9, 19, 16,  7,  1,  1,  1,  0,
          308  +  23,  1, 42, 20, 18, 98,101,103, 97,116, 22, 16,  7,  1,  1,  0,  1, 23,  1,
          309  +  37, 17, 18,100,119,101,108,116, 16, 17,  7,  1,  1,  0,  1, 25,  1, 35, 38,
          310  +  22, 99,117, 98,105,116,115, 17, 14,  7,  1,  1,  1,  0, 19,  1, 34, 26, 15,
          311  +  97,114,107, 21, 11,  7,  1,  1,  1,  0,  0,  1, 32, 16,  7, 23, 12,  7,  1,
          312  +   1,  1,  1,  0,  1, 28, 17, 67, 31, 29, 11,  7,  1,  0,  1,  1,  0,  1, 25,
          313  +   7, 19, 11, 12,  7,  1,  1,  1,  1,  0,  1, 22, 45, 71, 28, 28, 12,  7,  1,
          314  +   1,  1,  1,  0,  1, 21, 22, 92, 18,  4, 11,  7,  1,  1,  0,  1,  0,  1, 21,
          315  +  22, 18, 18, 11,  7,  1,  1,  1,  1,  0,  9, 17, 29, 74, 36, 11,  7,  1,  1,
          316  +   1,  0,  0,  1, 17, 29, 74, 25, 18,  7,  1,  1,  1,  1, 25,  1, 15,  6,  3,
          317  +  11,116,101,109,112,108,101,  5, 12,  7,  1,  1,  1,  1,  0,  1, 12,  4, 38,
          318  +  36, 27, 16,  7,  1,  0,  1,  1, 23,  1, 10, 89, 14,115,101,114,118,101, 14,
          319  +  16,  7,  1,  1,  1,  1, 21,  1,  4, 41, 32, 35,110,101, 97,114,  3, 14,  7,
          320  +   9,  0,  1,  1, 21,  1, 68, 32,100,111,116,104, 13, 15,  7,  0,  1,  1,  1,
          321  +  21,  1, 21, 91, 38,110,101, 97,114,  6, 11,  7,  0,  1,  1,  1,  0,  1, 16,
          322  +  81, 25,  9, 10,  7,  0,  1,  1,  8,  0,  1, 16,  7, 10, 11,  7,  0,  1,  1,
          323  +   1,  0,  1,  7, 72, 31,  8, 11,  7,  0,  1,  1,  1,  0,  1,  6, 37, 31,  7,
          324  +   8,  7,  0,  0,  0,  0,  0,  1, 35,  8,  7,  0,  0,  0,  0,  0,  1, 34,  8,
          325  +   7,  0,  0,  0,  0,  0,  1, 33,  8,  7,  0,  0,  0, 23, 11,  7,  1,  0,  1,
          326  +   1,  0,  1, 49, 51, 38, 15,  2,  0,  0,  0,  1,  1,241,  0,  0,  0,  0, 18,
          327  +   1,241,  1,221,  1,211,  1,203,  1,193,  1,183,  1,173,  1,163,  1,151,  1,
          328  + 143,  1,133,  1,122,  1,109,  1,100,  1, 92,  1, 83,  1, 74,  1, 64,  1, 55,
          329  +   1, 46,  1, 34,  1, 22,  1, 13,  1,  4,  0,252,  0,241,  0,232,  0,218,  0,
          330  + 209,  0,200,  0,191,  0,182,  0,173,  0,163,  0,153,  0,144,  0,136,  0,127,
          331  +   0,116,  0,105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  3,
          332  +  25,  1,116,101,109,112,108,101, 48, 10,  3, 25,  1,116,101,109,112,108,101,
          333  +  15,  8,  3, 21,  1,115,111,109,101, 21,  7,  3, 19,  1,115,105,120, 11,  8,
          334  +   3, 21,  1,115,104,101,119, 38,  9,  3, 23,  1,115,101,114,118,101, 10,  9,
          335  +   3, 23,  1,115,101,114,118,101,  3,  8,  3, 21,  1,115,101,110,100, 40,  8,
          336  +   3, 21,  1,115,101,110,100, 29,  8,  3, 21,  1,115,101,110,100, 12,  8,  3,
          337  +  21,  1,115,101,110,100,  8,  8,  3, 21,  1,115, 97,118,101,  2, 13,  3, 31,
          338  +   1,115, 97, 99,114,105,102,105, 99,101, 23,  8,  3, 21,  1,112,111,111,114,
          339  +  16, 10,  3, 25,  1,112,108, 97, 99,101,115, 32,  7,  3, 19,  1,111,105,108,
          340  +  49,  8,  3, 21,  1,110,101, 97,114,  7,  8,  3, 21,  1,110,101, 97,114,  4,
          341  +  11,  3, 27,  1,109,111,114,110,105,110,103, 41, 11,  3, 27,  1,109,111,114,
          342  + 110,105,110,103, 26,  8,  3, 21,  1,103,111,110,101, 25,  8,  3, 21,  1,103,
          343  + 111,110,101,  5,  9,  3, 23,  1,100,119,101,108,116, 37,  8,  3, 21,  1,100,
          344  + 111,116,104, 44,  8,  3, 21,  1,100,111,116,104, 13,  7,  3, 21,  9,100,111,
          345  + 116,104,  8,  3, 21,  1,100,105,101,100, 14, 12,  3, 29,  1,100,101,112, 97,
          346  + 114,116,101,100, 46, 10,  3, 25,  1, 99,117, 98,105,116,115, 35,  9,  3, 23,
          347  +   1, 99,104,105,108,100, 36,  7,  3, 19,  1, 99, 97,110,  6, 11,  3, 27,  1,
          348  +  98,101,116,119,101,101,110, 17,  9,  3, 23,  1, 98,101,103, 97,116, 43,  9,
          349  +   3, 23,  1, 98,101,103, 97,116, 42,  9,  3, 23,  1, 98,101,103, 97,116, 39,
          350  +   9,  3, 23,  1, 98,101,103, 97,116,  9,  7,  3, 19,  1, 97,114,107, 34,  9,
          351  +   3, 23,  1, 97,110,103,101,114, 47,  9,  3, 23,  1, 97,110,103,101,108, 27,
          352  +   9,  3, 23,  1, 97, 98,111,118,101, 45,  0,  0,  0, 17, 10,  3, 25,  1,116,
          353  + 101,109,112,108,101, 48,  2,  0,  0,  0,  1,  1,239,  0,  0,  0,  0, 20,  1,
          354  + 239,  1,206,  1,192,  1,180,  1,166,  1,152,  1,138,  1,125,  1,109,  1, 97,
          355  +   1, 84,  1, 69,  1, 52,  1, 39,  1, 26,  1, 14,  1,  1,  0,243,  0,230,  0,
          356  + 217,  0,201,  0,185,  0,172,  0,159,  0,147,  0,133,  0,120,  0,102,  0, 89,
          357  +   0, 76,  0,  0,  0,  0, 12,  5, 21,  1,  1,  1,115,101,110,100, 26, 14, 40,
          358  +  12,  5, 21,  1,  1,  1,115, 97,118,101, 39, 45,  2, 17,  5, 31,  1,  1,  1,
          359  + 115, 97, 99,114,105,102,105, 99,101, 31,  6, 23, 12,  5, 21,  1,  1,  1,112,
          360  + 111,111,114, 19, 44, 16, 13,  5, 25,  8,  1,  1,112,108, 97, 99,101,115, 16,
          361  +  32, 11,  5, 19,  1,  1,  1,111,105,108, 38,  9, 49, 12,  5, 21,  1,  1,  1,
          362  + 110,101, 97,114, 38, 21,  7, 12,  5, 21,  1,  1,  1,110,101, 97,114, 35, 41,
          363  +   4, 15,  5, 27,  1,  1,  1,109,111,114,110,105,110,103, 17, 40, 26, 15,  5,
          364  +  27,  1,  1,  1,109,111,114,110,105,110,103, 13, 46, 41, 12,  5, 21,  1,  1,
          365  +   1,103,111,110,101, 28, 25,  5, 12,  5, 21,  1,  1,  1,103,111,110,101, 19,
          366  +  10, 25, 13,  5, 23,  1,  1,  1,100,119,101,108,116, 18, 17, 37, 12,  5, 21,
          367  +   1,  1,  1,100,111,116,104, 39,  4, 13, 11,  5, 21,  1,  1,  9,100,111,116,
          368  + 104, 32, 40, 12,  5, 21,  1,  1,  1,100,111,116,104,  9, 48, 44, 12,  5, 21,
          369  +   1,  1,  1,100,105,101,100, 27, 35, 14, 16,  5, 29,  1,  1,  1,100,101,112,
          370  +  97,114,116,101,100, 22, 28, 46, 14,  5, 25,  1,  1,  1, 99,117, 98,105,116,
          371  + 115, 22, 38, 35, 12,  5, 23,  1,  8,  1, 99,104,105,108,100, 17, 36, 11,  5,
          372  +  19,  1,  1,  1, 99, 97,110, 11,  2,  6, 15,  5, 27,  1,  1,  1, 98,101,116,
          373  + 119,101,101,110, 36, 29, 17, 12,  5, 23,  1,  8,  1, 98,101,103, 97,116, 50,
          374  +   9, 13,  5, 23,  1,  1,  1, 98,101,103, 97,116, 45,  3, 39, 13,  5, 23,  1,
          375  +   1,  1, 98,101,103, 97,116, 41,  5, 43, 13,  5, 23,  1,  1,  1, 98,101,103,
          376  +  97,116,  5, 20, 42, 11,  5, 19,  1,  1,  1, 97,114,107, 20, 26, 34, 13,  5,
          377  +  23,  1,  1,  1, 97,110,103,101,114, 40, 22, 47, 13,  5, 23,  1,  1,  1, 97,
          378  + 110,103,101,108,  3, 22, 27, 12,  5, 23,  1,  9,  1, 97, 98,111,118,101, 45,
          379  +  20, 13,  5, 23,  1,  1,  1,  0,  0,  0, 19, 12,  5, 21,  1,  1,  1,115,101,
          380  + 110,100, 26, 14, 40, 13,  0,  0,  0, 28,  0, 78,  0,  1,241,  1,226,  1,210,
          381  +   1,195,  1,180,  1,166,  1,151,  1,136,  1,121,  1,105,  1, 91,  1, 76,  1,
          382  +  61,  1, 46,  1, 29,  1, 14,  0,252,  0,238,  0,224,  0,209,  0,194,  0,177,
          383  +   0,157,  0,143,  0,128,  0,110,  0, 94,  0, 78,  0,  0,  0,  0,  0,  0,  0,
          384  +   0,  0,  0,  0,  0,  0,  0, 14, 28,  6,  0,  1,  1,  1, 23, 17, 67, 31,119,
          385  + 111,114,107,115, 14, 27,  6,  0,  1,  1,  1, 23, 22, 71,  3, 97,110,103,101,
          386  + 108, 16, 26,  6,  0,  1,  1,  1, 27, 40, 98, 17,109,111,114,110,105,110,103,
          387  +  13, 25,  6,  0,  1,  1,  1, 21, 10,  7, 19,103,111,110,101, 12, 24,  6,  0,
          388  +   1,  1,  9, 21, 43, 46,119, 97,121,115, 18, 23,  6,  0,  1,  1,  1, 31,  6,
          389  +  37, 31,115, 97, 99,114,105,102,105, 99,101, 15, 22,  6,  0,  1,  1,  1, 25,
          390  +  45, 71, 28,116,104,111,117,103,104, 13, 21,  6,  0,  1,  1,  1, 21, 22, 92,
          391  +  18,115,111,109,101, 13, 20,  6,  0,  9,  1,  1, 23,  2, 45, 97, 98,111,118,
          392  + 101, 12, 19,  6,  0,  1,  1,  8, 21,  4, 58,119, 97,121,115, 12, 18,  6,  0,
          393  +   1,  1,  1, 19, 44, 19, 43,119, 97,114, 16, 17,  6,  0,  1,  1,  1, 27, 29,
          394  +  74, 36, 98,101,116,119,101,101,110, 13, 16,  6,  0,  1,  1,  1, 21, 44, 52,
          395  +  19,112,111,111,114, 15, 15,  6,  0,  1,  1,  1, 25,  6,  3, 11,116,101,109,
          396  + 112,108,101, 13, 14,  6,  0,  1,  1,  1, 21, 35, 48, 27,100,105,101,100, 13,
          397  +  13,  6,  0,  1,  1,  1, 21,  4, 21, 39,100,111,116,104, 13, 12,  6,  0,  1,
          398  +   1,  1, 21,  4, 38, 36,115,101,110,100, 12, 11,  6,  0,  1,  1,  1, 19, 13,
          399  +  48, 22,115,105,120, 14, 10,  6,  0,  1,  1,  1, 23, 41, 89, 14,115,101,114,
          400  + 118,101, 13,  9,  6,  0,  8,  1,  1, 23, 16, 50, 98,101,103, 97,116, 13,  8,
          401  +   6,  0,  1,  1,  1, 21, 42, 49, 34,115,101,110,100, 13,  7,  6,  0,  1,  1,
          402  +   1, 21, 21, 91, 38,110,101, 97,114, 12,  6,  6,  0,  1,  1,  1, 19,  2, 37,
          403  +  11, 99, 97,110, 13,  5,  6,  0,  1,  1,  1, 21, 25, 27, 28,103,111,110,101,
          404  +  13,  4,  6,  0,  1,  1,  1, 21, 41, 32, 35,110,101, 97,114, 14,  3,  6,  0,
          405  +   1,  1,  1, 23, 32, 24, 26,115,101,114,118,101, 13,  2,  6,  0,  1,  1,  1,
          406  +  21, 45, 14, 39,115, 97,118,101, 13,  1,  6,  0,  1,  1,  1, 21, 40, 68, 32,
          407  + 100,111,116,104, 13,  0,  0,  0, 22,  0,166,  0,  1,241,  1,226,  1,210,  1,
          408  + 194,  1,183,  1,169,  1,152,  1,137,  1,121,  1,106,  1, 90,  1, 75,  1, 57,
          409  +   1, 41,  1, 25,  1, 10,  0,250,  0,231,  0,215,  0,198,  0,184,  0,166,  0,
          410  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          411  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          412  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          413  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          414  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          415  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,
          416  +  50,  6,  0,  1,  1,  1, 27,  9, 92, 29,116,104,101,114,101,105,110, 12, 49,
          417  +   6,  0,  1,  1,  1, 19,  9, 51, 38,111,105,108, 15, 48,  6,  0,  1,  1,  1,
          418  +  25, 37, 93,  7,116,101,109,112,108,101, 14, 47,  6,  0,  1,  1,  1, 23, 22,
          419  +  16, 40, 97,110,103,101,114, 17, 46,  6,  0,  1,  1,  1, 29, 28, 88, 22,100,
          420  + 101,112, 97,114,116,101,100, 14, 45,  6,  0,  1,  1,  1, 23, 47, 54, 12, 97,
          421  +  98,111,118,101, 13, 44,  6,  0,  1,  1,  1, 21, 48, 15,  9,100,111,116,104,
          422  +  14, 43,  6,  0,  1,  1,  1, 23,  5, 23, 41, 98,101,103, 97,116, 14, 42,  6,
          423  +   0,  1,  1,  1, 23, 20, 18,  5, 98,101,103, 97,116, 16, 41,  6,  0,  1,  1,
          424  +   1, 27, 46, 92, 13,109,111,114,110,105,110,103, 13, 40,  6,  0,  1,  1,  1,
          425  +  21, 14, 30, 26,115,101,110,100, 14, 39,  6,  0,  1,  1,  1, 23,  3, 21, 45,
          426  +  98,101,103, 97,116, 13, 38,  6,  0,  1,  1,  1, 21, 10, 97, 34,115,104,101,
          427  + 119, 14, 37,  6,  0,  1,  1,  1, 23, 17, 66, 18,100,119,101,108,116, 13, 36,
          428  +   6,  0,  8,  1,  1, 23, 52, 17, 99,104,105,108,100, 15, 35,  6,  0,  1,  1,
          429  +   1, 25, 38, 34, 22, 99,117, 98,105,116,115, 12, 34,  6,  0,  1,  1,  1, 19,
          430  +  26, 15, 20, 97,114,107,  9, 33,  6,  0,  1,  1,  1,  0,  7, 72, 31, 14, 32,
          431  +   6,  0,  1,  1,  8, 25, 16,  7,112,108, 97, 99,101,115, 14, 31,  6,  0,  1,
          432  +   1,  1, 23, 39, 90, 27,116,114,117,116,104, 13, 30,  6,  0,  1,  1,  1, 21,
          433  +  16, 81, 25,119, 97,108,107, 13, 29,  6,  0,  1,  1,  1, 21, 34, 62, 27,115,
          434  + 101,110,100, 10,  0,  0,  0, 41,  0,116,  0,  1,251,  1,241,  1,231,  1,221,
          435  +   1,211,  1,203,  1,193,  1,183,  1,173,  1,163,  1,151,  1,143,  1,133,  1,
          436  + 122,  1,109,  1,100,  1, 92,  1, 83,  1, 74,  1, 64,  1, 55,  1, 46,  1, 34,
          437  +   1, 22,  1, 13,  1,  4,  0,252,  0,241,  0,232,  0,218,  0,209,  0,200,  0,
          438  + 191,  0,182,  0,173,  0,163,  0,153,  0,144,  0,136,  0,127,  0,116,  0,105,
          439  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 11,116,101,
          440  + 109,112,108,101, 48, 10,  3, 25,  1,116,101,109,112,108,101, 15,  8,  3, 21,
          441  +   1,115,111,109,101, 21,  7,  3, 19,  1,115,105,120, 11,  8,  3, 21,  1,115,
          442  + 104,101,119, 38,  9,  3, 23,  1,115,101,114,118,101, 10,  9,  3, 23,  1,115,
          443  + 101,114,118,101,  3,  8,  3, 21,  1,115,101,110,100, 40,  8,  3, 21,  1,115,
          444  + 101,110,100, 29,  8,  3, 21,  1,115,101,110,100, 12,  8,  3, 21,  1,115,101,
          445  + 110,100,  8,  8,  3, 21,  1,115, 97,118,101,  2, 13,  3, 31,  1,115, 97, 99,
          446  + 114,105,102,105, 99,101, 23,  8,  3, 21,  1,112,111,111,114, 16, 10,  3, 25,
          447  +   1,112,108, 97, 99,101,115, 32,  7,  3, 19,  1,111,105,108, 49,  8,  3, 21,
          448  +   1,110,101, 97,114,  7,  8,  3, 21,  1,110,101, 97,114,  4, 11,  3, 27,  1,
          449  + 109,111,114,110,105,110,103, 41, 11,  3, 27,  1,109,111,114,110,105,110,103,
          450  +  26,  8,  3, 21,  1,103,111,110,101, 25,  8,  3, 21,  1,103,111,110,101,  5,
          451  +   9,  3, 23,  1,100,119,101,108,116, 37,  8,  3, 21,  1,100,111,116,104, 44,
          452  +   8,  3, 21,  1,100,111,116,104, 13,  7,  3, 21,  9,100,111,116,104,  8,  3,
          453  +  21,  1,100,105,101,100, 14, 12,  3, 29,  1,100,101,112, 97,114,116,101,100,
          454  +  46, 10,  3, 25,  1, 99,117, 98,105,116,115, 35,  9,  3, 23,  1, 99,104,105,
          455  + 108,100, 36,  7,  3, 19,  1, 99, 97,110,  6, 11,  3, 27,  1, 98,101,116,119,
          456  + 101,101,110, 17,  9,  3, 23,  1, 98,101,103, 97,116, 43,  9,  3, 23,  1, 98,
          457  + 101,103, 97,116, 42,  9,  3, 23,  1, 98,101,103, 97,116, 39,  9,  3, 23,  1,
          458  +  98,101,103, 97,116,  9,  7,  3, 19,  1, 97,114,107, 34,  9,  3, 23,  1, 97,
          459  + 110,103,101,114, 47,  9,  3, 23,  1, 97,110,103,101,108, 27,  9,  3, 23,  1,
          460  +  97, 98,111,118,101, 45,  9,  3, 23,  1, 97, 98,111,118,101, 20,  4,  3,  0,
          461  +   1, 33, 10,  0,  0,  0,  8,  1,178,  0,  1,244,  1,233,  1,223,  1,214,  1,
          462  + 206,  1,197,  1,188,  1,178,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          463  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          464  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          465  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          466  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          467  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          468  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          469  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          470  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          471  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          472  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          473  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          474  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          475  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          476  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          477  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          478  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          479  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          480  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          481  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          482  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          483  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,
          484  +   3, 23,  1,119,111,114,107,115, 28,  8,  3, 21,  1,119, 97,121,115, 24,  8,
          485  +   3, 21,  1,119, 97,121,115, 19,  7,  3, 19,  1,119, 97,114, 18,  8,  3, 21,
          486  +   1,119, 97,108,107, 30,  9,  3, 23,  1,116,114,117,116,104, 31, 10,  3, 25,
          487  +   1,116,104,111,117,103,104, 22, 11,  3, 27,  1,116,104,101,114,101,105,110,
          488  +  50, 10,  0,  0,  0, 31,  0, 89,  0,  1,247,  1,233,  1,220,  1,206,  1,192,
          489  +   1,180,  1,166,  1,152,  1,138,  1,125,  1,109,  1, 97,  1, 84,  1, 69,  1,
          490  +  52,  1, 39,  1, 26,  1, 14,  1,  1,  0,243,  0,230,  0,217,  0,201,  0,185,
          491  +   0,172,  0,159,  0,147,  0,133,  0,120,  0,102,  0, 89,  0, 76,  0,  0,  0,
          492  +   0,  0,  0,  0, 13,  1,  1,115,101,110,100, 26, 14, 40, 12,  5, 21,  1,  1,
          493  +   1,115, 97,118,101, 39, 45,  2, 17,  5, 31,  1,  1,  1,115, 97, 99,114,105,
          494  + 102,105, 99,101, 31,  6, 23, 12,  5, 21,  1,  1,  1,112,111,111,114, 19, 44,
          495  +  16, 13,  5, 25,  8,  1,  1,112,108, 97, 99,101,115, 16, 32, 11,  5, 19,  1,
          496  +   1,  1,111,105,108, 38,  9, 49, 12,  5, 21,  1,  1,  1,110,101, 97,114, 38,
          497  +  21,  7, 12,  5, 21,  1,  1,  1,110,101, 97,114, 35, 41,  4, 15,  5, 27,  1,
          498  +   1,  1,109,111,114,110,105,110,103, 17, 40, 26, 15,  5, 27,  1,  1,  1,109,
          499  + 111,114,110,105,110,103, 13, 46, 41, 12,  5, 21,  1,  1,  1,103,111,110,101,
          500  +  28, 25,  5, 12,  5, 21,  1,  1,  1,103,111,110,101, 19, 10, 25, 13,  5, 23,
          501  +   1,  1,  1,100,119,101,108,116, 18, 17, 37, 12,  5, 21,  1,  1,  1,100,111,
          502  + 116,104, 39,  4, 13, 11,  5, 21,  1,  1,  9,100,111,116,104, 32, 40, 12,  5,
          503  +  21,  1,  1,  1,100,111,116,104,  9, 48, 44, 12,  5, 21,  1,  1,  1,100,105,
          504  + 101,100, 27, 35, 14, 16,  5, 29,  1,  1,  1,100,101,112, 97,114,116,101,100,
          505  +  22, 28, 46, 14,  5, 25,  1,  1,  1, 99,117, 98,105,116,115, 22, 38, 35, 12,
          506  +   5, 23,  1,  8,  1, 99,104,105,108,100, 17, 36, 11,  5, 19,  1,  1,  1, 99,
          507  +  97,110, 11,  2,  6, 15,  5, 27,  1,  1,  1, 98,101,116,119,101,101,110, 36,
          508  +  29, 17, 12,  5, 23,  1,  8,  1, 98,101,103, 97,116, 50,  9, 13,  5, 23,  1,
          509  +   1,  1, 98,101,103, 97,116, 45,  3, 39, 13,  5, 23,  1,  1,  1, 98,101,103,
          510  +  97,116, 41,  5, 43, 13,  5, 23,  1,  1,  1, 98,101,103, 97,116,  5, 20, 42,
          511  +  11,  5, 19,  1,  1,  1, 97,114,107, 20, 26, 34, 13,  5, 23,  1,  1,  1, 97,
          512  + 110,103,101,114, 40, 22, 47, 13,  5, 23,  1,  1,  1, 97,110,103,101,108,  3,
          513  +  22, 27, 12,  5, 23,  1,  9,  1, 97, 98,111,118,101, 45, 20, 13,  5, 23,  1,
          514  +   1,  1, 97, 98,111,118,101, 12, 47, 45,  8,  5,  0,  1,  1,  1, 31,  7, 33,
          515  +  10,  0,  0,  0, 18,  1, 13,  0,  1,243,  1,230,  1,217,  1,203,  1,189,  1,
          516  + 176,  1,164,  1,151,  1,136,  1,121,  1,105,  1, 90,  1, 76,  1, 63,  1, 51,
          517  +   1, 39,  1, 27,  1, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          518  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          519  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          520  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          521  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          522  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          523  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          524  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          525  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          526  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          527  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          528  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          529  +   0,  0,  0, 13,  5, 23,  1,  1,  1,119,111,114,107,115, 31, 17, 28, 11,  5,
          530  +  21,  9,  1,  1,119, 97,121,115, 43, 24, 11,  5, 21,  8,  1,  1,119, 97,121,
          531  + 115,  4, 19, 11,  5, 19,  1,  1,  1,119, 97,114, 43, 44, 18, 12,  5, 21,  1,
          532  +   1,  1,119, 97,108,107, 25, 16, 30, 13,  5, 23,  1,  1,  1,116,114,117,116,
          533  + 104, 27, 39, 31, 14,  5, 25,  1,  1,  1,116,104,111,117,103,104, 28, 45, 22,
          534  +  15,  5, 27,  1,  1,  1,116,104,101,114,101,105,110, 29,  9, 50, 14,  5, 25,
          535  +   1,  1,  1,116,101,109,112,108,101, 11,  6, 15, 14,  5, 25,  1,  1,  1,116,
          536  + 101,109,112,108,101,  7, 37, 48, 12,  5, 21,  1,  1,  1,115,111,109,101, 18,
          537  +  22, 21, 11,  5, 19,  1,  1,  1,115,105,120, 22, 13, 11, 12,  5, 21,  1,  1,
          538  +   1,115,104,101,119, 34, 10, 38, 13,  5, 23,  1,  1,  1,115,101,114,118,101,
          539  +  26, 32,  3, 13,  5, 23,  1,  1,  1,115,101,114,118,101, 14, 41, 10, 12,  5,
          540  +  21,  1,  1,  1,115,101,110,100, 36,  4, 12, 12,  5, 21,  1,  1,  1,115,101,
          541  + 110,100, 34, 42,  8, 12,  5, 21,  1,  1,  1,115,101,110,100, 27, 34, 29, 10,
          542  +   0,  0,  0, 28,  0, 82,  0,  1,241,  1,226,  1,211,  1,197,  1,181,  1,166,
          543  +   1,151,  1,137,  1,121,  1,104,  1, 84,  1, 73,  1, 59,  1, 41,  1, 26,  1,
          544  +  11,  0,253,  0,238,  0,223,  0,207,  0,191,  0,175,  0,159,  0,144,  0,129,
          545  +   0,113,  0, 97,  0, 82,  0, 68,  0,  0,  0,  0,  0, 14,  1,  1, 19, 26, 34,
          546  +  15, 20, 97,114,107, 14,  6,  1,  1,  1,  1, 21, 25,  5, 27, 28,103,111,110,
          547  + 101, 15,  6,  1,  1,  1,  1, 23, 22, 47, 16, 40, 97,110,103,101,114, 15,  6,
          548  +   1,  1,  1,  1, 23, 22, 27, 71,  3, 97,110,103,101,108, 14,  6,  1,  1,  1,
          549  +   1, 21, 22, 21, 92, 18,115,111,109,101, 14,  6,  1,  1,  1,  1, 21, 21,  7,
          550  +  91, 38,110,101, 97,114, 15,  6,  1,  1,  1,  1, 23, 20, 42, 18,  5, 98,101,
          551  + 103, 97,116, 15,  6,  1,  1,  1,  1, 23, 17, 37, 66, 18,100,119,101,108,116,
          552  +  15,  6,  1,  1,  1,  1, 23, 17, 28, 67, 31,119,111,114,107,115, 15,  6,  1,
          553  +   1,  1,  8, 25, 16, 32,  7,112,108, 97, 99,101,115, 14,  6,  1,  1,  1,  1,
          554  +  21, 16, 30, 81, 25,119, 97,108,107, 14,  6,  1,  1,  1,  1, 21, 14, 40, 30,
          555  +  26,115,101,110,100, 13,  6,  1,  1,  1,  1, 19, 13, 11, 48, 22,115,105,120,
          556  +  14,  6,  1,  1,  1,  1, 21, 10, 38, 97, 34,115,104,101,119, 14,  6,  1,  1,
          557  +   1,  1, 21, 10, 25,  7, 19,103,111,110,101, 17,  6,  1,  1,  1,  1, 27,  9,
          558  +  50, 92, 29,116,104,101,114,101,105,110, 13,  6,  1,  1,  1,  1, 19,  9, 49,
          559  +  51, 38,111,105,108, 10,  6,  1,  1,  1,  1,  0,  7, 33, 72, 31, 19,  6,  1,
          560  +   1,  1,  1, 31,  6, 23, 37, 31,115, 97, 99,114,105,102,105, 99,101, 16,  6,
          561  +   1,  1,  1,  1, 25,  6, 15,  3, 11,116,101,109,112,108,101, 15,  6,  1,  1,
          562  +   1,  1, 23,  5, 43, 23, 41, 98,101,103, 97,116, 13,  6,  1,  1,  1,  8, 21,
          563  +   4, 19, 58,119, 97,121,115, 14,  6,  1,  1,  1,  1, 21,  4, 13, 21, 39,100,
          564  + 111,116,104, 14,  6,  1,  1,  1,  1, 21,  4, 12, 38, 36,115,101,110,100, 15,
          565  +   6,  1,  1,  1,  1, 23,  3, 39, 21, 45, 98,101,103, 97,116, 13,  6,  1,  1,
          566  +   1,  1, 19,  2,  6, 37, 11, 99, 97,110, 14,  6,  9,  1,  1,  1, 23, 20,  2,
          567  +  45, 97, 98,111,118,101, 14,  6,  8,  1,  1,  1, 23, 36, 52, 17, 99,104,105,
          568  + 108,100, 14,  6,  8,  1,  1,  1, 23,  9, 16, 50, 98,101,103, 97,116, 10,  0,
          569  +   0,  0, 21,  0,177,  0,  1,237,  1,219,  1,203,  1,188,  1,173,  1,156,  1,
          570  + 139,  1,123,  1,109,  1, 91,  1, 76,  1, 60,  1, 45,  1, 31,  1, 16,  1,  2,
          571  +   0,243,  0,226,  0,208,  0,192,  0,177,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          572  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          573  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          574  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          575  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          576  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          577  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          578  +   0,  0,  0,  0, 14,  6,  1,  1,  1,  1, 21, 48, 44, 15,  9,100,111,116,104,
          579  +  15,  6,  1,  1,  1,  1, 23, 47, 45, 54, 12, 97, 98,111,118,101, 17,  6,  1,
          580  +   1,  1,  1, 27, 46, 41, 92, 13,109,111,114,110,105,110,103, 16,  6,  1,  1,
          581  +   1,  1, 25, 45, 22, 71, 28,116,104,111,117,103,104, 14,  6,  1,  1,  1,  1,
          582  +  21, 45,  2, 14, 39,115, 97,118,101, 13,  6,  1,  1,  1,  1, 19, 44, 18, 19,
          583  +  43,119, 97,114, 14,  6,  1,  1,  1,  1, 21, 44, 16, 52, 19,112,111,111,114,
          584  +  13,  6,  1,  1,  1,  9, 21, 43, 24, 46,119, 97,121,115, 14,  6,  1,  1,  1,
          585  +   1, 21, 42,  8, 49, 34,115,101,110,100, 15,  6,  1,  1,  1,  1, 23, 41, 10,
          586  +  89, 14,115,101,114,118,101, 14,  6,  1,  1,  1,  1, 21, 41,  4, 32, 35,110,
          587  + 101, 97,114, 17,  6,  1,  1,  1,  1, 27, 40, 26, 98, 17,109,111,114,110,105,
          588  + 110,103, 13,  6,  1,  9,  1,  1, 21, 40, 68, 32,100,111,116,104, 15,  6,  1,
          589  +   1,  1,  1, 23, 39, 31, 90, 27,116,114,117,116,104, 16,  6,  1,  1,  1,  1,
          590  +  25, 38, 35, 34, 22, 99,117, 98,105,116,115, 16,  6,  1,  1,  1,  1, 25, 37,
          591  +  48, 93,  7,116,101,109,112,108,101, 14,  6,  1,  1,  1,  1, 21, 35, 14, 48,
          592  +  27,100,105,101,100, 14,  6,  1,  1,  1,  1, 21, 34, 29, 62, 27,115,101,110,
          593  + 100, 15,  6,  1,  1,  1,  1, 23, 32,  3, 24, 26,115,101,114,118,101, 17,  6,
          594  +   1,  1,  1,  1, 27, 29, 17, 74, 36, 98,101,116,119,101,101,110, 18,  6,  1,
          595  +   1,  1,  1, 29, 28, 46, 88, 22,100,101,112, 97,114,116,101,100, 10,  0,  0,
          596  +   0, 32,  0, 95,  0,  1,247,  1,238,  1,229,  1,220,  1,211,  1,199,  1,187,
          597  +   1,176,  1,164,  1,148,  1,133,  1,116,  1, 99,  1, 86,  1, 67,  1, 55,  1,
          598  +  43,  1, 31,  1, 18,  1,  5,  0,249,  0,236,  0,224,  0,209,  0,191,  0,174,
          599  +   0,157,  0,145,  0,132,  0,120,  0,108,  0, 95,  0, 83,  0,  0,  0,  0,  0,
          600  +   0,  0,  0,  0,  0,  0,  0, 12,  1,  1,  0,  1, 49, 51, 38, 15, 12,  7,  1,
          601  +   1,  1,  1,  0,  1, 48, 37, 93,  7, 30, 11,  7,  1,  1,  1,  0,  0,  1, 47,
          602  +  22, 16, 24, 11,  7,  1,  0,  1,  1,  0,  1, 47, 16, 40, 12, 12,  7,  1,  1,
          603  +   1,  1,  0,  1, 46, 28, 88, 22,  2, 11,  7,  1,  1,  0,  1,  0,  1, 44, 48,
          604  +   9, 19, 16,  7,  1,  1,  1,  0, 23,  1, 42, 20, 18, 98,101,103, 97,116, 22,
          605  +  16,  7,  1,  1,  0,  1, 23,  1, 37, 17, 18,100,119,101,108,116, 16, 17,  7,
          606  +   1,  1,  0,  1, 25,  1, 35, 38, 22, 99,117, 98,105,116,115, 17, 14,  7,  1,
          607  +   1,  1,  0, 19,  1, 34, 26, 15, 97,114,107, 21, 11,  7,  1,  1,  1,  0,  0,
          608  +   1, 32, 16,  7, 23, 12,  7,  1,  1,  1,  1,  0,  1, 28, 17, 67, 31, 29, 11,
          609  +   7,  1,  0,  1,  1,  0,  1, 25,  7, 19, 11, 12,  7,  1,  1,  1,  1,  0,  1,
          610  +  22, 45, 71, 28, 28, 12,  7,  1,  1,  1,  1,  0,  1, 21, 22, 92, 18,  4, 11,
          611  +   7,  1,  1,  0,  1,  0,  1, 21, 22, 18, 18, 11,  7,  1,  1,  1,  1,  0,  9,
          612  +  17, 29, 74, 36, 11,  7,  1,  1,  1,  0,  0,  1, 17, 29, 74, 25, 18,  7,  1,
          613  +   1,  1,  1, 25,  1, 15,  6,  3, 11,116,101,109,112,108,101,  5, 12,  7,  1,
          614  +   1,  1,  1,  0,  1, 12,  4, 38, 36, 27, 16,  7,  1,  0,  1,  1, 23,  1, 10,
          615  +  89, 14,115,101,114,118,101, 14, 16,  7,  1,  1,  1,  1, 21,  1,  4, 41, 32,
          616  +  35,110,101, 97,114,  3, 14,  7,  9,  0,  1,  1, 21,  1, 68, 32,100,111,116,
          617  + 104, 13, 15,  7,  0,  1,  1,  1, 21,  1, 21, 91, 38,110,101, 97,114,  6, 11,
          618  +   7,  0,  1,  1,  1,  0,  1, 16, 81, 25,  9, 10,  7,  0,  1,  1,  8,  0,  1,
          619  +  16,  7, 10, 11,  7,  0,  1,  1,  1,  0,  1,  7, 72, 31,  8, 11,  7,  0,  1,
          620  +   1,  1,  0,  1,  6, 37, 31,  7,  8,  7,  0,  0,  0,  0,  0,  1, 35,  8,  7,
          621  +   0,  0,  0,  0,  0,  1, 34,  8,  7,  0,  0,  0,  0,  0,  1, 33,  8,  7,  0,
          622  +   0,  0,  0,  0,  1, 32,  8,  7,  0,  0,  0,  0,  0,  1, 31, 10,  0,  0,  0,
          623  +   2,  1,231,  0,  1,244,  1,231,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          624  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          625  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          626  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          627  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          628  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          629  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          630  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          631  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          632  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          633  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          634  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          635  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          636  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          637  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          638  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          639  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          640  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          641  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          642  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          643  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          644  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          645  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          646  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          647  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          648  +   0,  0,  0,  0,  0,  0,  0,  0, 12,  7,  1,  1,  1,  1,  0,  1, 49,  9, 51,
          649  +  38, 26, 11,  7,  1,  1,  0,  1,  0,  1, 49,  9, 38, 20, 13,  0,  0,  0, 23,
          650  +   0, 67,  0,  1,238,  1,220,  1,202,  1,186,  1,168,  1,148,  1,130,  1,107,
          651  +   1, 86,  1, 65,  1, 44,  1, 27,  1, 14,  0,250,  0,224,  0,205,  0,184,  0,
          652  + 165,  0,145,  0,123,  0,106,  0, 86,  0, 67,  0,  0,  0,  0,  0,  0,  0,  0,
          653  +   0,  0,  0,  0,  0, 17, 23,  6,  0, 23,  1,  1, 21,107,110,111,119,110, 52,
          654  +  19,112,111,111,114, 18, 22,  6,  0, 23,  1,  1, 23, 97, 98,111,118,101, 24,
          655  +  26,115,101,114,118,101, 15, 21,  6,  0, 19,  1,  1, 21,119, 97,114, 52, 19,
          656  + 112,111,111,114, 20, 20,  6,  0, 27,  1,  8, 25,110,111,116,104,105,110,103,
          657  +   7,112,108, 97, 99,101,115, 18, 19,  6,  0, 23,  1,  1, 23, 98,101,103, 97,
          658  + 116, 90, 27,116,114,117,116,104, 17, 18,  6,  0, 23,  1,  1, 21,100,119,101,
          659  + 108,116, 21, 39,100,111,116,104, 19, 17,  6,  0, 27,  1,  1, 21,109,111,114,
          660  + 110,105,110,103, 52, 19,112,111,111,114, 17, 16,  6,  0, 21,  1,  1, 23,115,
          661  + 104,101,119, 90, 27,116,114,117,116,104, 24, 15,  6,  0, 27,  1,  1, 31,116,
          662  + 104,101,114,101,105,110, 37, 31,115, 97, 99,114,105,102,105, 99,101, 18, 14,
          663  +   6,  0, 23,  1,  8, 25,115,109,111,116,101,  7,112,108, 97, 99,101,115, 11,
          664  +  13,  6,  0, 19,  1,  1,  0, 97,114,107, 72, 31, 15, 12,  6,  0, 21,  1,  8,
          665  +  21,119,105,110,101, 58,119, 97,121,115, 19, 11,  6,  0, 21,  1,  1, 27,115,
          666  + 111,109,101, 98, 17,109,111,114,110,105,110,103, 19, 10,  6,  0, 27,  1,  1,
          667  +  21, 98,101,116,119,101,101,110, 92, 18,115,111,109,101, 19,  9,  6,  0, 21,
          668  +   1,  1, 27,115, 97,118,101, 74, 36, 98,101,116,119,101,101,110, 21,  8,  6,
          669  +   0, 25,  1,  1, 27,116,104,111,117,103,104, 98, 17,109,111,114,110,105,110,
          670  + 103, 16,  7,  6,  0, 21,  1,  1, 21,115,101,110,100, 49, 34,115,101,110,100,
          671  +  18,  6,  6,  0, 25,  1,  1, 21,119,105,115,100,111,109, 38, 36,115,101,110,
          672  + 100, 16,  5,  6,  0, 23,  1,  9, 21, 97,110,103,101,114, 46,119, 97,121,115,
          673  +  14,  4,  6,  0, 19,  1,  1, 19, 99, 97,110, 19, 43,119, 97,114, 16,  3,  6,
          674  +   0, 23,  1,  1, 19,111,102,102,101,114, 48, 22,115,105,120, 16,  2,  6,  0,
          675  +  23,  1,  8, 21,119,111,114,107,115, 58,119, 97,121,115, 16,  1,  6,  0, 23,
          676  +   1,  1, 19,116,114,117,116,104, 37, 11, 99, 97,110, 13,  0,  0,  0, 22,  0,
          677  +  64,  0,  1,230,  1,213,  1,191,  1,169,  1,148,  1,130,  1,108,  1, 89,  1,
          678  +  70,  1, 51,  1, 34,  1, 16,  0,253,  0,233,  0,214,  0,194,  0,174,  0,151,
          679  +   0,132,  0,109,  0, 90,  0, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          680  +   0, 24, 45,  6,  0, 35,  1,  1, 23,105,110,104, 97, 98,105,116, 97,110,116,
          681  + 115, 23, 41, 98,101,103, 97,116, 17, 44,  6,  0, 23,  1,  1, 21, 97,110,103,
          682  + 101,108, 48, 27,100,105,101,100, 21, 43,  6,  0, 25,  1,  1, 27,116,101,109,
          683  + 112,108,101, 74, 36, 98,101,116,119,101,101,110, 17, 42,  6,  0, 23,  1,  1,
          684  +  21, 99,104,105,108,100, 81, 25,119, 97,108,107, 21, 41,  6,  0, 21,  1,  1,
          685  +  31,119, 97,121,115, 37, 31,115, 97, 99,114,105,102,105, 99,101, 18, 40,  6,
          686  +   0, 21,  1,  1, 25,112,111,111,114, 93,  7,116,101,109,112,108,101, 18, 39,
          687  +   6,  0, 21,  1,  1, 25,100,111,116,104,  3, 11,116,101,109,112,108,101, 17,
          688  +  38,  6,  0, 23,  1,  1, 21,102,114,117,105,116, 62, 27,115,101,110,100, 18,
          689  +  37,  6,  0, 23,  1,  1, 23,115,101,114,118,101, 90, 27,116,114,117,116,104,
          690  +  17, 36,  6,  0, 21,  1,  1, 23,110,101, 97,114, 90, 27,116,114,117,116,104,
          691  +  16, 35,  6,  0, 21,  1,  1, 21,108,111,110,103, 14, 39,115, 97,118,101, 15,
          692  +  34,  6,  0, 21,  1,  1, 19,119, 97,108,107, 15, 20, 97,114,107, 17, 33,  6,
          693  +   0, 25,  1,  9, 21, 99,117, 98,105,116,115, 46,119, 97,121,115, 17, 32,  6,
          694  +   0, 21,  1,  1, 23,103,111,110,101, 23, 41, 98,101,103, 97,116, 17, 31,  6,
          695  +   0, 23,  1,  1, 21,119,104,105,108,101, 49, 34,115,101,110,100, 20, 30,  6,
          696  +   0, 21,  1,  1, 29,112, 97,114,116, 88, 22,100,101,112, 97,114,116,101,100,
          697  +  16, 29,  6,  0, 21,  1,  1, 21, 98,101, 97,114, 92, 18,115,111,109,101, 19,
          698  +  28,  6,  0, 25,  1,  1, 23,112,108, 97, 99,101,115, 23, 41, 98,101,103, 97,
          699  + 116, 20, 27,  6,  0, 27,  1,  1, 23,116,104,121,115,101,108,102, 54, 12, 97,
          700  +  98,111,118,101, 20, 26,  6,  0, 29,  1,  1, 21,100,101,112, 97,114,116,101,
          701  + 100, 92, 18,115,111,109,101, 15, 25,  6,  0, 21,  1,  1, 19,116,101,108,108,
          702  +  19, 43,119, 97,114, 24, 24,  6,  0, 31,  1,  1, 27,115, 97, 99,114,105,102,
          703  + 105, 99,101, 92, 13,109,111,114,110,105,110,103, 13,  0,  0,  0,  5,  1,162,
          704  +   0,  1,239,  1,221,  1,203,  1,182,  1,162,  0,  0,  0,  0,  0,  0,  0,  0,
          705  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          706  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          707  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          708  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          709  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          710  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          711  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          712  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          713  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          714  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          715  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          716  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          717  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          718  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          719  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          720  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          721  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          722  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          723  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          724  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          725  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 18, 50,  6,  0, 23,  1,  1,
          726  +  23,119,114, 97,116,104, 21, 45, 98,101,103, 97,116, 19, 49,  6,  0, 21,  1,
          727  +   1, 27,116,114,101,101, 98, 17,109,111,114,110,105,110,103, 16, 48,  6,  0,
          728  +  19,  1,  1, 23,115,105,120, 71,  3, 97,110,103,101,108, 16, 47,  6,  0, 21,
          729  +   1,  1, 21,100,105,101,100,  7, 19,103,111,110,101, 15, 46,  6,  0, 19,  1,
          730  +   1, 21,111,105,108, 81, 25,119, 97,108,107, 10,  0,  0,  0, 40,  0,106,  0,
          731  +   1,246,  1,236,  1,226,  1,218,  1,209,  1,199,  1,187,  1,179,  1,169,  1,
          732  + 158,  1,145,  1,136,  1,127,  1,117,  1,107,  1, 98,  1, 82,  1, 72,  1, 63,
          733  +   1, 51,  1, 42,  1, 30,  1, 20,  1, 12,  1,  3,  0,248,  0,239,  0,225,  0,
          734  + 216,  0,207,  0,197,  0,188,  0,180,  0,170,  0,161,  0,152,  0,141,  0,129,
          735  +   0,118,  0,106,  0, 97,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,116,114,
          736  + 101,101, 49, 11,  3, 27,  1,116,104,121,115,101,108,102, 27, 10,  3, 25,  1,
          737  + 116,104,111,117,103,104,  8, 11,  3, 27,  1,116,104,101,114,101,105,110, 15,
          738  +  10,  3, 25,  1,116,101,109,112,108,101, 43,  8,  3, 21,  1,116,101,108,108,
          739  +  25,  8,  3, 21,  1,115,111,109,101, 11,  9,  3, 23,  1,115,109,111,116,101,
          740  +  14,  7,  3, 19,  1,115,105,120, 48,  8,  3, 21,  1,115,104,101,119, 16,  9,
          741  +   3, 23,  1,115,101,114,118,101, 37,  8,  3, 21,  1,115,101,110,100,  7,  8,
          742  +   3, 21,  1,115, 97,118,101,  9, 13,  3, 31,  1,115, 97, 99,114,105,102,105,
          743  +  99,101, 24,  8,  3, 21,  1,112,111,111,114, 40, 10,  3, 25,  1,112,108, 97,
          744  +  99,101,115, 28,  8,  3, 21,  1,112, 97,114,116, 30,  7,  3, 19,  1,111,105,
          745  + 108, 46,  9,  3, 23,  1,111,102,102,101,114,  3, 11,  3, 27,  1,110,111,116,
          746  + 104,105,110,103, 20,  8,  3, 21,  1,110,101, 97,114, 36, 11,  3, 27,  1,109,
          747  + 111,114,110,105,110,103, 17,  8,  3, 21,  1,108,111,110,103, 35,  9,  3, 23,
          748  +   1,107,110,111,119,110, 23, 15,  3, 35,  1,105,110,104, 97, 98,105,116, 97,
          749  + 110,116,115, 45,  8,  3, 21,  1,103,111,110,101, 32,  9,  3, 23,  1,102,114,
          750  + 117,105,116, 38,  9,  3, 23,  1,100,119,101,108,116, 18,  8,  3, 21,  1,100,
          751  + 111,116,104, 39,  8,  3, 21,  1,100,105,101,100, 47, 12,  3, 29,  1,100,101,
          752  + 112, 97,114,116,101,100, 26, 10,  3, 25,  1, 99,117, 98,105,116,115, 33,  9,
          753  +   3, 23,  1, 99,104,105,108,100, 42,  7,  3, 19,  1, 99, 97,110,  4, 11,  3,
          754  +  27,  1, 98,101,116,119,101,101,110, 10,  9,  3, 23,  1, 98,101,103, 97,116,
          755  +  19,  8,  3, 21,  1, 98,101, 97,114, 29,  7,  3, 19,  1, 97,114,107, 13,  9,
          756  +   3, 23,  1, 97,110,103,101,114,  5,  9,  3, 23,  1, 97,110,103,101,108, 44,
          757  +   9,  3, 23,  1, 97, 98,111,118,101, 22, 10,  0,  0,  0,  9,  1,171,  0,  1,
          758  + 247,  1,238,  1,230,  1,221,  1,211,  1,202,  1,191,  1,181,  1,171,  0,  0,
          759  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          760  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          761  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          762  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          763  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          764  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          765  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          766  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          767  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          768  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          769  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          770  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          771  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          772  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          773  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          774  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          775  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          776  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          777  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          778  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          779  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          780  +   9,  3, 23,  1,119,114, 97,116,104, 50,  9,  3, 23,  1,119,111,114,107,115,
          781  +   2, 10,  3, 25,  1,119,105,115,100,111,109,  6,  8,  3, 21,  1,119,105,110,
          782  + 101, 12,  9,  3, 23,  1,119,104,105,108,101, 31,  8,  3, 21,  1,119, 97,121,
          783  + 115, 41,  7,  3, 19,  1,119, 97,114, 21,  8,  3, 21,  1,119, 97,108,107, 34,
          784  +   8,  3, 23,  9,116,114,117,116,104, 13,  0,  0,  0,  5,  0, 84,  0,  1, 78,
          785  +   0,249,  0,177,  1,163,  0, 84,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          786  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          787  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          788  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 91, 19,
          789  +   7, 21, 19, 19,  8,129, 33,118,105,101,119,118, 50, 49,118, 50, 49, 67, 82,
          790  +  69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 50, 49, 40, 97, 44, 98, 44, 99,
          791  +  44,100, 44,101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98,
          792  +  44, 99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 50, 32, 79, 82, 68, 69,
          793  +  82, 32, 66, 89, 32, 98, 32, 76, 73, 77, 73, 84, 32, 49, 48, 70, 17,  6, 21,
          794  +  19, 19,  8,121,118,105,101,119,118, 53, 48,118, 53, 48, 67, 82, 69, 65, 84,
          795  +  69, 32, 86, 73, 69, 87, 32,118, 53, 48, 40, 97, 44, 98, 41, 32, 65, 83, 32,
          796  +  83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 32, 70, 82, 79, 77, 32,116, 53, 32,
          797  +  87, 72, 69, 82, 69, 32, 97, 60, 62, 50, 53, 83, 16,  7, 21, 19, 19,  8,129,
          798  +  17,118,105,101,119,118, 52, 48,118, 52, 48, 67, 82, 69, 65, 84, 69, 32, 86,
          799  +  73, 69, 87, 32,118, 52, 48, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32,
          800  +  65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101,
          801  +  32, 70, 82, 79, 77, 32,116, 52, 32, 87, 72, 69, 82, 69, 32, 97, 60, 62, 50,
          802  +  53, 83, 15,  7, 21, 19, 19,  8,129, 17,118,105,101,119,118, 51, 48,118, 51,
          803  +  48, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 51, 48, 40, 97, 44,
          804  +  98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32,
          805  +  97, 44, 98, 44, 99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 51, 32, 87,
          806  +  72, 69, 82, 69, 32, 97, 60, 62, 50, 53, 91, 18,  7, 21, 19, 19,  8,129, 33,
          807  + 118,105,101,119,118, 49, 49,118, 49, 49, 67, 82, 69, 65, 84, 69, 32, 86, 73,
          808  +  69, 87, 32,118, 49, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65,
          809  +  83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101, 32,
          810  +  70, 82, 79, 77, 32,116, 49, 32, 79, 82, 68, 69, 82, 32, 66, 89, 32, 98, 32,
          811  +  76, 73, 77, 73, 84, 32, 49, 48, 13,  1,163,  0,  4,  0, 40,  0,  1, 70,  0,
          812  + 233,  0,152,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          813  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,110, 23,  7, 21, 19, 19,  8,129, 71,
          814  + 118,105,101,119,118, 49, 50,118, 49, 50, 67, 82, 69, 65, 84, 69, 32, 86, 73,
          815  +  69, 87, 32,118, 49, 50, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65,
          816  +  83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,115,117,109, 40, 97, 41, 44, 32,
          817  +  97,118,103, 40, 98, 41, 44, 32, 99,111,117,110,116, 40, 42, 41, 44, 32,109,
          818  + 105,110, 40,100, 41, 44, 32,101, 32, 70, 82, 79, 77, 32,116, 49, 32, 71, 82,
          819  +  79, 85, 80, 32, 66, 89, 32, 53, 79, 22,  7, 21, 19, 19,  8,129,  9,118,105,
          820  + 101,119,118, 53, 49,118, 53, 49, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87,
          821  +  32,118, 53, 49, 40, 97, 44, 98, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84,
          822  +  32, 97, 44, 98, 32, 70, 82, 79, 77, 32,116, 53, 32, 79, 82, 68, 69, 82, 32,
          823  +  66, 89, 32, 98, 32, 76, 73, 77, 73, 84, 32, 49, 48, 91, 21,  7, 21, 19, 19,
          824  +   8,129, 33,118,105,101,119,118, 52, 49,118, 52, 49, 67, 82, 69, 65, 84, 69,
          825  +  32, 86, 73, 69, 87, 32,118, 52, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101,
          826  +  41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100,
          827  +  44,101, 32, 70, 82, 79, 77, 32,116, 52, 32, 79, 82, 68, 69, 82, 32, 66, 89,
          828  +  32, 98, 32, 76, 73, 77, 73, 84, 32, 49, 48, 91, 20,  7, 21, 19, 19,  8,129,
          829  +  33,118,105,101,119,118, 51, 49,118, 51, 49, 67, 82, 69, 65, 84, 69, 32, 86,
          830  +  73, 69, 87, 32,118, 51, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32,
          831  +  65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101,
          832  +  32, 70, 82, 79, 77, 32,116, 51, 32, 79, 82, 68, 69, 82, 32, 66, 89, 32, 98,
          833  +  32, 76, 73, 77, 73, 84, 32, 49, 48,  0,  0,  0, 93, 19, 19,  8,129, 33,118,
          834  + 105,101,119,118, 50, 49,118, 50, 49, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69,
          835  +  87, 32,118, 50, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83,
          836  +  32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101, 32, 70,
          837  +  82, 79, 77, 32,116, 50, 32, 79, 82, 68, 69, 82, 32, 66, 89, 32, 98, 32, 76,
          838  +  73, 77, 73, 84, 32, 49, 48, 13,  0,  0,  0,  3,  0, 66,  0,  1,107,  0,214,
          839  +   0, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          840  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          841  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,129, 17, 26,
          842  +   7, 21, 19, 19,  8,130, 13,118,105,101,119,118, 52, 50,118, 52, 50, 67, 82,
          843  +  69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 52, 50, 40, 97, 44, 98, 44, 99,
          844  +  44,100, 44,101, 41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,115,
          845  + 117,109, 40, 97, 41, 44, 32, 97,118,103, 40, 98, 41, 44, 32, 99,111,117,110,
          846  + 116, 40, 42, 41, 44, 32,109,105,110, 40,100, 41, 44, 32,101, 32, 70, 82, 79,
          847  +  77, 32,116, 52, 32, 71, 82, 79, 85, 80, 32, 66, 89, 32, 53, 10, 32, 32, 32,
          848  +  32, 72, 65, 86, 73, 78, 71, 32,109,105,110, 40,100, 41, 60, 51, 48, 32, 79,
          849  +  82, 68, 69, 82, 32, 66, 89, 32, 51, 44, 32, 49,129, 18, 25,  7, 21, 19, 19,
          850  +   8,130, 15,118,105,101,119,118, 51, 50,118, 51, 50, 67, 82, 69, 65, 84, 69,
          851  +  32, 86, 73, 69, 87, 32,118, 51, 50, 40, 97, 44, 98, 44, 99, 44,100, 44,101,
          852  +  41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,115,117,109, 40, 97,
          853  +  41, 44, 32, 97,118,103, 40, 98, 41, 44, 32, 99,111,117,110,116, 40, 42, 41,
          854  +  44, 32,109,105,110, 40,100, 41, 44, 32,101, 32, 70, 82, 79, 77, 32,116, 51,
          855  +  32, 71, 82, 79, 85, 80, 32, 66, 89, 32, 53, 10, 32, 32, 32, 32, 72, 65, 86,
          856  +  73, 78, 71, 32, 99,111,117,110,116, 40, 42, 41, 62, 49, 32, 79, 82, 68, 69,
          857  +  82, 32, 66, 89, 32, 51, 44, 32, 49,129, 18, 24,  7, 21, 19, 19,  8,130, 15,
          858  + 118,105,101,119,118, 50, 50,118, 50, 50, 67, 82, 69, 65, 84, 69, 32, 86, 73,
          859  +  69, 87, 32,118, 50, 50, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65,
          860  +  83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,115,117,109, 40, 97, 41, 44, 32,
          861  +  97,118,103, 40, 98, 41, 44, 32, 99,111,117,110,116, 40, 42, 41, 44, 32,109,
          862  + 105,110, 40,100, 41, 44, 32,101, 32, 70, 82, 79, 77, 32,116, 50, 32, 71, 82,
          863  +  79, 85, 80, 32, 66, 89, 32, 53, 10, 32, 32, 32, 32, 72, 65, 86, 73, 78, 71,
          864  +  32, 99,111,117,110,116, 40, 42, 41, 62, 49, 32, 79, 82, 68, 69, 82, 32, 66,
          865  +  89, 32, 51, 44, 32, 49, 13,  1,108,  0,  3,  0, 83,  0,  0,225,  0, 83,  1,
          866  + 136,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          867  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          868  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          869  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,129, 11, 28,  7, 21, 19,
          870  +  19,  8,130,  1,118,105,101,119,118, 49, 51,118, 49, 51, 67, 82, 69, 65, 84,
          871  +  69, 32, 86, 73, 69, 87, 32,118, 49, 51, 40, 97, 44, 98, 44, 99, 44,100, 44,
          872  + 101, 41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44,
          873  +  99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 49, 10, 32, 32, 85, 78, 73,
          874  +  79, 78, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101,
          875  +  32, 70, 82, 79, 77, 32,116, 50, 10, 32, 32, 85, 78, 73, 79, 78, 32, 83, 69,
          876  +  76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101, 32, 70, 82, 79, 77,
          877  +  32,116, 51,129,  8, 27,  7, 21, 19, 19,  8,129,123,118,105,101,119,118, 53,
          878  +  50,118, 53, 50, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 53, 50,
          879  +  40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 10, 32, 32, 83, 69,
          880  +  76, 69, 67, 84, 32, 99,111,117,110,116, 40, 42, 41, 44, 32,109,105,110, 40,
          881  +  98, 41, 44, 32,115,117, 98,115,116,114, 40, 98, 44, 49, 44, 49, 41, 44, 32,
          882  + 109,105,110, 40, 97, 41, 44, 32,109, 97,120, 40, 97, 41, 32, 70, 82, 79, 77,
          883  +  32,116, 53, 10, 32, 32, 32, 71, 82, 79, 85, 80, 32, 66, 89, 32, 51, 32, 79,
          884  +  82, 68, 69, 82, 32, 66, 89, 32, 49,  0,  0,  0, 28, 21, 19, 19,  8,130, 13,
          885  + 118,105,101,119,118, 52, 50,118, 52, 50, 67, 82, 69, 65, 84, 69, 32, 86,118,
          886  +  29,  7, 21, 19, 19,  8,129, 87,118,105,101,119,118, 50, 51,118, 50, 51, 67,
          887  +  82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 50, 51, 40, 97, 44, 98, 44,
          888  +  99, 44,100, 44,101, 41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,
          889  +  97, 44, 98, 44, 99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 49, 10, 32,
          890  +  32, 69, 88, 67, 69, 80, 84, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44,
          891  +  99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 49, 32, 87, 72, 69, 82, 69,
          892  +  32, 98, 60, 50, 53, 13,  0,  0,  0,  3,  0, 40,  0,  1,134,  1, 12,  0, 40,
          893  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          894  +   0,  0,  0,  0,  0,  0,  0,129, 97, 32,  7, 21, 19, 19,  8,131, 45,118,105,
          895  + 101,119,118, 54, 50,118, 54, 50, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87,
          896  +  32,118, 54, 50, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 10,
          897  +  32, 32, 83, 69, 76, 69, 67, 84, 32,116, 49, 46, 97, 44,116, 50, 46, 98, 44,
          898  + 116, 51, 46, 99, 44,116, 52, 46,100, 44,116, 53, 46, 98, 10, 32, 32, 32, 32,
          899  +  70, 82, 79, 77, 32,116, 49, 32, 74, 79, 73, 78, 32,116, 50, 32, 79, 78, 32,
          900  +  40,116, 49, 46, 97, 61,116, 50, 46, 98, 41, 10, 32, 32, 32, 32, 32, 32, 32,
          901  +  32, 32, 32, 32, 32, 74, 79, 73, 78, 32,116, 51, 32, 79, 78, 32, 40,116, 49,
          902  +  46, 97, 61,116, 51, 46, 97, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
          903  +  32, 32, 74, 79, 73, 78, 32,116, 52, 32, 79, 78, 32, 40,116, 52, 46, 98, 61,
          904  + 116, 51, 46, 98, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 76,
          905  +  69, 70, 84, 32, 74, 79, 73, 78, 32,116, 53, 32, 79, 78, 32, 40,116, 53, 46,
          906  +  97, 61,116, 49, 46, 99, 41,120, 31,  7, 21, 19, 19,  8,129, 91,118,105,101,
          907  + 119,118, 54, 49,118, 54, 49, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,
          908  + 118, 54, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 10, 32,
          909  +  32, 83, 69, 76, 69, 67, 84, 32,116, 50, 46, 97, 44,116, 51, 46, 98, 44,116,
          910  +  50, 46, 99, 44,116, 51, 46,100, 44,116, 50, 46,101, 10, 32, 32, 32, 32, 70,
          911  +  82, 79, 77, 32,116, 50, 32, 76, 69, 70, 84, 32, 74, 79, 73, 78, 32,116, 51,
          912  +  32, 79, 78, 32, 40,116, 50, 46, 97, 61,116, 51, 46, 97, 41,120, 30,  7, 21,
          913  +  19, 19,  8,129, 91,118,105,101,119,118, 54, 48,118, 54, 48, 67, 82, 69, 65,
          914  +  84, 69, 32, 86, 73, 69, 87, 32,118, 54, 48, 40, 97, 44, 98, 44, 99, 44,100,
          915  +  44,101, 41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,116, 49, 46,
          916  +  97, 44,116, 50, 46, 98, 44,116, 49, 46, 99, 44,116, 50, 46,100, 44,116, 49,
          917  +  46,101, 10, 32, 32, 32, 32, 70, 82, 79, 77, 32,116, 49, 32, 76, 69, 70, 84,
          918  +  32, 74, 79, 73, 78, 32,116, 50, 32, 79, 78, 32, 40,116, 49, 46, 97, 61,116,
          919  +  50, 46, 98, 41, 13,  0,  0,  0,  1,  1, 73,  0,  1, 73,  0,  0,  0,  0,  0,
          920  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          921  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          922  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          923  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          924  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          925  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          926  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          927  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          928  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          929  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          930  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          931  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          932  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          933  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          934  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          935  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
          936  +   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,129, 52, 33,  7, 21, 19, 19,  8,130,
          937  +  83,118,105,101,119,118, 55, 48,118, 55, 48, 67, 82, 69, 65, 84, 69, 32, 86,
          938  +  73, 69, 87, 32,118, 55, 48, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32,
          939  +  65, 83, 10, 32, 32, 87, 73, 84, 72, 32, 82, 69, 67, 85, 82, 83, 73, 86, 69,
          940  +  32, 99, 48, 40,120, 41, 32, 65, 83, 32, 40, 86, 65, 76, 85, 69, 83, 40, 49,
          941  +  41, 32, 85, 78, 73, 79, 78, 32, 65, 76, 76, 32, 83, 69, 76, 69, 67, 84, 32,
          942  + 120, 43, 49, 32, 70, 82, 79, 77, 32, 99, 48, 32, 87, 72, 69, 82, 69, 32,120,
          943  +  60, 57, 41, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,120, 44, 32, 98, 44, 32,
          944  +  99, 44, 32,100, 44, 32,101, 32, 70, 82, 79, 77, 32, 99, 48, 32, 74, 79, 73,
          945  +  78, 32,116, 49, 32, 79, 78, 32, 40,116, 49, 46, 97, 61, 53, 48, 45, 99, 48,
          946  +  46,120, 41,
          947  +};
          948  +

Added test/optfuzz-db01.txt.

            1  +-- Run this script through the sqlite3 command-line shell in order to generate
            2  +-- a database file containing lots of data for testing purposes.
            3  +--
            4  +-- This script assumes that the "bin2c" program is available on ones $PATH.
            5  +-- The "bin2c" program reads a binary file and outputs C-code that creates
            6  +-- an array of bytes holding the content of that file.
            7  +--
            8  +-- This script is designed to create many tables and views all having
            9  +-- 5 columns, "a" through "e", and with a variety of integers, short strings,
           10  +-- and NULL values.
           11  +--
           12  +.open -new testdb01.db
           13  +PRAGMA page_size=512;
           14  +BEGIN;
           15  +CREATE TABLE t1(a INTEGER PRIMARY KEY, b INT, c INT, d INT, e INT);
           16  +WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<50)
           17  +INSERT INTO t1(a,b,c,d,e) SELECT x,abs(random()%51),
           18  +   abs(random()%100), abs(random()%51), abs(random()%100) FROM c;
           19  +CREATE TABLE t2(a INT, b INT, c INT,d INT,e INT,PRIMARY KEY(b,a))WITHOUT ROWID;
           20  +INSERT INTO t2 SELECT * FROM t1;
           21  +CREATE TABLE t3(a,b,c,d,e);
           22  +INSERT INTO t3 SELECT a,b,c,d,e FROM t1 ORDER BY random() LIMIT 5;
           23  +INSERT INTO t3 SELECT null,b,c,d,e FROM t1 ORDER BY random() LIMIT 5;
           24  +INSERT INTO t3 SELECT a,null,c,d,e FROM t1 ORDER BY random() LIMIT 5;
           25  +INSERT INTO t3 SELECT a,b,null,d,e FROM t1 ORDER BY random() LIMIT 5;
           26  +INSERT INTO t3 SELECT a,b,c,null,e FROM t1 ORDER BY random() LIMIT 5;
           27  +INSERT INTO t3 SELECT a,b,c,d,null FROM t1 ORDER BY random() LIMIT 5;
           28  +INSERT INTO t3 SELECT null,null,null,null,null FROM t1 LIMIT 5;
           29  +CREATE INDEX t3x1 ON t3(a,b,c,d,e);
           30  +CREATE TABLE t4(a INT UNIQUE NOT NULL, b INT UNIQUE NOT NULL,c,d,e);
           31  +INSERT OR IGNORE INTO t4 SELECT a,b,c,d,e FROM t3;
           32  +CREATE TABLE t5(a INTEGER PRIMARY KEY, b TEXT UNIQUE,c,d,e);
           33  +INSERT INTO t5(b) VALUES
           34  +   ('truth'),
           35  +   ('works'),
           36  +   ('offer'),
           37  +   ('can'),
           38  +   ('anger'),
           39  +   ('wisdom'),
           40  +   ('send'),
           41  +   ('though'),
           42  +   ('save'),
           43  +   ('between'),
           44  +   ('some'),
           45  +   ('wine'),
           46  +   ('ark'),
           47  +   ('smote'),
           48  +   ('therein'),
           49  +   ('shew'),
           50  +   ('morning'),
           51  +   ('dwelt'),
           52  +   ('begat'),
           53  +   ('nothing'),
           54  +   ('war'),
           55  +   ('above'),
           56  +   ('known'),
           57  +   ('sacrifice'),
           58  +   ('tell'),
           59  +   ('departed'),
           60  +   ('thyself'),
           61  +   ('places'),
           62  +   ('bear'),
           63  +   ('part'),
           64  +   ('while'),
           65  +   ('gone'),
           66  +   ('cubits'),
           67  +   ('walk'),
           68  +   ('long'),
           69  +   ('near'),
           70  +   ('serve'),
           71  +   ('fruit'),
           72  +   ('doth'),
           73  +   ('poor'),
           74  +   ('ways'),
           75  +   ('child'),
           76  +   ('temple'),
           77  +   ('angel'),
           78  +   ('inhabitants'),
           79  +   ('oil'),
           80  +   ('died'),
           81  +   ('six'),
           82  +   ('tree'),
           83  +   ('wrath');
           84  +UPDATE t1 SET e=(SELECT b FROM t5 WHERE t5.a=(t1.e%51));
           85  +UPDATE t5 SET (c,d,e) = 
           86  +   (SELECT c,d,e FROM t1 WHERE t1.a=abs(t5.a+random()/100)%50+1);
           87  +UPDATE t2 SET e=(SELECT b FROM t5 WHERE t5.a=(t2.e%51));
           88  +UPDATE t3 SET e=(SELECT b FROM t5 WHERE t5.a=t3.e);
           89  +CREATE INDEX t1e ON t1(e);
           90  +CREATE INDEX t2ed ON t2(e,d);
           91  +CREATE VIEW v00(a,b,c,d,e) AS SELECT 1,1,1,1,'one';
           92  +CREATE VIEW v10(a,b,c,d,e) AS SELECT a,b,c,d,e FROM t1 WHERE a<>25;
           93  +CREATE VIEW v20(a,b,c,d,e) AS SELECT a,b,c,d,e FROM t2 WHERE a<>25;
           94  +CREATE VIEW v30(a,b,c,d,e) AS SELECT a,b,c,d,e FROM t3 WHERE a<>25;
           95  +CREATE VIEW v40(a,b,c,d,e) AS SELECT a,b,c,d,e FROM t4 WHERE a<>25;
           96  +CREATE VIEW v50(a,b) AS SELECT a,b FROM t5 WHERE a<>25;
           97  +CREATE VIEW v11(a,b,c,d,e) AS SELECT a,b,c,d,e FROM t1 ORDER BY b LIMIT 10;
           98  +CREATE VIEW v21(a,b,c,d,e) AS SELECT a,b,c,d,e FROM t2 ORDER BY b LIMIT 10;
           99  +CREATE VIEW v31(a,b,c,d,e) AS SELECT a,b,c,d,e FROM t3 ORDER BY b LIMIT 10;
          100  +CREATE VIEW v41(a,b,c,d,e) AS SELECT a,b,c,d,e FROM t4 ORDER BY b LIMIT 10;
          101  +CREATE VIEW v51(a,b) AS SELECT a,b FROM t5 ORDER BY b LIMIT 10;
          102  +CREATE VIEW v12(a,b,c,d,e) AS
          103  +  SELECT sum(a), avg(b), count(*), min(d), e FROM t1 GROUP BY 5;
          104  +CREATE VIEW v22(a,b,c,d,e) AS
          105  +  SELECT sum(a), avg(b), count(*), min(d), e FROM t2 GROUP BY 5
          106  +    HAVING count(*)>1 ORDER BY 3, 1;
          107  +CREATE VIEW v32(a,b,c,d,e) AS
          108  +  SELECT sum(a), avg(b), count(*), min(d), e FROM t3 GROUP BY 5
          109  +    HAVING count(*)>1 ORDER BY 3, 1;
          110  +CREATE VIEW v42(a,b,c,d,e) AS
          111  +  SELECT sum(a), avg(b), count(*), min(d), e FROM t4 GROUP BY 5
          112  +    HAVING min(d)<30 ORDER BY 3, 1;
          113  +CREATE VIEW v52(a,b,c,d,e) AS
          114  +  SELECT count(*), min(b), substr(b,1,1), min(a), max(a) FROM t5
          115  +   GROUP BY 3 ORDER BY 1;
          116  +
          117  +CREATE VIEW v13(a,b,c,d,e) AS
          118  +  SELECT a,b,c,d,e FROM t1
          119  +  UNION SELECT a,b,c,d,e FROM t2
          120  +  UNION SELECT a,b,c,d,e FROM t3;
          121  +CREATE VIEW v23(a,b,c,d,e) AS
          122  +  SELECT a,b,c,d,e FROM t1
          123  +  EXCEPT SELECT a,b,c,d,e FROM t1 WHERE b<25;
          124  +
          125  +CREATE VIEW v60(a,b,c,d,e) AS
          126  +  SELECT t1.a,t2.b,t1.c,t2.d,t1.e
          127  +    FROM t1 LEFT JOIN t2 ON (t1.a=t2.b);
          128  +CREATE VIEW v61(a,b,c,d,e) AS
          129  +  SELECT t2.a,t3.b,t2.c,t3.d,t2.e
          130  +    FROM t2 LEFT JOIN t3 ON (t2.a=t3.a);
          131  +CREATE VIEW v62(a,b,c,d,e) AS
          132  +  SELECT t1.a,t2.b,t3.c,t4.d,t5.b
          133  +    FROM t1 JOIN t2 ON (t1.a=t2.b)
          134  +            JOIN t3 ON (t1.a=t3.a)
          135  +            JOIN t4 ON (t4.b=t3.b)
          136  +            LEFT JOIN t5 ON (t5.a=t1.c);
          137  +CREATE VIEW v70(a,b,c,d,e) AS
          138  +  WITH RECURSIVE c0(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c0 WHERE x<9)
          139  +  SELECT x, b, c, d, e FROM c0 JOIN t1 ON (t1.a=50-c0.x);
          140  +COMMIT;
          141  +VACUUM;
          142  +.shell bin2c testdb01.db

Added test/optfuzz.c.

            1  +/*
            2  +** 2018-03-21
            3  +**
            4  +** The author disclaims copyright to this source code.  In place of
            5  +** a legal notice, here is a blessing:
            6  +**
            7  +**    May you do good and not evil.
            8  +**    May you find forgiveness for yourself and forgive others.
            9  +**    May you share freely, never taking more than you give.
           10  +**
           11  +*************************************************************************
           12  +**
           13  +** This program attempts to verify the correctness of the SQLite query
           14  +** optimizer by fuzzing.
           15  +**
           16  +** The input is an SQL script, presumably generated by a fuzzer.  The
           17  +** argument is the name of the input.  If no files are named, standard
           18  +** input is read.
           19  +**
           20  +** The SQL script is run twice, once with optimization enabled, and again
           21  +** with optimization disabled.  If the output is not equivalent, an error
           22  +** is printed and the program returns non-zero.
           23  +*/
           24  +
           25  +/* Include the SQLite amalgamation, after making appropriate #defines.
           26  +*/
           27  +#define SQLITE_THREADSAFE 0
           28  +#define SQLITE_OMIT_LOAD_EXTENSION 1
           29  +#define SQLITE_ENABLE_DESERIALIZE 1
           30  +#include "sqlite3.c"
           31  +
           32  +/* Content of the read-only test database */
           33  +#include "optfuzz-db01.c"
           34  +
           35  +/*
           36  +** Prepare a single SQL statement.  Panic if anything goes wrong
           37  +*/
           38  +static sqlite3_stmt *prepare_sql(sqlite3 *db, const char *zFormat, ...){
           39  +  char *zSql;
           40  +  int rc;
           41  +  sqlite3_stmt *pStmt = 0;
           42  +  va_list ap;
           43  +
           44  +  va_start(ap, zFormat);
           45  +  zSql = sqlite3_vmprintf(zFormat, ap);
           46  +  va_end(ap);
           47  +  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
           48  +  if( rc ){
           49  +    printf("Error: %s\nSQL: %s\n",
           50  +           sqlite3_errmsg(db), zSql);
           51  +    exit(1);
           52  +  }
           53  +  sqlite3_free(zSql);
           54  +  return pStmt;
           55  +}
           56  +
           57  +/*
           58  +** Run SQL.  Panic if anything goes wrong
           59  +*/
           60  +static void run_sql(sqlite3 *db, const char *zFormat, ...){
           61  +  char *zSql;
           62  +  int rc;
           63  +  char *zErr = 0;
           64  +  va_list ap;
           65  +
           66  +  va_start(ap, zFormat);
           67  +  zSql = sqlite3_vmprintf(zFormat, ap);
           68  +  va_end(ap);
           69  +  rc = sqlite3_exec(db, zSql, 0, 0, &zErr);
           70  +  if( rc || zErr ){
           71  +    printf("Error: %s\nsqlite3_errmsg: %s\nSQL: %s\n",
           72  +           zErr, sqlite3_errmsg(db), zSql);
           73  +    exit(1);
           74  +  }
           75  +  sqlite3_free(zSql);
           76  +}
           77  +
           78  +/*
           79  +** Run one or more SQL statements contained in zSql against database dbRun.
           80  +** Store the input in database dbOut.
           81  +*/
           82  +static int optfuzz_exec(
           83  +  sqlite3 *dbRun,             /* The database on which the SQL executes */
           84  +  const char *zSql,           /* The SQL to be executed */
           85  +  sqlite3 *dbOut,             /* Store results in this database */
           86  +  const char *zOutTab         /* Store results in this table of dbOut */
           87  +){
           88  +  int rc = SQLITE_OK;         /* Return code */
           89  +  const char *zLeftover;      /* Tail of unprocessed SQL */
           90  +  sqlite3_stmt *pStmt = 0;    /* The current SQL statement */
           91  +  sqlite3_stmt *pIns = 0;     /* Statement to insert into dbOut */
           92  +  const char *zCol;           /* Single column value */
           93  +  int nCol;                   /* Number of output columns */
           94  +  char zLine[4000];           /* Complete row value */
           95  +
           96  +  run_sql(dbOut, "BEGIN");
           97  +  run_sql(dbOut, "CREATE TABLE IF NOT EXISTS staging(x TEXT);");
           98  +  run_sql(dbOut, "CREATE TABLE IF NOT EXISTS \"w\"(x TEXT);", zOutTab);
           99  +  pIns = prepare_sql(dbOut, "INSERT INTO staging(x) VALUES(?1)");
          100  +  while( rc==SQLITE_OK && zSql[0] ){
          101  +    rc = sqlite3_prepare_v2(dbRun, zSql, -1, &pStmt, &zLeftover);
          102  +    assert( rc==SQLITE_OK || pStmt==0 );
          103  +    if( rc!=SQLITE_OK ) break;
          104  +    if( !pStmt ) continue;
          105  +    nCol = sqlite3_column_count(pStmt);
          106  +    run_sql(dbOut, "DELETE FROM staging;");
          107  +    while( 1 ){
          108  +      int i, j;
          109  +      rc = sqlite3_step(pStmt);
          110  +      for(i=j=0; i<nCol && j<sizeof(zLine)-50; i++){
          111  +        int eType = sqlite3_column_type(pStmt, i);
          112  +        if( eType==SQLITE_NULL ){
          113  +          zCol = "NULL";
          114  +        }else{
          115  +          zCol = (const char*)sqlite3_column_text(pStmt, i);
          116  +        }
          117  +        if( i ) zLine[j++] = ',';
          118  +        if( eType==SQLITE_TEXT ){
          119  +          sqlite3_snprintf(sizeof(zLine)-j, zLine+j, "'%q'", zCol);
          120  +        }else{
          121  +          sqlite3_snprintf(sizeof(zLine)-j, zLine+j, "%s", zCol);
          122  +        }
          123  +        j += (int)strlen(zLine+j);
          124  +      }
          125  +      /* Detect if any row is too large and throw an error, because we will
          126  +      ** want to go back and look more closely at that case */
          127  +      if( j>=sizeof(zLine)-100 ){
          128  +        printf("Excessively long output line: %d bytes\n" ,j);
          129  +        exit(1);
          130  +      }
          131  +      sqlite3_bind_text(pIns, 1, zLine, j, SQLITE_TRANSIENT);
          132  +      rc = sqlite3_step(pIns);
          133  +      assert( rc==SQLITE_DONE );
          134  +      sqlite3_reset(pIns);
          135  +    }
          136  +    run_sql(dbOut,
          137  +      "INSERT INTO \"%w\"(x) VALUES('### %q ###')",
          138  +      sqlite3_sql(pStmt)
          139  +    );
          140  +    run_sql(dbOut, 
          141  +      "INSERT INTO \"%w\"(x) SELECT group_concat(x,char(10))"
          142  +      "  FROM staging ORDER BY x",
          143  +      zOutTab
          144  +    );
          145  +    run_sql(dbOut, "COMMIT");
          146  +    sqlite3_finalize(pStmt);
          147  +    pStmt = 0;
          148  +    zSql = zLeftover;
          149  +  }
          150  +  sqlite3_finalize(pStmt);
          151  +  sqlite3_finalize(pIns);
          152  +  return rc;
          153  +}
          154  +
          155  +/*
          156  +** Read the content of file zName into memory obtained from sqlite3_malloc64()
          157  +** and return a pointer to the buffer. The caller is responsible for freeing
          158  +** the memory.
          159  +**
          160  +** If parameter pnByte is not NULL, (*pnByte) is set to the number of bytes
          161  +** read.
          162  +**
          163  +** For convenience, a nul-terminator byte is always appended to the data read
          164  +** from the file before the buffer is returned. This byte is not included in
          165  +** the final value of (*pnByte), if applicable.
          166  +**
          167  +** NULL is returned if any error is encountered. The final value of *pnByte
          168  +** is undefined in this case.
          169  +*/
          170  +static char *readFile(const char *zName, int *pnByte){
          171  +  FILE *in = fopen(zName, "rb");
          172  +  long nIn;
          173  +  size_t nRead;
          174  +  char *pBuf;
          175  +  if( in==0 ) return 0;
          176  +  fseek(in, 0, SEEK_END);
          177  +  nIn = ftell(in);
          178  +  rewind(in);
          179  +  pBuf = sqlite3_malloc64( nIn+1 );
          180  +  if( pBuf==0 ) return 0;
          181  +  nRead = fread(pBuf, nIn, 1, in);
          182  +  fclose(in);
          183  +  if( nRead!=1 ){
          184  +    sqlite3_free(pBuf);
          185  +    return 0;
          186  +  }
          187  +  pBuf[nIn] = 0;
          188  +  if( pnByte ) *pnByte = nIn;
          189  +  return pBuf;
          190  +}
          191  +
          192  +int main(int argc, char **argv){
          193  +  int nIn = 0;               /* Number of input files */
          194  +  char **azIn = 0;           /* Names of input files */
          195  +  sqlite3 *dbOut = 0;        /* Database to hold results */
          196  +  sqlite3 *dbRun = 0;        /* Database used for tests */
          197  +  int i, rc;
          198  +
          199  +  for(i=1; i<argc; i++){
          200  +    const char *z = argv[i];
          201  +    if( z[0]=='-' && z[1]=='-' ) z++;
          202  +    if( strcmp(z,"-help")==0 ){
          203  +      printf("Usage: %s FILENAME ...\n", argv[0]);
          204  +      return 0;
          205  +    }
          206  +    else if( z[0]=='-' ){
          207  +      printf("unknown option \"%s\".  Use --help for details\n", argv[i]);
          208  +      return 1;
          209  +    }
          210  +    else {
          211  +      nIn++;
          212  +      azIn = realloc(azIn, sizeof(azIn[0])*nIn);
          213  +      if( azIn==0 ){
          214  +        printf("out of memory\n");
          215  +        exit(1);
          216  +      }
          217  +      azIn[nIn-1] = argv[i];
          218  +    }
          219  +  }
          220  +
          221  +  sqlite3_open(":memory:", &dbOut);
          222  +  sqlite3_open(":memory:", &dbRun);
          223  +  sqlite3_deserialize(dbRun, "main", data001, sizeof(data001),
          224  +                      sizeof(data001), SQLITE_DESERIALIZE_READONLY);
          225  +  for(i=0; i<nIn; i++){
          226  +    char *zSql = readFile(azIn[i], 0);
          227  +    sqlite3_stmt *pCk;
          228  +    sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, dbRun, 0);
          229  +    rc = optfuzz_exec(dbRun, zSql, dbOut, "opt");
          230  +    if( rc==SQLITE_OK ){
          231  +      sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, dbRun, 0xffff);
          232  +      rc = optfuzz_exec(dbRun, zSql, dbOut, "noopt");
          233  +      if( rc ){
          234  +        printf("Non-optimized run failed.  Error: %s\n", sqlite3_errmsg(dbRun));
          235  +        exit(1);
          236  +      }
          237  +      pCk = prepare_sql(dbOut,
          238  +           "SELECT (SELECT group_concat(x) FROM opt)=="
          239  +           "       (SELECT group_concat(x) FROM noopt)");
          240  +      rc = sqlite3_step(pCk);
          241  +      if( rc!=SQLITE_ROW ){
          242  +        printf("Comparison failed. %s\n", sqlite3_errmsg(dbOut));
          243  +        exit(1);
          244  +      }
          245  +      if( !sqlite3_column_int(pCk, 0) ){
          246  +        printf("Opt/no-opt outputs differ for %s\n", azIn[i]);
          247  +        exit(1);
          248  +      }
          249  +      sqlite3_finalize(pCk);
          250  +    }
          251  +    sqlite3_free(zSql);
          252  +  }
          253  +  sqlite3_close(dbRun);
          254  +  sqlite3_close(dbOut);    
          255  +  free(azIn);
          256  +  if( sqlite3_memory_used() ){
          257  +    printf("Memory leak of %lld bytes\n", sqlite3_memory_used());
          258  +    exit(1);
          259  +  }
          260  +  return 0;
          261  +}

Changes to test/thread001.test.

   137    137     } {1}
   138    138     do_test thread001.$tn.7 {
   139    139       execsql { PRAGMA integrity_check }
   140    140     } {ok}
   141    141   }
   142    142   
   143    143   sqlite3_enable_shared_cache $::enable_shared_cache
          144  +catch { db close }
   144    145   set sqlite_open_file_count 0
   145    146   finish_test

Changes to test/trace3.test.

   125    125     set ::stmtlist(record) {}
   126    126     db trace_v2 trace_v2_record profile
   127    127     execsql {
   128    128       SELECT a, b FROM t1 ORDER BY a;
   129    129     }
   130    130     set stmt [lindex [lindex $::stmtlist(record) 0] 0]
   131    131     set ns [lindex [lindex $::stmtlist(record) 0] 1]
   132         -  list $stmt [expr {$ns >= 0 && $ns <= 1000000}]; # less than 0.001 second
          132  +  list $stmt [expr {$ns >= 0 && $ns <= 9999999}]; # less than 0.010 seconds
   133    133   } {/^-?\d+ 1$/}
   134    134   do_test trace3-4.4 {
   135    135     set ::stmtlist(record) {}
   136    136     db trace_v2 trace_v2_record 2
   137    137     execsql {
   138    138       SELECT a, b FROM t1 ORDER BY a;
   139    139     }
   140    140     set stmt [lindex [lindex $::stmtlist(record) 0] 0]
   141    141     set ns [lindex [lindex $::stmtlist(record) 0] 1]
   142         -  list $stmt [expr {$ns >= 0 && $ns <= 1000000}]; # less than 0.001 second
          142  +  list $stmt [expr {$ns >= 0 && $ns <= 9999999}]; # less than 0.010 seconds
   143    143   } {/^-?\d+ 1$/}
   144    144   
   145    145   do_test trace3-5.1 {
   146    146     set ::stmtlist(record) {}
   147    147     db trace_v2 trace_v2_record row
   148    148     execsql {
   149    149       SELECT a, b FROM t1 ORDER BY a;

Changes to test/zipfile.test.

     5      5   #
     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
           12  +
           13  +package require Tcl 8.6
    12     14   
    13     15   set testdir [file dirname $argv0]
    14     16   source $testdir/tester.tcl
    15     17   set testprefix zipfile
    16     18   
    17     19   ifcapable !vtab {
    18     20     finish_test; return
    19     21   }
    20     22   if {[catch {load_static_extension db zipfile} error]} {
    21     23     puts "Skipping zipfile tests, hit load error: $error"
    22     24     finish_test; return
           25  +}
           26  +if {[catch {load_static_extension db fileio} error]} {
           27  +  puts "Skipping zipfile tests, hit load error: $error"
           28  +  finish_test; return
    23     29   }
    24     30   
    25     31   proc readfile {f} {
    26     32     set fd [open $f]
    27     33     fconfigure $fd -translation binary -encoding binary
    28     34     set data [read $fd]
    29     35     close $fd
    30     36     set data
    31     37   }
    32     38   
    33         -if {$::tcl_platform(platform)=="unix" && [catch {exec unzip}]==0} {
    34         -  set ::UNZIP 1
    35         -  load_static_extension db fileio
           39  +unset -nocomplain ::UNZIP
           40  +
           41  +if {[catch {exec unzip} msg]==0 && \
           42  +    [regexp -line {^UnZip \d+\.\d+ .*? Info-ZIP\.} $msg]} {
           43  +  set ::UNZIP unzip
           44  +  proc fix_stat_mode {name mode} {
           45  +    if {$::tcl_platform(platform)=="windows"} {
           46  +      #
           47  +      # NOTE: Set or unset the write bits of the file permissions
           48  +      #       based on the read-only attribute because the Win32
           49  +      #       version of UnZip does this.
           50  +      #
           51  +      set writebits 0x12; # 0o22
           52  +      set result $mode
           53  +      if {[file attributes $name -readonly]} {
           54  +        set result [expr {$result | $writebits}]
           55  +      } else {
           56  +        set result [expr {$result & ~$writebits}]
           57  +      }
           58  +      return $result
           59  +    } else {
           60  +      return $mode
           61  +    }
           62  +  }
    36     63     proc do_unzip {file} {
    37     64       forcedelete test_unzip
    38     65       file mkdir test_unzip
    39         -    exec unzip -d test_unzip $file
    40         -  
    41         -    set res [db eval { 
    42         -      SELECT replace(name,'test_unzip/',''),mode,mtime,data 
           66  +    exec $::UNZIP -d test_unzip $file
           67  +
           68  +    db func modefix fix_stat_mode
           69  +
           70  +    set res [db eval {
           71  +      SELECT replace(name,'test_unzip/',''),modefix(name,mode),mtime,data
    43     72         FROM fsdir('test_unzip') 
    44     73         WHERE name!='test_unzip'
    45     74         ORDER BY name
    46     75       }]
    47     76       set res
    48     77     }
    49     78   }
................................................................................
   104    133   #          ( SELECT zipfile(name,mode,mtime,data,method) FROM zipfile($file) )
   105    134   #      );
   106    135   #
   107    136   #      Then tests that unpacking the new archive using [unzip] produces
   108    137   #      the same results as in (1).
   109    138   #
   110    139   proc do_unzip_test {tn file} {
   111         -  if {[info vars ::UNZIP]==""} { return }
   112    140     db func sss strip_slash
   113    141   
   114    142     db eval {
   115    143       SELECT writefile('test_unzip.zip',
   116    144           ( SELECT zipfile(name,mode,mtime,data,method) FROM zipfile($file) )
   117    145       );
   118    146     }
................................................................................
   242    270     UPDATE zz SET mtime=4 WHERE name='i.txt';
   243    271     SELECT name, mode, mtime, data, method FROM zipfile('test.zip');
   244    272   } {
   245    273     f.txt 33188 1000000000 abcde 0
   246    274     h.txt 33188 1000000004 aaaaaaaaaabbbbbbbbbb 8
   247    275     i.txt 33188 4 zxcvb 0
   248    276   }
          277  +
          278  +if {$::tcl_platform(platform)=="unix"} {
          279  +  set modes -rw-r--r-x
          280  +  set perms 33189
          281  +} else {
          282  +  set modes -rw-r--r--; # no execute bits on Win32
          283  +  set perms 33188
          284  +}
   249    285   
   250    286   do_execsql_test 1.6.3 {
   251         -  UPDATE zz SET mode='-rw-r--r-x' WHERE name='h.txt';
          287  +  UPDATE zz SET mode=$modes WHERE name='h.txt';
   252    288     SELECT name, mode, mtime, data, method FROM zipfile('test.zip');
   253         -} {
          289  +} [string map [list %perms% $perms] {
   254    290     f.txt 33188 1000000000 abcde 0
   255         -  h.txt 33189 1000000004 aaaaaaaaaabbbbbbbbbb 8
          291  +  h.txt %perms% 1000000004 aaaaaaaaaabbbbbbbbbb 8
   256    292     i.txt 33188 4 zxcvb 0
   257         -}
          293  +}]
   258    294   do_zip_tests 1.6.3a test.zip
   259    295   
   260    296   do_execsql_test 1.6.4 {
   261    297     UPDATE zz SET name = 'blue.txt' WHERE name='f.txt';
   262    298     SELECT name, mode, mtime, data, method FROM zipfile('test.zip');
   263         -} {
          299  +} [string map [list %perms% $perms] {
   264    300     blue.txt 33188 1000000000 abcde 0
   265         -  h.txt 33189 1000000004 aaaaaaaaaabbbbbbbbbb 8
          301  +  h.txt %perms% 1000000004 aaaaaaaaaabbbbbbbbbb 8
   266    302     i.txt 33188 4 zxcvb 0
   267         -}
          303  +}]
   268    304   do_zip_tests 1.6.4a test.zip
   269    305   
   270    306   do_execsql_test 1.6.5 {
   271    307     UPDATE zz SET data = 'edcba' WHERE name='blue.txt';
   272    308     SELECT name, mode, mtime, data, method FROM zipfile('test.zip');
   273         -} {
          309  +} [string map [list %perms% $perms] {
   274    310     blue.txt 33188 1000000000 edcba 0
   275         -  h.txt 33189 1000000004 aaaaaaaaaabbbbbbbbbb 8
          311  +  h.txt %perms% 1000000004 aaaaaaaaaabbbbbbbbbb 8
   276    312     i.txt 33188 4 zxcvb 0
   277         -}
          313  +}]
   278    314   
   279    315   do_execsql_test 1.6.6 {
   280    316     UPDATE zz SET mode=NULL, data = NULL WHERE name='blue.txt';
   281    317     SELECT name, mode, mtime, data, method FROM zipfile('test.zip');
   282         -} {
          318  +} [string map [list %perms% $perms] {
   283    319     blue.txt/ 16877 1000000000 {} 0
   284         -  h.txt 33189 1000000004 aaaaaaaaaabbbbbbbbbb 8
          320  +  h.txt %perms% 1000000004 aaaaaaaaaabbbbbbbbbb 8
   285    321     i.txt 33188 4 zxcvb 0
   286         -}
          322  +}]
   287    323   
   288    324   do_catchsql_test 1.6.7 {
   289    325     UPDATE zz SET data=NULL WHERE name='i.txt'
   290    326   } {1 {zipfile: mode does not match data}}
   291    327   do_execsql_test 1.6.8 {
   292    328     SELECT name, mode, mtime, data, method FROM zipfile('test.zip');
   293         -} {
          329  +} [string map [list %perms% $perms] {
   294    330     blue.txt/ 16877 1000000000 {} 0
   295         -  h.txt 33189 1000000004 aaaaaaaaaabbbbbbbbbb 8
          331  +  h.txt %perms% 1000000004 aaaaaaaaaabbbbbbbbbb 8
   296    332     i.txt 33188 4 zxcvb 0
   297         -}
          333  +}]
   298    334   
   299         -do_execsql_test 1.6.8 {
          335  +do_execsql_test 1.6.9 {
   300    336     UPDATE zz SET data = '' WHERE name='i.txt';
   301    337     SELECT name,mode,mtime,data,method from zipfile('test.zip');
   302         -} {
          338  +} [string map [list %perms% $perms] {
   303    339     blue.txt/ 16877 1000000000 {} 0
   304         -  h.txt 33189 1000000004 aaaaaaaaaabbbbbbbbbb 8
          340  +  h.txt %perms% 1000000004 aaaaaaaaaabbbbbbbbbb 8
   305    341     i.txt 33188 4 {} 0
   306         -}
          342  +}]
   307    343   
   308         -do_execsql_test 1.6.9 {
          344  +do_execsql_test 1.6.10 {
   309    345     SELECT a.name, a.data 
   310    346     FROM zz AS a, zz AS b 
   311    347     WHERE a.name=+b.name AND +a.mode=b.mode
   312    348   } {
   313    349     blue.txt/ {}
   314    350     h.txt aaaaaaaaaabbbbbbbbbb
   315    351     i.txt {}
   316    352   }
   317    353   
   318         -do_execsql_test 1.6.10 {
          354  +do_execsql_test 1.6.11 {
   319    355     SELECT name, data FROM zz WHERE name LIKE '%txt'
   320    356   } {
   321    357     h.txt aaaaaaaaaabbbbbbbbbb
   322    358     i.txt {}
   323    359   }
   324    360   
   325    361   do_execsql_test 1.7 {
................................................................................
   356    392   } {
   357    393     dirname3/ 16877 {}
   358    394     dirname2/ 16877 {}
   359    395     dirname2/file1.txt 33188 abcdefghijklmnop
   360    396   }
   361    397   do_zip_tests 2.4a test.zip
   362    398   
   363         -# If on unix, check that the [unzip] utility can unpack our archive.
          399  +# Check that the [unzip] utility can unpack our archive.
   364    400   #
   365         -if {$::tcl_platform(platform)=="unix"} {
          401  +if {[info exists ::UNZIP]} {
   366    402     do_test 2.5.1 {
   367    403       forcedelete dirname
   368    404       forcedelete dirname2
   369         -    set rc [catch { exec unzip test.zip > /dev/null } msg]
          405  +    if {$::tcl_platform(platform)=="unix"} {
          406  +      set null /dev/null
          407  +    } else {
          408  +      set null NUL
          409  +    }
          410  +    set rc [catch { exec $::UNZIP test.zip > $null } msg]
   370    411       list $rc $msg
   371    412     } {0 {}}
   372    413     do_test 2.5.2 { file isdir dirname3 } 1
   373    414     do_test 2.5.3 { file isdir dirname2 } 1
   374    415     do_test 2.5.4 { file isdir dirname2/file1.txt } 0
   375    416     do_test 2.5.5 { 
   376    417       set fd [open dirname2/file1.txt]
................................................................................
   380    421     } {abcdefghijklmnop}
   381    422   }
   382    423   
   383    424   #-------------------------------------------------------------------------
   384    425   reset_db
   385    426   forcedelete test.zip
   386    427   load_static_extension db zipfile
          428  +load_static_extension db fileio
   387    429   
   388    430   do_execsql_test 3.0 {
   389    431     CREATE VIRTUAL TABLE temp.x1 USING zipfile('test.zip');
   390    432     INSERT INTO x1(name, data) VALUES('dir1/', NULL);
   391    433     INSERT INTO x1(name, data) VALUES('file1', '1234');
   392    434     INSERT INTO x1(name, data) VALUES('dir1/file2', '5678');
   393    435   }
................................................................................
   449    491     WITH c(name,data) AS ( 
   450    492       SELECT 'a.txt', 'abc' UNION ALL
   451    493       SELECT NULL, 'def'
   452    494     )
   453    495     SELECT zipfile(name,data) FROM c
   454    496   } {1 {first argument to zipfile() must be non-NULL}}
   455    497   
   456         -do_catchsql_test 4.7 {
          498  +do_catchsql_test 4.8 {
   457    499     WITH c(name,data,method) AS ( 
   458    500       SELECT 'a.txt', 'abc', 0
   459    501       UNION SELECT 'b.txt', 'def', 8
   460    502       UNION SELECT 'c.txt', 'ghi', 16
   461    503     )
   462    504     SELECT zipfile(name,NULL,NULL,data,method) FROM c
   463    505   } {1 {illegal method value: 16}}
   464    506   
   465         -do_catchsql_test 4.8 {
          507  +do_catchsql_test 4.9 {
   466    508     WITH c(name,data) AS ( 
   467    509       SELECT 'a.txt', 'abc'
   468    510       UNION SELECT 'b.txt', 'def'
   469    511       UNION SELECT 'c.txt/', 'ghi'
   470    512     )
   471    513     SELECT zipfile(name,NULL,NULL,data) FROM c
   472    514   } {1 {non-directory name must not end with /}}
................................................................................
   481    523     SELECT name,mtime,data FROM zipfile(
   482    524       ( SELECT rt( zipfile(name,NULL,mtime,data,NULL) ) FROM c )
   483    525     )
   484    526   } {
   485    527     a.txt 946684800 abc
   486    528   }
   487    529   
   488         -if {[info vars ::UNZIP]!=""} { 
          530  +if {[info exists ::UNZIP]} {
   489    531   ifcapable datetime {
   490         -  load_static_extension db fileio
   491    532     forcedelete test1.zip test2.zip
   492    533     do_test 6.0 {
   493    534       execsql {
   494    535         WITH c(name,mtime,data) AS (
   495    536           SELECT 'a.txt', 946684800, 'abc' UNION ALL
   496    537           SELECT 'b.txt', 1000000000, 'abc' UNION ALL
   497    538           SELECT 'c.txt', 1111111000, 'abc'
................................................................................
   498    539         )
   499    540         SELECT writefile('test1.zip', rt( zipfile(name, NULL, mtime, data) ) ),
   500    541                writefile('test2.zip',   ( zipfile(name, NULL, mtime, data) ) ) 
   501    542         FROM c;
   502    543       }
   503    544       forcedelete test_unzip
   504    545       file mkdir test_unzip
   505         -    exec unzip -d test_unzip test1.zip
          546  +    exec $::UNZIP -d test_unzip test1.zip
   506    547   
   507    548       db eval {
   508    549         SELECT name, strftime('%s', mtime, 'unixepoch', 'localtime') 
   509    550         FROM fsdir('test_unzip') WHERE name!='test_unzip'
   510    551         ORDER BY name
   511    552       }
   512    553     } [list {*}{
   513    554       test_unzip/a.txt 946684800
   514    555       test_unzip/b.txt 1000000000 
   515    556       test_unzip/c.txt 1111111000 
   516    557     }]
          558  +
          559  +  # fsdir() issue reported on the mailing list on 2018-03-14 by Jack Thaw.
          560  +  do_test 6.0b {
          561  +    db eval {
          562  +      SELECT sum(name LIKE '%/a.txt')
          563  +      FROM (VALUES(1),(2),(3)) CROSS JOIN fsdir('test_unzip')
          564  +    }
          565  +  } {3}
   517    566   
   518    567     do_execsql_test 6.1 {
   519    568       SELECT name, mtime, data FROM zipfile('test1.zip')
   520    569     } {
   521    570       a.txt 946684800   abc
   522    571       b.txt 1000000000  abc
   523    572       c.txt 1111111000  abc
   524    573     }
   525    574   
   526    575     do_test 6.2 {
   527    576       forcedelete test_unzip
   528    577       file mkdir test_unzip
   529         -    exec unzip -d test_unzip test2.zip
          578  +    exec $::UNZIP -d test_unzip test2.zip
   530    579   
   531    580       db eval {
   532    581         SELECT name, mtime 
   533    582         FROM fsdir('test_unzip') WHERE name!='test_unzip'
   534    583         ORDER BY name
   535    584       }
   536    585     } [list {*}{
................................................................................
   640    689   #-------------------------------------------------------------------------
   641    690   # INSERT OR REPLACE and INSERT OR IGNORE
   642    691   #
   643    692   catch {db close}
   644    693   forcedelete test.zip test.db
   645    694   sqlite3 db :memory:
   646    695   load_static_extension db zipfile
          696  +load_static_extension db fileio
          697  +
   647    698   do_execsql_test 10.0 {
   648    699     CREATE VIRTUAL TABLE z USING zipfile('test.zip');
   649    700   } {}
   650    701   do_catchsql_test 10.1 {
   651    702     INSERT INTO z(name,data) VALUES('a0','one'),('a0','two');
   652    703   } {1 {duplicate name: "a0"}}
   653    704   do_execsql_test 10.2 {
................................................................................
   662    713   do_execsql_test 10.5 {
   663    714     INSERT OR IGNORE INTO z(name,data) VALUES('a0','five'),('a0','six');
   664    715   } {}
   665    716   do_execsql_test 10.6 {
   666    717     SELECT name, data FROM z;
   667    718   } {a0 four}
   668    719   
          720  +do_execsql_test 11.1 {
          721  +  DELETE FROM z;
          722  +} {}
          723  +do_execsql_test 11.2 {
          724  +  SELECT name, data FROM z;
          725  +} {}
          726  +do_execsql_test 11.3 {
          727  +  INSERT INTO z (name,data) VALUES ('b0','one');
          728  +  SELECT name, data FROM z;
          729  +} {b0 one}
          730  +do_execsql_test 11.4 {
          731  +  UPDATE z SET name = 'b1' WHERE name = 'b0';
          732  +  SELECT name, data FROM z;
          733  +} {b1 one}
          734  +do_execsql_test 11.5 {
          735  +  INSERT INTO z (name,data) VALUES ('b0','one');
          736  +  SELECT name, data FROM z ORDER BY name;
          737  +} {b0 one b1 one}
          738  +do_catchsql_test 11.6 {
          739  +  UPDATE z SET name = 'b1' WHERE name = 'b0';
          740  +} {1 {duplicate name: "b1"}}
          741  +do_execsql_test 11.7 {
          742  +  UPDATE z SET data = 'two' WHERE name = 'b0';
          743  +  SELECT name, data FROM z ORDER BY name;
          744  +} {b0 two b1 one}
          745  +do_catchsql_test 11.8 {
          746  +  UPDATE z SET name = 'b1';
          747  +} {1 {duplicate name: "b1"}}
          748  +do_catchsql_test 11.9 {
          749  +  UPDATE z SET name = 'b2';
          750  +} {1 {duplicate name: "b2"}}
          751  +do_execsql_test 11.10 {
          752  +  UPDATE z SET name = name;
          753  +  SELECT name, data FROM z ORDER BY name;
          754  +} {b0 two b2 one}
          755  +do_execsql_test 11.11 {
          756  +  UPDATE z SET name = name || 'suffix';
          757  +  SELECT name, data FROM z ORDER BY name;
          758  +} {b0suffix two b2suffix one}
   669    759   
   670    760   finish_test

Changes to test/zipfile2.test.

     5      5   #
     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
           12  +
           13  +package require Tcl 8.6
    12     14   
    13     15   set testdir [file dirname $argv0]
    14     16   source $testdir/tester.tcl
    15     17   set testprefix zipfile2
    16     18   
    17     19   ifcapable !vtab {
    18     20     finish_test; return
................................................................................
    46     48     CREATE VIRTUAL TABLE bbb USING zipfile("testzip");
    47     49     CREATE VIRTUAL TABLE ccc USING zipfile(`testzip`);
    48     50     CREATE VIRTUAL TABLE ddd USING zipfile([testzip]);
    49     51     CREATE VIRTUAL TABLE eee USING zipfile(testzip);
    50     52     CREATE VIRTUAL TABLE fff USING zipfile('test''zip');
    51     53   }
    52     54   
           55  +if {$::tcl_platform(platform)=="windows"} {
           56  +  set res {1 {cannot open file: testdir}}
           57  +} else {
           58  +  set res {1 {error in fread()}}
           59  +}
    53     60   do_test 2.0 {
    54     61     forcedelete testdir
    55     62     file mkdir testdir
    56     63     execsql { CREATE VIRTUAL TABLE hhh USING zipfile('testdir') }
    57     64     catchsql { SELECT * FROM hhh } 
    58         -} {1 {error in fread()}}
           65  +} $res
    59     66   
    60     67   
    61     68   set archive {
    62     69     504B0304140000080000D4A52BEC09F3B6E0110000001100000005000900612E
    63     70     747874555405000140420F00636F6E74656E7473206F6620612E747874504B03
    64     71     04140000080000D4A52BECD98916A7110000001100000005000900622E747874
    65     72     555405000140420F00636F6E74656E7473206F6620622E747874504B01021E03
................................................................................
   199    206     set hex [binary encode hex $blob]
   200    207     set hex [string map {6e6f7461646972 6e6f746164692f} $hex] 
   201    208     set blob2 [binary decode hex $hex]
   202    209   
   203    210     execsql { SELECT name, data IS NULL FROM zipfile($blob2) }
   204    211   } {notadi/ 1}
   205    212   
          213  +#-------------------------------------------------------------------------
          214  +# Test that duplicate entries may not be created using UPDATE
          215  +# statements.
          216  +#
          217  +forcedelete test.zip
          218  +do_execsql_test 6.0 {
          219  +  CREATE VIRTUAL TABLE temp.zip USING zipfile('test.zip'); 
          220  +  INSERT INTO temp.zip (name,data) VALUES ('test1','test'); 
          221  +  INSERT INTO temp.zip (name,data) VALUES ('test2','test'); 
          222  +}
          223  +do_catchsql_test 6.1 {
          224  +  UPDATE temp.zip SET name='test1' WHERE name='test2'
          225  +} {1 {duplicate name: "test1"}}
          226  +
          227  +forcedelete test.zip
          228  +do_catchsql_test 6.2 {
          229  +  DROP TABLE zip;
          230  +  CREATE VIRTUAL TABLE temp.zip USING zipfile('test.zip'); 
          231  +  INSERT INTO temp.zip (name,data) VALUES ('test','test'); 
          232  +  UPDATE  temp.zip set name=name||'new' where name='test'; 
          233  +  INSERT INTO temp.zip (name,data) VALUES ('test','test'); 
          234  +  UPDATE  temp.zip set name=name||'new' where name='test'; 
          235  +} {1 {duplicate name: "testnew"}}
          236  +
          237  +forcedelete test.zip
          238  +do_execsql_test 6.3 {
          239  +  INSERT INTO temp.zip (name,data) VALUES ('test1','test'); 
          240  +  INSERT INTO temp.zip (name,data) VALUES ('test2','test'); 
          241  +  UPDATE OR REPLACE zip SET name='test2' WHERE name='test1';
          242  +  SELECT name FROM zip;
          243  +} {test2}
   206    244   
   207    245   finish_test
   208    246