Fossil

Check-in [04a8ee6e]
Login

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

Overview
Comment:Merge updates from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | seeEnhanced
Files: files | file ages | folders
SHA1: 04a8ee6ec25315c0c6a937d628ea907704a53a3d
User & Date: mistachkin 2016-10-04 19:07:13
Context
2016-10-04
19:17
Coding style tweaks. Closed-Leaf check-in: 34d988c2 user: mistachkin tags: seeEnhanced
19:07
Merge updates from trunk. check-in: 04a8ee6e user: mistachkin tags: seeEnhanced
19:06
Fix harmless compiler warnings. check-in: 3f06618c user: mistachkin tags: trunk
19:05
Add an assert(). check-in: e6a5634f user: mistachkin tags: seeEnhanced
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to skins/blitz/footer.txt.

     1      1         </div> <!-- end div container -->
     2      2       </div> <!-- end div middle max-full-width -->
     3      3       <div class="footer">
     4      4         <div class="container">
     5      5           <div class="pull-right">
     6         -          <a href="http://fossil-scm.org">Fossil $release_version $manifest_version $manifest_date</a>
            6  +          <a href="https://www.fossil-scm.org/">Fossil $release_version $manifest_version $manifest_date</a>
     7      7           </div>
     8      8           This page was generated in about <th1>puts [expr {([utime]+[stime]+1000)/1000*0.001}]</th1>s
     9      9         </div>
    10     10       </div>
    11     11     </body>
    12     12   </html>

Changes to skins/blitz_no_logo/footer.txt.

     1      1         </div> <!-- end div container -->
     2      2       </div> <!-- end div middle max-full-width -->
     3      3       <div class="footer">
     4      4         <div class="container">
     5      5           <div class="pull-right">
     6         -          <a href="http://fossil-scm.org">Fossil $release_version $manifest_version $manifest_date</a>
            6  +          <a href="https://www.fossil-scm.org/">Fossil $release_version $manifest_version $manifest_date</a>
     7      7           </div>
     8      8           This page was generated in about <th1>puts [expr {([utime]+[stime]+1000)/1000*0.001}]</th1>s
     9      9         </div>
    10     10       </div>
    11     11     </body>
    12     12   </html>

Changes to skins/eagle/footer.txt.

     1      1   <div class="footer">
     2      2     <th1>
     3      3     proc getTclVersion {} {
     4      4       if {[catch {tclEval info patchlevel} tclVersion] == 0} {
     5         -      return "<a href=\"http://www.tcl.tk/\">Tcl</a> version $tclVersion"
            5  +      return "<a href=\"https://www.tcl.tk/\">Tcl</a> version $tclVersion"
     6      6       }
     7      7       return ""
     8      8     }
     9      9     proc getVersion { version } {
    10     10       set length [string length $version]
    11     11       return [string range $version 1 [expr {$length - 2}]]
    12     12     }

Changes to skins/enhanced1/footer.txt.

     1      1   <div class="footer">
     2      2     <th1>
     3      3     proc getTclVersion {} {
     4      4       if {[catch {tclEval info patchlevel} tclVersion] == 0} {
     5         -      return "<a href=\"http://www.tcl.tk/\">Tcl</a> version $tclVersion"
            5  +      return "<a href=\"https://www.tcl.tk/\">Tcl</a> version $tclVersion"
     6      6       }
     7      7       return ""
     8      8     }
     9      9     proc getVersion { version } {
    10     10       set length [string length $version]
    11     11       return [string range $version 1 [expr {$length - 2}]]
    12     12     }

Changes to src/add.c.

    69     69        ** entries should be removed.  2012-02-04 */
    70     70        ".fos",
    71     71        ".fos-journal",
    72     72        ".fos-wal",
    73     73        ".fos-shm",
    74     74     };
    75     75   
    76         -  /* Names of auxiliary files generated by SQLite when the "manifest"
    77         -  ** property is enabled
           76  +  /* Possible names of auxiliary files generated when the "manifest" property
           77  +  ** is used
    78     78     */
    79         -  static const char *const azManifest[] = {
    80         -     "manifest",
    81         -     "manifest.uuid",
           79  +  static const struct {
           80  +    const char *fname;
           81  +    int flg;
           82  +  }aManifestflags[] = {
           83  +    { "manifest",      MFESTFLG_RAW },
           84  +    { "manifest.uuid", MFESTFLG_UUID },
           85  +    { "manifest.tags", MFESTFLG_TAGS }
    82     86     };
           87  +  static const char *azManifests[3];
    83     88   
    84     89     /*
    85     90     ** Names of repository files, if they exist in the checkout.
    86     91     */
    87     92     static const char *azRepo[4] = { 0, 0, 0, 0 };
    88     93   
    89     94     /* Cached setting "manifest" */
    90     95     static int cachedManifest = -1;
           96  +  static int numManifests;
    91     97   
    92     98     if( cachedManifest == -1 ){
           99  +    int i;
    93    100       Blob repo;
    94         -    cachedManifest = db_get_boolean("manifest",0);
          101  +    cachedManifest = db_get_manifest_setting();
          102  +    numManifests = 0;
          103  +    for(i=0; i<count(aManifestflags); i++){
          104  +      if( cachedManifest&aManifestflags[i].flg ) {
          105  +        azManifests[numManifests++] = aManifestflags[i].fname;
          106  +      }
          107  +    }
    95    108       blob_zero(&repo);
    96    109       if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){
    97    110         const char *zRepo = blob_str(&repo);
    98    111         azRepo[0] = zRepo;
    99    112         azRepo[1] = mprintf("%s-journal", zRepo);
   100    113         azRepo[2] = mprintf("%s-wal", zRepo);
   101    114         azRepo[3] = mprintf("%s-shm", zRepo);
................................................................................
   102    115       }
   103    116     }
   104    117   
   105    118     if( N<0 ) return 0;
   106    119     if( N<count(azName) ) return azName[N];
   107    120     N -= count(azName);
   108    121     if( cachedManifest ){
   109         -    if( N<count(azManifest) ) return azManifest[N];
   110         -    N -= count(azManifest);
          122  +    if( N<numManifests ) return azManifests[N];
          123  +    N -= numManifests;
   111    124     }
   112    125     if( !omitRepo && N<count(azRepo) ) return azRepo[N];
   113    126     return 0;
   114    127   }
   115    128   
   116    129   /*
   117    130   ** Return a list of all reserved filenames as an SQL list.

Changes to src/allrepo.c.

   373    373          "INSERT INTO repolist "
   374    374          "SELECT DISTINCT substr(name, 6), name COLLATE nocase"
   375    375          "  FROM global_config"
   376    376          " WHERE substr(name, 1, 5)=='repo:'"
   377    377          " ORDER BY 1"
   378    378       );
   379    379     }
   380         -  db_multi_exec("CREATE TEMP TABLE todel(x TEXT)");
          380  +  db_multi_exec("CREATE TEMP TABLE toDel(x TEXT)");
   381    381     db_prepare(&q, "SELECT name, tag FROM repolist ORDER BY 1");
   382    382     while( db_step(&q)==SQLITE_ROW ){
   383    383       const char *zFilename = db_column_text(&q, 0);
   384    384   #if !USE_SEE
   385    385       if( sqlite3_strglob("*.efossil", zFilename)==0 ) continue;
   386    386   #endif
   387    387       if( file_access(zFilename, F_OK)
   388    388        || !file_is_canonical(zFilename)
   389    389        || (useCheckouts && file_isdir(zFilename)!=1)
   390    390       ){
   391         -      db_multi_exec("INSERT INTO todel VALUES(%Q)", db_column_text(&q, 1));
          391  +      db_multi_exec("INSERT INTO toDel VALUES(%Q)", db_column_text(&q, 1));
   392    392         nToDel++;
   393    393         continue;
   394    394       }
   395    395       if( zCmd[0]=='l' ){
   396    396         fossil_print("%s\n", zFilename);
   397    397         continue;
   398    398       }else if( showFile ){

Changes to src/checkin.c.

  1464   1464   ** is seen in a text file.
  1465   1465   **
  1466   1466   ** Return 1 if the user pressed 'c'. In that case, the file will have
  1467   1467   ** been converted to UTF-8 (if it was UTF-16) with NL line-endings,
  1468   1468   ** and the original file will have been renamed to "<filename>-original".
  1469   1469   */
  1470   1470   static int commit_warning(
  1471         -  Blob *p,              /* The content of the file being committed. */
  1472         -  int crnlOk,           /* Non-zero if CR/NL warnings should be disabled. */
  1473         -  int binOk,            /* Non-zero if binary warnings should be disabled. */
  1474         -  int encodingOk,       /* Non-zero if encoding warnings should be disabled. */
  1475         -  int noPrompt,         /* Non-zero to disable prompts and assume 'No'. */
  1476         -  const char *zFilename /* The full name of the file being committed. */
         1471  +  Blob *pContent,        /* The content of the file being committed. */
         1472  +  int crnlOk,            /* Non-zero if CR/NL warnings should be disabled. */
         1473  +  int binOk,             /* Non-zero if binary warnings should be disabled. */
         1474  +  int encodingOk,        /* Non-zero if encoding warnings should be disabled. */
         1475  +  int noPrompt,          /* 0 to always prompt, 1 for 'N', 2 for 'Y'. */
         1476  +  const char *zFilename, /* The full name of the file being committed. */
         1477  +  Blob *pReason          /* Reason for warning, if any (non-fatal only). */
  1477   1478   ){
  1478   1479     int bReverse;           /* UTF-16 byte order is reversed? */
  1479   1480     int fUnicode;           /* return value of could_be_utf16() */
  1480   1481     int fBinary;            /* does the blob content appear to be binary? */
  1481   1482     int lookFlags;          /* output flags from looks_like_utf8/utf16() */
  1482   1483     int fHasAnyCr;          /* the blob contains one or more CR chars */
  1483   1484     int fHasLoneCrOnly;     /* all detected line endings are CR only */
................................................................................
  1484   1485     int fHasCrLfOnly;       /* all detected line endings are CR/LF pairs */
  1485   1486     int fHasInvalidUtf8 = 0;/* contains invalid UTF-8 */
  1486   1487     char *zMsg;             /* Warning message */
  1487   1488     Blob fname;             /* Relative pathname of the file */
  1488   1489     static int allOk = 0;   /* Set to true to disable this routine */
  1489   1490   
  1490   1491     if( allOk ) return 0;
  1491         -  fUnicode = could_be_utf16(p, &bReverse);
         1492  +  fUnicode = could_be_utf16(pContent, &bReverse);
  1492   1493     if( fUnicode ){
  1493         -    lookFlags = looks_like_utf16(p, bReverse, LOOK_NUL);
         1494  +    lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
  1494   1495     }else{
  1495         -    lookFlags = looks_like_utf8(p, LOOK_NUL);
  1496         -    if( !(lookFlags & LOOK_BINARY) && invalid_utf8(p) ){
         1496  +    lookFlags = looks_like_utf8(pContent, LOOK_NUL);
         1497  +    if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
  1497   1498         fHasInvalidUtf8 = 1;
  1498   1499       }
  1499   1500     }
  1500   1501     fHasAnyCr = (lookFlags & LOOK_CR);
  1501   1502     fBinary = (lookFlags & LOOK_BINARY);
  1502   1503     fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
  1503   1504     fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
  1504         -  if( fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8){
         1505  +  if( fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
  1505   1506       const char *zWarning;
  1506   1507       const char *zDisable;
  1507   1508       const char *zConvert = "c=convert/";
  1508   1509       Blob ans;
  1509   1510       char cReply;
  1510   1511   
  1511   1512       if( fBinary ){
................................................................................
  1561   1562       }
  1562   1563       file_relative_name(zFilename, &fname, 0);
  1563   1564       zMsg = mprintf(
  1564   1565            "%s contains %s. Use --no-warnings or the %s to"
  1565   1566                    " disable this warning.\n"
  1566   1567            "Commit anyhow (a=all/%sy/N)? ",
  1567   1568            blob_str(&fname), zWarning, zDisable, zConvert);
  1568         -    if( !noPrompt ){
         1569  +    if( noPrompt==0 ){
  1569   1570         prompt_user(zMsg, &ans);
  1570   1571         cReply = blob_str(&ans)[0];
  1571   1572         blob_reset(&ans);
         1573  +    }else if( noPrompt==2 ){
         1574  +      cReply = 'Y';
  1572   1575       }else{
  1573   1576         cReply = 'N';
  1574   1577       }
  1575   1578       fossil_free(zMsg);
  1576   1579       if( cReply=='a' || cReply=='A' ){
  1577   1580         allOk = 1;
  1578   1581       }else if( *zConvert && (cReply=='c' || cReply=='C') ){
  1579   1582         char *zOrig = file_newname(zFilename, "original", 1);
  1580   1583         FILE *f;
  1581         -      blob_write_to_file(p, zOrig);
         1584  +      blob_write_to_file(pContent, zOrig);
  1582   1585         fossil_free(zOrig);
  1583   1586         f = fossil_fopen(zFilename, "wb");
  1584   1587         if( f==0 ){
  1585   1588           fossil_warning("cannot open %s for writing", zFilename);
  1586   1589         }else{
  1587   1590           if( fUnicode ){
  1588   1591             int bomSize;
  1589   1592             const unsigned char *bom = get_utf8_bom(&bomSize);
  1590   1593             fwrite(bom, 1, bomSize, f);
  1591         -          blob_to_utf8_no_bom(p, 0);
         1594  +          blob_to_utf8_no_bom(pContent, 0);
  1592   1595           }else if( fHasInvalidUtf8 ){
  1593         -          blob_cp1252_to_utf8(p);
         1596  +          blob_cp1252_to_utf8(pContent);
  1594   1597           }
  1595   1598           if( fHasAnyCr ){
  1596         -          blob_to_lf_only(p);
         1599  +          blob_to_lf_only(pContent);
  1597   1600           }
  1598         -        fwrite(blob_buffer(p), 1, blob_size(p), f);
         1601  +        fwrite(blob_buffer(pContent), 1, blob_size(pContent), f);
  1599   1602           fclose(f);
  1600   1603         }
  1601   1604         return 1;
  1602   1605       }else if( cReply!='y' && cReply!='Y' ){
  1603   1606         fossil_fatal("Abandoning commit due to %s in %s",
  1604   1607                      zWarning, blob_str(&fname));
         1608  +    }else if( noPrompt==2 ){
         1609  +      if( pReason ){
         1610  +        blob_append(pReason, zWarning, -1);
         1611  +      }
         1612  +      return 1;
  1605   1613       }
  1606   1614       blob_reset(&fname);
  1607   1615     }
  1608   1616     return 0;
  1609   1617   }
         1618  +
         1619  +/*
         1620  +** COMMAND: test-commit-warning
         1621  +**
         1622  +** Usage: %fossil test-commit-warning ?OPTIONS?
         1623  +**
         1624  +** Check each file in the checkout, including unmodified ones, using all
         1625  +** the pre-commit checks.
         1626  +**
         1627  +** Options:
         1628  +**    --no-settings     Do not consider any glob settings.
         1629  +**    -v|--verbose      Show per-file results for all pre-commit checks.
         1630  +**
         1631  +** See also: commit, extras
         1632  +*/
         1633  +void test_commit_warning(void){
         1634  +  int rc = 0;
         1635  +  int noSettings;
         1636  +  int verboseFlag;
         1637  +  Stmt q;
         1638  +  noSettings = find_option("no-settings",0,0)!=0;
         1639  +  verboseFlag = find_option("verbose","v",0)!=0;
         1640  +  verify_all_options();
         1641  +  db_must_be_within_tree();
         1642  +  db_prepare(&q,
         1643  +      "SELECT %Q || pathname, pathname, %s, %s, %s FROM vfile"
         1644  +      " WHERE NOT deleted",
         1645  +      g.zLocalRoot,
         1646  +      glob_expr("pathname", noSettings ? 0 : db_get("crnl-glob","")),
         1647  +      glob_expr("pathname", noSettings ? 0 : db_get("binary-glob","")),
         1648  +      glob_expr("pathname", noSettings ? 0 : db_get("encoding-glob",""))
         1649  +  );
         1650  +  while( db_step(&q)==SQLITE_ROW ){
         1651  +    const char *zFullname;
         1652  +    const char *zName;
         1653  +    Blob content;
         1654  +    Blob reason;
         1655  +    int crnlOk, binOk, encodingOk;
         1656  +    int fileRc;
         1657  +
         1658  +    zFullname = db_column_text(&q, 0);
         1659  +    zName = db_column_text(&q, 1);
         1660  +    crnlOk = db_column_int(&q, 2);
         1661  +    binOk = db_column_int(&q, 3);
         1662  +    encodingOk = db_column_int(&q, 4);
         1663  +    blob_zero(&content);
         1664  +    if( file_wd_islink(zFullname) ){
         1665  +      blob_read_link(&content, zFullname);
         1666  +    }else{
         1667  +      blob_read_from_file(&content, zFullname);
         1668  +    }
         1669  +    blob_zero(&reason);
         1670  +    fileRc = commit_warning(&content, crnlOk, binOk, encodingOk, 2,
         1671  +                            zFullname, &reason);
         1672  +    if( fileRc || verboseFlag ){
         1673  +      fossil_print("%d\t%s\t%s\n", fileRc, zName, blob_str(&reason));
         1674  +    }
         1675  +    blob_reset(&reason);
         1676  +    rc |= fileRc;
         1677  +  }
         1678  +  db_finalize(&q);
         1679  +  fossil_print("%d\n", rc);
         1680  +}
  1610   1681   
  1611   1682   /*
  1612   1683   ** qsort() comparison routine for an array of pointers to strings.
  1613   1684   */
  1614   1685   static int tagCmp(const void *a, const void *b){
  1615   1686     char **pA = (char**)a;
  1616   1687     char **pB = (char**)b;
................................................................................
  1796   1867     }
  1797   1868     sCiInfo.zDateOvrd = find_option("date-override",0,1);
  1798   1869     sCiInfo.zUserOvrd = find_option("user-override",0,1);
  1799   1870     db_must_be_within_tree();
  1800   1871     noSign = db_get_boolean("omitsign", 0)|noSign;
  1801   1872     if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
  1802   1873     useCksum = db_get_boolean("repo-cksum", 1);
  1803         -  outputManifest = db_get_boolean("manifest", 0);
         1874  +  outputManifest = db_get_manifest_setting();
  1804   1875     verify_all_options();
  1805   1876   
  1806   1877     /* Escape special characters in tags and put all tags in sorted order */
  1807   1878     if( nTag ){
  1808   1879       int i;
  1809   1880       for(i=0; i<nTag; i++) sCiInfo.azTag[i] = mprintf("%F", sCiInfo.azTag[i]);
  1810   1881       qsort((void*)sCiInfo.azTag, nTag, sizeof(sCiInfo.azTag[0]), tagCmp);
................................................................................
  2054   2125       }else{
  2055   2126         blob_read_from_file(&content, zFullname);
  2056   2127       }
  2057   2128       /* Do not emit any warnings when they are disabled. */
  2058   2129       if( !noWarningFlag ){
  2059   2130         abortCommit |= commit_warning(&content, crnlOk, binOk,
  2060   2131                                       encodingOk, noPrompt,
  2061         -                                    zFullname);
         2132  +                                    zFullname, 0);
  2062   2133       }
  2063   2134       if( contains_merge_marker(&content) ){
  2064   2135         Blob fname; /* Relative pathname of the file */
  2065   2136   
  2066   2137         nConflict++;
  2067   2138         file_relative_name(zFullname, &fname, 0);
  2068   2139         fossil_print("possible unresolved merge conflict in %s\n",
................................................................................
  2157   2228   
  2158   2229     /* If the -n|--dry-run option is specified, output the manifest file
  2159   2230     ** and rollback the transaction.
  2160   2231     */
  2161   2232     if( dryRunFlag ){
  2162   2233       blob_write_to_file(&manifest, "");
  2163   2234     }
  2164         -  if( outputManifest ){
         2235  +  if( outputManifest & MFESTFLG_RAW ){
  2165   2236       zManifestFile = mprintf("%smanifest", g.zLocalRoot);
  2166   2237       blob_write_to_file(&manifest, zManifestFile);
  2167   2238       blob_reset(&manifest);
  2168   2239       blob_read_from_file(&manifest, zManifestFile);
  2169   2240       free(zManifestFile);
  2170   2241     }
  2171   2242   
................................................................................
  2191   2262       }else{
  2192   2263         fossil_print("Not_Closed: %s (not a leaf any more)\n", zIntegrateUuid);
  2193   2264       }
  2194   2265     }
  2195   2266     db_finalize(&q);
  2196   2267   
  2197   2268     fossil_print("New_Version: %s\n", zUuid);
  2198         -  if( outputManifest ){
         2269  +  if( outputManifest & MFESTFLG_UUID ){
  2199   2270       zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot);
  2200   2271       blob_zero(&muuid);
  2201   2272       blob_appendf(&muuid, "%s\n", zUuid);
  2202   2273       blob_write_to_file(&muuid, zManifestFile);
  2203   2274       free(zManifestFile);
  2204   2275       blob_reset(&muuid);
  2205   2276     }
................................................................................
  2273   2344     db_multi_exec("PRAGMA repository.application_id=252006673;");
  2274   2345     db_multi_exec("PRAGMA localdb.application_id=252006674;");
  2275   2346     if( dryRunFlag ){
  2276   2347       db_end_transaction(1);
  2277   2348       exit(1);
  2278   2349     }
  2279   2350     db_end_transaction(0);
         2351  +
         2352  +  if( outputManifest & MFESTFLG_TAGS ){
         2353  +    Blob tagslist;
         2354  +    zManifestFile = mprintf("%smanifest.tags", g.zLocalRoot);
         2355  +    blob_zero(&tagslist);
         2356  +    get_checkin_taglist(nvid, &tagslist);
         2357  +    blob_write_to_file(&tagslist, zManifestFile);
         2358  +    blob_reset(&tagslist);
         2359  +    free(zManifestFile);
         2360  +  }
  2280   2361   
  2281   2362     if( !g.markPrivate ){
  2282   2363       autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0);
  2283   2364     }
  2284   2365     if( count_nonbranch_children(vid)>1 ){
  2285   2366       fossil_print("**** warning: a fork has occurred *****\n");
  2286   2367     }
  2287   2368   }

Changes to src/checkout.c.

   125    125   }
   126    126   
   127    127   
   128    128   /*
   129    129   ** If the "manifest" setting is true, then automatically generate
   130    130   ** files named "manifest" and "manifest.uuid" containing, respectively,
   131    131   ** the text of the manifest and the artifact ID of the manifest.
          132  +** If the manifest setting is set, but is not a boolean value, then treat
          133  +** each character as a flag to enable writing "manifest", "manifest.uuid" or
          134  +** "manifest.tags".
   132    135   */
   133    136   void manifest_to_disk(int vid){
   134    137     char *zManFile;
   135    138     Blob manifest;
   136    139     Blob hash;
          140  +  Blob taglist;
          141  +  int flg;
          142  +
          143  +  flg = db_get_manifest_setting();
   137    144   
   138         -  if( db_get_boolean("manifest",0) ){
          145  +  if( flg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
   139    146       blob_zero(&manifest);
   140    147       content_get(vid, &manifest);
   141         -    zManFile = mprintf("%smanifest", g.zLocalRoot);
   142    148       blob_zero(&hash);
   143    149       sha1sum_blob(&manifest, &hash);
   144    150       sterilize_manifest(&manifest);
          151  +  }
          152  +  if( flg & MFESTFLG_RAW ){
          153  +    zManFile = mprintf("%smanifest", g.zLocalRoot);
   145    154       blob_write_to_file(&manifest, zManFile);
   146    155       free(zManFile);
   147         -    zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
   148         -    blob_append(&hash, "\n", 1);
   149         -    blob_write_to_file(&hash, zManFile);
   150         -    free(zManFile);
   151         -    blob_reset(&hash);
   152    156     }else{
   153    157       if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){
   154    158         zManFile = mprintf("%smanifest", g.zLocalRoot);
   155    159         file_delete(zManFile);
   156    160         free(zManFile);
   157    161       }
          162  +  }
          163  +  if( flg & MFESTFLG_UUID ){
          164  +    zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
          165  +    blob_append(&hash, "\n", 1);
          166  +    blob_write_to_file(&hash, zManFile);
          167  +    free(zManFile);
          168  +    blob_reset(&hash);
          169  +  }else{
   158    170       if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){
   159    171         zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
   160    172         file_delete(zManFile);
   161    173         free(zManFile);
   162    174       }
   163    175     }
          176  +  if( flg & MFESTFLG_TAGS ){
          177  +    blob_zero(&taglist);
          178  +    zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
          179  +    get_checkin_taglist(vid, &taglist);
          180  +    blob_write_to_file(&taglist, zManFile);
          181  +    free(zManFile);
          182  +    blob_reset(&taglist);
          183  +  }else{
          184  +    if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.tags'") ){
          185  +      zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
          186  +      file_delete(zManFile);
          187  +      free(zManFile);
          188  +    }
          189  +  }
          190  +}
   164    191   
          192  +/*
          193  +** Find the branch name and all symbolic tags for a particular check-in
          194  +** identified by "rid".
          195  +**
          196  +** The branch name is actually only extracted if this procedure is run
          197  +** from within a local check-out.  And the branch name is not the branch
          198  +** name for "rid" but rather the branch name for the current check-out.
          199  +** It is unclear if the rid parameter is always the same as the current
          200  +** check-out.
          201  +*/
          202  +void get_checkin_taglist(int rid, Blob *pOut){
          203  +  Stmt stmt;
          204  +  char *zCurrent;
          205  +  blob_reset(pOut);
          206  +  zCurrent = db_text(0, "SELECT value FROM tagxref"
          207  +                        " WHERE rid=%d AND tagid=%d", rid, TAG_BRANCH);
          208  +  blob_appendf(pOut, "branch %s\n", zCurrent);
          209  +  db_prepare(&stmt, "SELECT substr(tagname, 5)"
          210  +                    "  FROM tagxref, tag"
          211  +                    " WHERE tagxref.rid=%d"
          212  +                    "   AND tagxref.tagtype>0"
          213  +                    "   AND tag.tagid=tagxref.tagid"
          214  +                    "   AND tag.tagname GLOB 'sym-*'", rid);
          215  +  while( db_step(&stmt)==SQLITE_ROW ){
          216  +    const char *zName;
          217  +    zName = db_column_text(&stmt, 0);
          218  +    blob_appendf(pOut, "tag %s\n", zName);
          219  +  }
          220  +  db_reset(&stmt);
          221  +  db_finalize(&stmt);
   165    222   }
          223  +
   166    224   
   167    225   /*
   168    226   ** COMMAND: checkout*
   169    227   ** COMMAND: co*
   170    228   **
   171    229   ** Usage: %fossil checkout ?VERSION | --latest? ?OPTIONS?
   172    230   **    or: %fossil co ?VERSION | --latest? ?OPTIONS?

Changes to src/db.c.

  2357   2357   }
  2358   2358   int db_lget_int(const char *zName, int dflt){
  2359   2359     return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName);
  2360   2360   }
  2361   2361   void db_lset_int(const char *zName, int value){
  2362   2362     db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value);
  2363   2363   }
         2364  +
         2365  +#if INTERFACE
         2366  +/* Manifest generation flags */
         2367  +#define MFESTFLG_RAW  0x01
         2368  +#define MFESTFLG_UUID 0x02
         2369  +#define MFESTFLG_TAGS 0x04
         2370  +#endif /* INTERFACE */
         2371  +
         2372  +/*
         2373  +** Get the manifest setting.  For backwards compatibility first check if the
         2374  +** value is a boolean.  If it's not a boolean, treat each character as a flag
         2375  +** to enable a manifest type.  This system puts certain boundary conditions on
         2376  +** which letters can be used to represent flags (any permutation of flags must
         2377  +** not be able to fully form one of the boolean values).
         2378  +*/
         2379  +int db_get_manifest_setting(void){
         2380  +  int flg;
         2381  +  char *zNVVal = db_get("manifest", "off");
         2382  +  char *zVal = db_get_versioned("manifest", zNVVal);
         2383  +  if( is_false(zVal) ){
         2384  +    return 0;
         2385  +  }else if( is_truth(zVal) ) {
         2386  +    return MFESTFLG_RAW|MFESTFLG_UUID;
         2387  +  }
         2388  +  flg = 0;
         2389  +  while( *zVal ){
         2390  +   switch( *zVal ){
         2391  +     case 'r': flg |= MFESTFLG_RAW;  break;
         2392  +     case 'u': flg |= MFESTFLG_UUID; break;
         2393  +     case 't': flg |= MFESTFLG_TAGS; break;
         2394  +    }
         2395  +    zVal++;
         2396  +  }
         2397  +  return flg;
         2398  +}
         2399  +
  2364   2400   
  2365   2401   /*
  2366   2402   ** Record the name of a local repository in the global_config() database.
  2367   2403   ** The repository filename %s is recorded as an entry with a "name" field
  2368   2404   ** of the following form:
  2369   2405   **
  2370   2406   **       repo:%s
................................................................................
  2657   2693     { "hash-digits",      0,              5, 0, 0, "10"                  },
  2658   2694     { "http-port",        0,             16, 0, 0, "8080"                },
  2659   2695     { "https-login",      0,              0, 0, 0, "off"                 },
  2660   2696     { "ignore-glob",      0,             40, 1, 0, ""                    },
  2661   2697     { "keep-glob",        0,             40, 1, 0, ""                    },
  2662   2698     { "localauth",        0,              0, 0, 0, "off"                 },
  2663   2699     { "main-branch",      0,             40, 0, 0, "trunk"               },
  2664         -  { "manifest",         0,              0, 1, 0, "off"                 },
         2700  +  { "manifest",         0,              5, 0, 0, "off"                 },
  2665   2701     { "max-loadavg",      0,             25, 0, 0, "0.0"                 },
  2666   2702     { "max-upload",       0,             25, 0, 0, "250000"              },
  2667   2703     { "mtime-changes",    0,              0, 0, 0, "on"                  },
  2668   2704   #if FOSSIL_ENABLE_LEGACY_MV_RM
  2669   2705     { "mv-rm-files",      0,              0, 0, 0, "off"                 },
  2670   2706   #endif
  2671   2707     { "pgp-command",      0,             40, 0, 0, "gpg --clearsign -o " },
................................................................................
  2862   2898   **    localauth        If enabled, require that HTTP connections from
  2863   2899   **                     127.0.0.1 be authenticated by password.  If
  2864   2900   **                     false, all HTTP requests from localhost have
  2865   2901   **                     unrestricted access to the repository.
  2866   2902   **
  2867   2903   **    main-branch      The primary branch for the project.  Default: trunk
  2868   2904   **
  2869         -**    manifest         If enabled, automatically create files "manifest" and
  2870         -**     (versionable)   "manifest.uuid" in every checkout.  The SQLite and
  2871         -**                     Fossil repositories both require this.  Default: off.
         2905  +**    manifest         If set to a true boolean value, automatically create
         2906  +**     (versionable)   files "manifest" and "manifest.uuid" in every checkout.
         2907  +**                     Optionally use combinations of characters 'r'
         2908  +**                     for "manifest", 'u' for "manifest.uuid" and 't' for
         2909  +**                     "manifest.tags".  The SQLite and Fossil repositories
         2910  +**                     both require manifests.  Default: off.
  2872   2911   **
  2873   2912   **    max-loadavg      Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
  2874   2913   **                     are disallowed if the system load average goes above this
  2875   2914   **                     value.  "0.0" means no limit.  This only works on unix.
  2876   2915   **                     Only local settings of this value make a difference since
  2877   2916   **                     when running as a web-server, Fossil does not open the
  2878   2917   **                     global configuration database.

Changes to src/diff.c.

   135    135   */
   136    136   static DLine *break_into_lines(
   137    137     const char *z,
   138    138     int n,
   139    139     int *pnLine,
   140    140     u64 diffFlags
   141    141   ){
   142         -  int nLine, i, j, k, s, x;
          142  +  int nLine, i, k, nn, s, x;
   143    143     unsigned int h, h2;
   144    144     DLine *a;
          145  +  const char *zNL, *z2;
   145    146   
   146         -  /* Count the number of lines.  Allocate space to hold
   147         -  ** the returned array.
          147  +  /* Count the number of lines in the input file.  Include the last line
          148  +  ** in the count even if it lacks the \n terminator
   148    149     */
   149         -  for(i=j=0, nLine=1; i<n; i++, j++){
   150         -    int c = z[i];
   151         -    if( c==0 ){
   152         -      return 0;
   153         -    }
   154         -    if( c=='\n' && z[i+1]!=0 ){
   155         -      nLine++;
   156         -      if( j>LENGTH_MASK ){
   157         -        return 0;
   158         -      }
   159         -      j = 0;
   160         -    }
          150  +  for(nLine=0, z2=z; (zNL = strchr(z2,'\n'))!=0; z2=zNL+1, nLine++){}
          151  +  if( z2[0]!=0 ){
          152  +    nLine++;
          153  +    do{ z2++; }while( z2[0] );
   161    154     }
   162         -  if( j>LENGTH_MASK ){
   163         -    return 0;
   164         -  }
   165         -  a = fossil_malloc( nLine*sizeof(a[0]) );
   166         -  memset(a, 0, nLine*sizeof(a[0]) );
   167         -  if( n==0 ){
          155  +  if( n!=(int)(z2-z) ) return 0;
          156  +
          157  +  a = fossil_malloc( sizeof(a[0])*nLine );
          158  +  memset(a, 0, sizeof(a[0])*nLine);
          159  +  if( nLine==0 ){
   168    160       *pnLine = 0;
   169    161       return a;
   170    162     }
   171         -
   172         -  /* Fill in the array */
   173         -  for(i=0; i<nLine; i++){
   174         -    for(j=0; z[j] && z[j]!='\n'; j++){}
          163  +  i = 0;
          164  +  do{
          165  +    zNL = strchr(z,'\n');
          166  +    if( zNL==0 ) zNL = z+strlen(z);
          167  +    nn = (int)(zNL - z);
          168  +    if( nn>LENGTH_MASK ){
          169  +      fossil_free(a);
          170  +      return 0;
          171  +    }
   175    172       a[i].z = z;
   176         -    k = j;
          173  +    k = nn;
   177    174       if( diffFlags & DIFF_STRIP_EOLCR ){
   178    175         if( k>0 && z[k-1]=='\r' ){ k--; }
   179    176       }
   180    177       a[i].n = k;
   181    178       s = 0;
   182    179       if( diffFlags & DIFF_IGNORE_EOLWS ){
   183    180         while( k>0 && fossil_isspace(z[k-1]) ){ k--; }
................................................................................
   185    182       if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
   186    183         int numws = 0;
   187    184         while( s<k && fossil_isspace(z[s]) ){ s++; }
   188    185         for(h=0, x=s; x<k; x++){
   189    186           if( fossil_isspace(z[x]) ){
   190    187             ++numws;
   191    188           }else{
   192         -          h = h ^ (h<<2) ^ z[x];
          189  +          h += z[x];
          190  +          h *= 0x9e3779b1;
   193    191           }
   194    192         }
   195    193         k -= numws;
   196    194       }else{
   197    195         for(h=0, x=s; x<k; x++){
   198         -        h = h ^ (h<<2) ^ z[x];
          196  +        h += z[x];
          197  +        h *= 0x9e3779b1;
   199    198         }
   200    199       }
   201    200       a[i].indent = s;
   202    201       a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
   203    202       h2 = h % nLine;
   204    203       a[i].iNext = a[h2].iHash;
   205    204       a[h2].iHash = i+1;
   206         -    z += j+1;
   207         -  }
          205  +    z += nn+1;
          206  +    i++;
          207  +  }while( zNL[0] && zNL[1] );
          208  +  assert( i==nLine );
   208    209   
   209    210     /* Return results */
   210    211     *pnLine = nLine;
   211    212     return a;
   212    213   }
   213    214   
   214    215   /*
................................................................................
   961    962     while( nB>0 && fossil_isspace(zB[0]) ){ nB--; zB++; }
   962    963     while( nB>0 && fossil_isspace(zB[nB-1]) ){ nB--; }
   963    964     if( nA>250 ) nA = 250;
   964    965     if( nB>250 ) nB = 250;
   965    966     avg = (nA+nB)/2;
   966    967     if( avg==0 ) return 0;
   967    968     if( nA==nB && memcmp(zA, zB, nA)==0 ) return 0;
   968         -  memset(aFirst, 0, sizeof(aFirst));
          969  +  memset(aFirst, 0xff, sizeof(aFirst));
   969    970     zA--; zB--;   /* Make both zA[] and zB[] 1-indexed */
   970    971     for(i=nB; i>0; i--){
   971    972       c = (unsigned char)zB[i];
   972    973       aNext[i] = aFirst[c];
   973    974       aFirst[c] = i;
   974    975     }
   975    976     best = 0;
   976    977     for(i=1; i<=nA-best; i++){
   977    978       c = (unsigned char)zA[i];
   978         -    for(j=aFirst[c]; j>0 && j<nB-best; j = aNext[j]){
          979  +    for(j=aFirst[c]; j<nB-best && memcmp(&zA[i],&zB[j],best)==0; j = aNext[j]){
   979    980         int limit = minInt(nA-i, nB-j);
   980         -      for(k=1; k<=limit && zA[k+i]==zB[k+j]; k++){}
          981  +      for(k=best; k<=limit && zA[k+i]==zB[k+j]; k++){}
   981    982         if( k>best ) best = k;
   982    983       }
   983    984     }
   984    985     score = (best>avg) ? 0 : (avg - best)*100/avg;
   985    986   
   986    987   #if 0
   987    988     fprintf(stderr, "A: [%.*s]\nB: [%.*s]\nbest=%d avg=%d score=%d\n",

Changes to src/diffcmd.c.

   771    771   ** the source check-in for the diff operation.  If not specified, the
   772    772   ** source check-in is the base check-in for the current check-out.
   773    773   **
   774    774   ** If the "--to VERSION" option appears, it specifies the check-in from
   775    775   ** which the second version of the file or files is taken.  If there is
   776    776   ** no "--to" option then the (possibly edited) files in the current check-out
   777    777   ** are used.
          778  +**
          779  +** The "--checkin VERSION" option shows the changes made by
          780  +** check-in VERSION relative to its primary parent.
   778    781   **
   779    782   ** The "-i" command-line option forces the use of the internal diff logic
   780    783   ** rather than any external diff program that might be configured using
   781    784   ** the "setting" command.  If no external diff program is configured, then
   782    785   ** the "-i" option is a no-op.  The "-i" option converts "gdiff" into "diff".
   783    786   **
   784    787   ** The "-N" or "--new-file" option causes the complete text of added or
................................................................................
   791    794   ** as binary when considering if they should be used with external diff program.
   792    795   ** This option overrides the "binary-glob" setting.
   793    796   **
   794    797   ** Options:
   795    798   **   --binary PATTERN           Treat files that match the glob PATTERN as binary
   796    799   **   --branch BRANCH            Show diff of all changes on BRANCH
   797    800   **   --brief                    Show filenames only
          801  +**   --checkin VERSION          Show diff of all changes in VERSION
   798    802   **   --context|-c N             Use N lines of context
   799    803   **   --diff-binary BOOL         Include binary files when using external commands
   800    804   **   --exec-abs-paths           Force absolute path names with external commands.
   801    805   **   --exec-rel-paths           Force relative path names with external commands.
   802    806   **   --from|-r VERSION          Select VERSION as source for the diff
   803    807   **   --internal|-i              Use internal diff logic
   804    808   **   --side-by-side|-y          Side-by-side diff
................................................................................
   814    818   */
   815    819   void diff_cmd(void){
   816    820     int isGDiff;               /* True for gdiff.  False for normal diff */
   817    821     int isInternDiff;          /* True for internal diff */
   818    822     int verboseFlag;           /* True if -v or --verbose flag is used */
   819    823     const char *zFrom;         /* Source version number */
   820    824     const char *zTo;           /* Target version number */
          825  +  const char *zCheckin;      /* Check-in version number */
   821    826     const char *zBranch;       /* Branch to diff */
   822    827     const char *zDiffCmd = 0;  /* External diff command. NULL for internal diff */
   823    828     const char *zBinGlob = 0;  /* Treat file names matching this as binary */
   824    829     int fIncludeBinary = 0;    /* Include binary files for external diff */
   825    830     int againstUndo = 0;       /* Diff against files in the undo buffer */
   826    831     u64 diffFlags = 0;         /* Flags to control the DIFF */
   827    832     FileDirList *pFileDir = 0; /* Restrict the diff to these files */
................................................................................
   830    835       diff_tk("diff", 2);
   831    836       return;
   832    837     }
   833    838     isGDiff = g.argv[1][0]=='g';
   834    839     isInternDiff = find_option("internal","i",0)!=0;
   835    840     zFrom = find_option("from", "r", 1);
   836    841     zTo = find_option("to", 0, 1);
          842  +  zCheckin = find_option("checkin", 0, 1);
   837    843     zBranch = find_option("branch", 0, 1);
   838    844     againstUndo = find_option("undo",0,0)!=0;
   839    845     diffFlags = diff_options();
   840    846     verboseFlag = find_option("verbose","v",0)!=0;
   841    847     if( !verboseFlag ){
   842    848       verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */
   843    849     }
   844    850     if( verboseFlag ) diffFlags |= DIFF_VERBOSE;
   845         -  if( againstUndo && (zFrom!=0 || zTo!=0 || zBranch!=0) ){
   846         -    fossil_fatal("cannot use --undo together with --from or --to or --branch");
          851  +  if( againstUndo && ( zFrom!=0 || zTo!=0 || zCheckin!=0 || zBranch!=0) ){
          852  +    fossil_fatal("cannot use --undo together with --from, --to, --checkin,"
          853  +                 " or --branch");
   847    854     }
   848    855     if( zBranch ){
   849         -    if( zTo || zFrom ){
   850         -      fossil_fatal("cannot use --from or --to with --branch");
          856  +    if( zTo || zFrom || zCheckin ){
          857  +      fossil_fatal("cannot use --from, --to, or --checkin with --branch");
   851    858       }
   852    859       zTo = zBranch;
   853    860       zFrom = mprintf("root:%s", zBranch);
   854    861     }
          862  +  if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){
          863  +    fossil_fatal("cannot use --checkin together with --from or --to");
          864  +  }
   855    865     if( zTo==0 || againstUndo ){
   856    866       db_must_be_within_tree();
   857    867     }else if( zFrom==0 ){
   858    868       fossil_fatal("must use --from if --to is present");
   859    869     }else{
   860    870       db_find_and_open_repository(0, 0);
   861    871     }
................................................................................
   879    889           pFileDir[0].zName[1] = 0;
   880    890           break;
   881    891         }
   882    892         pFileDir[i-2].nName = blob_size(&fname);
   883    893         pFileDir[i-2].nUsed = 0;
   884    894         blob_reset(&fname);
   885    895       }
          896  +  }
          897  +  if ( zCheckin!=0 ){
          898  +    int ridTo = name_to_typed_rid(zCheckin, "ci");
          899  +    zTo = zCheckin;
          900  +    zFrom = db_text(0,
          901  +      "SELECT uuid FROM blob, plink"
          902  +      " WHERE plink.cid=%d AND plink.isprim AND plink.pid=blob.rid",
          903  +      ridTo);
          904  +    if( zFrom==0 ){
          905  +      fossil_fatal("check-in %s has no parent", zTo);
          906  +    }
   886    907     }
   887    908     if( againstUndo ){
   888    909       if( db_lget_int("undo_available",0)==0 ){
   889    910         fossil_print("No undo or redo is available\n");
   890    911         return;
   891    912       }
   892    913       diff_against_undo(zDiffCmd, zBinGlob, fIncludeBinary,
................................................................................
   899    920                         diffFlags, pFileDir);
   900    921     }
   901    922     if( pFileDir ){
   902    923       int i;
   903    924       for(i=0; pFileDir[i].zName; i++){
   904    925         if( pFileDir[i].nUsed==0
   905    926          && strcmp(pFileDir[0].zName,".")!=0
   906         -       && !file_isdir(g.argv[i+2])
          927  +       && !file_wd_isdir(g.argv[i+2])
   907    928         ){
   908    929           fossil_fatal("not found: '%s'", g.argv[i+2]);
   909    930         }
   910    931         fossil_free(pFileDir[i].zName);
   911    932       }
   912    933       fossil_free(pFileDir);
   913    934     }

Changes to src/dispatch.c.

    57     57   /*
    58     58   ** The page_index.h file contains the definition for aCommand[] - an array
    59     59   ** of CmdOrPage objects that defines all available commands and webpages
    60     60   ** known to Fossil.
    61     61   **
    62     62   ** The entries in aCommand[] are in sorted order by name.  Since webpage names
    63     63   ** always begin with "/", all webpage names occur first.  The page_index.h file
    64         -** also sets the FOSSIL_FIRST_CMD macro to be the *approximate* index 
           64  +** also sets the FOSSIL_FIRST_CMD macro to be the *approximate* index
    65     65   ** in aCommand[] of the first command entry.  FOSSIL_FIRST_CMD might be
    66     66   ** slightly too low, and so the range FOSSIL_FIRST_CMD...MX_COMMAND might
    67     67   ** contain a few webpage entries at the beginning.
    68     68   **
    69     69   ** The page_index.h file is generated by the mkindex program which scans all
    70     70   ** source code files looking for header comments on the functions that
    71     71   ** implement command and webpages.
................................................................................
   132    132     for(i=FOSSIL_FIRST_CMD; i<MX_COMMAND; i++){
   133    133       if( strncmp(zPrefix, aCommand[i].zName, nPrefix)==0 ){
   134    134         blob_appendf(pList, " %s", aCommand[i].zName);
   135    135       }
   136    136     }
   137    137   }
   138    138   
          139  +/*
          140  +** Attempt to reformat plain-text help into HTML for display on a webpage.
          141  +**
          142  +** The HTML output is appended to Blob pHtml, which should already be
          143  +** initialized.
          144  +*/
          145  +static void help_to_html(const char *zHelp, Blob *pHtml){
          146  +  char *s;
          147  +  char *d;
          148  +  char *z;
          149  +
          150  +  /* Transform "%fossil" into just "fossil" */
          151  +  z = s = d = mprintf("%s", zHelp);
          152  +  while( *s ){
          153  +    if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){
          154  +      s++;
          155  +    }else{
          156  +      *d++ = *s++;
          157  +    }
          158  +  }
          159  +  *d = 0;
          160  +
          161  +  blob_appendf(pHtml, "<pre>\n%h\n</pre>\n", z);
          162  +  fossil_free(z);
          163  +}
   139    164   
   140    165   /*
   141    166   ** COMMAND: test-all-help
   142    167   **
   143    168   ** Usage: %fossil test-all-help ?OPTIONS?
   144    169   **
   145    170   ** Show help text for commands and pages.  Useful for proof-reading.
................................................................................
   146    171   ** Defaults to just the CLI commands.  Specify --www to see only the
   147    172   ** web pages, or --everything to see both commands and pages.
   148    173   **
   149    174   ** Options:
   150    175   **    -e|--everything   Show all commands and pages.
   151    176   **    -t|--test         Include test- commands
   152    177   **    -w|--www          Show WWW pages.
          178  +**    -h|--html         Transform output to HTML.
   153    179   */
   154    180   void test_all_help_cmd(void){
   155    181     int i;
   156    182     int mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER;
          183  +  int useHtml = find_option("html","h",0)!=0;
   157    184   
   158    185     if( find_option("www","w",0) ){
   159    186       mask = CMDFLAG_WEBPAGE;
   160    187     }
   161    188     if( find_option("everything","e",0) ){
   162    189       mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE;
   163    190     }
   164    191     if( find_option("test","t",0) ){
   165    192       mask |= CMDFLAG_TEST;
   166    193     }
          194  +  if( useHtml ) fossil_print("<!--\n");
   167    195     fossil_print("Help text for:\n");
   168    196     if( mask & CMDFLAG_1ST_TIER ) fossil_print(" * Commands\n");
   169    197     if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n");
   170    198     if( mask & CMDFLAG_TEST )     fossil_print(" * Test commands\n");
   171    199     if( mask & CMDFLAG_WEBPAGE )  fossil_print(" * Web pages\n");
   172         -  fossil_print("---\n");
          200  +  if( useHtml ){
          201  +    fossil_print("-->\n");
          202  +    fossil_print("<!-- start_all_help -->\n");
          203  +  }else{
          204  +    fossil_print("---\n");
          205  +  }
   173    206     for(i=0; i<MX_COMMAND; i++){
   174    207       if( (aCommand[i].eCmdFlags & mask)==0 ) continue;
   175    208       fossil_print("# %s\n", aCommand[i].zName);
   176         -    fossil_print("%s\n\n", aCommand[i].zHelp);
          209  +    if( useHtml ){
          210  +      Blob html;
          211  +      blob_zero(&html);
          212  +      help_to_html(aCommand[i].zHelp, &html);
          213  +      fossil_print("%s\n\n", blob_str(&html));
          214  +      blob_reset(&html);
          215  +    }else{
          216  +      fossil_print("%s\n\n", aCommand[i].zHelp);
          217  +    }
   177    218     }
   178         -  fossil_print("---\n");
          219  +  if( useHtml ){
          220  +    fossil_print("<!-- end_all_help -->\n");
          221  +  }else{
          222  +    fossil_print("---\n");
          223  +  }
   179    224     version_cmd();
   180    225   }
   181    226   
   182    227   /*
   183    228   ** WEBPAGE: help
   184    229   ** URL: /help?name=CMD
   185    230   **
................................................................................
   189    234   void help_page(void){
   190    235     const char *zCmd = P("cmd");
   191    236   
   192    237     if( zCmd==0 ) zCmd = P("name");
   193    238     style_header("Command-line Help");
   194    239     if( zCmd ){
   195    240       int rc;
   196         -    char *z, *s, *d;
   197    241       const CmdOrPage *pCmd = 0;
   198    242   
   199    243       style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
   200    244       if( *zCmd=='/' ){
   201    245         /* Some of the webpages require query parameters in order to work.
   202    246         ** @ <h1>The "<a href='%R%s(zCmd)'>%s(zCmd)</a>" page:</h1> */
   203    247         @ <h1>The "%s(zCmd)" page:</h1>
................................................................................
   206    250       }
   207    251       rc = dispatch_name_search(zCmd, CMDFLAG_ANY, &pCmd);
   208    252       if( rc==1 ){
   209    253         @ unknown command: %s(zCmd)
   210    254       }else if( rc==2 ){
   211    255         @ ambiguous command prefix: %s(zCmd)
   212    256       }else{
   213         -      z = (char*)pCmd->zHelp;
   214         -      if( z[0]==0 ){
          257  +      if( pCmd->zHelp[0]==0 ){
   215    258           @ no help available for the %s(pCmd->zName) command
   216    259         }else{
   217         -        z=s=d=mprintf("%s",z);
   218         -        while( *s ){
   219         -          if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){
   220         -            s++;
   221         -          }else{
   222         -            *d++ = *s++;
   223         -          }
   224         -        }
   225         -        *d = 0;
   226         -        @ <blockquote><pre>
   227         -        @ %h(z)
   228         -        @ </pre></blockquote>
   229         -        fossil_free(z);
          260  +        @ <blockquote>
          261  +        help_to_html(pCmd->zHelp, cgi_output_blob());
          262  +        @ </blockquote>
   230    263         }
   231    264       }
   232    265     }else{
   233    266       int i, j, n;
   234    267   
   235    268       @ <h1>Available commands:</h1>
   236    269       @ <table border="0"><tr>
................................................................................
   329    362   */
   330    363   void test_all_help_page(void){
   331    364     int i;
   332    365     style_header("Testpage: All Help Text");
   333    366     for(i=0; i<MX_COMMAND; i++){
   334    367       if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
   335    368       @ <h2>%s(aCommand[i].zName):</h2>
   336         -    @ <blockquote><pre>
   337         -    @ %h(aCommand[i].zHelp)
   338         -    @ </pre></blockquote>
          369  +    @ <blockquote>
          370  +    help_to_html(aCommand[i].zHelp, cgi_output_blob());
          371  +    @ </blockquote>
   339    372     }
   340    373     style_footer();
   341    374   }
   342    375   
   343    376   static void multi_column_list(const char **azWord, int nWord){
   344    377     int i, j, len;
   345    378     int mxLen = 0;

Changes to src/file.c.

   291    291     }else{
   292    292       rc = getStat(0, 0);
   293    293     }
   294    294     return rc ? 0 : (S_ISDIR(fileStat.st_mode) ? 1 : 2);
   295    295   }
   296    296   
   297    297   /*
   298         -** Same as file_isdir(), but takes into account symlinks.
          298  +** Same as file_isdir(), but takes into account symlinks.  Return 1 if
          299  +** zFilename is a directory -OR- a symlink that points to a directory.
          300  +** Return 0 if zFilename does not exist.  Return 2 if zFilename exists
          301  +** but is something other than a directory.
   299    302   */
   300    303   int file_wd_isdir(const char *zFilename){
   301    304     int rc;
          305  +  char *zFN;
   302    306   
   303         -  if( zFilename ){
   304         -    char *zFN = mprintf("%s", zFilename);
   305         -    file_simplify_name(zFN, -1, 0);
   306         -    rc = getStat(zFN, 1);
   307         -    free(zFN);
          307  +  zFN = mprintf("%s", zFilename);
          308  +  file_simplify_name(zFN, -1, 0);
          309  +  rc = getStat(zFN, 1);
          310  +  if( rc ){
          311  +    rc = 0; /* It does not exist at all. */
          312  +  }else if( S_ISDIR(fileStat.st_mode) ){
          313  +    rc = 1; /* It exists and is a real directory. */
          314  +  }else if( S_ISLNK(fileStat.st_mode) ){
          315  +    Blob content;
          316  +    blob_read_link(&content, zFN); /* It exists and is a link. */
          317  +    rc = file_wd_isdir(blob_str(&content)); /* Points to directory? */
          318  +    blob_reset(&content);
   308    319     }else{
   309         -    rc = getStat(0, 1);
          320  +    rc = 2; /* It exists and is something else. */
   310    321     }
   311         -  return rc ? 0 : (S_ISDIR(fileStat.st_mode) ? 1 : 2);
          322  +  free(zFN);
          323  +  return rc;
   312    324   }
   313    325   
   314    326   
   315    327   /*
   316    328   ** Wrapper around the access() system call.
   317    329   */
   318    330   int file_access(const char *zFilename, int flags){
................................................................................
   469    481   int file_wd_setexe(const char *zFilename, int onoff){
   470    482     int rc = 0;
   471    483   #if !defined(_WIN32)
   472    484     struct stat buf;
   473    485     if( fossil_stat(zFilename, &buf, 1)!=0 || S_ISLNK(buf.st_mode) ) return 0;
   474    486     if( onoff ){
   475    487       int targetMode = (buf.st_mode & 0444)>>2;
   476         -    if( (buf.st_mode & 0100) == 0 ){
          488  +    if( (buf.st_mode & 0100)==0 ){
   477    489         chmod(zFilename, buf.st_mode | targetMode);
   478    490         rc = 1;
   479    491       }
   480    492     }else{
   481         -    if( (buf.st_mode & 0100) != 0 ){
          493  +    if( (buf.st_mode & 0100)!=0 ){
   482    494         chmod(zFilename, buf.st_mode & ~0111);
   483    495         rc = 1;
   484    496       }
   485    497     }
   486    498   #endif /* _WIN32 */
   487    499     return rc;
   488    500   }
................................................................................
   598    610         /*
   599    611         ** On Windows, local path looks like: C:/develop/project/file.txt
   600    612         ** The if stops us from trying to create a directory of a drive letter
   601    613         ** C: in this example.
   602    614         */
   603    615         if( !(i==2 && zName[1]==':') ){
   604    616   #endif
   605         -        if( file_mkdir(zName, forceFlag) && file_isdir(zName)!=1 ){
          617  +        if( file_mkdir(zName, forceFlag) && file_wd_isdir(zName)!=1 ){
   606    618             if (errorReturn <= 0) {
   607    619               fossil_fatal_recursive("unable to create directory %s", zName);
   608    620             }
   609    621             rc = errorReturn;
   610    622             break;
   611    623           }
   612    624   #if defined(_WIN32) || defined(__CYGWIN__)

Changes to src/finfo.c.

   703    703         const char *zPrior = db_column_text(&q,4);
   704    704         const char *zParent = db_column_text(&q,5);
   705    705         int isExec = db_column_int(&q,6);
   706    706         int isAux = db_column_int(&q,7);
   707    707         @ <tr>
   708    708         @ <td><a href='%R/finfo?name=%t(zName)'>%h(zName)</a></td>
   709    709         if( zParent ){
   710         -        @ <td><a href='%R/info/%!S(zPid)'>%S(zParent)</a></td>
          710  +        @ <td><a href='%R/info/%!S(zParent)'>%S(zParent)</a></td>
   711    711         }else{
   712    712           @ <td><i>(New)</i></td>
   713    713         }
   714    714         @ <td align='center'>%s(isAux?"&#x2713;":"")</td>
   715    715         if( zFid ){
   716    716           @ <td><a href='%R/info/%!S(zFid)'>%S(zFid)</a></td>
   717    717         }else{

Changes to src/main.mk.

   496    496                    -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
   497    497                    -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
   498    498                    -DSQLITE_OMIT_DECLTYPE \
   499    499                    -DSQLITE_OMIT_DEPRECATED \
   500    500                    -DSQLITE_OMIT_PROGRESS_CALLBACK \
   501    501                    -DSQLITE_OMIT_SHARED_CACHE \
   502    502                    -DSQLITE_OMIT_LOAD_EXTENSION \
          503  +                 -DSQLITE_MAX_EXPR_DEPTH=0 \
          504  +                 -DSQLITE_USE_ALLOCA \
   503    505                    -DSQLITE_ENABLE_LOCKING_STYLE=0 \
   504    506                    -DSQLITE_DEFAULT_FILE_FORMAT=4 \
   505    507                    -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
   506    508                    -DSQLITE_ENABLE_FTS4 \
   507    509                    -DSQLITE_ENABLE_FTS3_PARENTHESIS \
   508    510                    -DSQLITE_ENABLE_DBSTAT_VTAB \
   509    511                    -DSQLITE_ENABLE_JSON1 \

Changes to src/makemake.tcl.

   162    162     -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1
   163    163     -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
   164    164     -DSQLITE_OMIT_DECLTYPE
   165    165     -DSQLITE_OMIT_DEPRECATED
   166    166     -DSQLITE_OMIT_PROGRESS_CALLBACK
   167    167     -DSQLITE_OMIT_SHARED_CACHE
   168    168     -DSQLITE_OMIT_LOAD_EXTENSION
          169  +  -DSQLITE_MAX_EXPR_DEPTH=0
          170  +  -DSQLITE_USE_ALLOCA
   169    171     -DSQLITE_ENABLE_LOCKING_STYLE=0
   170    172     -DSQLITE_DEFAULT_FILE_FORMAT=4
   171    173     -DSQLITE_ENABLE_EXPLAIN_COMMENTS
   172    174     -DSQLITE_ENABLE_FTS4
   173    175     -DSQLITE_ENABLE_FTS3_PARENTHESIS
   174    176     -DSQLITE_ENABLE_DBSTAT_VTAB
   175    177     -DSQLITE_ENABLE_JSON1
................................................................................
   665    667   endif
   666    668   
   667    669   #### The directories where the OpenSSL include and library files are located.
   668    670   #    The recommended usage here is to use the Sysinternals junction tool
   669    671   #    to create a hard link between an "openssl-1.x" sub-directory of the
   670    672   #    Fossil source code directory and the target OpenSSL source directory.
   671    673   #
   672         -OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2i
          674  +OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2j
   673    675   OPENSSLINCDIR = $(OPENSSLDIR)/include
   674    676   OPENSSLLIBDIR = $(OPENSSLDIR)
   675    677   
   676    678   #### Either the directory where the Tcl library is installed or the Tcl
   677    679   #    source code directory resides (depending on the value of the macro
   678    680   #    FOSSIL_TCL_SOURCE).  If this points to the Tcl install directory,
   679    681   #    this directory must have "include" and "lib" sub-directories.  If
................................................................................
  1495   1497   
  1496   1498   # Enable support for the SQLite Encryption Extension?
  1497   1499   !ifndef USE_SEE
  1498   1500   USE_SEE = 0
  1499   1501   !endif
  1500   1502   
  1501   1503   !if $(FOSSIL_ENABLE_SSL)!=0
  1502         -SSLDIR    = $(B)\compat\openssl-1.0.2i
         1504  +SSLDIR    = $(B)\compat\openssl-1.0.2j
  1503   1505   SSLINCDIR = $(SSLDIR)\inc32
  1504   1506   !if $(FOSSIL_DYNAMIC_BUILD)!=0
  1505   1507   SSLLIBDIR = $(SSLDIR)\out32dll
  1506   1508   !else
  1507   1509   SSLLIBDIR = $(SSLDIR)\out32
  1508   1510   !endif
  1509   1511   SSLLFLAGS = /nologo /opt:ref /debug

Changes to src/sqlite3.c.

   379    379   **
   380    380   ** See also: [sqlite3_libversion()],
   381    381   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
   382    382   ** [sqlite_version()] and [sqlite_source_id()].
   383    383   */
   384    384   #define SQLITE_VERSION        "3.15.0"
   385    385   #define SQLITE_VERSION_NUMBER 3015000
   386         -#define SQLITE_SOURCE_ID      "2016-09-22 18:53:13 c3774c6a5fe48af91fda28e9e18c6ed9053ea992"
          386  +#define SQLITE_SOURCE_ID      "2016-10-04 12:20:12 3a9d802fda10585654332b314d317250dc5d894e"
   387    387   
   388    388   /*
   389    389   ** CAPI3REF: Run-Time Library Version Numbers
   390    390   ** KEYWORDS: sqlite3_version, sqlite3_sourceid
   391    391   **
   392    392   ** These interfaces provide the same information as the [SQLITE_VERSION],
   393    393   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
  8913   8913     const char *zTab                /* Table name */
  8914   8914   );
  8915   8915   
  8916   8916   /*
  8917   8917   ** CAPI3REF: Set a table filter on a Session Object.
  8918   8918   **
  8919   8919   ** The second argument (xFilter) is the "filter callback". For changes to rows 
  8920         -** in tables that are not attached to the Session oject, the filter is called
         8920  +** in tables that are not attached to the Session object, the filter is called
  8921   8921   ** to determine whether changes to the table's rows should be tracked or not. 
  8922   8922   ** If xFilter returns 0, changes is not tracked. Note that once a table is 
  8923   8923   ** attached, xFilter will not be called again.
  8924   8924   */
  8925   8925   void sqlite3session_table_filter(
  8926   8926     sqlite3_session *pSession,      /* Session object */
  8927   8927     int(*xFilter)(
................................................................................
  9179   9179   ** destroyed.
  9180   9180   **
  9181   9181   ** Assuming the changeset blob was created by one of the
  9182   9182   ** [sqlite3session_changeset()], [sqlite3changeset_concat()] or
  9183   9183   ** [sqlite3changeset_invert()] functions, all changes within the changeset 
  9184   9184   ** that apply to a single table are grouped together. This means that when 
  9185   9185   ** an application iterates through a changeset using an iterator created by 
  9186         -** this function, all changes that relate to a single table are visted 
         9186  +** this function, all changes that relate to a single table are visited 
  9187   9187   ** consecutively. There is no chance that the iterator will visit a change 
  9188   9188   ** the applies to table X, then one for table Y, and then later on visit 
  9189   9189   ** another change for table X.
  9190   9190   */
  9191   9191   int sqlite3changeset_start(
  9192   9192     sqlite3_changeset_iter **pp,    /* OUT: New changeset iterator handle */
  9193   9193     int nChangeset,                 /* Size of changeset blob in bytes */
................................................................................
  9266   9266   ** This function is used to find which columns comprise the PRIMARY KEY of
  9267   9267   ** the table modified by the change that iterator pIter currently points to.
  9268   9268   ** If successful, *pabPK is set to point to an array of nCol entries, where
  9269   9269   ** nCol is the number of columns in the table. Elements of *pabPK are set to
  9270   9270   ** 0x01 if the corresponding column is part of the tables primary key, or
  9271   9271   ** 0x00 if it is not.
  9272   9272   **
  9273         -** If argumet pnCol is not NULL, then *pnCol is set to the number of columns
         9273  +** If argument pnCol is not NULL, then *pnCol is set to the number of columns
  9274   9274   ** in the table.
  9275   9275   **
  9276   9276   ** If this function is called when the iterator does not point to a valid
  9277   9277   ** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
  9278   9278   ** SQLITE_OK is returned and the output variables populated as described
  9279   9279   ** above.
  9280   9280   */
................................................................................
  9541   9541   ** to the changegroup.
  9542   9542   **
  9543   9543   ** Rows within the changeset and changegroup are identified by the values in
  9544   9544   ** their PRIMARY KEY columns. A change in the changeset is considered to
  9545   9545   ** apply to the same row as a change already present in the changegroup if
  9546   9546   ** the two rows have the same primary key.
  9547   9547   **
  9548         -** Changes to rows that that do not already appear in the changegroup are
         9548  +** Changes to rows that do not already appear in the changegroup are
  9549   9549   ** simply copied into it. Or, if both the new changeset and the changegroup
  9550   9550   ** contain changes that apply to a single row, the final contents of the
  9551   9551   ** changegroup depends on the type of each change, as follows:
  9552   9552   **
  9553   9553   ** <table border=1 style="margin-left:8ex;margin-right:8ex">
  9554   9554   **   <tr><th style="white-space:pre">Existing Change  </th>
  9555   9555   **       <th style="white-space:pre">New Change       </th>
................................................................................
 11409  11409   #define TK_USING                          125
 11410  11410   #define TK_ORDER                          126
 11411  11411   #define TK_GROUP                          127
 11412  11412   #define TK_HAVING                         128
 11413  11413   #define TK_LIMIT                          129
 11414  11414   #define TK_WHERE                          130
 11415  11415   #define TK_INTO                           131
 11416         -#define TK_INTEGER                        132
 11417         -#define TK_FLOAT                          133
 11418         -#define TK_BLOB                           134
        11416  +#define TK_FLOAT                          132
        11417  +#define TK_BLOB                           133
        11418  +#define TK_INTEGER                        134
 11419  11419   #define TK_VARIABLE                       135
 11420  11420   #define TK_CASE                           136
 11421  11421   #define TK_WHEN                           137
 11422  11422   #define TK_THEN                           138
 11423  11423   #define TK_ELSE                           139
 11424  11424   #define TK_INDEX                          140
 11425  11425   #define TK_ALTER                          141
................................................................................
 12680  12680   #define OP_SorterInsert  125
 12681  12681   #define OP_IdxInsert     126 /* synopsis: key=r[P2]                        */
 12682  12682   #define OP_IdxDelete     127 /* synopsis: key=r[P2@P3]                     */
 12683  12683   #define OP_Seek          128 /* synopsis: Move P3 to P1.rowid              */
 12684  12684   #define OP_IdxRowid      129 /* synopsis: r[P2]=rowid                      */
 12685  12685   #define OP_Destroy       130
 12686  12686   #define OP_Clear         131
 12687         -#define OP_ResetSorter   132
 12688         -#define OP_Real          133 /* same as TK_FLOAT, synopsis: r[P2]=P4       */
        12687  +#define OP_Real          132 /* same as TK_FLOAT, synopsis: r[P2]=P4       */
        12688  +#define OP_ResetSorter   133
 12689  12689   #define OP_CreateIndex   134 /* synopsis: r[P2]=root iDb=P1                */
 12690  12690   #define OP_CreateTable   135 /* synopsis: r[P2]=root iDb=P1                */
 12691  12691   #define OP_ParseSchema   136
 12692  12692   #define OP_LoadAnalysis  137
 12693  12693   #define OP_DropTable     138
 12694  12694   #define OP_DropIndex     139
 12695  12695   #define OP_DropTrigger   140
................................................................................
 12739  12739   /*  72 */ 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10,\
 12740  12740   /*  80 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00,\
 12741  12741   /*  88 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\
 12742  12742   /*  96 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
 12743  12743   /* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
 12744  12744   /* 112 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
 12745  12745   /* 120 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00,\
 12746         -/* 128 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10,\
        12746  +/* 128 */ 0x00, 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10,\
 12747  12747   /* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,\
 12748  12748   /* 144 */ 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\
 12749  12749   /* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\
 12750  12750   /* 160 */ 0x00, 0x00, 0x00,}
 12751  12751   
 12752  12752   /* The sqlite3P2Values() routine is able to run faster if it knows
 12753  12753   ** the value of the largest JUMP opcode.  The smaller the maximum
................................................................................
 14961  14961   #define EP_MemToken  0x010000 /* Need to sqlite3DbFree() Expr.zToken */
 14962  14962   #define EP_NoReduce  0x020000 /* Cannot EXPRDUP_REDUCE this Expr */
 14963  14963   #define EP_Unlikely  0x040000 /* unlikely() or likelihood() function */
 14964  14964   #define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */
 14965  14965   #define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */
 14966  14966   #define EP_Subquery  0x200000 /* Tree contains a TK_SELECT operator */
 14967  14967   #define EP_Alias     0x400000 /* Is an alias for a result set column */
        14968  +#define EP_Leaf      0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */
 14968  14969   
 14969  14970   /*
 14970  14971   ** Combinations of two or more EP_* flags
 14971  14972   */
 14972  14973   #define EP_Propagate (EP_Collate|EP_Subquery) /* Propagate these bits up tree */
 14973  14974   
 14974  14975   /*
................................................................................
 15512  15513     u8 nTempReg;         /* Number of temporary registers in aTempReg[] */
 15513  15514     u8 isMultiWrite;     /* True if statement may modify/insert multiple rows */
 15514  15515     u8 mayAbort;         /* True if statement may throw an ABORT exception */
 15515  15516     u8 hasCompound;      /* Need to invoke convertCompoundSelectToSubquery() */
 15516  15517     u8 okConstFactor;    /* OK to factor out constants */
 15517  15518     u8 disableLookaside; /* Number of times lookaside has been disabled */
 15518  15519     u8 nColCache;        /* Number of entries in aColCache[] */
 15519         -  int aTempReg[8];     /* Holding area for temporary registers */
 15520  15520     int nRangeReg;       /* Size of the temporary register block */
 15521  15521     int iRangeReg;       /* First register in temporary register block */
 15522  15522     int nErr;            /* Number of errors seen */
 15523  15523     int nTab;            /* Number of previously allocated VDBE cursors */
 15524  15524     int nMem;            /* Number of memory cells used so far */
 15525         -  int nSet;            /* Number of sets used so far */
 15526  15525     int nOpAlloc;        /* Number of slots allocated for Vdbe.aOp[] */
 15527  15526     int szOpAlloc;       /* Bytes of memory space allocated for Vdbe.aOp[] */
 15528         -  int iFixedOp;        /* Never back out opcodes iFixedOp-1 or earlier */
 15529  15527     int ckBase;          /* Base register of data during check constraints */
 15530  15528     int iSelfTab;        /* Table of an index whose exprs are being coded */
 15531  15529     int iCacheLevel;     /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
 15532  15530     int iCacheCnt;       /* Counter used to generate aColCache[].lru values */
 15533  15531     int nLabel;          /* Number of labels used */
 15534  15532     int *aLabel;         /* Space to hold the labels */
 15535         -  struct yColCache {
 15536         -    int iTable;           /* Table cursor number */
 15537         -    i16 iColumn;          /* Table column number */
 15538         -    u8 tempReg;           /* iReg is a temp register that needs to be freed */
 15539         -    int iLevel;           /* Nesting level */
 15540         -    int iReg;             /* Reg with value of this column. 0 means none. */
 15541         -    int lru;              /* Least recently used entry has the smallest value */
 15542         -  } aColCache[SQLITE_N_COLCACHE];  /* One for each column cache entry */
 15543  15533     ExprList *pConstExpr;/* Constant expressions */
 15544  15534     Token constraintName;/* Name of the constraint currently being parsed */
 15545  15535     yDbMask writeMask;   /* Start a write transaction on these databases */
 15546  15536     yDbMask cookieMask;  /* Bitmask of schema verified databases */
 15547         -  int cookieValue[SQLITE_MAX_ATTACHED+2];  /* Values of cookies to verify */
 15548  15537     int regRowid;        /* Register holding rowid of CREATE TABLE entry */
 15549  15538     int regRoot;         /* Register holding root page number for new objects */
 15550  15539     int nMaxArg;         /* Max args passed to user function by sub-program */
 15551  15540   #if SELECTTRACE_ENABLED
 15552  15541     int nSelect;         /* Number of SELECT statements seen */
 15553  15542     int nSelectIndent;   /* How far to indent SELECTTRACE() output */
 15554  15543   #endif
 15555  15544   #ifndef SQLITE_OMIT_SHARED_CACHE
 15556  15545     int nTableLock;        /* Number of locks in aTableLock */
 15557  15546     TableLock *aTableLock; /* Required table locks for shared-cache mode */
 15558  15547   #endif
 15559  15548     AutoincInfo *pAinc;  /* Information about AUTOINCREMENT counters */
 15560         -
 15561         -  /* Information used while coding trigger programs. */
 15562  15549     Parse *pToplevel;    /* Parse structure for main program (or NULL) */
 15563  15550     Table *pTriggerTab;  /* Table triggers are being coded for */
 15564  15551     int addrCrTab;       /* Address of OP_CreateTable opcode on CREATE TABLE */
 15565  15552     u32 nQueryLoop;      /* Est number of iterations of a query (10*log2(N)) */
 15566  15553     u32 oldmask;         /* Mask of old.* columns referenced */
 15567  15554     u32 newmask;         /* Mask of new.* columns referenced */
 15568  15555     u8 eTriggerOp;       /* TK_UPDATE, TK_INSERT or TK_DELETE */
 15569  15556     u8 eOrconf;          /* Default ON CONFLICT policy for trigger steps */
 15570  15557     u8 disableTriggers;  /* True to disable triggers */
        15558  +
        15559  +  /**************************************************************************
        15560  +  ** Fields above must be initialized to zero.  The fields that follow,
        15561  +  ** down to the beginning of the recursive section, do not need to be
        15562  +  ** initialized as they will be set before being used.  The boundary is
        15563  +  ** determined by offsetof(Parse,aColCache).
        15564  +  **************************************************************************/
        15565  +
        15566  +  struct yColCache {
        15567  +    int iTable;           /* Table cursor number */
        15568  +    i16 iColumn;          /* Table column number */
        15569  +    u8 tempReg;           /* iReg is a temp register that needs to be freed */
        15570  +    int iLevel;           /* Nesting level */
        15571  +    int iReg;             /* Reg with value of this column. 0 means none. */
        15572  +    int lru;              /* Least recently used entry has the smallest value */
        15573  +  } aColCache[SQLITE_N_COLCACHE];  /* One for each column cache entry */
        15574  +  int aTempReg[8];        /* Holding area for temporary registers */
        15575  +  Token sNameToken;       /* Token with unqualified schema object name */
        15576  +  Token sLastToken;       /* The last token parsed */
 15571  15577   
 15572  15578     /************************************************************************
 15573  15579     ** Above is constant between recursions.  Below is reset before and after
 15574  15580     ** each recursion.  The boundary between these two regions is determined
 15575  15581     ** using offsetof(Parse,nVar) so the nVar field must be the first field
 15576  15582     ** in the recursive region.
 15577  15583     ************************************************************************/
................................................................................
 15580  15586     int nzVar;                /* Number of available slots in azVar[] */
 15581  15587     u8 iPkSortOrder;          /* ASC or DESC for INTEGER PRIMARY KEY */
 15582  15588     u8 explain;               /* True if the EXPLAIN flag is found on the query */
 15583  15589   #ifndef SQLITE_OMIT_VIRTUALTABLE
 15584  15590     u8 declareVtab;           /* True if inside sqlite3_declare_vtab() */
 15585  15591     int nVtabLock;            /* Number of virtual tables to lock */
 15586  15592   #endif
 15587         -  int nAlias;               /* Number of aliased result set columns */
 15588  15593     int nHeight;              /* Expression tree height of current sub-select */
 15589  15594   #ifndef SQLITE_OMIT_EXPLAIN
 15590  15595     int iSelectId;            /* ID of current select for EXPLAIN output */
 15591  15596     int iNextSelectId;        /* Next available select ID for EXPLAIN output */
 15592  15597   #endif
 15593  15598     char **azVar;             /* Pointers to names of parameters */
 15594  15599     Vdbe *pReprepare;         /* VM being reprepared (sqlite3Reprepare()) */
 15595  15600     const char *zTail;        /* All SQL text past the last semicolon parsed */
 15596  15601     Table *pNewTable;         /* A table being constructed by CREATE TABLE */
 15597  15602     Trigger *pNewTrigger;     /* Trigger under construct by a CREATE TRIGGER */
 15598  15603     const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
 15599         -  Token sNameToken;         /* Token with unqualified schema object name */
 15600         -  Token sLastToken;         /* The last token parsed */
 15601  15604   #ifndef SQLITE_OMIT_VIRTUALTABLE
 15602  15605     Token sArg;               /* Complete text of a module argument */
 15603  15606     Table **apVtabLock;       /* Pointer to virtual tables needing locking */
 15604  15607   #endif
 15605  15608     Table *pZombieTab;        /* List of Table objects to delete after code gen */
 15606  15609     TriggerPrg *pTriggerPrg;  /* Linked list of coded triggers */
 15607  15610     With *pWith;              /* Current WITH clause, or NULL */
 15608  15611     With *pWithToFree;        /* Free this WITH object at the end of the parse */
 15609  15612   };
 15610  15613   
        15614  +/*
        15615  +** Sizes and pointers of various parts of the Parse object.
        15616  +*/
        15617  +#define PARSE_HDR_SZ offsetof(Parse,aColCache) /* Recursive part w/o aColCache*/
        15618  +#define PARSE_RECURSE_SZ offsetof(Parse,nVar)  /* Recursive part */
        15619  +#define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */
        15620  +#define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ)  /* Pointer to tail */
        15621  +
 15611  15622   /*
 15612  15623   ** Return true if currently inside an sqlite3_declare_vtab() call.
 15613  15624   */
 15614  15625   #ifdef SQLITE_OMIT_VIRTUALTABLE
 15615  15626     #define IN_DECLARE_VTAB 0
 15616  15627   #else
 15617  15628     #define IN_DECLARE_VTAB (pParse->declareVtab)
................................................................................
 16167  16178   SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
 16168  16179   SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
 16169  16180   SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
 16170  16181   SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*, const Token*);
 16171  16182   SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
 16172  16183   SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
 16173  16184   SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*);
 16174         -SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*);
        16185  +SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
 16175  16186   SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
 16176  16187   SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
 16177  16188   SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
 16178  16189   SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int);
 16179  16190   SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);
 16180  16191   SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*);
 16181  16192   SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*);
................................................................................
 16987  16998   ** Bit 0x20 is set if the mapped character requires translation to upper
 16988  16999   ** case. i.e. if the character is a lower-case ASCII character.
 16989  17000   ** If x is a lower-case ASCII character, then its upper-case equivalent
 16990  17001   ** is (x - 0x20). Therefore toupper() can be implemented as:
 16991  17002   **
 16992  17003   **   (x & ~(map[x]&0x20))
 16993  17004   **
 16994         -** Standard function tolower() is implemented using the sqlite3UpperToLower[]
        17005  +** The equivalent of tolower() is implemented using the sqlite3UpperToLower[]
 16995  17006   ** array. tolower() is used more often than toupper() by SQLite.
 16996  17007   **
 16997         -** Bit 0x40 is set if the character non-alphanumeric and can be used in an 
        17008  +** Bit 0x40 is set if the character is non-alphanumeric and can be used in an 
 16998  17009   ** SQLite identifier.  Identifiers are alphanumerics, "_", "$", and any
 16999  17010   ** non-ASCII UTF character. Hence the test for whether or not a character is
 17000  17011   ** part of an identifier is 0x46.
 17001         -**
 17002         -** SQLite's versions are identical to the standard versions assuming a
 17003         -** locale of "C". They are implemented as macros in sqliteInt.h.
 17004  17012   */
 17005  17013   #ifdef SQLITE_ASCII
 17006  17014   SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = {
 17007  17015     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 00..07    ........ */
 17008  17016     0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,  /* 08..0f    ........ */
 17009  17017     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 10..17    ........ */
 17010  17018     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 18..1f    ........ */
................................................................................
 17069  17077   ** page size in bytes.
 17070  17078   */
 17071  17079   #ifndef SQLITE_SORTER_PMASZ
 17072  17080   # define SQLITE_SORTER_PMASZ 250
 17073  17081   #endif
 17074  17082   
 17075  17083   /* Statement journals spill to disk when their size exceeds the following
 17076         -** threashold (in bytes). 0 means that statement journals are created and
        17084  +** threshold (in bytes). 0 means that statement journals are created and
 17077  17085   ** written to disk immediately (the default behavior for SQLite versions
 17078  17086   ** before 3.12.0).  -1 means always keep the entire statement journal in
 17079  17087   ** memory.  (The statement journal is also always held entirely in memory
 17080  17088   ** if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this
 17081  17089   ** setting.)
 17082  17090   */
 17083  17091   #ifndef SQLITE_STMTJRNL_SPILL 
................................................................................
 17157  17165   };
 17158  17166   
 17159  17167   
 17160  17168   /*
 17161  17169   ** The value of the "pending" byte must be 0x40000000 (1 byte past the
 17162  17170   ** 1-gibabyte boundary) in a compatible database.  SQLite never uses
 17163  17171   ** the database page that contains the pending byte.  It never attempts
 17164         -** to read or write that page.  The pending byte page is set assign
        17172  +** to read or write that page.  The pending byte page is set aside
 17165  17173   ** for use by the VFS layers as space for managing file locks.
 17166  17174   **
 17167  17175   ** During testing, it is often desirable to move the pending byte to
 17168  17176   ** a different position in the file.  This allows code that has to
 17169  17177   ** deal with the pending byte to run on files that are much smaller
 17170  17178   ** than 1 GiB.  The sqlite3_test_control() interface can be used to
 17171  17179   ** move the pending byte.
................................................................................
 17717  17725   ** Boolean values
 17718  17726   */
 17719  17727   typedef unsigned Bool;
 17720  17728   
 17721  17729   /* Opaque type used by code in vdbesort.c */
 17722  17730   typedef struct VdbeSorter VdbeSorter;
 17723  17731   
 17724         -/* Opaque type used by the explainer */
 17725         -typedef struct Explain Explain;
 17726         -
 17727  17732   /* Elements of the linked list at Vdbe.pAuxData */
 17728  17733   typedef struct AuxData AuxData;
 17729  17734   
 17730  17735   /* Types of VDBE cursors */
 17731  17736   #define CURTYPE_BTREE       0
 17732  17737   #define CURTYPE_SORTER      1
 17733  17738   #define CURTYPE_VTAB        2
................................................................................
 17794  17799     u32 *aOffset;         /* Pointer to aType[nField] */
 17795  17800     u32 aType[1];         /* Type values for all entries in the record */
 17796  17801     /* 2*nField extra array elements allocated for aType[], beyond the one
 17797  17802     ** static element declared in the structure.  nField total array slots for
 17798  17803     ** aType[] and nField+1 array slots for aOffset[] */
 17799  17804   };
 17800  17805   
        17806  +
        17807  +/*
        17808  +** A value for VdbeCursor.cacheStatus that means the cache is always invalid.
        17809  +*/
        17810  +#define CACHE_STALE 0
        17811  +
 17801  17812   /*
 17802  17813   ** When a sub-program is executed (OP_Program), a structure of this type
 17803  17814   ** is allocated to store the current value of the program counter, as
 17804  17815   ** well as the current memory cell array and various other frame specific
 17805  17816   ** values stored in the Vdbe struct. When the sub-program is finished, 
 17806  17817   ** these values are copied back to the Vdbe from the VdbeFrame structure,
 17807  17818   ** restoring the state of the VM to as it was before the sub-program
................................................................................
 17838  17849     int nChildCsr;          /* Number of cursors for child frame */
 17839  17850     int nChange;            /* Statement changes (Vdbe.nChange)     */
 17840  17851     int nDbChange;          /* Value of db->nChange */
 17841  17852   };
 17842  17853   
 17843  17854   #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
 17844  17855   
 17845         -/*
 17846         -** A value for VdbeCursor.cacheValid that means the cache is always invalid.
 17847         -*/
 17848         -#define CACHE_STALE 0
 17849         -
 17850  17856   /*
 17851  17857   ** Internally, the vdbe manipulates nearly all SQL values as Mem
 17852  17858   ** structures. Each Mem struct may cache multiple representations (string,
 17853  17859   ** integer etc.) of the same value.
 17854  17860   */
 17855  17861   struct Mem {
 17856  17862     union MemValue {
................................................................................
 17983  17989     int isError;            /* Error code returned by the function. */
 17984  17990     u8 skipFlag;            /* Skip accumulator loading if true */
 17985  17991     u8 fErrorOrAux;         /* isError!=0 or pVdbe->pAuxData modified */
 17986  17992     u8 argc;                /* Number of arguments */
 17987  17993     sqlite3_value *argv[1]; /* Argument set */
 17988  17994   };
 17989  17995   
 17990         -/*
 17991         -** An Explain object accumulates indented output which is helpful
 17992         -** in describing recursive data structures.
 17993         -*/
 17994         -struct Explain {
 17995         -  Vdbe *pVdbe;       /* Attach the explanation to this Vdbe */
 17996         -  StrAccum str;      /* The string being accumulated */
 17997         -  int nIndent;       /* Number of elements in aIndent */
 17998         -  u16 aIndent[100];  /* Levels of indentation */
 17999         -  char zBase[100];   /* Initial space */
 18000         -};
 18001         -
 18002  17996   /* A bitfield type for use inside of structures.  Always follow with :N where
 18003  17997   ** N is the number of bits.
 18004  17998   */
 18005  17999   typedef unsigned bft;  /* Bit Field Type */
 18006  18000   
 18007  18001   typedef struct ScanStatus ScanStatus;
 18008  18002   struct ScanStatus {
................................................................................
 18019  18013   ** state of the virtual machine.
 18020  18014   **
 18021  18015   ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
 18022  18016   ** is really a pointer to an instance of this structure.
 18023  18017   */
 18024  18018   struct Vdbe {
 18025  18019     sqlite3 *db;            /* The database connection that owns this statement */
        18020  +  Vdbe *pPrev,*pNext;     /* Linked list of VDBEs with the same Vdbe.db */
        18021  +  Parse *pParse;          /* Parsing context used to create this Vdbe */
        18022  +  ynVar nVar;             /* Number of entries in aVar[] */
        18023  +  ynVar nzVar;            /* Number of entries in azVar[] */
        18024  +  u32 magic;              /* Magic number for sanity checking */
        18025  +  int nMem;               /* Number of memory locations currently allocated */
        18026  +  int nCursor;            /* Number of slots in apCsr[] */
        18027  +  u32 cacheCtr;           /* VdbeCursor row cache generation counter */
        18028  +  int pc;                 /* The program counter */
        18029  +  int rc;                 /* Value to return */
        18030  +  int nChange;            /* Number of db changes made since last reset */
        18031  +  int iStatement;         /* Statement number (or 0 if has not opened stmt) */
        18032  +  i64 iCurrentTime;       /* Value of julianday('now') for this statement */
        18033  +  i64 nFkConstraint;      /* Number of imm. FK constraints this VM */
        18034  +  i64 nStmtDefCons;       /* Number of def. constraints when stmt started */
        18035  +  i64 nStmtDefImmCons;    /* Number of def. imm constraints when stmt started */
        18036  +
        18037  +  /* When allocating a new Vdbe object, all of the fields below should be
        18038  +  ** initialized to zero or NULL */
        18039  +
 18026  18040     Op *aOp;                /* Space to hold the virtual machine's program */
 18027  18041     Mem *aMem;              /* The memory locations */
 18028  18042     Mem **apArg;            /* Arguments to currently executing user function */
 18029  18043     Mem *aColName;          /* Column names to return */
 18030  18044     Mem *pResultSet;        /* Pointer to an array of results */
 18031         -  Parse *pParse;          /* Parsing context used to create this Vdbe */
 18032         -  int nMem;               /* Number of memory locations currently allocated */
 18033         -  int nOp;                /* Number of instructions in the program */
 18034         -  int nCursor;            /* Number of slots in apCsr[] */
 18035         -  u32 magic;              /* Magic number for sanity checking */
 18036  18045     char *zErrMsg;          /* Error message written here */
 18037         -  Vdbe *pPrev,*pNext;     /* Linked list of VDBEs with the same Vdbe.db */
 18038  18046     VdbeCursor **apCsr;     /* One element of this array for each open cursor */
 18039  18047     Mem *aVar;              /* Values for the OP_Variable opcode. */
 18040  18048     char **azVar;           /* Name of variables */
 18041         -  ynVar nVar;             /* Number of entries in aVar[] */
 18042         -  ynVar nzVar;            /* Number of entries in azVar[] */
 18043         -  u32 cacheCtr;           /* VdbeCursor row cache generation counter */
 18044         -  int pc;                 /* The program counter */
 18045         -  int rc;                 /* Value to return */
        18049  +#ifndef SQLITE_OMIT_TRACE
        18050  +  i64 startTime;          /* Time when query started - used for profiling */
        18051  +#endif
        18052  +  int nOp;                /* Number of instructions in the program */
 18046  18053   #ifdef SQLITE_DEBUG
 18047  18054     int rcApp;              /* errcode set by sqlite3_result_error_code() */
 18048  18055   #endif
 18049  18056     u16 nResColumn;         /* Number of columns in one row of the result set */
 18050  18057     u8 errorAction;         /* Recovery action to do in case of an error */
        18058  +  u8 minWriteFileFormat;  /* Minimum file format for writable database files */
 18051  18059     bft expired:1;          /* True if the VM needs to be recompiled */
 18052  18060     bft doingRerun:1;       /* True if rerunning after an auto-reprepare */
 18053         -  u8 minWriteFileFormat;  /* Minimum file format for writable database files */
 18054  18061     bft explain:2;          /* True if EXPLAIN present on SQL command */
 18055  18062     bft changeCntOn:1;      /* True to update the change-counter */
 18056  18063     bft runOnlyOnce:1;      /* Automatically expire on reset */
 18057  18064     bft usesStmtJournal:1;  /* True if uses a statement journal */
 18058  18065     bft readOnly:1;         /* True for statements that do not write */
 18059  18066     bft bIsReader:1;        /* True for statements that read */
 18060  18067     bft isPrepareV2:1;      /* True if prepared with prepare_v2() */
 18061         -  int nChange;            /* Number of db changes made since last reset */
 18062  18068     yDbMask btreeMask;      /* Bitmask of db->aDb[] entries referenced */
 18063  18069     yDbMask lockMask;       /* Subset of btreeMask that requires a lock */
 18064         -  int iStatement;         /* Statement number (or 0 if has not opened stmt) */
 18065  18070     u32 aCounter[5];        /* Counters used by sqlite3_stmt_status() */
 18066         -#ifndef SQLITE_OMIT_TRACE
 18067         -  i64 startTime;          /* Time when query started - used for profiling */
 18068         -#endif
 18069         -  i64 iCurrentTime;       /* Value of julianday('now') for this statement */
 18070         -  i64 nFkConstraint;      /* Number of imm. FK constraints this VM */
 18071         -  i64 nStmtDefCons;       /* Number of def. constraints when stmt started */
 18072         -  i64 nStmtDefImmCons;    /* Number of def. imm constraints when stmt started */
 18073  18071     char *zSql;             /* Text of the SQL statement that generated this */
 18074  18072     void *pFree;            /* Free this when deleting the vdbe */
 18075  18073     VdbeFrame *pFrame;      /* Parent frame */
 18076  18074     VdbeFrame *pDelFrame;   /* List of frame objects to free on VM reset */
 18077  18075     int nFrame;             /* Number of frames in pFrame list */
 18078  18076     u32 expmask;            /* Binding to these vars invalidates VM */
 18079  18077     SubProgram *pProgram;   /* Linked list of all sub-programs used by VM */
................................................................................
 18084  18082     ScanStatus *aScan;      /* Scan definitions for sqlite3_stmt_scanstatus() */
 18085  18083   #endif
 18086  18084   };
 18087  18085   
 18088  18086   /*
 18089  18087   ** The following are allowed values for Vdbe.magic
 18090  18088   */
 18091         -#define VDBE_MAGIC_INIT     0x26bceaa5    /* Building a VDBE program */
 18092         -#define VDBE_MAGIC_RUN      0xbdf20da3    /* VDBE is ready to execute */
 18093         -#define VDBE_MAGIC_HALT     0x519c2973    /* VDBE has completed execution */
 18094         -#define VDBE_MAGIC_DEAD     0xb606c3c8    /* The VDBE has been deallocated */
        18089  +#define VDBE_MAGIC_INIT     0x16bceaa5    /* Building a VDBE program */
        18090  +#define VDBE_MAGIC_RUN      0x2df20da3    /* VDBE is ready to execute */
        18091  +#define VDBE_MAGIC_HALT     0x319c2973    /* VDBE has completed execution */
        18092  +#define VDBE_MAGIC_RESET    0x48fa9f76    /* Reset and ready to run again */
        18093  +#define VDBE_MAGIC_DEAD     0x5606c3c8    /* The VDBE has been deallocated */
 18095  18094   
 18096  18095   /*
 18097  18096   ** Structure used to store the context required by the 
 18098  18097   ** sqlite3_preupdate_*() API functions.
 18099  18098   */
 18100  18099   struct PreUpdate {
 18101  18100     Vdbe *v;
................................................................................
 28773  28772   /*
 28774  28773   ** The hashing function.
 28775  28774   */
 28776  28775   static unsigned int strHash(const char *z){
 28777  28776     unsigned int h = 0;
 28778  28777     unsigned char c;
 28779  28778     while( (c = (unsigned char)*z++)!=0 ){     /*OPTIMIZATION-IF-TRUE*/
 28780         -    h = (h<<3) ^ h ^ sqlite3UpperToLower[c];
        28779  +    /* Knuth multiplicative hashing.  (Sorting & Searching, p. 510).
        28780  +    ** 0x9e3779b1 is 2654435761 which is the closest prime number to
        28781  +    ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */
        28782  +    h += sqlite3UpperToLower[c];
        28783  +    h *= 0x9e3779b1;
 28781  28784     }
 28782  28785     return h;
 28783  28786   }
 28784  28787   
 28785  28788   
 28786  28789   /* Link pNew element into the hash table pH.  If pEntry!=0 then also
 28787  28790   ** insert pNew into the pEntry hash bucket.
................................................................................
 29129  29132       /* 125 */ "SorterInsert"     OpHelp(""),
 29130  29133       /* 126 */ "IdxInsert"        OpHelp("key=r[P2]"),
 29131  29134       /* 127 */ "IdxDelete"        OpHelp("key=r[P2@P3]"),
 29132  29135       /* 128 */ "Seek"             OpHelp("Move P3 to P1.rowid"),
 29133  29136       /* 129 */ "IdxRowid"         OpHelp("r[P2]=rowid"),
 29134  29137       /* 130 */ "Destroy"          OpHelp(""),
 29135  29138       /* 131 */ "Clear"            OpHelp(""),
 29136         -    /* 132 */ "ResetSorter"      OpHelp(""),
 29137         -    /* 133 */ "Real"             OpHelp("r[P2]=P4"),
        29139  +    /* 132 */ "Real"             OpHelp("r[P2]=P4"),
        29140  +    /* 133 */ "ResetSorter"      OpHelp(""),
 29138  29141       /* 134 */ "CreateIndex"      OpHelp("r[P2]=root iDb=P1"),
 29139  29142       /* 135 */ "CreateTable"      OpHelp("r[P2]=root iDb=P1"),
 29140  29143       /* 136 */ "ParseSchema"      OpHelp(""),
 29141  29144       /* 137 */ "LoadAnalysis"     OpHelp(""),
 29142  29145       /* 138 */ "DropTable"        OpHelp(""),
 29143  29146       /* 139 */ "DropIndex"        OpHelp(""),
 29144  29147       /* 140 */ "DropTrigger"      OpHelp(""),
................................................................................
 44016  44019     Pgno pgno,                  /* Page number obtained */
 44017  44020     sqlite3_pcache_page *pPage  /* Page obtained by prior PcacheFetch() call */
 44018  44021   ){
 44019  44022     PgHdr *pPgHdr;
 44020  44023     assert( pPage!=0 );
 44021  44024     pPgHdr = (PgHdr*)pPage->pExtra;
 44022  44025     assert( pPgHdr->pPage==0 );
 44023         -  memset(pPgHdr, 0, sizeof(PgHdr));
        44026  +  memset(&pPgHdr->pDirty, 0, sizeof(PgHdr) - offsetof(PgHdr,pDirty));
 44024  44027     pPgHdr->pPage = pPage;
 44025  44028     pPgHdr->pData = pPage->pBuf;
 44026  44029     pPgHdr->pExtra = (void *)&pPgHdr[1];
 44027  44030     memset(pPgHdr->pExtra, 0, pCache->szExtra);
 44028  44031     pPgHdr->pCache = pCache;
 44029  44032     pPgHdr->pgno = pgno;
 44030  44033     pPgHdr->flags = PGHDR_CLEAN;
................................................................................
 58982  58985     const void *pKey,   /* Packed key if the btree is an index */
 58983  58986     i64 nKey,           /* Integer key for tables.  Size of pKey for indices */
 58984  58987     int bias,           /* Bias search to the high end */
 58985  58988     int *pRes           /* Write search results here */
 58986  58989   ){
 58987  58990     int rc;                    /* Status code */
 58988  58991     UnpackedRecord *pIdxKey;   /* Unpacked index key */
 58989         -  char aSpace[200];          /* Temp space for pIdxKey - to avoid a malloc */
        58992  +  char aSpace[384];          /* Temp space for pIdxKey - to avoid a malloc */
 58990  58993     char *pFree = 0;
 58991  58994   
 58992  58995     if( pKey ){
 58993  58996       assert( nKey==(i64)(int)nKey );
 58994  58997       pIdxKey = sqlite3VdbeAllocUnpackedRecord(
 58995  58998           pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree
 58996  58999       );
................................................................................
 64319  64322       nPayload = pX->nData + pX->nZero;
 64320  64323       pSrc = pX->pData;
 64321  64324       nSrc = pX->nData;
 64322  64325       assert( pPage->intKeyLeaf ); /* fillInCell() only called for leaves */
 64323  64326       nHeader += putVarint32(&pCell[nHeader], nPayload);
 64324  64327       nHeader += putVarint(&pCell[nHeader], *(u64*)&pX->nKey);
 64325  64328     }else{
 64326         -    assert( pX->nData==0 );
 64327         -    assert( pX->nZero==0 );
 64328  64329       assert( pX->nKey<=0x7fffffff && pX->pKey!=0 );
 64329  64330       nSrc = nPayload = (int)pX->nKey;
 64330  64331       pSrc = pX->pKey;
 64331  64332       nHeader += putVarint32(&pCell[nHeader], nPayload);
 64332  64333     }
 64333  64334     
 64334  64335     /* Fill in the payload */
................................................................................
 68020  68021   ** function. If an error occurs while doing so, return 0 and write an 
 68021  68022   ** error message to pErrorDb.
 68022  68023   */
 68023  68024   static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
 68024  68025     int i = sqlite3FindDbName(pDb, zDb);
 68025  68026   
 68026  68027     if( i==1 ){
 68027         -    Parse *pParse;
        68028  +    Parse sParse;
 68028  68029       int rc = 0;
 68029         -    pParse = sqlite3StackAllocZero(pErrorDb, sizeof(*pParse));
 68030         -    if( pParse==0 ){
 68031         -      sqlite3ErrorWithMsg(pErrorDb, SQLITE_NOMEM, "out of memory");
 68032         -      rc = SQLITE_NOMEM_BKPT;
 68033         -    }else{
 68034         -      pParse->db = pDb;
 68035         -      if( sqlite3OpenTempDatabase(pParse) ){
 68036         -        sqlite3ErrorWithMsg(pErrorDb, pParse->rc, "%s", pParse->zErrMsg);
 68037         -        rc = SQLITE_ERROR;
 68038         -      }
 68039         -      sqlite3DbFree(pErrorDb, pParse->zErrMsg);
 68040         -      sqlite3ParserReset(pParse);
 68041         -      sqlite3StackFree(pErrorDb, pParse);
        68030  +    memset(&sParse, 0, sizeof(sParse));
        68031  +    sParse.db = pDb;
        68032  +    if( sqlite3OpenTempDatabase(&sParse) ){
        68033  +      sqlite3ErrorWithMsg(pErrorDb, sParse.rc, "%s", sParse.zErrMsg);
        68034  +      rc = SQLITE_ERROR;
 68042  68035       }
        68036  +    sqlite3DbFree(pErrorDb, sParse.zErrMsg);
        68037  +    sqlite3ParserReset(&sParse);
 68043  68038       if( rc ){
 68044  68039         return 0;
 68045  68040       }
 68046  68041     }
 68047  68042   
 68048  68043     if( i<0 ){
 68049  68044       sqlite3ErrorWithMsg(pErrorDb, SQLITE_ERROR, "unknown database %s", zDb);
................................................................................
 69039  69034     assert( !(fg&(MEM_Str|MEM_Blob)) );
 69040  69035     assert( fg&(MEM_Int|MEM_Real) );
 69041  69036     assert( (pMem->flags&MEM_RowSet)==0 );
 69042  69037     assert( EIGHT_BYTE_ALIGNMENT(pMem) );
 69043  69038   
 69044  69039   
 69045  69040     if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
        69041  +    pMem->enc = 0;
 69046  69042       return SQLITE_NOMEM_BKPT;
 69047  69043     }
 69048  69044   
 69049  69045     /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
 69050  69046     ** string representation of the value. Then, if the required encoding
 69051  69047     ** is UTF-16le or UTF-16be do a translation.
 69052  69048     ** 
................................................................................
 70015  70011     int op;
 70016  70012     char *zVal = 0;
 70017  70013     sqlite3_value *pVal = 0;
 70018  70014     int negInt = 1;
 70019  70015     const char *zNeg = "";
 70020  70016     int rc = SQLITE_OK;
 70021  70017   
 70022         -  if( !pExpr ){
 70023         -    *ppVal = 0;
 70024         -    return SQLITE_OK;
 70025         -  }
        70018  +  assert( pExpr!=0 );
 70026  70019     while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft;
 70027  70020     if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;
 70028  70021   
 70029  70022     /* Compressed expressions only appear when parsing the DEFAULT clause
 70030  70023     ** on a table column definition, and hence only when pCtx==0.  This
 70031  70024     ** check ensures that an EP_TokenOnly expression is never passed down
 70032  70025     ** into valueFromFunction(). */
................................................................................
 70142  70135   SQLITE_PRIVATE int sqlite3ValueFromExpr(
 70143  70136     sqlite3 *db,              /* The database connection */
 70144  70137     Expr *pExpr,              /* The expression to evaluate */
 70145  70138     u8 enc,                   /* Encoding to use */
 70146  70139     u8 affinity,              /* Affinity to use */
 70147  70140     sqlite3_value **ppVal     /* Write the new value here */
 70148  70141   ){
 70149         -  return valueFromExpr(db, pExpr, enc, affinity, ppVal, 0);
        70142  +  return pExpr ? valueFromExpr(db, pExpr, enc, affinity, ppVal, 0) : 0;
 70150  70143   }
 70151  70144   
 70152  70145   #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
 70153  70146   /*
 70154  70147   ** The implementation of the sqlite_record() function. This function accepts
 70155  70148   ** a single argument of any type. The return value is a formatted database 
 70156  70149   ** record (a blob) containing the argument value.
................................................................................
 70485  70478   
 70486  70479   /*
 70487  70480   ** Create a new virtual database engine.
 70488  70481   */
 70489  70482   SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
 70490  70483     sqlite3 *db = pParse->db;
 70491  70484     Vdbe *p;
 70492         -  p = sqlite3DbMallocZero(db, sizeof(Vdbe) );
        70485  +  p = sqlite3DbMallocRawNN(db, sizeof(Vdbe) );
 70493  70486     if( p==0 ) return 0;
        70487  +  memset(&p->aOp, 0, sizeof(Vdbe)-offsetof(Vdbe,aOp));
 70494  70488     p->db = db;
 70495  70489     if( db->pVdbe ){
 70496  70490       db->pVdbe->pPrev = p;
 70497  70491     }
 70498  70492     p->pNext = db->pVdbe;
 70499  70493     p->pPrev = 0;
 70500  70494     db->pVdbe = p;
................................................................................
 70648  70642   #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
 70649  70643     pOp->zComment = 0;
 70650  70644   #endif
 70651  70645   #ifdef SQLITE_DEBUG
 70652  70646     if( p->db->flags & SQLITE_VdbeAddopTrace ){
 70653  70647       int jj, kk;
 70654  70648       Parse *pParse = p->pParse;
 70655         -    for(jj=kk=0; jj<SQLITE_N_COLCACHE; jj++){
        70649  +    for(jj=kk=0; jj<pParse->nColCache; jj++){
 70656  70650         struct yColCache *x = pParse->aColCache + jj;
 70657         -      if( x->iLevel>pParse->iCacheLevel || x->iReg==0 ) continue;
 70658  70651         printf(" r[%d]={%d:%d}", x->iReg, x->iTable, x->iColumn);
 70659  70652         kk++;
 70660  70653       }
 70661  70654       if( kk ) printf("\n");
 70662  70655       sqlite3VdbePrintOp(0, i, &p->aOp[i]);
 70663  70656       test_addop_breakpoint();
 70664  70657     }
................................................................................
 70838  70831     int j = ADDR(x);
 70839  70832     assert( v->magic==VDBE_MAGIC_INIT );
 70840  70833     assert( j<p->nLabel );
 70841  70834     assert( j>=0 );
 70842  70835     if( p->aLabel ){
 70843  70836       p->aLabel[j] = v->nOp;
 70844  70837     }
 70845         -  p->iFixedOp = v->nOp - 1;
 70846  70838   }
 70847  70839   
 70848  70840   /*
 70849  70841   ** Mark the VDBE as one that can only be run one time.
 70850  70842   */
 70851  70843   SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
 70852  70844     p->runOnlyOnce = 1;
................................................................................
 71229  71221   SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe *p, u32 addr, int val){
 71230  71222     sqlite3VdbeGetOp(p,addr)->p2 = val;
 71231  71223   }
 71232  71224   SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){
 71233  71225     sqlite3VdbeGetOp(p,addr)->p3 = val;
 71234  71226   }
 71235  71227   SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u8 p5){
 71236         -  if( !p->db->mallocFailed ) p->aOp[p->nOp-1].p5 = p5;
        71228  +  assert( p->nOp>0 || p->db->mallocFailed );
        71229  +  if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5;
 71237  71230   }
 71238  71231   
 71239  71232   /*
 71240  71233   ** Change the P2 operand of instruction addr so that it points to
 71241  71234   ** the address of the next instruction to be coded.
 71242  71235   */
 71243  71236   SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){
 71244         -  p->pParse->iFixedOp = p->nOp - 1;
 71245  71237     sqlite3VdbeChangeP2(p, addr, p->nOp);
 71246  71238   }
 71247  71239   
 71248  71240   
 71249  71241   /*
 71250  71242   ** If the input FuncDef structure is ephemeral, then free it.  If
 71251  71243   ** the FuncDef is not ephermal, then do nothing.
................................................................................
 71360  71352   }
 71361  71353   
 71362  71354   /*
 71363  71355   ** If the last opcode is "op" and it is not a jump destination,
 71364  71356   ** then remove it.  Return true if and only if an opcode was removed.
 71365  71357   */
 71366  71358   SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){
 71367         -  if( (p->nOp-1)>(p->pParse->iFixedOp) && p->aOp[p->nOp-1].opcode==op ){
        71359  +  if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){
 71368  71360       return sqlite3VdbeChangeToNoop(p, p->nOp-1);
 71369  71361     }else{
 71370  71362       return 0;
 71371  71363     }
 71372  71364   }
 71373  71365   
 71374  71366   /*
................................................................................
 71922  71914     fprintf(pOut, zFormat1, pc, 
 71923  71915         sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5,
 71924  71916         zCom
 71925  71917     );
 71926  71918     fflush(pOut);
 71927  71919   }
 71928  71920   #endif
        71921  +
        71922  +/*
        71923  +** Initialize an array of N Mem element.
        71924  +*/
        71925  +static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
        71926  +  while( (N--)>0 ){
        71927  +    p->db = db;
        71928  +    p->flags = flags;
        71929  +    p->szMalloc = 0;
        71930  +#ifdef SQLITE_DEBUG
        71931  +    p->pScopyFrom = 0;
        71932  +#endif
        71933  +    p++;
        71934  +  }
        71935  +}
 71929  71936   
 71930  71937   /*
 71931  71938   ** Release an array of N Mem elements
 71932  71939   */
 71933  71940   static void releaseMemArray(Mem *p, int N){
 71934  71941     if( p && N ){
 71935  71942       Mem *pEnd = &p[N];
................................................................................
 72134  72141       if( sqlite3VdbeMemClearAndResize(pMem, 100) ){ /* P4 */
 72135  72142         assert( p->db->mallocFailed );
 72136  72143         return SQLITE_ERROR;
 72137  72144       }
 72138  72145       pMem->flags = MEM_Str|MEM_Term;
 72139  72146       zP4 = displayP4(pOp, pMem->z, pMem->szMalloc);
 72140  72147       if( zP4!=pMem->z ){
        72148  +      pMem->n = 0;
 72141  72149         sqlite3VdbeMemSetStr(pMem, zP4, -1, SQLITE_UTF8, 0);
 72142  72150       }else{
 72143  72151         assert( pMem->z!=0 );
 72144  72152         pMem->n = sqlite3Strlen30(pMem->z);
 72145  72153         pMem->enc = SQLITE_UTF8;
 72146  72154       }
 72147  72155       pMem++;
................................................................................
 72276  72284   ** running it.
 72277  72285   */
 72278  72286   SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
 72279  72287   #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
 72280  72288     int i;
 72281  72289   #endif
 72282  72290     assert( p!=0 );
 72283         -  assert( p->magic==VDBE_MAGIC_INIT );
        72291  +  assert( p->magic==VDBE_MAGIC_INIT || p->magic==VDBE_MAGIC_RESET );
 72284  72292   
 72285  72293     /* There should be at least one opcode.
 72286  72294     */
 72287  72295     assert( p->nOp>0 );
 72288  72296   
 72289  72297     /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */
 72290  72298     p->magic = VDBE_MAGIC_RUN;
................................................................................
 72365  72373     ** of the prepared statement.
 72366  72374     */
 72367  72375     n = ROUND8(sizeof(Op)*p->nOp);              /* Bytes of opcode memory used */
 72368  72376     x.pSpace = &((u8*)p->aOp)[n];               /* Unused opcode memory */
 72369  72377     assert( EIGHT_BYTE_ALIGNMENT(x.pSpace) );
 72370  72378     x.nFree = ROUNDDOWN8(pParse->szOpAlloc - n);  /* Bytes of unused memory */
 72371  72379     assert( x.nFree>=0 );
 72372         -  if( x.nFree>0 ){
 72373         -    memset(x.pSpace, 0, x.nFree);
 72374         -    assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );
 72375         -  }
        72380  +  assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );
 72376  72381   
 72377  72382     resolveP2Values(p, &nArg);
 72378  72383     p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
 72379  72384     if( pParse->explain && nMem<10 ){
 72380  72385       nMem = 10;
 72381  72386     }
 72382  72387     p->expired = 0;
................................................................................
 72397  72402       p->aVar = allocSpace(&x, p->aVar, nVar*sizeof(Mem));
 72398  72403       p->apArg = allocSpace(&x, p->apArg, nArg*sizeof(Mem*));
 72399  72404       p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
 72400  72405   #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
 72401  72406       p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
 72402  72407   #endif
 72403  72408       if( x.nNeeded==0 ) break;
 72404         -    x.pSpace = p->pFree = sqlite3DbMallocZero(db, x.nNeeded);
        72409  +    x.pSpace = p->pFree = sqlite3DbMallocRawNN(db, x.nNeeded);
 72405  72410       x.nFree = x.nNeeded;
 72406  72411     }while( !db->mallocFailed );
 72407  72412   
 72408         -  p->nCursor = nCursor;
 72409         -  if( p->aVar ){
 72410         -    p->nVar = (ynVar)nVar;
 72411         -    for(n=0; n<nVar; n++){
 72412         -      p->aVar[n].flags = MEM_Null;
 72413         -      p->aVar[n].db = db;
 72414         -    }
 72415         -  }
 72416  72413     p->nzVar = pParse->nzVar;
 72417  72414     p->azVar = pParse->azVar;
 72418  72415     pParse->nzVar =  0;
 72419  72416     pParse->azVar = 0;
 72420         -  if( p->aMem ){
 72421         -    p->nMem = nMem;
 72422         -    for(n=0; n<nMem; n++){
 72423         -      p->aMem[n].flags = MEM_Undefined;
 72424         -      p->aMem[n].db = db;
 72425         -    }
 72426         -  }
 72427  72417     p->explain = pParse->explain;
        72418  +  if( db->mallocFailed ){
        72419  +    p->nVar = 0;
        72420  +    p->nCursor = 0;
        72421  +    p->nMem = 0;
        72422  +  }else{
        72423  +    p->nCursor = nCursor;
        72424  +    p->nVar = (ynVar)nVar;
        72425  +    initMemArray(p->aVar, nVar, db, MEM_Null);
        72426  +    p->nMem = nMem;
        72427  +    initMemArray(p->aMem, nMem, db, MEM_Undefined);
        72428  +    memset(p->apCsr, 0, nCursor*sizeof(VdbeCursor*));
        72429  +#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
        72430  +    memset(p->anExec, 0, p->nOp*sizeof(i64));
        72431  +#endif
        72432  +  }
 72428  72433     sqlite3VdbeRewind(p);
 72429  72434   }
 72430  72435   
 72431  72436   /*
 72432  72437   ** Close a VDBE cursor and release all the resources that cursor 
 72433  72438   ** happens to hold.
 72434  72439   */
................................................................................
 72572  72577     int n;
 72573  72578     sqlite3 *db = p->db;
 72574  72579   
 72575  72580     releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
 72576  72581     sqlite3DbFree(db, p->aColName);
 72577  72582     n = nResColumn*COLNAME_N;
 72578  72583     p->nResColumn = (u16)nResColumn;
 72579         -  p->aColName = pColName = (Mem*)sqlite3DbMallocZero(db, sizeof(Mem)*n );
        72584  +  p->aColName = pColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n );
 72580  72585     if( p->aColName==0 ) return;
 72581         -  while( n-- > 0 ){
 72582         -    pColName->flags = MEM_Null;
 72583         -    pColName->db = p->db;
 72584         -    pColName++;
 72585         -  }
        72586  +  initMemArray(p->aColName, n, p->db, MEM_Null);
 72586  72587   }
 72587  72588   
 72588  72589   /*
 72589  72590   ** Set the name of the idx'th column to be returned by the SQL statement.
 72590  72591   ** zName must be a pointer to a nul terminated string.
 72591  72592   **
 72592  72593   ** This call must be made after a call to sqlite3VdbeSetNumCols().
................................................................................
 73340  73341           sqlite3VdbePrintOp(out, i, &p->aOp[i]);
 73341  73342         }
 73342  73343         fclose(out);
 73343  73344       }
 73344  73345     }
 73345  73346   #endif
 73346  73347     p->iCurrentTime = 0;
 73347         -  p->magic = VDBE_MAGIC_INIT;
        73348  +  p->magic = VDBE_MAGIC_RESET;
 73348  73349     return p->rc & db->errMask;
 73349  73350   }
 73350  73351    
 73351  73352   /*
 73352  73353   ** Clean up and delete a VDBE after execution.  Return an integer which is
 73353  73354   ** the result code.  Write any error message text into *pzErrMsg.
 73354  73355   */
................................................................................
 73404  73405   ** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with
 73405  73406   ** the database connection and frees the object itself.
 73406  73407   */
 73407  73408   SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
 73408  73409     SubProgram *pSub, *pNext;
 73409  73410     int i;
 73410  73411     assert( p->db==0 || p->db==db );
 73411         -  releaseMemArray(p->aVar, p->nVar);
 73412  73412     releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
 73413  73413     for(pSub=p->pProgram; pSub; pSub=pNext){
 73414  73414       pNext = pSub->pNext;
 73415  73415       vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
 73416  73416       sqlite3DbFree(db, pSub);
 73417  73417     }
 73418         -  for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
 73419         -  sqlite3DbFree(db, p->azVar);
        73418  +  if( p->magic!=VDBE_MAGIC_INIT ){
        73419  +    releaseMemArray(p->aVar, p->nVar);
        73420  +    for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
        73421  +    sqlite3DbFree(db, p->azVar);
        73422  +    sqlite3DbFree(db, p->pFree);
        73423  +  }
 73420  73424     vdbeFreeOpArray(db, p->aOp, p->nOp);
 73421  73425     sqlite3DbFree(db, p->aColName);
 73422  73426     sqlite3DbFree(db, p->zSql);
 73423         -  sqlite3DbFree(db, p->pFree);
 73424  73427   #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
 73425  73428     for(i=0; i<p->nScan; i++){
 73426  73429       sqlite3DbFree(db, p->aScan[i].zName);
 73427  73430     }
 73428  73431     sqlite3DbFree(db, p->aScan);
 73429  73432   #endif
 73430  73433   }
................................................................................
 76045  76048   ** of NULL.
 76046  76049   */
 76047  76050   static Mem *columnMem(sqlite3_stmt *pStmt, int i){
 76048  76051     Vdbe *pVm;
 76049  76052     Mem *pOut;
 76050  76053   
 76051  76054     pVm = (Vdbe *)pStmt;
 76052         -  if( pVm && pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){
 76053         -    sqlite3_mutex_enter(pVm->db->mutex);
        76055  +  if( pVm==0 ) return (Mem*)columnNullValue();
        76056  +  assert( pVm->db );
        76057  +  sqlite3_mutex_enter(pVm->db->mutex);
        76058  +  if( pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){
 76054  76059       pOut = &pVm->pResultSet[i];
 76055  76060     }else{
 76056         -    if( pVm && ALWAYS(pVm->db) ){
 76057         -      sqlite3_mutex_enter(pVm->db->mutex);
 76058         -      sqlite3Error(pVm->db, SQLITE_RANGE);
 76059         -    }
        76061  +    sqlite3Error(pVm->db, SQLITE_RANGE);
 76060  76062       pOut = (Mem*)columnNullValue();
 76061  76063     }
 76062  76064     return pOut;
 76063  76065   }
 76064  76066   
 76065  76067   /*
 76066  76068   ** This function is called after invoking an sqlite3_value_XXX function on a 
................................................................................
 76085  76087     /* If malloc() failed during an encoding conversion within an
 76086  76088     ** sqlite3_column_XXX API, then set the return code of the statement to
 76087  76089     ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR
 76088  76090     ** and _finalize() will return NOMEM.
 76089  76091     */
 76090  76092     Vdbe *p = (Vdbe *)pStmt;
 76091  76093     if( p ){
        76094  +    assert( p->db!=0 );
        76095  +    assert( sqlite3_mutex_held(p->db->mutex) );
 76092  76096       p->rc = sqlite3ApiExit(p->db, p->rc);
 76093  76097       sqlite3_mutex_leave(p->db->mutex);
 76094  76098     }
 76095  76099   }
 76096  76100   
 76097  76101   /**************************** sqlite3_column_  *******************************
 76098  76102   ** The following routines are used to access elements of the current row
................................................................................
 76661  76665   }
 76662  76666   
 76663  76667   /*
 76664  76668   ** Return true if the prepared statement is in need of being reset.
 76665  76669   */
 76666  76670   SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
 76667  76671     Vdbe *v = (Vdbe*)pStmt;
 76668         -  return v!=0 && v->pc>=0 && v->magic==VDBE_MAGIC_RUN;
        76672  +  return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0;
 76669  76673   }
 76670  76674   
 76671  76675   /*
 76672  76676   ** Return a pointer to the next prepared statement after pStmt associated
 76673  76677   ** with database connection pDb.  If pStmt is NULL, return the first
 76674  76678   ** prepared statement for the database connection.  Return NULL if there
 76675  76679   ** are no more.
................................................................................
 78413  78417   case OP_Null: {           /* out2 */
 78414  78418     int cnt;
 78415  78419     u16 nullFlag;
 78416  78420     pOut = out2Prerelease(p, pOp);
 78417  78421     cnt = pOp->p3-pOp->p2;
 78418  78422     assert( pOp->p3<=(p->nMem+1 - p->nCursor) );
 78419  78423     pOut->flags = nullFlag = pOp->p1 ? (MEM_Null|MEM_Cleared) : MEM_Null;
        78424  +  pOut->n = 0;
 78420  78425     while( cnt>0 ){
 78421  78426       pOut++;
 78422  78427       memAboutToChange(p, pOut);
 78423  78428       sqlite3VdbeMemSetNull(pOut);
 78424  78429       pOut->flags = nullFlag;
        78430  +    pOut->n = 0;
 78425  78431       cnt--;
 78426  78432     }
 78427  78433     break;
 78428  78434   }
 78429  78435   
 78430  78436   /* Opcode: SoftNull P1 * * * *
 78431  78437   ** Synopsis: r[P1]=NULL
................................................................................
 80485  80491         ** counter. If the statement transaction needs to be rolled back,
 80486  80492         ** the value of this counter needs to be restored too.  */
 80487  80493         p->nStmtDefCons = db->nDeferredCons;
 80488  80494         p->nStmtDefImmCons = db->nDeferredImmCons;
 80489  80495       }
 80490  80496   
 80491  80497       /* Gather the schema version number for checking:
 80492         -    ** IMPLEMENTATION-OF: R-32195-19465 The schema version is used by SQLite
 80493         -    ** each time a query is executed to ensure that the internal cache of the
 80494         -    ** schema used when compiling the SQL query matches the schema of the
 80495         -    ** database against which the compiled query is actually executed.
        80498  +    ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema
        80499  +    ** version is checked to ensure that the schema has not changed since the
        80500  +    ** SQL statement was prepared.
 80496  80501       */
 80497  80502       sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&iMeta);
 80498  80503       iGen = db->aDb[pOp->p1].pSchema->iGeneration;
 80499  80504     }else{
 80500  80505       iGen = iMeta = 0;
 80501  80506     }
 80502  80507     assert( pOp->p5==0 || pOp->p4type==P4_INT32 );
................................................................................
 81744  81749   **
 81745  81750   ** If the OPFLAG_NCHANGE flag of P2 (NB: P2 not P5) is set, then the row
 81746  81751   ** change count is incremented (otherwise not).
 81747  81752   **
 81748  81753   ** P1 must not be pseudo-table.  It has to be a real table with
 81749  81754   ** multiple rows.
 81750  81755   **
 81751         -** If P4 is not NULL then it points to a Table struture. In this case either 
        81756  +** If P4 is not NULL then it points to a Table object. In this case either 
 81752  81757   ** the update or pre-update hook, or both, may be invoked. The P1 cursor must
 81753  81758   ** have been positioned using OP_NotFound prior to invoking this opcode in 
 81754  81759   ** this case. Specifically, if one is configured, the pre-update hook is 
 81755  81760   ** invoked if P4 is not NULL. The update-hook is invoked if one is configured, 
 81756  81761   ** P4 is not NULL, and the OPFLAG_NCHANGE flag is set in P2.
 81757  81762   **
 81758  81763   ** If the OPFLAG_ISUPDATE flag is set in P2, then P3 contains the address
................................................................................
 82335  82340     rc = ExpandBlob(pIn2);
 82336  82341     if( rc ) goto abort_due_to_error;
 82337  82342     if( pOp->opcode==OP_SorterInsert ){
 82338  82343       rc = sqlite3VdbeSorterWrite(pC, pIn2);
 82339  82344     }else{
 82340  82345       x.nKey = pIn2->n;
 82341  82346       x.pKey = pIn2->z;
 82342         -    x.nData = 0;
 82343         -    x.nZero = 0;
 82344         -    x.pData = 0;
 82345  82347       rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, pOp->p3, 
 82346  82348           ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
 82347  82349           );
 82348  82350       assert( pC->deferredMoveto==0 );
 82349  82351       pC->cacheStatus = CACHE_STALE;
 82350  82352     }
 82351  82353     if( rc) goto abort_due_to_error;
................................................................................
 88034  88036   ** and WRC_Continue to continue.
 88035  88037   */
 88036  88038   static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){
 88037  88039     int rc;
 88038  88040     testcase( ExprHasProperty(pExpr, EP_TokenOnly) );
 88039  88041     testcase( ExprHasProperty(pExpr, EP_Reduced) );
 88040  88042     rc = pWalker->xExprCallback(pWalker, pExpr);
 88041         -  if( rc || ExprHasProperty(pExpr,EP_TokenOnly) ) return rc & WRC_Abort;
        88043  +  if( rc || ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
        88044  +    return rc & WRC_Abort;
        88045  +  }
 88042  88046     if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
 88043  88047     if( pExpr->pRight && walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
 88044  88048     if( ExprHasProperty(pExpr, EP_xIsSelect) ){
 88045  88049       if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
 88046  88050     }else if( pExpr->x.pList ){
 88047  88051       if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
 88048  88052     }
................................................................................
 88778  88782         const char *zColumn;
 88779  88783         const char *zTable;
 88780  88784         const char *zDb;
 88781  88785         Expr *pRight;
 88782  88786   
 88783  88787         /* if( pSrcList==0 ) break; */
 88784  88788         notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr);
 88785         -      /*notValid(pParse, pNC, "the \".\" operator", NC_PartIdx|NC_IsCheck, 1);*/
 88786  88789         pRight = pExpr->pRight;
 88787  88790         if( pRight->op==TK_ID ){
 88788  88791           zDb = 0;
 88789  88792           zTable = pExpr->pLeft->u.zToken;
 88790  88793           zColumn = pRight->u.zToken;
 88791  88794         }else{
 88792  88795           assert( pRight->op==TK_DOT );
................................................................................
 88807  88810         int is_agg = 0;             /* True if is an aggregate function */
 88808  88811         int nId;                    /* Number of characters in function name */
 88809  88812         const char *zId;            /* The function name. */
 88810  88813         FuncDef *pDef;              /* Information about the function */
 88811  88814         u8 enc = ENC(pParse->db);   /* The database encoding */
 88812  88815   
 88813  88816         assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
 88814         -      notValid(pParse, pNC, "functions", NC_PartIdx);
        88817  +//      notValid(pParse, pNC, "functions", NC_PartIdx);
 88815  88818         zId = pExpr->u.zToken;
 88816  88819         nId = sqlite3Strlen30(zId);
 88817  88820         pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);
 88818  88821         if( pDef==0 ){
 88819  88822           pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0);
 88820  88823           if( pDef==0 ){
 88821  88824             no_such_func = 1;
................................................................................
 88867  88870             ** constant because they are constant for the duration of one query */
 88868  88871             ExprSetProperty(pExpr,EP_ConstFunc);
 88869  88872           }
 88870  88873           if( (pDef->funcFlags & SQLITE_FUNC_CONSTANT)==0 ){
 88871  88874             /* Date/time functions that use 'now', and other functions like
 88872  88875             ** sqlite_version() that might change over time cannot be used
 88873  88876             ** in an index. */
 88874         -          notValid(pParse, pNC, "non-deterministic functions", NC_IdxExpr);
        88877  +          notValid(pParse, pNC, "non-deterministic functions",
        88878  +                   NC_IdxExpr|NC_PartIdx);
 88875  88879           }
 88876  88880         }
 88877  88881         if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){
 88878  88882           sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId);
 88879  88883           pNC->nErr++;
 88880  88884           is_agg = 0;
 88881  88885         }else if( no_such_func && pParse->db->init.busy==0
................................................................................
 90407  90411   ** Special case:  If op==TK_INTEGER and pToken points to a string that
 90408  90412   ** can be translated into a 32-bit integer, then the token is not
 90409  90413   ** stored in u.zToken.  Instead, the integer values is written
 90410  90414   ** into u.iValue and the EP_IntValue flag is set.  No extra storage
 90411  90415   ** is allocated to hold the integer text and the dequote flag is ignored.
 90412  90416   */
 90413  90417   SQLITE_PRIVATE Expr *sqlite3ExprAlloc(
 90414         -  sqlite3 *db,            /* Handle for sqlite3DbMallocZero() (may be null) */
        90418  +  sqlite3 *db,            /* Handle for sqlite3DbMallocRawNN() */
 90415  90419     int op,                 /* Expression opcode */
 90416  90420     const Token *pToken,    /* Token argument.  Might be NULL */
 90417  90421     int dequote             /* True to dequote */
 90418  90422   ){
 90419  90423     Expr *pNew;
 90420  90424     int nExtra = 0;
 90421  90425     int iValue = 0;
................................................................................
 90625  90629   ** the SQL statement comes from an external source.
 90626  90630   **
 90627  90631   ** Wildcards of the form ":aaa", "@aaa", or "$aaa" are assigned the same number
 90628  90632   ** as the previous instance of the same wildcard.  Or if this is the first
 90629  90633   ** instance of the wildcard, the next sequential variable number is
 90630  90634   ** assigned.
 90631  90635   */
 90632         -SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
        90636  +SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n){
 90633  90637     sqlite3 *db = pParse->db;
 90634  90638     const char *z;
 90635  90639   
 90636  90640     if( pExpr==0 ) return;
 90637  90641     assert( !ExprHasProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );
 90638  90642     z = pExpr->u.zToken;
 90639  90643     assert( z!=0 );
 90640  90644     assert( z[0]!=0 );
        90645  +  assert( n==sqlite3Strlen30(z) );
 90641  90646     if( z[1]==0 ){
 90642  90647       /* Wildcard of the form "?".  Assign the next variable number */
 90643  90648       assert( z[0]=='?' );
 90644  90649       pExpr->iColumn = (ynVar)(++pParse->nVar);
 90645  90650     }else{
 90646         -    ynVar x = 0;
 90647         -    u32 n = sqlite3Strlen30(z);
        90651  +    ynVar x;
 90648  90652       if( z[0]=='?' ){
 90649  90653         /* Wildcard of the form "?nnn".  Convert "nnn" to an integer and
 90650  90654         ** use it as the variable number */
 90651  90655         i64 i;
 90652  90656         int bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8);
 90653         -      pExpr->iColumn = x = (ynVar)i;
        90657  +      x = (ynVar)i;
 90654  90658         testcase( i==0 );
 90655  90659         testcase( i==1 );
 90656  90660         testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 );
 90657  90661         testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] );
 90658  90662         if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
 90659  90663           sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
 90660  90664               db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
 90661         -        x = 0;
        90665  +        return;
 90662  90666         }
 90663  90667         if( i>pParse->nVar ){
 90664  90668           pParse->nVar = (int)i;
 90665  90669         }
 90666  90670       }else{
 90667  90671         /* Wildcards like ":aaa", "$aaa" or "@aaa".  Reuse the same variable
 90668  90672         ** number as the prior appearance of the same name, or if the name
 90669  90673         ** has never appeared before, reuse the same variable number
 90670  90674         */
 90671  90675         ynVar i;
 90672         -      for(i=0; i<pParse->nzVar; i++){
        90676  +      for(i=x=0; i<pParse->nzVar; i++){
 90673  90677           if( pParse->azVar[i] && strcmp(pParse->azVar[i],z)==0 ){
 90674         -          pExpr->iColumn = x = (ynVar)i+1;
 90675         -          break;
 90676         -        }
 90677         -      }
 90678         -      if( x==0 ) x = pExpr->iColumn = (ynVar)(++pParse->nVar);
 90679         -    }
 90680         -    if( x>0 ){
 90681         -      if( x>pParse->nzVar ){
 90682         -        char **a;
 90683         -        a = sqlite3DbRealloc(db, pParse->azVar, x*sizeof(a[0]));
 90684         -        if( a==0 ){
 90685         -          assert( db->mallocFailed ); /* Error reported through mallocFailed */
 90686         -          return;
 90687         -        }
 90688         -        pParse->azVar = a;
 90689         -        memset(&a[pParse->nzVar], 0, (x-pParse->nzVar)*sizeof(a[0]));
 90690         -        pParse->nzVar = x;
 90691         -      }
 90692         -      if( z[0]!='?' || pParse->azVar[x-1]==0 ){
 90693         -        sqlite3DbFree(db, pParse->azVar[x-1]);
 90694         -        pParse->azVar[x-1] = sqlite3DbStrNDup(db, z, n);
 90695         -      }
        90678  +          x = (ynVar)i+1;
        90679  +          break;
        90680  +        }
        90681  +      }
        90682  +      if( x==0 ) x = (ynVar)(++pParse->nVar);
        90683  +    }
        90684  +    pExpr->iColumn = x;
        90685  +    if( x>pParse->nzVar ){
        90686  +      char **a;
        90687  +      a = sqlite3DbRealloc(db, pParse->azVar, x*sizeof(a[0]));
        90688  +      if( a==0 ){
        90689  +        assert( db->mallocFailed ); /* Error reported through mallocFailed */
        90690  +        return;
        90691  +      }
        90692  +      pParse->azVar = a;
        90693  +      memset(&a[pParse->nzVar], 0, (x-pParse->nzVar)*sizeof(a[0]));
        90694  +      pParse->nzVar = x;
        90695  +    }
        90696  +    if( pParse->azVar[x-1]==0 ){
        90697  +      pParse->azVar[x-1] = sqlite3DbStrNDup(db, z, n);
 90696  90698       }
 90697  90699     } 
 90698         -  if( !pParse->nErr && pParse->nVar>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
        90700  +  if( pParse->nVar>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
 90699  90701       sqlite3ErrorMsg(pParse, "too many SQL variables");
 90700  90702     }
 90701  90703   }
 90702  90704   
 90703  90705   /*
 90704  90706   ** Recursively delete an expression tree.
 90705  90707   */
 90706  90708   static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){
 90707  90709     assert( p!=0 );
 90708  90710     /* Sanity check: Assert that the IntValue is non-negative if it exists */
 90709  90711     assert( !ExprHasProperty(p, EP_IntValue) || p->u.iValue>=0 );
 90710         -  if( !ExprHasProperty(p, EP_TokenOnly) ){
        90712  +#ifdef SQLITE_DEBUG
        90713  +  if( ExprHasProperty(p, EP_Leaf) && !ExprHasProperty(p, EP_TokenOnly) ){
        90714  +    assert( p->pLeft==0 );
        90715  +    assert( p->pRight==0 );
        90716  +    assert( p->x.pSelect==0 );
        90717  +  }
        90718  +#endif
        90719  +  if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){
 90711  90720       /* The Expr.x union is never used at the same time as Expr.pRight */
 90712  90721       assert( p->x.pList==0 || p->pRight==0 );
 90713  90722       if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
 90714  90723       sqlite3ExprDelete(db, p->pRight);
 90715         -    if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken);
 90716  90724       if( ExprHasProperty(p, EP_xIsSelect) ){
 90717  90725         sqlite3SelectDelete(db, p->x.pSelect);
 90718  90726       }else{
 90719  90727         sqlite3ExprListDelete(db, p->x.pList);
 90720  90728       }
 90721  90729     }
        90730  +  if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken);
 90722  90731     if( !ExprHasProperty(p, EP_Static) ){
 90723  90732       sqlite3DbFree(db, p);
 90724  90733     }
 90725  90734   }
 90726  90735   SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){
 90727  90736     if( p ) sqlite3ExprDeleteNN(db, p);
 90728  90737   }
................................................................................
 90891  90900   
 90892  90901       /* Copy the p->u.zToken string, if any. */
 90893  90902       if( nToken ){
 90894  90903         char *zToken = pNew->u.zToken = (char*)&zAlloc[nNewSize];
 90895  90904         memcpy(zToken, p->u.zToken, nToken);
 90896  90905       }
 90897  90906   
 90898         -    if( 0==((p->flags|pNew->flags) & EP_TokenOnly) ){
        90907  +    if( 0==((p->flags|pNew->flags) & (EP_TokenOnly|EP_Leaf)) ){
 90899  90908         /* Fill in the pNew->x.pSelect or pNew->x.pList member. */
 90900  90909         if( ExprHasProperty(p, EP_xIsSelect) ){
 90901  90910           pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, dupFlags);
 90902  90911         }else{
 90903  90912           pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, dupFlags);
 90904  90913         }
 90905  90914       }
 90906  90915   
 90907  90916       /* Fill in pNew->pLeft and pNew->pRight. */
 90908  90917       if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly) ){
 90909  90918         zAlloc += dupedExprNodeSize(p, dupFlags);
 90910         -      if( ExprHasProperty(pNew, EP_Reduced) ){
        90919  +      if( !ExprHasProperty(pNew, EP_TokenOnly|EP_Leaf) ){
 90911  90920           pNew->pLeft = p->pLeft ?
 90912  90921                         exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc) : 0;
 90913  90922           pNew->pRight = p->pRight ?
 90914  90923                          exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc) : 0;
 90915  90924         }
 90916  90925         if( pzBuffer ){
 90917  90926           *pzBuffer = zAlloc;
 90918  90927         }
 90919  90928       }else{
 90920         -      if( !ExprHasProperty(p, EP_TokenOnly) ){
        90929  +      if( !ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
 90921  90930           if( pNew->op==TK_SELECT_COLUMN ){
 90922  90931             pNew->pLeft = p->pLeft;
 90923  90932           }else{
 90924  90933             pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0);
 90925  90934           }
 90926  90935           pNew->pRight = sqlite3ExprDup(db, p->pRight, 0);
 90927  90936         }
................................................................................
 92274  92283           VdbeComment((v, "Init subquery result"));
 92275  92284         }else{
 92276  92285           dest.eDest = SRT_Exists;
 92277  92286           sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm);
 92278  92287           VdbeComment((v, "Init EXISTS result"));
 92279  92288         }
 92280  92289         sqlite3ExprDelete(pParse->db, pSel->pLimit);
 92281         -      pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0,
 92282         -                                  &sqlite3IntTokens[1]);
        92290  +      pSel->pLimit = sqlite3ExprAlloc(pParse->db, TK_INTEGER,
        92291  +                                  &sqlite3IntTokens[1], 0);
 92283  92292         pSel->iLimit = 0;
 92284  92293         pSel->selFlags &= ~SF_MultiValue;
 92285  92294         if( sqlite3Select(pParse, pSel, &dest) ){
 92286  92295           return 0;
 92287  92296         }
 92288  92297         rReg = dest.iSDParm;
 92289  92298         ExprSetVVAProperty(pExpr, EP_NoReduce);
................................................................................
 92644  92653           codeReal(v, z, negFlag, iMem);
 92645  92654         }
 92646  92655   #endif
 92647  92656       }
 92648  92657     }
 92649  92658   }
 92650  92659   
 92651         -#if defined(SQLITE_DEBUG)
 92652  92660   /*
 92653         -** Verify the consistency of the column cache
        92661  +** Erase column-cache entry number i
 92654  92662   */
 92655         -static int cacheIsValid(Parse *pParse){
 92656         -  int i, n;
 92657         -  for(i=n=0; i<SQLITE_N_COLCACHE; i++){
 92658         -    if( pParse->aColCache[i].iReg>0 ) n++;
 92659         -  }
 92660         -  return n==pParse->nColCache;
 92661         -}
 92662         -#endif
 92663         -
 92664         -/*
 92665         -** Clear a cache entry.
 92666         -*/
 92667         -static void cacheEntryClear(Parse *pParse, struct yColCache *p){
 92668         -  if( p->tempReg ){
        92663  +static void cacheEntryClear(Parse *pParse, int i){
        92664  +  if( pParse->aColCache[i].tempReg ){
 92669  92665       if( pParse->nTempReg<ArraySize(pParse->aTempReg) ){
 92670         -      pParse->aTempReg[pParse->nTempReg++] = p->iReg;
        92666  +      pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
 92671  92667       }
 92672         -    p->tempReg = 0;
 92673  92668     }
 92674         -  p->iReg = 0;
 92675  92669     pParse->nColCache--;
 92676         -  assert( pParse->db->mallocFailed || cacheIsValid(pParse) );
        92670  +  if( i<pParse->nColCache ){
        92671  +    pParse->aColCache[i] = pParse->aColCache[pParse->nColCache];
        92672  +  }
 92677  92673   }
 92678  92674   
 92679  92675   
 92680  92676   /*
 92681  92677   ** Record in the column cache that a particular column from a
 92682  92678   ** particular table is stored in a particular register.
 92683  92679   */
................................................................................
 92699  92695   
 92700  92696     /* First replace any existing entry.
 92701  92697     **
 92702  92698     ** Actually, the way the column cache is currently used, we are guaranteed
 92703  92699     ** that the object will never already be in cache.  Verify this guarantee.
 92704  92700     */
 92705  92701   #ifndef NDEBUG
 92706         -  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
 92707         -    assert( p->iReg==0 || p->iTable!=iTab || p->iColumn!=iCol );
 92708         -  }
 92709         -#endif
 92710         -
 92711         -  /* Find an empty slot and replace it */
 92712         -  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
 92713         -    if( p->iReg==0 ){
 92714         -      p->iLevel = pParse->iCacheLevel;
 92715         -      p->iTable = iTab;
 92716         -      p->iColumn = iCol;
 92717         -      p->iReg = iReg;
 92718         -      p->tempReg = 0;
 92719         -      p->lru = pParse->iCacheCnt++;
 92720         -      pParse->nColCache++;
 92721         -      assert( pParse->db->mallocFailed || cacheIsValid(pParse) );
 92722         -      return;
 92723         -    }
 92724         -  }
 92725         -
 92726         -  /* Replace the last recently used */
 92727         -  minLru = 0x7fffffff;
 92728         -  idxLru = -1;
 92729         -  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
 92730         -    if( p->lru<minLru ){
 92731         -      idxLru = i;
 92732         -      minLru = p->lru;
 92733         -    }
 92734         -  }
 92735         -  if( ALWAYS(idxLru>=0) ){
        92702  +  for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
        92703  +    assert( p->iTable!=iTab || p->iColumn!=iCol );
        92704  +  }
        92705  +#endif
        92706  +
        92707  +  /* If the cache is already full, delete the least recently used entry */
        92708  +  if( pParse->nColCache>=SQLITE_N_COLCACHE ){
        92709  +    minLru = 0x7fffffff;
        92710  +    idxLru = -1;
        92711  +    for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
        92712  +      if( p->lru<minLru ){
        92713  +        idxLru = i;
        92714  +        minLru = p->lru;
        92715  +      }
        92716  +    }
 92736  92717       p = &pParse->aColCache[idxLru];
 92737         -    p->iLevel = pParse->iCacheLevel;
 92738         -    p->iTable = iTab;
 92739         -    p->iColumn = iCol;
 92740         -    p->iReg = iReg;
 92741         -    p->tempReg = 0;
 92742         -    p->lru = pParse->iCacheCnt++;
 92743         -    assert( cacheIsValid(pParse) );
 92744         -    return;
        92718  +  }else{
        92719  +    p = &pParse->aColCache[pParse->nColCache++];
 92745  92720     }
        92721  +
        92722  +  /* Add the new entry to the end of the cache */
        92723  +  p->iLevel = pParse->iCacheLevel;
        92724  +  p->iTable = iTab;
        92725  +  p->iColumn = iCol;
        92726  +  p->iReg = iReg;
        92727  +  p->tempReg = 0;
        92728  +  p->lru = pParse->iCacheCnt++;
 92746  92729   }
 92747  92730   
 92748  92731   /*
 92749  92732   ** Indicate that registers between iReg..iReg+nReg-1 are being overwritten.
 92750  92733   ** Purge the range of registers from the column cache.
 92751  92734   */
 92752  92735   SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse *pParse, int iReg, int nReg){
 92753         -  struct yColCache *p;
 92754         -  if( iReg<=0 || pParse->nColCache==0 ) return;
 92755         -  p = &pParse->aColCache[SQLITE_N_COLCACHE-1];
 92756         -  while(1){
 92757         -    if( p->iReg >= iReg && p->iReg < iReg+nReg ) cacheEntryClear(pParse, p);
 92758         -    if( p==pParse->aColCache ) break;
 92759         -    p--;
        92736  +  int i = 0;
        92737  +  while( i<pParse->nColCache ){
        92738  +    struct yColCache *p = &pParse->aColCache[i];
        92739  +    if( p->iReg >= iReg && p->iReg < iReg+nReg ){
        92740  +      cacheEntryClear(pParse, i);
        92741  +    }else{
        92742  +      i++;
        92743  +    }
 92760  92744     }
 92761  92745   }
 92762  92746   
 92763  92747   /*
 92764  92748   ** Remember the current column cache context.  Any new entries added
 92765  92749   ** added to the column cache after this call are removed when the
 92766  92750   ** corresponding pop occurs.
................................................................................
 92776  92760   
 92777  92761   /*
 92778  92762   ** Remove from the column cache any entries that were added since the
 92779  92763   ** the previous sqlite3ExprCachePush operation.  In other words, restore
 92780  92764   ** the cache to the state it was in prior the most recent Push.
 92781  92765   */
 92782  92766   SQLITE_PRIVATE void sqlite3ExprCachePop(Parse *pParse){
 92783         -  int i;
 92784         -  struct yColCache *p;
        92767  +  int i = 0;
 92785  92768     assert( pParse->iCacheLevel>=1 );
 92786  92769     pParse->iCacheLevel--;
 92787  92770   #ifdef SQLITE_DEBUG
 92788  92771     if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
 92789  92772       printf("POP  to %d\n", pParse->iCacheLevel);
 92790  92773     }
 92791  92774   #endif
 92792         -  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
 92793         -    if( p->iReg && p->iLevel>pParse->iCacheLevel ){
 92794         -      cacheEntryClear(pParse, p);
        92775  +  while( i<pParse->nColCache ){
        92776  +    if( pParse->aColCache[i].iLevel>pParse->iCacheLevel ){
        92777  +      cacheEntryClear(pParse, i);
        92778  +    }else{
        92779  +      i++;
 92795  92780       }
 92796  92781     }
 92797  92782   }
 92798  92783   
 92799  92784   /*
 92800  92785   ** When a cached column is reused, make sure that its register is
 92801  92786   ** no longer available as a temp register.  ticket #3879:  that same
 92802  92787   ** register might be in the cache in multiple places, so be sure to
 92803  92788   ** get them all.
 92804  92789   */
 92805  92790   static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){
 92806  92791     int i;
 92807  92792     struct yColCache *p;
 92808         -  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
        92793  +  for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
 92809  92794       if( p->iReg==iReg ){
 92810  92795         p->tempReg = 0;
 92811  92796       }
 92812  92797     }
 92813  92798   }
 92814  92799   
 92815  92800   /* Generate code that will load into register regOut a value that is
................................................................................
 92879  92864     int iReg,        /* Store results here */
 92880  92865     u8 p5            /* P5 value for OP_Column + FLAGS */
 92881  92866   ){
 92882  92867     Vdbe *v = pParse->pVdbe;
 92883  92868     int i;
 92884  92869     struct yColCache *p;
 92885  92870   
 92886         -  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
 92887         -    if( p->iReg>0 && p->iTable==iTable && p->iColumn==iColumn ){
        92871  +  for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
        92872  +    if( p->iTable==iTable && p->iColumn==iColumn ){
 92888  92873         p->lru = pParse->iCacheCnt++;
 92889  92874         sqlite3ExprCachePinRegister(pParse, p->iReg);
 92890  92875         return p->iReg;
 92891  92876       }
 92892  92877     }  
 92893  92878     assert( v!=0 );
 92894  92879     sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg);
................................................................................
 92912  92897   
 92913  92898   
 92914  92899   /*
 92915  92900   ** Clear all column cache entries.
 92916  92901   */
 92917  92902   SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
 92918  92903     int i;
 92919         -  struct yColCache *p;
 92920  92904   
 92921  92905   #if SQLITE_DEBUG
 92922  92906     if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
 92923  92907       printf("CLEAR\n");
 92924  92908     }
 92925  92909   #endif
 92926         -  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
 92927         -    if( p->iReg ){
 92928         -      cacheEntryClear(pParse, p);
        92910  +  for(i=0; i<pParse->nColCache; i++){
        92911  +    if( pParse->aColCache[i].tempReg
        92912  +     && pParse->nTempReg<ArraySize(pParse->aTempReg)
        92913  +    ){
        92914  +       pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
 92929  92915       }
 92930  92916     }
        92917  +  pParse->nColCache = 0;
 92931  92918   }
 92932  92919   
 92933  92920   /*
 92934  92921   ** Record the fact that an affinity change has occurred on iCount
 92935  92922   ** registers starting with iStart.
 92936  92923   */
 92937  92924   SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse *pParse, int iStart, int iCount){
................................................................................
 92955  92942   **
 92956  92943   ** This routine is used within assert() and testcase() macros only
 92957  92944   ** and does not appear in a normal build.
 92958  92945   */
 92959  92946   static int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){
 92960  92947     int i;
 92961  92948     struct yColCache *p;
 92962         -  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
        92949  +  for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
 92963  92950       int r = p->iReg;
 92964  92951       if( r>=iFrom && r<=iTo ) return 1;    /*NO_TEST*/
 92965  92952     }
 92966  92953     return 0;
 92967  92954   }
 92968  92955   #endif /* SQLITE_DEBUG || SQLITE_COVERAGE_TEST */
 92969  92956   
................................................................................
 94651  94638   ** the deallocation is deferred until the column cache line that uses
 94652  94639   ** the register becomes stale.
 94653  94640   */
 94654  94641   SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
 94655  94642     if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
 94656  94643       int i;
 94657  94644       struct yColCache *p;
 94658         -    for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
        94645  +    for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
 94659  94646         if( p->iReg==iReg ){
 94660  94647           p->tempReg = 1;
 94661  94648           return;
 94662  94649         }
 94663  94650       }
 94664  94651       pParse->aTempReg[pParse->nTempReg++] = iReg;
 94665  94652     }
................................................................................
 97957  97944         if( pFix->pParse->db->init.busy ){
 97958  97945           pExpr->op = TK_NULL;
 97959  97946         }else{
 97960  97947           sqlite3ErrorMsg(pFix->pParse, "%s cannot use variables", pFix->zType);
 97961  97948           return 1;
 97962  97949         }
 97963  97950       }
 97964         -    if( ExprHasProperty(pExpr, EP_TokenOnly) ) break;
        97951  +    if( ExprHasProperty(pExpr, EP_TokenOnly|EP_Leaf) ) break;
 97965  97952       if( ExprHasProperty(pExpr, EP_xIsSelect) ){
 97966  97953         if( sqlite3FixSelect(pFix, pExpr->x.pSelect) ) return 1;
 97967  97954       }else{
 97968  97955         if( sqlite3FixExprList(pFix, pExpr->x.pList) ) return 1;
 97969  97956       }
 97970  97957       if( sqlite3FixExpr(pFix, pExpr->pRight) ){
 97971  97958         return 1;
................................................................................
 98421  98408     /* Begin by generating some termination code at the end of the
 98422  98409     ** vdbe program
 98423  98410     */
 98424  98411     v = sqlite3GetVdbe(pParse);
 98425  98412     assert( !pParse->isMultiWrite 
 98426  98413          || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
 98427  98414     if( v ){
 98428         -    while( sqlite3VdbeDeletePriorOpcode(v, OP_Close) ){}
 98429  98415       sqlite3VdbeAddOp0(v, OP_Halt);
 98430  98416   
 98431  98417   #if SQLITE_USER_AUTHENTICATION
 98432  98418       if( pParse->nTableLock>0 && db->init.busy==0 ){
 98433  98419         sqlite3UserAuthInit(db);
 98434  98420         if( db->auth.authLevel<UAUTH_User ){
 98435  98421           sqlite3ErrorMsg(pParse, "user not authenticated");
................................................................................
 98448  98434       if( db->mallocFailed==0 
 98449  98435        && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr)
 98450  98436       ){
 98451  98437         int iDb, i;
 98452  98438         assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
 98453  98439         sqlite3VdbeJumpHere(v, 0);
 98454  98440         for(iDb=0; iDb<db->nDb; iDb++){
        98441  +        Schema *pSchema;
 98455  98442           if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
 98456  98443           sqlite3VdbeUsesBtree(v, iDb);
        98444  +        pSchema = db->aDb[iDb].pSchema;
 98457  98445           sqlite3VdbeAddOp4Int(v,
 98458  98446             OP_Transaction,                    /* Opcode */
 98459  98447             iDb,                               /* P1 */
 98460  98448             DbMaskTest(pParse->writeMask,iDb), /* P2 */
 98461         -          pParse->cookieValue[iDb],          /* P3 */
 98462         -          db->aDb[iDb].pSchema->iGeneration  /* P4 */
        98449  +          pSchema->schema_cookie,            /* P3 */
        98450  +          pSchema->iGeneration               /* P4 */
 98463  98451           );
 98464  98452           if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
 98465  98453           VdbeComment((v,
 98466  98454                 "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
 98467  98455         }
 98468  98456   #ifndef SQLITE_OMIT_VIRTUALTABLE
 98469  98457         for(i=0; i<pParse->nVtabLock; i++){
................................................................................
 98506  98494       *  See ticket [a696379c1f08866] */
 98507  98495       if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;
 98508  98496       sqlite3VdbeMakeReady(v, pParse);
 98509  98497       pParse->rc = SQLITE_DONE;
 98510  98498     }else{
 98511  98499       pParse->rc = SQLITE_ERROR;
 98512  98500     }
 98513         -
 98514         -  /* We are done with this Parse object. There is no need to de-initialize it */
 98515         -#if 0
 98516         -  pParse->colNamesSet = 0;
 98517         -  pParse->nTab = 0;
 98518         -  pParse->nMem = 0;
 98519         -  pParse->nSet = 0;
 98520         -  pParse->nVar = 0;
 98521         -  DbMaskZero(pParse->cookieMask);
 98522         -#endif
 98523  98501   }
 98524  98502   
 98525  98503   /*
 98526  98504   ** Run the parser and code generator recursively in order to generate
 98527  98505   ** code for the SQL statement given onto the end of the pParse context
 98528  98506   ** currently under construction.  When the parser is run recursively
 98529  98507   ** this way, the final OP_Halt is not appended and other initialization
................................................................................
 98535  98513   ** care if you decide to try to use this routine for some other purposes.
 98536  98514   */
 98537  98515   SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
 98538  98516     va_list ap;
 98539  98517     char *zSql;
 98540  98518     char *zErrMsg = 0;
 98541  98519     sqlite3 *db = pParse->db;
 98542         -# define SAVE_SZ  (sizeof(Parse) - offsetof(Parse,nVar))
 98543         -  char saveBuf[SAVE_SZ];
        98520  +  char saveBuf[PARSE_TAIL_SZ];
 98544  98521   
 98545  98522     if( pParse->nErr ) return;
 98546  98523     assert( pParse->nested<10 );  /* Nesting should only be of limited depth */
 98547  98524     va_start(ap, zFormat);
 98548  98525     zSql = sqlite3VMPrintf(db, zFormat, ap);
 98549  98526     va_end(ap);
 98550  98527     if( zSql==0 ){
 98551  98528       return;   /* A malloc must have failed */
 98552  98529     }
 98553  98530     pParse->nested++;
 98554         -  memcpy(saveBuf, &pParse->nVar, SAVE_SZ);
 98555         -  memset(&pParse->nVar, 0, SAVE_SZ);
        98531  +  memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
        98532  +  memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
 98556  98533     sqlite3RunParser(pParse, zSql, &zErrMsg);
 98557  98534     sqlite3DbFree(db, zErrMsg);
 98558  98535     sqlite3DbFree(db, zSql);
 98559         -  memcpy(&pParse->nVar, saveBuf, SAVE_SZ);
        98536  +  memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ);
 98560  98537     pParse->nested--;
 98561  98538   }
 98562  98539   
 98563  98540   #if SQLITE_USER_AUTHENTICATION
 98564  98541   /*
 98565  98542   ** Return TRUE if zTable is the name of the system table that stores the
 98566  98543   ** list of users and their access credentials.
................................................................................
 99733  99710   ** since it was last read.
 99734  99711   **
 99735  99712   ** This plan is not completely bullet-proof.  It is possible for
 99736  99713   ** the schema to change multiple times and for the cookie to be
 99737  99714   ** set back to prior value.  But schema changes are infrequent
 99738  99715   ** and the probability of hitting the same cookie value is only
 99739  99716   ** 1 chance in 2^32.  So we're safe enough.
        99717  +**
        99718  +** IMPLEMENTATION-OF: R-34230-56049 SQLite automatically increments
        99719  +** the schema-version whenever the schema changes.
 99740  99720   */
 99741  99721   SQLITE_PRIVATE void sqlite3ChangeCookie(Parse *pParse, int iDb){
 99742  99722     sqlite3 *db = pParse->db;
 99743  99723     Vdbe *v = pParse->pVdbe;
 99744  99724     assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
 99745  99725     sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_SCHEMA_VERSION, 
 99746  99726                       db->aDb[iDb].pSchema->schema_cookie+1);
................................................................................
102316 102296   ** Record the fact that the schema cookie will need to be verified
102317 102297   ** for database iDb.  The code to actually verify the schema cookie
102318 102298   ** will occur at the end of the top-level VDBE and will be generated
102319 102299   ** later, by sqlite3FinishCoding().
102320 102300   */
102321 102301   SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
102322 102302     Parse *pToplevel = sqlite3ParseToplevel(pParse);
102323         -  sqlite3 *db = pToplevel->db;
102324 102303   
102325         -  assert( iDb>=0 && iDb<db->nDb );
102326         -  assert( db->aDb[iDb].pBt!=0 || iDb==1 );
       102304  +  assert( iDb>=0 && iDb<pParse->db->nDb );
       102305  +  assert( pParse->db->aDb[iDb].pBt!=0 || iDb==1 );
102327 102306     assert( iDb<SQLITE_MAX_ATTACHED+2 );
102328         -  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
       102307  +  assert( sqlite3SchemaMutexHeld(pParse->db, iDb, 0) );
102329 102308     if( DbMaskTest(pToplevel->cookieMask, iDb)==0 ){
102330 102309       DbMaskSet(pToplevel->cookieMask, iDb);
102331         -    pToplevel->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie;
102332 102310       if( !OMIT_TEMPDB && iDb==1 ){
102333 102311         sqlite3OpenTempDatabase(pToplevel);
102334 102312       }
102335 102313     }
102336 102314   }
102337 102315   
102338 102316   /*
................................................................................
107190 107168               sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)
107191 107169             , 0);
107192 107170           }else if( action==OE_SetDflt ){
107193 107171             Expr *pDflt = pFKey->pFrom->aCol[iFromCol].pDflt;
107194 107172             if( pDflt ){
107195 107173               pNew = sqlite3ExprDup(db, pDflt, 0);
107196 107174             }else{
107197         -            pNew = sqlite3PExpr(pParse, TK_NULL, 0, 0, 0);
       107175  +            pNew = sqlite3ExprAlloc(db, TK_NULL, 0, 0);
107198 107176             }
107199 107177           }else{
107200         -          pNew = sqlite3PExpr(pParse, TK_NULL, 0, 0, 0);
       107178  +          pNew = sqlite3ExprAlloc(db, TK_NULL, 0, 0);
107201 107179           }
107202 107180           pList = sqlite3ExprListAppend(pParse, pList, pNew);
107203 107181           sqlite3ExprListSetName(pParse, pList, &tFromCol, 0);
107204 107182         }
107205 107183       }
107206 107184       sqlite3DbFree(db, aiCol);
107207 107185   
................................................................................
109536 109514       sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
109537 109515       sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
109538 109516     }
109539 109517     if( emptySrcTest ) sqlite3VdbeJumpHere(v, emptySrcTest);
109540 109518     sqlite3ReleaseTempReg(pParse, regRowid);
109541 109519     sqlite3ReleaseTempReg(pParse, regData);
109542 109520     if( emptyDestTest ){
       109521  +    sqlite3AutoincrementEnd(pParse);
109543 109522       sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_OK, 0);
109544 109523       sqlite3VdbeJumpHere(v, emptyDestTest);
109545 109524       sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
109546 109525       return 0;
109547 109526     }else{
109548 109527       return 1;
109549 109528     }
................................................................................
114032 114011     const char *zSql,         /* UTF-8 encoded SQL statement. */
114033 114012     int nBytes,               /* Length of zSql in bytes. */
114034 114013     int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */
114035 114014     Vdbe *pReprepare,         /* VM being reprepared */
114036 114015     sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
114037 114016     const char **pzTail       /* OUT: End of parsed string */
114038 114017   ){
114039         -  Parse *pParse;            /* Parsing context */
114040 114018     char *zErrMsg = 0;        /* Error message */
114041 114019     int rc = SQLITE_OK;       /* Result code */
114042 114020     int i;                    /* Loop counter */
       114021  +  Parse sParse;             /* Parsing context */
114043 114022   
114044         -  /* Allocate the parsing context */
114045         -  pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
114046         -  if( pParse==0 ){
114047         -    rc = SQLITE_NOMEM_BKPT;
114048         -    goto end_prepare;
114049         -  }
114050         -  pParse->pReprepare = pReprepare;
       114023  +  memset(&sParse, 0, PARSE_HDR_SZ);
       114024  +  memset(PARSE_TAIL(&sParse), 0, PARSE_TAIL_SZ);
       114025  +  sParse.pReprepare = pReprepare;
114051 114026     assert( ppStmt && *ppStmt==0 );
114052 114027     /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */
114053 114028     assert( sqlite3_mutex_held(db->mutex) );
114054 114029   
114055 114030     /* Check to verify that it is possible to get a read lock on all
114056 114031     ** database schemas.  The inability to get a read lock indicates that
114057 114032     ** some other database connection is holding a write-lock, which in
................................................................................
114087 114062           goto end_prepare;
114088 114063         }
114089 114064       }
114090 114065     }
114091 114066   
114092 114067     sqlite3VtabUnlockList(db);
114093 114068   
114094         -  pParse->db = db;
114095         -  pParse->nQueryLoop = 0;  /* Logarithmic, so 0 really means 1 */
       114069  +  sParse.db = db;
114096 114070     if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){
114097 114071       char *zSqlCopy;
114098 114072       int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
114099 114073       testcase( nBytes==mxLen );
114100 114074       testcase( nBytes==mxLen+1 );
114101 114075       if( nBytes>mxLen ){
114102 114076         sqlite3ErrorWithMsg(db, SQLITE_TOOBIG, "statement too long");
114103 114077         rc = sqlite3ApiExit(db, SQLITE_TOOBIG);
114104 114078         goto end_prepare;
114105 114079       }
114106 114080       zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
114107 114081       if( zSqlCopy ){
114108         -      sqlite3RunParser(pParse, zSqlCopy, &zErrMsg);
114109         -      pParse->zTail = &zSql[pParse->zTail-zSqlCopy];
       114082  +      sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg);
       114083  +      sParse.zTail = &zSql[sParse.zTail-zSqlCopy];
114110 114084         sqlite3DbFree(db, zSqlCopy);
114111 114085       }else{
114112         -      pParse->zTail = &zSql[nBytes];
       114086  +      sParse.zTail = &zSql[nBytes];
114113 114087       }
114114 114088     }else{
114115         -    sqlite3RunParser(pParse, zSql, &zErrMsg);
       114089  +    sqlite3RunParser(&sParse, zSql, &zErrMsg);
114116 114090     }
114117         -  assert( 0==pParse->nQueryLoop );
       114091  +  assert( 0==sParse.nQueryLoop );
114118 114092   
114119         -  if( pParse->rc==SQLITE_DONE ) pParse->rc = SQLITE_OK;
114120         -  if( pParse->checkSchema ){
114121         -    schemaIsValid(pParse);
       114093  +  if( sParse.rc==SQLITE_DONE ) sParse.rc = SQLITE_OK;
       114094  +  if( sParse.checkSchema ){
       114095  +    schemaIsValid(&sParse);
114122 114096     }
114123 114097     if( db->mallocFailed ){
114124         -    pParse->rc = SQLITE_NOMEM_BKPT;
       114098  +    sParse.rc = SQLITE_NOMEM_BKPT;
114125 114099     }
114126 114100     if( pzTail ){
114127         -    *pzTail = pParse->zTail;
       114101  +    *pzTail = sParse.zTail;
114128 114102     }
114129         -  rc = pParse->rc;
       114103  +  rc = sParse.rc;
114130 114104   
114131 114105   #ifndef SQLITE_OMIT_EXPLAIN
114132         -  if( rc==SQLITE_OK && pParse->pVdbe && pParse->explain ){
       114106  +  if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){
114133 114107       static const char * const azColName[] = {
114134 114108          "addr", "opcode", "p1", "p2", "p3", "p4", "p5", "comment",
114135 114109          "selectid", "order", "from", "detail"
114136 114110       };
114137 114111       int iFirst, mx;
114138         -    if( pParse->explain==2 ){
114139         -      sqlite3VdbeSetNumCols(pParse->pVdbe, 4);
       114112  +    if( sParse.explain==2 ){
       114113  +      sqlite3VdbeSetNumCols(sParse.pVdbe, 4);
114140 114114         iFirst = 8;
114141 114115         mx = 12;
114142 114116       }else{
114143         -      sqlite3VdbeSetNumCols(pParse->pVdbe, 8);
       114117  +      sqlite3VdbeSetNumCols(sParse.pVdbe, 8);
114144 114118         iFirst = 0;
114145 114119         mx = 8;
114146 114120       }
114147 114121       for(i=iFirst; i<mx; i++){
114148         -      sqlite3VdbeSetColName(pParse->pVdbe, i-iFirst, COLNAME_NAME,
       114122  +      sqlite3VdbeSetColName(sParse.pVdbe, i-iFirst, COLNAME_NAME,
114149 114123                               azColName[i], SQLITE_STATIC);
114150 114124       }
114151 114125     }
114152 114126   #endif
114153 114127   
114154 114128     if( db->init.busy==0 ){
114155         -    Vdbe *pVdbe = pParse->pVdbe;
114156         -    sqlite3VdbeSetSql(pVdbe, zSql, (int)(pParse->zTail-zSql), saveSqlFlag);
       114129  +    Vdbe *pVdbe = sParse.pVdbe;
       114130  +    sqlite3VdbeSetSql(pVdbe, zSql, (int)(sParse.zTail-zSql), saveSqlFlag);
114157 114131     }
114158         -  if( pParse->pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){
114159         -    sqlite3VdbeFinalize(pParse->pVdbe);
       114132  +  if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){
       114133  +    sqlite3VdbeFinalize(sParse.pVdbe);
114160 114134       assert(!(*ppStmt));
114161 114135     }else{
114162         -    *ppStmt = (sqlite3_stmt*)pParse->pVdbe;
       114136  +    *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
114163 114137     }
114164 114138   
114165 114139     if( zErrMsg ){
114166 114140       sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
114167 114141       sqlite3DbFree(db, zErrMsg);
114168 114142     }else{
114169 114143       sqlite3Error(db, rc);
114170 114144     }
114171 114145   
114172 114146     /* Delete any TriggerPrg structures allocated while parsing this statement. */
114173         -  while( pParse->pTriggerPrg ){
114174         -    TriggerPrg *pT = pParse->pTriggerPrg;
114175         -    pParse->pTriggerPrg = pT->pNext;
       114147  +  while( sParse.pTriggerPrg ){
       114148  +    TriggerPrg *pT = sParse.pTriggerPrg;
       114149  +    sParse.pTriggerPrg = pT->pNext;
114176 114150       sqlite3DbFree(db, pT);
114177 114151     }
114178 114152   
114179 114153   end_prepare:
114180 114154   
114181         -  sqlite3ParserReset(pParse);
114182         -  sqlite3StackFree(db, pParse);
       114155  +  sqlite3ParserReset(&sParse);
114183 114156     rc = sqlite3ApiExit(db, rc);
114184 114157     assert( (rc&db->errMask)==rc );
114185 114158     return rc;
114186 114159   }
114187 114160   static int sqlite3LockAndPrepare(
114188 114161     sqlite3 *db,              /* Database handle. */
114189 114162     const char *zSql,         /* UTF-8 encoded SQL statement. */
................................................................................
115380 115353   
115381 115354   /*
115382 115355   ** Allocate a KeyInfo object sufficient for an index of N key columns and
115383 115356   ** X extra columns.
115384 115357   */
115385 115358   SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){
115386 115359     int nExtra = (N+X)*(sizeof(CollSeq*)+1);
115387         -  KeyInfo *p = sqlite3DbMallocRaw(db, sizeof(KeyInfo) + nExtra);
       115360  +  KeyInfo *p = sqlite3DbMallocRawNN(db, sizeof(KeyInfo) + nExtra);
115388 115361     if( p ){
115389 115362       p->aSortOrder = (u8*)&p->aColl[N+X];
115390 115363       p->nField = (u16)N;
115391 115364       p->nXField = (u16)X;
115392 115365       p->enc = ENC(db);
115393 115366       p->db = db;
115394 115367       p->nRef = 1;
................................................................................
118070 118043         pSub->pOrderBy = 0;
118071 118044       }
118072 118045       pWhere = sqlite3ExprDup(db, pSub->pWhere, 0);
118073 118046       if( subqueryIsAgg ){
118074 118047         assert( pParent->pHaving==0 );
118075 118048         pParent->pHaving = pParent->pWhere;
118076 118049         pParent->pWhere = pWhere;
118077         -      pParent->pHaving = sqlite3ExprAnd(db, pParent->pHaving, 
118078         -                                  sqlite3ExprDup(db, pSub->pHaving, 0));
       118050  +      pParent->pHaving = sqlite3ExprAnd(db, 
       118051  +          sqlite3ExprDup(db, pSub->pHaving, 0), pParent->pHaving
       118052  +      );
118079 118053         assert( pParent->pGroupBy==0 );
118080 118054         pParent->pGroupBy = sqlite3ExprListDup(db, pSub->pGroupBy, 0);
118081 118055       }else{
118082         -      pParent->pWhere = sqlite3ExprAnd(db, pParent->pWhere, pWhere);
       118056  +      pParent->pWhere = sqlite3ExprAnd(db, pWhere, pParent->pWhere);
118083 118057       }
118084 118058       substSelect(db, pParent, iParent, pSub->pEList, 0);
118085 118059     
118086 118060       /* The flattened query is distinct if either the inner or the
118087 118061       ** outer query is distinct. 
118088 118062       */
118089 118063       pParent->selFlags |= pSub->selFlags & SF_Distinct;
................................................................................
124039 124013   **
124040 124014   ** The number of terms in a join is limited by the number of bits
124041 124015   ** in prereqRight and prereqAll.  The default is 64 bits, hence SQLite
124042 124016   ** is only able to process joins with 64 or fewer tables.
124043 124017   */
124044 124018   struct WhereTerm {
124045 124019     Expr *pExpr;            /* Pointer to the subexpression that is this term */
       124020  +  WhereClause *pWC;       /* The clause this term is part of */
       124021  +  LogEst truthProb;       /* Probability of truth for this expression */
       124022  +  u16 wtFlags;            /* TERM_xxx bit flags.  See below */
       124023  +  u16 eOperator;          /* A WO_xx value describing <op> */
       124024  +  u8 nChild;              /* Number of children that must disable us */
       124025  +  u8 eMatchOp;            /* Op for vtab MATCH/LIKE/GLOB/REGEXP terms */
124046 124026     int iParent;            /* Disable pWC->a[iParent] when this term disabled */
124047 124027     int leftCursor;         /* Cursor number of X in "X <op> <expr>" */
124048 124028     int iField;             /* Field in (?,?,?) IN (SELECT...) vector */
124049 124029     union {
124050 124030       int leftColumn;         /* Column number of X in "X <op> <expr>" */
124051 124031       WhereOrInfo *pOrInfo;   /* Extra information if (eOperator & WO_OR)!=0 */
124052 124032       WhereAndInfo *pAndInfo; /* Extra information if (eOperator& WO_AND)!=0 */
124053 124033     } u;
124054         -  LogEst truthProb;       /* Probability of truth for this expression */
124055         -  u16 eOperator;          /* A WO_xx value describing <op> */
124056         -  u16 wtFlags;            /* TERM_xxx bit flags.  See below */
124057         -  u8 nChild;              /* Number of children that must disable us */
124058         -  u8 eMatchOp;            /* Op for vtab MATCH/LIKE/GLOB/REGEXP terms */
124059         -  WhereClause *pWC;       /* The clause this term is part of */
124060 124034     Bitmask prereqRight;    /* Bitmask of tables used by pExpr->pRight */
124061 124035     Bitmask prereqAll;      /* Bitmask of tables referenced by pExpr */
124062 124036   };
124063 124037   
124064 124038   /*
124065 124039   ** Allowed values of WhereTerm.wtFlags
124066 124040   */
................................................................................
124205 124179   ** planner.
124206 124180   */
124207 124181   struct WhereInfo {
124208 124182     Parse *pParse;            /* Parsing and code generating context */
124209 124183     SrcList *pTabList;        /* List of tables in the join */
124210 124184     ExprList *pOrderBy;       /* The ORDER BY clause or NULL */
124211 124185     ExprList *pDistinctSet;   /* DISTINCT over all these values */
124212         -  WhereLoop *pLoops;        /* List of all WhereLoop objects */
124213         -  Bitmask revMask;          /* Mask of ORDER BY terms that need reversing */
124214         -  LogEst nRowOut;           /* Estimated number of output rows */
124215 124186     LogEst iLimit;            /* LIMIT if wctrlFlags has WHERE_USE_LIMIT */
       124187  +  int aiCurOnePass[2];      /* OP_OpenWrite cursors for the ONEPASS opt */
       124188  +  int iContinue;            /* Jump here to continue with next record */
       124189  +  int iBreak;               /* Jump here to break out of the loop */
       124190  +  int savedNQueryLoop;      /* pParse->nQueryLoop outside the WHERE loop */
124216 124191     u16 wctrlFlags;           /* Flags originally passed to sqlite3WhereBegin() */
       124192  +  u8 nLevel;                /* Number of nested loop */
124217 124193     i8 nOBSat;                /* Number of ORDER BY terms satisfied by indices */
124218 124194     u8 sorted;                /* True if really sorted (not just grouped) */
124219 124195     u8 eOnePass;              /* ONEPASS_OFF, or _SINGLE, or _MULTI */
124220 124196     u8 untestedTerms;         /* Not all WHERE terms resolved by outer loop */
124221 124197     u8 eDistinct;             /* One of the WHERE_DISTINCT_* values */
124222         -  u8 nLevel;                /* Number of nested loop */
124223 124198     u8 bOrderedInnerLoop;     /* True if only the inner-most loop is ordered */
124224 124199     int iTop;                 /* The very beginning of the WHERE loop */
124225         -  int iContinue;            /* Jump here to continue with next record */
124226         -  int iBreak;               /* Jump here to break out of the loop */
124227         -  int savedNQueryLoop;      /* pParse->nQueryLoop outside the WHERE loop */
124228         -  int aiCurOnePass[2];      /* OP_OpenWrite cursors for the ONEPASS opt */
124229         -  WhereMaskSet sMaskSet;    /* Map cursor numbers to bitmasks */
       124200  +  WhereLoop *pLoops;        /* List of all WhereLoop objects */
       124201  +  Bitmask revMask;          /* Mask of ORDER BY terms that need reversing */
       124202  +  LogEst nRowOut;           /* Estimated number of output rows */
124230 124203     WhereClause sWC;          /* Decomposition of the WHERE clause */
       124204  +  WhereMaskSet sMaskSet;    /* Map cursor numbers to bitmasks */
124231 124205     WhereLevel a[1];          /* Information about each nest loop in WHERE */
124232 124206   };
124233 124207   
124234 124208   /*
124235 124209   ** Private interfaces - callable only by other where.c routines.
124236 124210   **
124237 124211   ** where.c:
................................................................................
126313 126287     **
126314 126288     ** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
126315 126289     ** and we are coding the t1 loop and the t2 loop has not yet coded,
126316 126290     ** then we cannot use the "t1.a=t2.b" constraint, but we can code
126317 126291     ** the implied "t1.a=123" constraint.
126318 126292     */
126319 126293     for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
126320         -    Expr *pE, *pEAlt;
       126294  +    Expr *pE, sEAlt;
126321 126295       WhereTerm *pAlt;
126322 126296       if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
126323 126297       if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) continue;
126324 126298       if( (pTerm->eOperator & WO_EQUIV)==0 ) continue;
126325 126299       if( pTerm->leftCursor!=iCur ) continue;
126326 126300       if( pLevel->iLeftJoin ) continue;
126327 126301       pE = pTerm->pExpr;
................................................................................
126331 126305                       WO_EQ|WO_IN|WO_IS, 0);
126332 126306       if( pAlt==0 ) continue;
126333 126307       if( pAlt->wtFlags & (TERM_CODED) ) continue;
126334 126308       testcase( pAlt->eOperator & WO_EQ );
126335 126309       testcase( pAlt->eOperator & WO_IS );
126336 126310       testcase( pAlt->eOperator & WO_IN );
126337 126311       VdbeModuleComment((v, "begin transitive constraint"));
126338         -    pEAlt = sqlite3StackAllocRaw(db, sizeof(*pEAlt));
126339         -    if( pEAlt ){
126340         -      *pEAlt = *pAlt->pExpr;
126341         -      pEAlt->pLeft = pE->pLeft;
126342         -      sqlite3ExprIfFalse(pParse, pEAlt, addrCont, SQLITE_JUMPIFNULL);
126343         -      sqlite3StackFree(db, pEAlt);
126344         -    }
       126312  +    sEAlt = *pAlt->pExpr;
       126313  +    sEAlt.pLeft = pE->pLeft;
       126314  +    sqlite3ExprIfFalse(pParse, &sEAlt, addrCont, SQLITE_JUMPIFNULL);
126345 126315     }
126346 126316   
126347 126317     /* For a LEFT OUTER JOIN, generate code that will record the fact that
126348 126318     ** at least one row of the right table has matched the left table.  
126349 126319     */
126350 126320     if( pLevel->iLeftJoin ){
126351 126321       pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
................................................................................
126446 126416         return 0;
126447 126417       }
126448 126418       memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm);
126449 126419       if( pOld!=pWC->aStatic ){
126450 126420         sqlite3DbFree(db, pOld);
126451 126421       }
126452 126422       pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
126453         -    memset(&pWC->a[pWC->nTerm], 0, sizeof(pWC->a[0])*(pWC->nSlot-pWC->nTerm));
126454 126423     }
126455 126424     pTerm = &pWC->a[idx = pWC->nTerm++];
126456 126425     if( p && ExprHasProperty(p, EP_Unlikely) ){
126457 126426       pTerm->truthProb = sqlite3LogEst(p->iTable) - 270;
126458 126427     }else{
126459 126428       pTerm->truthProb = 1;
126460 126429     }
126461 126430     pTerm->pExpr = sqlite3ExprSkipCollate(p);
126462 126431     pTerm->wtFlags = wtFlags;
126463 126432     pTerm->pWC = pWC;
126464 126433     pTerm->iParent = -1;
       126434  +  memset(&pTerm->eOperator, 0,
       126435  +         sizeof(WhereTerm) - offsetof(WhereTerm,eOperator));
126465 126436     return idx;
126466 126437   }
126467 126438   
126468 126439   /*
126469 126440   ** Return TRUE if the given operator is one of the operators that is
126470 126441   ** allowed for an indexable WHERE clause term.  The allowed operators are
126471 126442   ** "=", "<", ">", "<=", ">=", "IN", "IS", and "IS NULL"
................................................................................
127616 127587       Expr *pNewExpr;
127617 127588       Expr *pLeft = pExpr->pLeft;
127618 127589       int idxNew;
127619 127590       WhereTerm *pNewTerm;
127620 127591   
127621 127592       pNewExpr = sqlite3PExpr(pParse, TK_GT,
127622 127593                               sqlite3ExprDup(db, pLeft, 0),
127623         -                            sqlite3PExpr(pParse, TK_NULL, 0, 0, 0), 0);
       127594  +                            sqlite3ExprAlloc(db, TK_NULL, 0, 0), 0);
127624 127595   
127625 127596       idxNew = whereClauseInsert(pWC, pNewExpr,
127626 127597                                 TERM_VIRTUAL|TERM_DYNAMIC|TERM_VNULL);
127627 127598       if( idxNew ){
127628 127599         pNewTerm = &pWC->a[idxNew];
127629 127600         pNewTerm->prereqRight = 0;
127630 127601         pNewTerm->leftCursor = pLeft->iTable;
................................................................................
127794 127765     for(j=k=0; j<pArgs->nExpr; j++){
127795 127766       while( k<pTab->nCol && (pTab->aCol[k].colFlags & COLFLAG_HIDDEN)==0 ){k++;}
127796 127767       if( k>=pTab->nCol ){
127797 127768         sqlite3ErrorMsg(pParse, "too many arguments on %s() - max %d",
127798 127769                         pTab->zName, j);
127799 127770         return;
127800 127771       }
127801         -    pColRef = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
       127772  +    pColRef = sqlite3ExprAlloc(pParse->db, TK_COLUMN, 0, 0);
127802 127773       if( pColRef==0 ) return;
127803 127774       pColRef->iTable = pItem->iCursor;
127804 127775       pColRef->iColumn = k++;
127805 127776       pColRef->pTab = pTab;
127806 127777       pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef,
127807 127778                            sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
127808 127779       whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);
................................................................................
132216 132187     ** return value. A single allocation is used to store the WhereInfo
132217 132188     ** struct, the contents of WhereInfo.a[], the WhereClause structure
132218 132189     ** and the WhereMaskSet structure. Since WhereClause contains an 8-byte
132219 132190     ** field (type Bitmask) it must be aligned on an 8-byte boundary on
132220 132191     ** some architectures. Hence the ROUND8() below.
132221 132192     */
132222 132193     nByteWInfo = ROUND8(sizeof(WhereInfo)+(nTabList-1)*sizeof(WhereLevel));
132223         -  pWInfo = sqlite3DbMallocZero(db, nByteWInfo + sizeof(WhereLoop));
       132194  +  pWInfo = sqlite3DbMallocRawNN(db, nByteWInfo + sizeof(WhereLoop));
132224 132195     if( db->mallocFailed ){
132225 132196       sqlite3DbFree(db, pWInfo);
132226 132197       pWInfo = 0;
132227 132198       goto whereBeginError;
132228 132199     }
132229         -  pWInfo->aiCurOnePass[0] = pWInfo->aiCurOnePass[1] = -1;
132230         -  pWInfo->nLevel = nTabList;
132231 132200     pWInfo->pParse = pParse;
132232 132201     pWInfo->pTabList = pTabList;
132233 132202     pWInfo->pOrderBy = pOrderBy;
132234 132203     pWInfo->pDistinctSet = pDistinctSet;
       132204  +  pWInfo->aiCurOnePass[0] = pWInfo->aiCurOnePass[1] = -1;
       132205  +  pWInfo->nLevel = nTabList;
132235 132206     pWInfo->iBreak = pWInfo->iContinue = sqlite3VdbeMakeLabel(v);
132236 132207     pWInfo->wctrlFlags = wctrlFlags;
132237 132208     pWInfo->iLimit = iAuxArg;
132238 132209     pWInfo->savedNQueryLoop = pParse->nQueryLoop;
       132210  +  memset(&pWInfo->nOBSat, 0, 
       132211  +         offsetof(WhereInfo,sWC) - offsetof(WhereInfo,nOBSat));
       132212  +  memset(&pWInfo->a[0], 0, sizeof(WhereLoop)+nTabList*sizeof(WhereLevel));
132239 132213     assert( pWInfo->eOnePass==ONEPASS_OFF );  /* ONEPASS defaults to OFF */
132240 132214     pMaskSet = &pWInfo->sMaskSet;
132241 132215     sWLB.pWInfo = pWInfo;
132242 132216     sWLB.pWC = &pWInfo->sWC;
132243 132217     sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo);
132244 132218     assert( EIGHT_BYTE_ALIGNMENT(sWLB.pNew) );
132245 132219     whereLoopInit(sWLB.pNew);
................................................................................
132842 132816   ** LIMIT clause of a SELECT statement.
132843 132817   */
132844 132818   struct LimitVal {
132845 132819     Expr *pLimit;    /* The LIMIT expression.  NULL if there is no limit */
132846 132820     Expr *pOffset;   /* The OFFSET expression.  NULL if there is none */
132847 132821   };
132848 132822   
132849         -/*
132850         -** An instance of this structure is used to store the LIKE,
132851         -** GLOB, NOT LIKE, and NOT GLOB operators.
132852         -*/
132853         -struct LikeOp {
132854         -  Token eOperator;  /* "like" or "glob" or "regexp" */
132855         -  int bNot;         /* True if the NOT keyword is present */
132856         -};
132857         -
132858 132823   /*
132859 132824   ** An instance of the following structure describes the event of a
132860 132825   ** TRIGGER.  "a" is the event type, one of TK_UPDATE, TK_INSERT,
132861 132826   ** TK_DELETE, or TK_INSTEAD.  If the event is of the form
132862 132827   **
132863 132828   **      UPDATE ON (a,b,c)
132864 132829   **
132865 132830   ** Then the "b" IdList records the list "a,b,c".
132866 132831   */
132867 132832   struct TrigEvent { int a; IdList * b; };
132868 132833   
132869         -/*
132870         -** An instance of this structure holds the ATTACH key and the key type.
132871         -*/
132872         -struct AttachKey { int type;  Token key; };
132873         -
132874 132834   /*
132875 132835   ** Disable lookaside memory allocation for objects that might be
132876 132836   ** shared across database connections.
132877 132837   */
132878 132838   static void disableLookaside(Parse *pParse){
132879 132839     pParse->disableLookaside++;
132880 132840     pParse->db->lookaside.bDisable++;
................................................................................
132913 132873     }
132914 132874   
132915 132875     /* Construct a new Expr object from a single identifier.  Use the
132916 132876     ** new Expr to populate pOut.  Set the span of pOut to be the identifier
132917 132877     ** that created the expression.
132918 132878     */
132919 132879     static void spanExpr(ExprSpan *pOut, Parse *pParse, int op, Token t){
132920         -    pOut->pExpr = sqlite3PExpr(pParse, op, 0, 0, &t);
       132880  +    Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1);
       132881  +    if( p ){
       132882  +      memset(p, 0, sizeof(Expr));
       132883  +      p->op = (u8)op;
       132884  +      p->flags = EP_Leaf;
       132885  +      p->iAgg = -1;
       132886  +      p->u.zToken = (char*)&p[1];
       132887  +      memcpy(p->u.zToken, t.z, t.n);
       132888  +      p->u.zToken[t.n] = 0;
       132889  +      if( sqlite3Isquote(p->u.zToken[0]) ){
       132890  +        if( p->u.zToken[0]=='"' ) p->flags |= EP_DblQuoted;
       132891  +        sqlite3Dequote(p->u.zToken);
       132892  +      }
       132893  +#if SQLITE_MAX_EXPR_DEPTH>0
       132894  +      p->nHeight = 1;
       132895  +#endif  
       132896  +    }
       132897  +    pOut->pExpr = p;
132921 132898       pOut->zStart = t.z;
132922 132899       pOut->zEnd = &t.z[t.n];
132923 132900     }
132924 132901   
132925 132902     /* This routine constructs a binary expression node out of two ExprSpan
132926 132903     ** objects and uses the result to populate a new ExprSpan object.
132927 132904     */
................................................................................
133076 133053     ExprSpan yy190;
133077 133054     int yy194;
133078 133055     Select* yy243;
133079 133056     IdList* yy254;
133080 133057     With* yy285;
133081 133058     struct TrigEvent yy332;
133082 133059     struct LimitVal yy354;
133083         -  struct LikeOp yy392;
133084 133060     struct {int value; int mask;} yy497;
133085 133061   } YYMINORTYPE;
133086 133062   #ifndef YYSTACKDEPTH
133087 133063   #define YYSTACKDEPTH 100
133088 133064   #endif
133089 133065   #define sqlite3ParserARG_SDECL Parse *pParse;
133090 133066   #define sqlite3ParserARG_PDECL ,Parse *pParse
133091 133067   #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
133092 133068   #define sqlite3ParserARG_STORE yypParser->pParse = pParse
133093 133069   #define YYFALLBACK 1
133094 133070   #define YYNSTATE             456
133095         -#define YYNRULE              331
       133071  +#define YYNRULE              332
133096 133072   #define YY_MAX_SHIFT         455
133097         -#define YY_MIN_SHIFTREDUCE   667
133098         -#define YY_MAX_SHIFTREDUCE   997
133099         -#define YY_MIN_REDUCE        998
133100         -#define YY_MAX_REDUCE        1328
133101         -#define YY_ERROR_ACTION      1329
133102         -#define YY_ACCEPT_ACTION     1330
133103         -#define YY_NO_ACTION         1331
       133073  +#define YY_MIN_SHIFTREDUCE   668
       133074  +#define YY_MAX_SHIFTREDUCE   999
       133075  +#define YY_MIN_REDUCE        1000
       133076  +#define YY_MAX_REDUCE        1331
       133077  +#define YY_ERROR_ACTION      1332
       133078  +#define YY_ACCEPT_ACTION     1333
       133079  +#define YY_NO_ACTION         1334
133104 133080   /************* End control #defines *******************************************/
133105 133081   
133106 133082   /* Define the yytestcase() macro to be a no-op if is not already defined
133107 133083   ** otherwise.
133108 133084   **
133109 133085   ** Applications can choose to define yytestcase() in the %include section
133110 133086   ** to a macro that can assist in verifying code coverage.  For production
................................................................................
133168 133144   **  yy_shift_ofst[]    For each state, the offset into yy_action for
133169 133145   **                     shifting terminals.
133170 133146   **  yy_reduce_ofst[]   For each state, the offset into yy_action for
133171 133147   **                     shifting non-terminals after a reduce.
133172 133148   **  yy_default[]       Default action for each state.
133173 133149   **
133174 133150   *********** Begin parsing tables **********************************************/
133175         -#define YY_ACTTAB_COUNT (1571)
       133151  +#define YY_ACTTAB_COUNT (1567)
133176 133152   static const YYACTIONTYPE yy_action[] = {
133177         - /*     0 */   325,  830,  351,  824,    5,  203,  203,  818,   99,  100,
133178         - /*    10 */    90,  840,  840,  852,  855,  844,  844,   97,   97,   98,
       133153  + /*     0 */   325,  832,  351,  825,    5,  203,  203,  819,   99,  100,
       133154  + /*    10 */    90,  842,  842,  854,  857,  846,  846,   97,   97,   98,
133179 133155    /*    20 */    98,   98,   98,  301,   96,   96,   96,   96,   95,   95,
133180         - /*    30 */    94,   94,   94,   93,  351,  325,  975,  975,  823,  823,
133181         - /*    40 */   823,  945,  354,   99,  100,   90,  840,  840,  852,  855,
133182         - /*    50 */   844,  844,   97,   97,   98,   98,   98,   98,  338,   96,
       133156  + /*    30 */    94,   94,   94,   93,  351,  325,  977,  977,  824,  824,
       133157  + /*    40 */   826,  947,  354,   99,  100,   90,  842,  842,  854,  857,
       133158  + /*    50 */   846,  846,   97,   97,   98,   98,   98,   98,  338,   96,
133183 133159    /*    60 */    96,   96,   96,   95,   95,   94,   94,   94,   93,  351,
133184         - /*    70 */    95,   95,   94,   94,   94,   93,  351,  790,  975,  975,
133185         - /*    80 */   325,   94,   94,   94,   93,  351,  791,   75,   99,  100,
133186         - /*    90 */    90,  840,  840,  852,  855,  844,  844,   97,   97,   98,
       133160  + /*    70 */    95,   95,   94,   94,   94,   93,  351,  791,  977,  977,
       133161  + /*    80 */   325,   94,   94,   94,   93,  351,  792,   75,   99,  100,
       133162  + /*    90 */    90,  842,  842,  854,  857,  846,  846,   97,   97,   98,
133187 133163    /*   100 */    98,   98,   98,  450,   96,   96,   96,   96,   95,   95,
133188         - /*   110 */    94,   94,   94,   93,  351, 1330,  155,  155,    2,  325,
       133164  + /*   110 */    94,   94,   94,   93,  351, 1333,  155,  155,    2,  325,
133189 133165    /*   120 */   275,  146,  132,   52,   52,   93,  351,   99,  100,   90,
133190         - /*   130 */   840,  840,  852,  855,  844,  844,   97,   97,   98,   98,
       133166  + /*   130 */   842,  842,  854,  857,  846,  846,   97,   97,   98,   98,
133191 133167    /*   140 */    98,   98,  101,   96,   96,   96,   96,   95,   95,   94,
133192         - /*   150 */    94,   94,   93,  351,  956,  956,  325,  268,  428,  413,
133193         - /*   160 */   411,   61,  751,  751,   99,  100,   90,  840,  840,  852,
133194         - /*   170 */   855,  844,  844,   97,   97,   98,   98,   98,   98,   60,
       133168  + /*   150 */    94,   94,   93,  351,  958,  958,  325,  268,  428,  413,
       133169  + /*   160 */   411,   61,  752,  752,   99,  100,   90,  842,  842,  854,
       133170  + /*   170 */   857,  846,  846,   97,   97,   98,   98,   98,   98,   60,
133195 133171    /*   180 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,
133196         - /*   190 */   351,  325,  270,  329,  273,  277,  957,  958,  250,   99,
133197         - /*   200 */   100,   90,  840,  840,  852,  855,  844,  844,   97,   97,
       133172  + /*   190 */   351,  325,  270,  329,  273,  277,  959,  960,  250,   99,
       133173  + /*   200 */   100,   90,  842,  842,  854,  857,  846,  846,   97,   97,
133198 133174    /*   210 */    98,   98,   98,   98,  301,   96,   96,   96,   96,   95,
133199         - /*   220 */    95,   94,   94,   94,   93,  351,  325,  936, 1323,  697,
133200         - /*   230 */   705, 1323,  242,  412,   99,  100,   90,  840,  840,  852,
133201         - /*   240 */   855,  844,  844,   97,   97,   98,   98,   98,   98,  347,
       133175  + /*   220 */    95,   94,   94,   94,   93,  351,  325,  938, 1326,  698,
       133176  + /*   230 */   706, 1326,  242,  412,   99,  100,   90,  842,  842,  854,
       133177  + /*   240 */   857,  846,  846,   97,   97,   98,   98,   98,   98,  347,
133202 133178    /*   250 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,
133203         - /*   260 */   351,  325,  936, 1324,  384,  698, 1324,  381,  379,   99,
133204         - /*   270 */   100,   90,  840,  840,  852,  855,  844,  844,   97,   97,
133205         - /*   280 */    98,   98,   98,   98,  700,   96,   96,   96,   96,   95,
       133179  + /*   260 */   351,  325,  938, 1327,  384,  699, 1327,  381,  379,   99,
       133180  + /*   270 */   100,   90,  842,  842,  854,  857,  846,  846,   97,   97,
       133181  + /*   280 */    98,   98,   98,   98,  701,   96,   96,   96,   96,   95,
133206 133182    /*   290 */    95,   94,   94,   94,   93,  351,  325,   92,   89,  178,
133207         - /*   300 */   831,  934,  373,  699,   99,  100,   90,  840,  840,  852,
133208         - /*   310 */   855,  844,  844,   97,   97,   98,   98,   98,   98,  375,
       133183  + /*   300 */   833,  936,  373,  700,   99,  100,   90,  842,  842,  854,
       133184  + /*   310 */   857,  846,  846,   97,   97,   98,   98,   98,   98,  375,
133209 133185    /*   320 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,
133210         - /*   330 */   351,  325, 1273,  945,  354,  817,  934,  738,  738,   99,
133211         - /*   340 */   100,   90,  840,  840,  852,  855,  844,  844,   97,   97,
       133186  + /*   330 */   351,  325, 1276,  947,  354,  818,  936,  739,  739,   99,
       133187  + /*   340 */   100,   90,  842,  842,  854,  857,  846,  846,   97,   97,
133212 133188    /*   350 */    98,   98,   98,   98,  230,   96,   96,   96,   96,   95,
133213         - /*   360 */    95,   94,   94,   94,   93,  351,  325,  967,  227,   92,
133214         - /*   370 */    89,  178,  373,  300,   99,  100,   90,  840,  840,  852,
133215         - /*   380 */   855,  844,  844,   97,   97,   98,   98,   98,   98,  919,
       133189  + /*   360 */    95,   94,   94,   94,   93,  351,  325,  969,  227,   92,
       133190  + /*   370 */    89,  178,  373,  300,   99,  100,   90,  842,  842,  854,
       133191  + /*   380 */   857,  846,  846,   97,   97,   98,   98,   98,   98,  921,
133216 133192    /*   390 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,
133217         - /*   400 */   351,  325,  449,  447,  447,  447,  147,  736,  736,   99,
133218         - /*   410 */   100,   90,  840,  840,  852,  855,  844,  844,   97,   97,
       133193  + /*   400 */   351,  325,  449,  447,  447,  447,  147,  737,  737,   99,
       133194  + /*   410 */   100,   90,  842,  842,  854,  857,  846,  846,   97,   97,
133219 133195    /*   420 */    98,   98,   98,   98,  296,   96,   96,   96,   96,   95,
133220         - /*   430 */    95,   94,   94,   94,   93,  351,  325,  419,  231,  956,
133221         - /*   440 */   956,  158,   25,  422,   99,  100,   90,  840,  840,  852,
133222         - /*   450 */   855,  844,  844,   97,   97,   98,   98,   98,   98,  450,
       133196  + /*   430 */    95,   94,   94,   94,   93,  351,  325,  419,  231,  958,
       133197  + /*   440 */   958,  158,   25,  422,   99,  100,   90,  842,  842,  854,
       133198  + /*   450 */   857,  846,  846,   97,   97,   98,   98,   98,   98,  450,
133223 133199    /*   460 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,
133224         - /*   470 */   351,  443,  224,  224,  420,  956,  956,  960,  325,   52,
133225         - /*   480 */    52,  957,  958,  176,  415,   78,   99,  100,   90,  840,
133226         - /*   490 */   840,  852,  855,  844,  844,   97,   97,   98,   98,   98,
       133200  + /*   470 */   351,  443,  224,  224,  420,  958,  958,  962,  325,   52,
       133201  + /*   480 */    52,  959,  960,  176,  415,   78,   99,  100,   90,  842,
       133202  + /*   490 */   842,  854,  857,  846,  846,   97,   97,   98,   98,   98,
133227 133203    /*   500 */    98,  379,   96,   96,   96,   96,   95,   95,   94,   94,
133228         - /*   510 */    94,   93,  351,  325,  428,  418,  298,  957,  958,  960,
133229         - /*   520 */    81,   99,   88,   90,  840,  840,  852,  855,  844,  844,
133230         - /*   530 */    97,   97,   98,   98,   98,   98,  716,   96,   96,   96,
133231         - /*   540 */    96,   95,   95,   94,   94,   94,   93,  351,  325,  841,
133232         - /*   550 */   841,  853,  856,  994,  318,  343,  379,  100,   90,  840,
133233         - /*   560 */   840,  852,  855,  844,  844,   97,   97,   98,   98,   98,
       133204  + /*   510 */    94,   93,  351,  325,  428,  418,  298,  959,  960,  962,
       133205  + /*   520 */    81,   99,   88,   90,  842,  842,  854,  857,  846,  846,
       133206  + /*   530 */    97,   97,   98,   98,   98,   98,  717,   96,   96,   96,
       133207  + /*   540 */    96,   95,   95,   94,   94,   94,   93,  351,  325,  843,
       133208  + /*   550 */   843,  855,  858,  996,  318,  343,  379,  100,   90,  842,
       133209  + /*   560 */   842,  854,  857,  846,  846,   97,   97,   98,   98,   98,
133234 133210    /*   570 */    98,  450,   96,   96,   96,   96,   95,   95,   94,   94,
133235 133211    /*   580 */    94,   93,  351,  325,  350,  350,  350,  260,  377,  340,
133236         - /*   590 */   927,   52,   52,   90,  840,  840,  852,  855,  844,  844,
       133212  + /*   590 */   929,   52,   52,   90,  842,  842,  854,  857,  846,  846,
133237 133213    /*   600 */    97,   97,   98,   98,   98,   98,  361,   96,   96,   96,
133238 133214    /*   610 */    96,   95,   95,   94,   94,   94,   93,  351,   86,  445,
133239         - /*   620 */   845,    3, 1200,  361,  360,  378,  344,  812,  956,  956,
133240         - /*   630 */  1297,   86,  445,  728,    3,  212,  169,  287,  405,  282,
133241         - /*   640 */   404,  199,  232,  450,  300,  759,   83,   84,  280,  245,
       133215  + /*   620 */   847,    3, 1203,  361,  360,  378,  344,  813,  958,  958,
       133216  + /*   630 */  1300,   86,  445,  729,    3,  212,  169,  287,  405,  282,
       133217  + /*   640 */   404,  199,  232,  450,  300,  760,   83,   84,  280,  245,
133242 133218    /*   650 */   262,  365,  251,   85,  352,  352,   92,   89,  178,   83,
133243 133219    /*   660 */    84,  242,  412,   52,   52,  448,   85,  352,  352,  246,
133244         - /*   670 */   957,  958,  194,  455,  669,  402,  399,  398,  448,  243,
133245         - /*   680 */   221,  114,  434,  775,  361,  450,  397,  268,  746,  224,
133246         - /*   690 */   224,  132,  132,  198,  830,  434,  452,  451,  428,  427,
133247         - /*   700 */   818,  415,  733,  712,  132,   52,   52,  830,  268,  452,
133248         - /*   710 */   451,  733,  194,  818,  363,  402,  399,  398,  450, 1268,
133249         - /*   720 */  1268,   23,  956,  956,   86,  445,  397,    3,  228,  429,
133250         - /*   730 */   893,  823,  823,  823,  825,   19,  203,  719,   52,   52,
133251         - /*   740 */   428,  408,  439,  249,  823,  823,  823,  825,   19,  229,
133252         - /*   750 */   403,  153,   83,   84,  760,  177,  241,  450,  720,   85,
133253         - /*   760 */   352,  352,  120,  157,  957,  958,   58,  975,  409,  355,
133254         - /*   770 */   330,  448,  268,  428,  430,  320,  789,   32,   32,   86,
133255         - /*   780 */   445,  775,    3,  341,   98,   98,   98,   98,  434,   96,
       133220  + /*   670 */   959,  960,  194,  455,  670,  402,  399,  398,  448,  243,
       133221  + /*   680 */   221,  114,  434,  776,  361,  450,  397,  268,  747,  224,
       133222  + /*   690 */   224,  132,  132,  198,  832,  434,  452,  451,  428,  427,
       133223  + /*   700 */   819,  415,  734,  713,  132,   52,   52,  832,  268,  452,
       133224  + /*   710 */   451,  734,  194,  819,  363,  402,  399,  398,  450, 1271,
       133225  + /*   720 */  1271,   23,  958,  958,   86,  445,  397,    3,  228,  429,
       133226  + /*   730 */   895,  824,  824,  826,  827,   19,  203,  720,   52,   52,
       133227  + /*   740 */   428,  408,  439,  249,  824,  824,  826,  827,   19,  229,
       133228  + /*   750 */   403,  153,   83,   84,  761,  177,  241,  450,  721,   85,
       133229  + /*   760 */   352,  352,  120,  157,  959,  960,   58,  977,  409,  355,
       133230  + /*   770 */   330,  448,  268,  428,  430,  320,  790,   32,   32,   86,
       133231  + /*   780 */   445,  776,    3,  341,   98,   98,   98,   98,  434,   96,
133256 133232    /*   790 */    96,   96,   96,   95,   95,   94,   94,   94,   93,  351,
133257         - /*   800 */   830,  120,  452,  451,  812,  885,  818,   83,   84,  975,
133258         - /*   810 */   812,  132,  410,  918,   85,  352,  352,  132,  407,  788,
133259         - /*   820 */   956,  956,   92,   89,  178,  915,  448,  262,  370,  261,
133260         - /*   830 */    82,  912,   80,  262,  370,  261,  932,  823,  823,  823,
133261         - /*   840 */   825,   19,  257,  434,   96,   96,   96,   96,   95,   95,
133262         - /*   850 */    94,   94,   94,   93,  351,  830,  268,  452,  451,  956,
133263         - /*   860 */   956,  818,  957,  958,  120,   92,   89,  178,  943,    2,
133264         - /*   870 */   916,  963,  268,    1,  766,   76,  445,  761,    3,  707,
133265         - /*   880 */   899,  899,  387,  956,  956,  756,  917,  371,  739,  777,
133266         - /*   890 */   755,  907,  823,  823,  823,  825,   19,  883,  740,  450,
133267         - /*   900 */    24,  957,  958,   83,   84,  369,  956,  956,  708,  226,
133268         - /*   910 */    85,  352,  352,  745,  315,  314,  313,  215,  311,   10,
133269         - /*   920 */    10,  682,  448,  349,  348,  957,  958,  887,  776,  691,
133270         - /*   930 */   331,  956,  956,  337,  157,  450,  268,  103,  450,  434,
133271         - /*   940 */   450,  816,  310,  906,  887,  889,  321,  450,  957,  958,
133272         - /*   950 */   708,  830,  775,  452,  451,   10,   10,  818,   10,   10,
133273         - /*   960 */    52,   52,  171,  170,  180,  225,  248,   10,   10,  339,
133274         - /*   970 */   701,  701,  233,  957,  958,  247,  982,  741,  450,  956,
133275         - /*   980 */   956,  425,  157,  980,  685,  981,  182,  912,  823,  823,
133276         - /*   990 */   823,  825,   19,  183,  324,  423,  132,  181,   51,   51,
133277         - /*  1000 */   715,  349,  348,  394,  256,  887,  334,  915,  983,  983,
133278         - /*  1010 */   830,  417,  824,  234,  198,  234,  818,  268,  326,  382,
133279         - /*  1020 */   120,  957,  958,  264,  177,   98,   98,   98,   98,   91,
       133233  + /*   800 */   832,  120,  452,  451,  813,  887,  819,   83,   84,  977,
       133234  + /*   810 */   813,  132,  410,  920,   85,  352,  352,  132,  407,  789,
       133235  + /*   820 */   958,  958,   92,   89,  178,  917,  448,  262,  370,  261,
       133236  + /*   830 */    82,  914,   80,  262,  370,  261,  776,  824,  824,  826,
       133237  + /*   840 */   827,   19,  934,  434,   96,   96,   96,   96,   95,   95,
       133238  + /*   850 */    94,   94,   94,   93,  351,  832,   74,  452,  451,  958,
       133239  + /*   860 */   958,  819,  959,  960,  120,   92,   89,  178,  945,    2,
       133240  + /*   870 */   918,  965,  268,    1,  976,   76,  445,  762,    3,  708,
       133241  + /*   880 */   901,  901,  387,  958,  958,  757,  919,  371,  740,  778,
       133242  + /*   890 */   756,  257,  824,  824,  826,  827,   19,  417,  741,  450,
       133243  + /*   900 */    24,  959,  960,   83,   84,  369,  958,  958,  177,  226,
       133244  + /*   910 */    85,  352,  352,  885,  315,  314,  313,  215,  311,   10,
       133245  + /*   920 */    10,  683,  448,  349,  348,  959,  960,  909,  777,  157,
       133246  + /*   930 */   120,  958,  958,  337,  776,  416,  711,  310,  450,  434,
       133247  + /*   940 */   450,  321,  450,  791,  103,  200,  175,  450,  959,  960,
       133248  + /*   950 */   908,  832,  792,  452,  451,    9,    9,  819,   10,   10,
       133249  + /*   960 */    52,   52,   51,   51,  180,  716,  248,   10,   10,  171,
       133250  + /*   970 */   170,  167,  339,  959,  960,  247,  984,  702,  702,  450,
       133251  + /*   980 */   715,  233,  686,  982,  889,  983,  182,  914,  824,  824,
       133252  + /*   990 */   826,  827,   19,  183,  256,  423,  132,  181,  394,   10,
       133253  + /*  1000 */    10,  889,  891,  749,  958,  958,  917,  268,  985,  198,
       133254  + /*  1010 */   985,  349,  348,  425,  415,  299,  817,  832,  326,  825,
       133255  + /*  1020 */   120,  332,  133,  819,  268,   98,   98,   98,   98,   91,
133280 133256    /*  1030 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,
133281         - /*  1040 */   351,  816,  416,  371,  120,  359,  816,  823,  823,  823,
133282         - /*  1050 */   775,  299,  916,  450,  368,  197,  196,  195,  358,  200,
133283         - /*  1060 */   175,  380,    9,    9,  450, 1287,  875,  714,  917,  450,
133284         - /*  1070 */   433,  237,  450,   36,   36,  132,  253,  450,  255,  450,
133285         - /*  1080 */   117,  450,  809,  362,   37,   37,  983,  983,  450,   12,
133286         - /*  1090 */    12,  330,   27,   27,  446,  331,  280,   38,   38,   39,
133287         - /*  1100 */    39,   40,   40, 1207,  450,  816,  335,  356,   41,   41,
133288         - /*  1110 */   450,  336,  450,  695,  450,  120,  450,  332,  133,  450,
133289         - /*  1120 */   268,  450,  269,  450,   42,   42,  450,  816,  254,  450,
133290         - /*  1130 */    28,   28,   29,   29,   31,   31,   43,   43,  450,   44,
133291         - /*  1140 */    44,   45,   45,   11,   11,  450,   46,   46,  450,  105,
133292         - /*  1150 */   105,  450,  748,  713,  450,  695,  450,  910,   47,   47,
133293         - /*  1160 */   450,  267,  450,  415,  450,   48,   48,  450,   33,   33,
133294         - /*  1170 */   386,   49,   49,  450,   50,   50,   34,   34,  450,  172,
133295         - /*  1180 */   122,  122,  123,  123,  124,  124,  450,   56,   56,  450,
133296         - /*  1190 */   120,  450,  345,   35,   35,  450,  790,  450,  106,  106,
133297         - /*  1200 */   450,   74,  450,  974,  450,  791,   53,   53,  432,  107,
133298         - /*  1210 */   107,  108,  108,  450,  272,  104,  104,  121,  121,  450,
133299         - /*  1220 */   119,  119,  112,  112,  111,  111,  450,  317,  996,  450,
133300         - /*  1230 */   118,  450,  162,  109,  109,  317,  935,  450,  896,  110,
133301         - /*  1240 */   110,  450,  895,  744,  688,  436,   55,   55,   20,   57,
133302         - /*  1250 */    57,   54,   54,  440,  444,  756,  385,   26,   26,  274,
133303         - /*  1260 */   755,   30,   30,   21,  672,  673,  674,  223,  175,  931,
133304         - /*  1270 */   814,  372,  319,  202,  202,  882,  120,  120,  120,  374,
133305         - /*  1280 */   826,  710,  202,   72,  276,  263,  120,  120,   74,  395,
133306         - /*  1290 */   278,  286,  208,   74,  718,  717,  725,  726,  892,  892,
133307         - /*  1300 */   167,  997,  285,  753,  729,  784,   77,  878,  202,  997,
133308         - /*  1310 */   208,  693,  891,  891,  116,  281,  782,  882,  390,  815,
133309         - /*  1320 */   762,  773,  826,  431,  302,  303,  822,  218,  696,  289,
133310         - /*  1330 */   690,  291,  293,  679,  678,  680,  950,  159,  316,    7,
133311         - /*  1340 */   364,  252,  259,  804,  909,  376,  400,  295,  308,  173,
133312         - /*  1350 */   435,  953,  168,  991,  135,  205,  926,  924,   59,  988,
133313         - /*  1360 */    62,  284,  880,  333,  879,  712,  144,  156,  130,   72,
133314         - /*  1370 */   366,  367,  393,  185,  189,  160,  383,   67,  389,  266,
133315         - /*  1380 */   137,  894,  774,  219,  154,  139,  190,  140,  391,  271,
133316         - /*  1390 */   191,  141,  142,  801,  681,  148,  811,  342,  322,  192,
133317         - /*  1400 */   406,  732,  911,  874,  723,  731,  323,  710,  730,   71,
133318         - /*  1410 */   704,  204,  283,  703,    6,   79,  421,  702,  965,  770,
133319         - /*  1420 */   297,  346,  426,  102,  722,  288,   73,  424,  213,  951,
133320         - /*  1430 */   771,  438,   22,  290,  687,  769,  442,  453,  239,  217,
133321         - /*  1440 */   214,  668,  125,  353,  126,  216,  454,  166,  676,  115,
133322         - /*  1450 */   675,  235,  244,  179,  670,  357,  810,  113,  890,  888,
133323         - /*  1460 */   292,  136,  128,  752,  304,  768,  294,  305,  138,  742,
133324         - /*  1470 */   306,  307,  127,  184,  860,  258,  905,  145,  143,  238,
133325         - /*  1480 */    63,   64,   65,   66,  240,  129,  908,  186,  187,  904,
133326         - /*  1490 */     8,   13,  188,  265,  897,  149,  202,  985,  388,  684,
133327         - /*  1500 */   150,  161,  392,  285,  193,  279,  151,  396,   68,   14,
133328         - /*  1510 */   401,   15,  327,  721,  328,  134,   69,   70,  236,  131,
133329         - /*  1520 */   829,  828,  858,  750,   16,  201,  754,    4,  783,  220,
133330         - /*  1530 */   414,  174,  222,  152,   77,  778,   74,   17,   18,  873,
133331         - /*  1540 */   859,  857,  914,  862,  913,  207,  206,  940,  163,  437,
133332         - /*  1550 */   946,  941,  164,  209,  210,  441,  861,  165,  312,  827,
133333         - /*  1560 */   694,   87, 1000,  309,  211, 1000, 1000, 1000, 1000, 1289,
133334         - /*  1570 */  1288,
       133257  + /*  1040 */   351,  157,  810,  371,  382,  359,  959,  960,  358,  268,
       133258  + /*  1050 */   450,  918,  368,  324,  824,  824,  826,  450,  709,  450,
       133259  + /*  1060 */   264,  380,  889,  450,  877,  746,  253,  919,  255,  433,
       133260  + /*  1070 */    36,   36,  234,  450,  234,  120,  269,   37,   37,   12,
       133261  + /*  1080 */    12,  334,  272,   27,   27,  450,  330,  118,  450,  162,
       133262  + /*  1090 */   742,  280,  450,   38,   38,  450,  985,  356,  985,  450,
       133263  + /*  1100 */   709, 1210,  450,  132,  450,   39,   39,  450,   40,   40,
       133264  + /*  1110 */   450,  362,   41,   41,  450,   42,   42,  450,  254,   28,
       133265  + /*  1120 */    28,  450,   29,   29,   31,   31,  450,   43,   43,  450,
       133266  + /*  1130 */    44,   44,  450,  714,   45,   45,  450,   11,   11,  767,
       133267  + /*  1140 */   450,   46,   46,  450,  268,  450,  105,  105,  450,   47,
       133268  + /*  1150 */    47,  450,   48,   48,  450,  237,   33,   33,  450,  172,
       133269  + /*  1160 */    49,   49,  450,   50,   50,   34,   34,  274,  122,  122,
       133270  + /*  1170 */   450,  123,  123,  450,  124,  124,  450,  898,   56,   56,
       133271  + /*  1180 */   450,  897,   35,   35,  450,  267,  450,  817,  450,  817,
       133272  + /*  1190 */   106,  106,  450,   53,   53,  385,  107,  107,  450,  817,
       133273  + /*  1200 */   108,  108,  817,  450,  104,  104,  121,  121,  119,  119,
       133274  + /*  1210 */   450,  117,  112,  112,  450,  276,  450,  225,  111,  111,
       133275  + /*  1220 */   450,  730,  450,  109,  109,  450,  673,  674,  675,  912,
       133276  + /*  1230 */   110,  110,  317,  998,   55,   55,   57,   57,  692,  331,
       133277  + /*  1240 */    54,   54,   26,   26,  696,   30,   30,  317,  937,  197,
       133278  + /*  1250 */   196,  195,  335,  281,  336,  446,  331,  745,  689,  436,
       133279  + /*  1260 */   440,  444,  120,   72,  386,  223,  175,  345,  757,  933,
       133280  + /*  1270 */    20,  286,  319,  756,  815,  372,  374,  202,  202,  202,
       133281  + /*  1280 */   263,  395,  285,   74,  208,   21,  696,  719,  718,  884,
       133282  + /*  1290 */   120,  120,  120,  120,  120,  754,  278,  828,   77,   74,
       133283  + /*  1300 */   726,  727,  785,  783,  880,  202,  999,  208,  894,  893,
       133284  + /*  1310 */   894,  893,  694,  816,  763,  116,  774, 1290,  431,  432,
       133285  + /*  1320 */   302,  999,  390,  303,  823,  697,  691,  680,  159,  289,
       133286  + /*  1330 */   679,  884,  681,  952,  291,  218,  293,    7,  316,  828,
       133287  + /*  1340 */   173,  805,  259,  364,  252,  911,  376,  713,  295,  435,
       133288  + /*  1350 */   308,  168,  955,  993,  135,  400,  990,  284,  882,  881,
       133289  + /*  1360 */   205,  928,  926,   59,  333,   62,  144,  156,  130,   72,
       133290  + /*  1370 */   802,  366,  367,  393,  137,  185,  189,  160,  139,  383,
       133291  + /*  1380 */    67,  896,  140,  141,  142,  148,  389,  812,  775,  266,
       133292  + /*  1390 */   219,  190,  154,  391,  913,  876,  271,  406,  191,  322,
       133293  + /*  1400 */   682,  733,  192,  342,  732,  724,  731,  711,  723,  421,
       133294  + /*  1410 */   705,   71,  323,    6,  204,  771,  288,   79,  297,  346,
       133295  + /*  1420 */   772,  704,  290,  283,  703,  770,  292,  294,  967,  239,
       133296  + /*  1430 */   769,  102,  862,  438,  426,  240,  424,  442,   73,  213,
       133297  + /*  1440 */   688,  238,   22,  453,  953,  214,  217,  216,  454,  677,
       133298  + /*  1450 */   676,  671,  753,  125,  115,  235,  126,  669,  353,  166,
       133299  + /*  1460 */   127,  244,  179,  357,  306,  304,  305,  307,  113,  892,
       133300  + /*  1470 */   327,  890,  811,  328,  134,  128,  136,  138,  743,  258,
       133301  + /*  1480 */   907,  184,  143,  129,  910,  186,   63,   64,  145,  187,
       133302  + /*  1490 */   906,   65,    8,   66,   13,  188,  202,  899,  265,  149,
       133303  + /*  1500 */   987,  388,  150,  685,  161,  392,  285,  193,  279,  396,
       133304  + /*  1510 */   151,  401,   68,   14,   15,  722,   69,  236,  831,  131,
       133305  + /*  1520 */   830,  860,   70,  751,   16,  414,  755,    4,  174,  220,
       133306  + /*  1530 */   222,  784,  201,  152,  779,   77,   74,   17,   18,  875,
       133307  + /*  1540 */   861,  859,  916,  864,  915,  207,  206,  942,  163,  437,
       133308  + /*  1550 */   948,  943,  164,  209, 1002,  441,  863,  165,  210,  829,
       133309  + /*  1560 */   695,   87,  312,  211, 1292, 1291,  309,
133335 133310   };
133336 133311   static const YYCODETYPE yy_lookahead[] = {
133337 133312    /*     0 */    19,   95,   53,   97,   22,   24,   24,  101,   27,   28,
133338 133313    /*    10 */    29,   30,   31,   32,   33,   34,   35,   36,   37,   38,
133339 133314    /*    20 */    39,   40,   41,  152,   43,   44,   45,   46,   47,   48,
133340 133315    /*    30 */    49,   50,   51,   52,   53,   19,   55,   55,  132,  133,
133341 133316    /*    40 */   134,    1,    2,   27,   28,   29,   30,   31,   32,   33,
................................................................................
133413 133388    /*   760 */    55,   56,  196,  152,   97,   98,  209,   55,  163,  244,
133414 133389    /*   770 */   107,   66,  152,  207,  208,  164,  175,  172,  173,   19,
133415 133390    /*   780 */    20,  124,   22,  111,   38,   39,   40,   41,   83,   43,
133416 133391    /*   790 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
133417 133392    /*   800 */    95,  196,   97,   98,   85,  152,  101,   47,   48,   97,
133418 133393    /*   810 */    85,   92,  207,  193,   54,   55,   56,   92,   49,  175,
133419 133394    /*   820 */    55,   56,  221,  222,  223,   12,   66,  108,  109,  110,
133420         - /*   830 */   137,  163,  139,  108,  109,  110,  152,  132,  133,  134,
       133395  + /*   830 */   137,  163,  139,  108,  109,  110,   26,  132,  133,  134,
133421 133396    /*   840 */   135,  136,  152,   83,   43,   44,   45,   46,   47,   48,
133422         - /*   850 */    49,   50,   51,   52,   53,   95,  152,   97,   98,   55,
       133397  + /*   850 */    49,   50,   51,   52,   53,   95,   26,   97,   98,   55,
133423 133398    /*   860 */    56,  101,   97,   98,  196,  221,  222,  223,  146,  147,
133424         - /*   870 */    57,  171,  152,   22,  213,   19,   20,   49,   22,  179,
       133399  + /*   870 */    57,  171,  152,   22,   26,   19,   20,   49,   22,  179,
133425 133400    /*   880 */   108,  109,  110,   55,   56,  116,   73,  219,   75,  124,
133426         - /*   890 */   121,  152,  132,  133,  134,  135,  136,  193,   85,  152,
133427         - /*   900 */   232,   97,   98,   47,   48,  237,   55,   56,   55,    5,
       133401  + /*   890 */   121,  152,  132,  133,  134,  135,  136,  163,   85,  152,
       133402  + /*   900 */   232,   97,   98,   47,   48,  237,   55,   56,   98,    5,
133428 133403    /*   910 */    54,   55,   56,  193,   10,   11,   12,   13,   14,  172,
133429         - /*   920 */   173,   17,   66,   47,   48,   97,   98,  152,  124,  166,
133430         - /*   930 */   167,   55,   56,  186,  152,  152,  152,   22,  152,   83,
133431         - /*   940 */   152,  152,  160,  152,  169,  170,  164,  152,   97,   98,
133432         - /*   950 */    97,   95,   26,   97,   98,  172,  173,  101,  172,  173,
133433         - /*   960 */   172,  173,   47,   48,   60,   22,   62,  172,  173,  186,
133434         - /*   970 */    55,   56,  186,   97,   98,   71,  100,  193,  152,   55,
133435         - /*   980 */    56,  186,  152,  107,   21,  109,   82,  163,  132,  133,
133436         - /*   990 */   134,  135,  136,   89,  164,  207,   92,   93,  172,  173,
133437         - /*  1000 */   181,   47,   48,   19,   16,  230,  217,   12,  132,  133,
133438         - /*  1010 */    95,  163,   97,  183,   30,  185,  101,  152,  114,  152,
133439         - /*  1020 */   196,   97,   98,  152,   98,   38,   39,   40,   41,   42,
       133404  + /*   920 */   173,   17,   66,   47,   48,   97,   98,  152,  124,  152,
       133405  + /*   930 */   196,   55,   56,  186,  124,  152,  106,  160,  152,   83,
       133406  + /*   940 */   152,  164,  152,   61,   22,  211,  212,  152,   97,   98,
       133407  + /*   950 */   152,   95,   70,   97,   98,  172,  173,  101,  172,  173,
       133408  + /*   960 */   172,  173,  172,  173,   60,  181,   62,  172,  173,   47,
       133409  + /*   970 */    48,  123,  186,   97,   98,   71,  100,   55,   56,  152,
       133410  + /*   980 */   181,  186,   21,  107,  152,  109,   82,  163,  132,  133,
       133411  + /*   990 */   134,  135,  136,   89,   16,  207,   92,   93,   19,  172,
       133412  + /*  1000 */   173,  169,  170,  195,   55,   56,   12,  152,  132,   30,
       133413  + /*  1010 */   134,   47,   48,  186,  206,  225,  152,   95,  114,   97,
       133414  + /*  1020 */   196,  245,  246,  101,  152,   38,   39,   40,   41,   42,
133440 133415    /*  1030 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
133441         - /*  1040 */    53,  152,  152,  219,  196,  141,  152,  132,  133,  134,
133442         - /*  1050 */   124,  225,   57,  152,   91,  108,  109,  110,  193,  211,
133443         - /*  1060 */   212,  237,  172,  173,  152,  122,  103,  181,   73,  152,
133444         - /*  1070 */    75,  210,  152,  172,  173,   92,   88,  152,   90,  152,
133445         - /*  1080 */    22,  152,  163,  100,  172,  173,  132,  133,  152,  172,
133446         - /*  1090 */   173,  107,  172,  173,  166,  167,  112,  172,  173,  172,
133447         - /*  1100 */   173,  172,  173,  140,  152,  152,  217,  242,  172,  173,
133448         - /*  1110 */   152,  217,  152,   55,  152,  196,  152,  245,  246,  152,
133449         - /*  1120 */   152,  152,  152,  152,  172,  173,  152,  152,  140,  152,
133450         - /*  1130 */   172,  173,  172,  173,  172,  173,  172,  173,  152,  172,
133451         - /*  1140 */   173,  172,  173,  172,  173,  152,  172,  173,  152,  172,
133452         - /*  1150 */   173,  152,  195,  152,  152,   97,  152,  163,  172,  173,
133453         - /*  1160 */   152,  193,  152,  206,  152,  172,  173,  152,  172,  173,
133454         - /*  1170 */   217,  172,  173,  152,  172,  173,  172,  173,  152,   26,
133455         - /*  1180 */   172,  173,  172,  173,  172,  173,  152,  172,  173,  152,
133456         - /*  1190 */   196,  152,  217,  172,  173,  152,   61,  152,  172,  173,
133457         - /*  1200 */   152,   26,  152,   26,  152,   70,  172,  173,  191,  172,
133458         - /*  1210 */   173,  172,  173,  152,  152,  172,  173,  172,  173,  152,
133459         - /*  1220 */   172,  173,  172,  173,  172,  173,  152,   22,   23,  152,
133460         - /*  1230 */    22,  152,   24,  172,  173,   22,   23,  152,   59,  172,
133461         - /*  1240 */   173,  152,   63,  163,  163,  163,  172,  173,   22,  172,
133462         - /*  1250 */   173,  172,  173,  163,  163,  116,   77,  172,  173,  152,
133463         - /*  1260 */   121,  172,  173,   37,    7,    8,    9,  211,  212,   23,
133464         - /*  1270 */    23,   23,   26,   26,   26,   55,  196,  196,  196,   23,
133465         - /*  1280 */    55,  106,   26,  130,  152,   23,  196,  196,   26,   23,
133466         - /*  1290 */    23,  101,   26,   26,  100,  101,    7,    8,  132,  133,
133467         - /*  1300 */   123,   96,  112,   23,  152,   23,   26,   23,   26,   96,
133468         - /*  1310 */    26,   23,  132,  133,   26,  152,  152,   97,  234,  152,
133469         - /*  1320 */   152,  152,   97,  152,  152,  152,  152,  233,  152,  210,
133470         - /*  1330 */   152,  210,  210,  152,  152,  152,  152,  197,  150,  198,
133471         - /*  1340 */   214,  214,  239,  201,  201,  239,  176,  214,  200,  184,
133472         - /*  1350 */   227,  155,  198,   67,  243,  122,  159,  159,  240,   69,
133473         - /*  1360 */   240,  175,  175,  159,  175,  180,   22,  220,   27,  130,
133474         - /*  1370 */    18,  159,   18,  158,  158,  220,  159,  137,   74,  235,
133475         - /*  1380 */   189,  236,  159,  159,   22,  192,  158,  192,  177,  159,
133476         - /*  1390 */   158,  192,  192,  201,  159,  189,  189,   76,  177,  158,
133477         - /*  1400 */   107,  174,  201,  201,  182,  174,  177,  106,  174,  107,
133478         - /*  1410 */   174,  159,  174,  176,   22,  137,  125,  174,  174,  216,
133479         - /*  1420 */   159,   53,  126,  129,  182,  215,  128,  127,   25,   13,
133480         - /*  1430 */   216,  177,   26,  215,  162,  216,  177,  161,  229,    6,
133481         - /*  1440 */   153,    4,  165,    3,  165,  153,  151,   22,  151,  178,
133482         - /*  1450 */   151,  178,  142,   15,  151,   94,  120,   16,   23,   23,
133483         - /*  1460 */   215,  131,  111,  205,  204,  216,  215,  203,  123,   20,
133484         - /*  1470 */   202,  201,  165,  125,  224,   16,    1,  131,  123,  226,
133485         - /*  1480 */    37,   37,   37,   37,  229,  111,   56,   64,  122,    1,
133486         - /*  1490 */     5,   22,  107,  140,   80,   80,   26,   87,   72,   20,
133487         - /*  1500 */   107,   24,   19,  112,  105,   23,   22,   79,   22,   22,
133488         - /*  1510 */    79,   22,  249,   58,  249,  246,   22,   26,   79,   68,
133489         - /*  1520 */    23,   23,   23,  116,   22,   64,   23,   22,   56,   23,
133490         - /*  1530 */    26,  122,   23,   22,   26,  124,   26,   64,   64,   23,
       133416  + /*  1040 */    53,  152,  163,  219,  152,  141,   97,   98,  193,  152,
       133417  + /*  1050 */   152,   57,   91,  164,  132,  133,  134,  152,   55,  152,
       133418  + /*  1060 */   152,  237,  230,  152,  103,  193,   88,   73,   90,   75,
       133419  + /*  1070 */   172,  173,  183,  152,  185,  196,  152,  172,  173,  172,
       133420  + /*  1080 */   173,  217,  152,  172,  173,  152,  107,   22,  152,   24,
       133421  + /*  1090 */   193,  112,  152,  172,  173,  152,  132,  242,  134,  152,
       133422  + /*  1100 */    97,  140,  152,   92,  152,  172,  173,  152,  172,  173,
       133423  + /*  1110 */   152,  100,  172,  173,  152,  172,  173,  152,  140,  172,
       133424  + /*  1120 */   173,  152,  172,  173,  172,  173,  152,  172,  173,  152,
       133425  + /*  1130 */   172,  173,  152,  152,  172,  173,  152,  172,  173,  213,
       133426  + /*  1140 */   152,  172,  173,  152,  152,  152,  172,  173,  152,  172,
       133427  + /*  1150 */   173,  152,  172,  173,  152,  210,  172,  173,  152,   26,
       133428  + /*  1160 */   172,  173,  152,  172,  173,  172,  173,  152,  172,  173,
       133429  + /*  1170 */   152,  172,  173,  152,  172,  173,  152,   59,  172,  173,
       133430  + /*  1180 */   152,   63,  172,  173,  152,  193,  152,  152,  152,  152,
       133431  + /*  1190 */   172,  173,  152,  172,  173,   77,  172,  173,  152,  152,
       133432  + /*  1200 */   172,  173,  152,  152,  172,  173,  172,  173,  172,  173,
       133433  + /*  1210 */   152,   22,  172,  173,  152,  152,  152,   22,  172,  173,
       133434  + /*  1220 */   152,  152,  152,  172,  173,  152,    7,    8,    9,  163,
       133435  + /*  1230 */   172,  173,   22,   23,  172,  173,  172,  173,  166,  167,
       133436  + /*  1240 */   172,  173,  172,  173,   55,  172,  173,   22,   23,  108,
       133437  + /*  1250 */   109,  110,  217,  152,  217,  166,  167,  163,  163,  163,
       133438  + /*  1260 */   163,  163,  196,  130,  217,  211,  212,  217,  116,   23,
       133439  + /*  1270 */    22,  101,   26,  121,   23,   23,   23,   26,   26,   26,
       133440  + /*  1280 */    23,   23,  112,   26,   26,   37,   97,  100,  101,   55,
       133441  + /*  1290 */   196,  196,  196,  196,  196,   23,   23,   55,   26,   26,
       133442  + /*  1300 */     7,    8,   23,  152,   23,   26,   96,   26,  132,  132,
       133443  + /*  1310 */   134,  134,   23,  152,  152,   26,  152,  122,  152,  191,
       133444  + /*  1320 */   152,   96,  234,  152,  152,  152,  152,  152,  197,  210,
       133445  + /*  1330 */   152,   97,  152,  152,  210,  233,  210,  198,  150,   97,
       133446  + /*  1340 */   184,  201,  239,  214,  214,  201,  239,  180,  214,  227,
       133447  + /*  1350 */   200,  198,  155,   67,  243,  176,   69,  175,  175,  175,
       133448  + /*  1360 */   122,  159,  159,  240,  159,  240,   22,  220,   27,  130,
       133449  + /*  1370 */   201,   18,  159,   18,  189,  158,  158,  220,  192,  159,
       133450  + /*  1380 */   137,  236,  192,  192,  192,  189,   74,  189,  159,  235,
       133451  + /*  1390 */   159,  158,   22,  177,  201,  201,  159,  107,  158,  177,
       133452  + /*  1400 */   159,  174,  158,   76,  174,  182,  174,  106,  182,  125,
       133453  + /*  1410 */   174,  107,  177,   22,  159,  216,  215,  137,  159,   53,
       133454  + /*  1420 */   216,  176,  215,  174,  174,  216,  215,  215,  174,  229,
       133455  + /*  1430 */   216,  129,  224,  177,  126,  229,  127,  177,  128,   25,
       133456  + /*  1440 */   162,  226,   26,  161,   13,  153,    6,  153,  151,  151,
       133457  + /*  1450 */   151,  151,  205,  165,  178,  178,  165,    4,    3,   22,
       133458  + /*  1460 */   165,  142,   15,   94,  202,  204,  203,  201,   16,   23,
       133459  + /*  1470 */   249,   23,  120,  249,  246,  111,  131,  123,   20,   16,
       133460  + /*  1480 */     1,  125,  123,  111,   56,   64,   37,   37,  131,  122,
       133461  + /*  1490 */     1,   37,    5,   37,   22,  107,   26,   80,  140,   80,
       133462  + /*  1500 */    87,   72,  107,   20,   24,   19,  112,  105,   23,   79,
       133463  + /*  1510 */    22,   79,   22,   22,   22,   58,   22,   79,   23,   68,
       133464  + /*  1520 */    23,   23,   26,  116,   22,   26,   23,   22,  122,   23,
       133465  + /*  1530 */    23,   56,   64,   22,  124,   26,   26,   64,   64,   23,
133491 133466    /*  1540 */    23,   23,   23,   11,   23,   22,   26,   23,   22,   24,
133492         - /*  1550 */     1,   23,   22,   26,  122,   24,   23,   22,   15,   23,
133493         - /*  1560 */    23,   22,  251,   23,  122,  251,  251,  251,  251,  122,
133494         - /*  1570 */   122,
       133467  + /*  1550 */     1,   23,   22,   26,  251,   24,   23,   22,  122,   23,
       133468  + /*  1560 */    23,   22,   15,  122,  122,  122,   23,
133495 133469   };
133496         -#define YY_SHIFT_USE_DFLT (1571)
       133470  +#define YY_SHIFT_USE_DFLT (1567)
133497 133471   #define YY_SHIFT_COUNT    (455)
133498 133472   #define YY_SHIFT_MIN      (-94)
133499 133473   #define YY_SHIFT_MAX      (1549)
133500 133474   static const short yy_shift_ofst[] = {
133501 133475    /*     0 */    40,  599,  904,  612,  760,  760,  760,  760,  725,  -19,
133502 133476    /*    10 */    16,   16,  100,  760,  760,  760,  760,  760,  760,  760,
133503 133477    /*    20 */   876,  876,  573,  542,  719,  600,   61,  137,  172,  207,
................................................................................
133505 133479    /*    40 */   459,  459,  459,  459,  459,  459,  459,  459,  459,  459,
133506 133480    /*    50 */   459,  459,  459,  494,  459,  529,  564,  564,  705,  760,
133507 133481    /*    60 */   760,  760,  760,  760,  760,  760,  760,  760,  760,  760,
133508 133482    /*    70 */   760,  760,  760,  760,  760,  760,  760,  760,  760,  760,
133509 133483    /*    80 */   760,  760,  760,  760,  760,  760,  760,  760,  760,  760,
133510 133484    /*    90 */   856,  760,  760,  760,  760,  760,  760,  760,  760,  760,
133511 133485    /*   100 */   760,  760,  760,  760,  987,  746,  746,  746,  746,  746,
133512         - /*   110 */   801,   23,   32,  924,  963,  984,  954,  954,  924,   73,
133513         - /*   120 */   113,  -51, 1571, 1571, 1571,  536,  536,  536,   99,   99,
133514         - /*   130 */   813,  813,  667,  205,  240,  924,  924,  924,  924,  924,
133515         - /*   140 */   924,  924,  924,  924,  924,  924,  924,  924,  924,  924,
133516         - /*   150 */   924,  924,  924,  924,  924,  332,  983,  422,  422,  113,
133517         - /*   160 */    30,   30,   30,   30,   30,   30, 1571, 1571, 1571,  915,
133518         - /*   170 */   -94,  -94,  384,  613,  828,  420,  765,  804,  851,  924,
133519         - /*   180 */   924,  924,  924,  924,  924,  924,  924,  924,  924,  924,
133520         - /*   190 */   924,  924,  924,  924,  924,  672,  672,  672,  924,  924,
133521         - /*   200 */   657,  924,  924,  924,  -18,  924,  924,  995,  924,  924,
133522         - /*   210 */   924,  924,  924,  924,  924,  924,  924,  924,  772, 1179,
133523         - /*   220 */   712,  712,  712,  926,   45,  769, 1257, 1153,  418,  418,
133524         - /*   230 */   569, 1153,  569, 1175,  607,  663, 1135,  418,  693, 1135,
133525         - /*   240 */  1135, 1177, 1139, 1208, 1286, 1233, 1233, 1290, 1290, 1233,
133526         - /*   250 */  1344, 1341, 1239, 1352, 1352, 1352, 1352, 1233, 1354, 1239,
133527         - /*   260 */  1344, 1341, 1341, 1239, 1233, 1354, 1240, 1304, 1233, 1233,
133528         - /*   270 */  1354, 1362, 1233, 1354, 1233, 1354, 1362, 1293, 1293, 1293,
133529         - /*   280 */  1321, 1362, 1293, 1301, 1293, 1321, 1293, 1293, 1291, 1302,
133530         - /*   290 */  1291, 1302, 1291, 1302, 1291, 1302, 1233, 1392, 1233, 1278,
133531         - /*   300 */  1362, 1368, 1368, 1362, 1294, 1296, 1298, 1300, 1239, 1403,
133532         - /*   310 */  1406, 1416, 1416, 1433, 1433, 1433, 1433, 1571, 1571, 1571,
133533         - /*   320 */  1571, 1571, 1571, 1571, 1571,  519,  988, 1205, 1213,  104,
133534         - /*   330 */   947, 1058, 1246, 1226, 1247, 1248, 1256, 1262, 1266, 1267,
133535         - /*   340 */   853, 1194, 1289, 1190, 1280, 1282, 1220, 1284, 1166, 1180,
133536         - /*   350 */  1288, 1225,  943, 1437, 1440, 1425, 1310, 1438, 1361, 1441,
133537         - /*   360 */  1435, 1436, 1336, 1330, 1351, 1345, 1449, 1348, 1459, 1475,
133538         - /*   370 */  1355, 1346, 1443, 1444, 1445, 1446, 1374, 1430, 1423, 1366,
133539         - /*   380 */  1488, 1485, 1469, 1385, 1353, 1414, 1470, 1415, 1410, 1426,
133540         - /*   390 */  1393, 1477, 1479, 1483, 1391, 1399, 1484, 1428, 1486, 1487,
133541         - /*   400 */  1482, 1489, 1431, 1455, 1494, 1439, 1451, 1497, 1498, 1499,
133542         - /*   410 */  1491, 1407, 1502, 1503, 1505, 1504, 1409, 1506, 1509, 1472,
133543         - /*   420 */  1461, 1511, 1411, 1508, 1473, 1510, 1474, 1516, 1508, 1517,
       133486  + /*   110 */   801,   23,   32,  949,  961,  979,  964,  964,  949,   73,
       133487  + /*   120 */   113,  -51, 1567, 1567, 1567,  536,  536,  536,   99,   99,
       133488  + /*   130 */   813,  813,  667,  205,  240,  949,  949,  949,  949,  949,
       133489  + /*   140 */   949,  949,  949,  949,  949,  949,  949,  949,  949,  949,
       133490  + /*   150 */   949,  949,  949,  949,  949,  332, 1011,  422,  422,  113,
       133491  + /*   160 */    30,   30,   30,   30,   30,   30, 1567, 1567, 1567,  922,
       133492  + /*   170 */   -94,  -94,  384,  613,  828,  420,  765,  804,  851,  949,
       133493  + /*   180 */   949,  949,  949,  949,  949,  949,  949,  949,  949,  949,
       133494  + /*   190 */   949,  949,  949,  949,  949,  672,  672,  672,  949,  949,
       133495  + /*   200 */   657,  949,  949,  949,  -18,  949,  949,  994,  949,  949,
       133496  + /*   210 */   949,  949,  949,  949,  949,  949,  949,  949,  772, 1118,
       133497  + /*   220 */   712,  712,  712,  810,   45,  769, 1219, 1133,  418,  418,
       133498  + /*   230 */   569, 1133,  569,  830,  607,  663,  882,  418,  693,  882,
       133499  + /*   240 */   882,  848, 1152, 1065, 1286, 1238, 1238, 1287, 1287, 1238,
       133500  + /*   250 */  1344, 1341, 1239, 1353, 1353, 1353, 1353, 1238, 1355, 1239,
       133501  + /*   260 */  1344, 1341, 1341, 1239, 1238, 1355, 1243, 1312, 1238, 1238,
       133502  + /*   270 */  1355, 1370, 1238, 1355, 1238, 1355, 1370, 1290, 1290, 1290,
       133503  + /*   280 */  1327, 1370, 1290, 1301, 1290, 1327, 1290, 1290, 1284, 1304,
       133504  + /*   290 */  1284, 1304, 1284, 1304, 1284, 1304, 1238, 1391, 1238, 1280,
       133505  + /*   300 */  1370, 1366, 1366, 1370, 1302, 1308, 1310, 1309, 1239, 1414,
       133506  + /*   310 */  1416, 1431, 1431, 1440, 1440, 1440, 1440, 1567, 1567, 1567,
       133507  + /*   320 */  1567, 1567, 1567, 1567, 1567,  519,  978, 1210, 1225,  104,
       133508  + /*   330 */  1141, 1189, 1246, 1248, 1251, 1252, 1253, 1257, 1258, 1273,
       133509  + /*   340 */  1003, 1187, 1293, 1170, 1272, 1279, 1234, 1281, 1176, 1177,
       133510  + /*   350 */  1289, 1242, 1195, 1453, 1455, 1437, 1319, 1447, 1369, 1452,
       133511  + /*   360 */  1446, 1448, 1352, 1345, 1364, 1354, 1458, 1356, 1463, 1479,
       133512  + /*   370 */  1359, 1357, 1449, 1450, 1454, 1456, 1372, 1428, 1421, 1367,
       133513  + /*   380 */  1489, 1487, 1472, 1388, 1358, 1417, 1470, 1419, 1413, 1429,
       133514  + /*   390 */  1395, 1480, 1483, 1486, 1394, 1402, 1488, 1430, 1490, 1491,
       133515  + /*   400 */  1485, 1492, 1432, 1457, 1494, 1438, 1451, 1495, 1497, 1498,
       133516  + /*   410 */  1496, 1407, 1502, 1503, 1505, 1499, 1406, 1506, 1507, 1475,
       133517  + /*   420 */  1468, 1511, 1410, 1509, 1473, 1510, 1474, 1516, 1509, 1517,
133544 133518    /*   430 */  1518, 1519, 1520, 1521, 1523, 1532, 1524, 1526, 1525, 1527,
133545         - /*   440 */  1528, 1530, 1531, 1527, 1533, 1535, 1536, 1537, 1539, 1432,
133546         - /*   450 */  1442, 1447, 1448, 1540, 1543, 1549,
       133519  + /*   440 */  1528, 1530, 1531, 1527, 1533, 1535, 1536, 1537, 1539, 1436,
       133520  + /*   450 */  1441, 1442, 1443, 1543, 1547, 1549,
133547 133521   };
133548 133522   #define YY_REDUCE_USE_DFLT (-130)
133549 133523   #define YY_REDUCE_COUNT (324)
133550 133524   #define YY_REDUCE_MIN   (-129)
133551         -#define YY_REDUCE_MAX   (1307)
       133525  +#define YY_REDUCE_MAX   (1300)
133552 133526   static const short yy_reduce_ofst[] = {
133553 133527    /*     0 */   -29,  566,  525,  605,  -49,  307,  491,  533,  668,  435,
133554         - /*    10 */   601,  644,  148,  747,  783,  786,  419,  788,  795,  826,
133555         - /*    20 */   454,  775,  830,  495,  824,  848,   76,   76,   76,   76,
       133528  + /*    10 */   601,  644,  148,  747,  786,  795,  419,  788,  827,  790,
       133529  + /*    20 */   454,  832,  889,  495,  824,  734,   76,   76,   76,   76,
133556 133530    /*    30 */    76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
133557 133531    /*    40 */    76,   76,   76,   76,   76,   76,   76,   76,   76,   76,
133558         - /*    50 */    76,   76,   76,   76,   76,   76,   76,   76,  890,  901,
133559         - /*    60 */   912,  917,  920,  925,  927,  929,  936,  952,  958,  960,
133560         - /*    70 */   962,  964,  967,  969,  971,  974,  977,  986,  993,  996,
133561         - /*    80 */   999, 1002, 1004, 1008, 1010, 1012, 1015, 1021, 1026, 1034,
133562         - /*    90 */  1037, 1039, 1043, 1045, 1048, 1050, 1052, 1061, 1067, 1074,
133563         - /*   100 */  1077, 1079, 1085, 1089,   76,   76,   76,   76,   76,   76,
133564         - /*   110 */    76,   76,   76,  865,   36,  523,  235,  416,  782,   76,
       133532  + /*    50 */    76,   76,   76,   76,   76,   76,   76,   76,  783,  898,
       133533  + /*    60 */   905,  907,  911,  921,  933,  936,  940,  943,  947,  950,
       133534  + /*    70 */   952,  955,  958,  962,  965,  969,  974,  977,  980,  984,
       133535  + /*    80 */   988,  991,  993,  996,  999, 1002, 1006, 1010, 1018, 1021,
       133536  + /*    90 */  1024, 1028, 1032, 1034, 1036, 1040, 1046, 1051, 1058, 1062,
       133537  + /*   100 */  1064, 1068, 1070, 1073,   76,   76,   76,   76,   76,   76,
       133538  + /*   110 */    76,   76,   76,  855,   36,  523,  235,  416,  777,   76,
133565 133539    /*   120 */   278,   76,   76,   76,   76,  700,  700,  700,  150,  220,
133566 133540    /*   130 */   147,  217,  221,  306,  306,  611,    5,  535,  556,  620,
133567         - /*   140 */   704,  720,  784,  116,  789,  349,  889,  894,  404,  953,
133568         - /*   150 */   968, -129,  975,  492,   62,  722,  919,  763,  928,  957,
133569         - /*   160 */   994, 1080, 1081, 1082, 1090, 1091,  872, 1056,  557,   57,
       133541  + /*   140 */   720,  872,  897,  116,  864,  349, 1035, 1037,  404, 1047,
       133542  + /*   150 */   992, -129, 1050,  492,   62,  722,  879, 1072, 1089,  808,
       133543  + /*   160 */  1066, 1094, 1095, 1096, 1097, 1098,  776, 1054,  557,   57,
133570 133544    /*   170 */   112,  131,  167,  182,  250,  272,  291,  331,  364,  438,
133571         - /*   180 */   497,  517,  591,  653,  684,  690,  739,  791,  867,  871,
133572         - /*   190 */   970, 1062, 1107, 1132, 1152,  355,  819,  886, 1001, 1163,
133573         - /*   200 */   661, 1164, 1167, 1168,  861, 1169, 1171, 1017, 1172, 1173,
133574         - /*   210 */  1174,  250, 1176, 1178, 1181, 1182, 1183, 1184, 1084, 1094,
133575         - /*   220 */  1119, 1121, 1122,  661, 1140, 1141, 1188, 1142, 1126, 1127,
133576         - /*   230 */  1103, 1143, 1106, 1170, 1165, 1185, 1186, 1133, 1123, 1187,
133577         - /*   240 */  1189, 1148, 1154, 1196, 1111, 1197, 1198, 1118, 1120, 1204,
133578         - /*   250 */  1147, 1191, 1192, 1193, 1195, 1199, 1200, 1212, 1215, 1201,
133579         - /*   260 */  1155, 1206, 1207, 1202, 1217, 1216, 1145, 1144, 1223, 1224,
133580         - /*   270 */  1228, 1211, 1230, 1232, 1235, 1241, 1221, 1227, 1231, 1234,
133581         - /*   280 */  1222, 1229, 1236, 1237, 1238, 1242, 1243, 1244, 1203, 1210,
133582         - /*   290 */  1214, 1218, 1219, 1245, 1249, 1251, 1252, 1250, 1261, 1253,
133583         - /*   300 */  1254, 1209, 1255, 1259, 1258, 1260, 1264, 1268, 1270, 1272,
133584         - /*   310 */  1276, 1287, 1292, 1295, 1297, 1299, 1303, 1263, 1265, 1269,
133585         - /*   320 */  1277, 1279, 1271, 1273, 1307,
       133545  + /*   180 */   497,  517,  591,  653,  690,  739,  775,  798,  892,  908,
       133546  + /*   190 */   924,  930, 1015, 1063, 1069,  355,  784,  799,  981, 1101,
       133547  + /*   200 */   926, 1151, 1161, 1162,  945, 1164, 1166, 1128, 1168, 1171,
       133548  + /*   210 */  1172,  250, 1173, 1174, 1175, 1178, 1180, 1181, 1088, 1102,
       133549  + /*   220 */  1119, 1124, 1126,  926, 1131, 1139, 1188, 1140, 1129, 1130,
       133550  + /*   230 */  1103, 1144, 1107, 1179, 1156, 1167, 1182, 1134, 1122, 1183,
       133551  + /*   240 */  1184, 1150, 1153, 1197, 1111, 1202, 1203, 1123, 1125, 1205,
       133552  + /*   250 */  1147, 1185, 1169, 1186, 1190, 1191, 1192, 1213, 1217, 1193,
       133553  + /*   260 */  1157, 1196, 1198, 1194, 1220, 1218, 1145, 1154, 1229, 1231,
       133554  + /*   270 */  1233, 1216, 1237, 1240, 1241, 1244, 1222, 1227, 1230, 1232,
       133555  + /*   280 */  1223, 1235, 1236, 1245, 1249, 1226, 1250, 1254, 1199, 1201,
       133556  + /*   290 */  1204, 1207, 1209, 1211, 1214, 1212, 1255, 1208, 1259, 1215,
       133557  + /*   300 */  1256, 1200, 1206, 1260, 1247, 1261, 1263, 1262, 1266, 1278,
       133558  + /*   310 */  1282, 1292, 1294, 1297, 1298, 1299, 1300, 1221, 1224, 1228,
       133559  + /*   320 */  1288, 1291, 1276, 1277, 1295,
133586 133560   };
133587 133561   static const YYACTIONTYPE yy_default[] = {
133588         - /*     0 */  1278, 1268, 1268, 1268, 1200, 1200, 1200, 1200, 1268, 1094,
133589         - /*    10 */  1123, 1123, 1252, 1329, 1329, 1329, 1329, 1329, 1329, 1199,
133590         - /*    20 */  1329, 1329, 1329, 1329, 1268, 1098, 1129, 1329, 1329, 1329,
133591         - /*    30 */  1329, 1201, 1202, 1329, 1329, 1329, 1251, 1253, 1139, 1138,
133592         - /*    40 */  1137, 1136, 1234, 1110, 1134, 1127, 1131, 1201, 1195, 1196,
133593         - /*    50 */  1194, 1198, 1202, 1329, 1130, 1164, 1179, 1163, 1329, 1329,
133594         - /*    60 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133595         - /*    70 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133596         - /*    80 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133597         - /*    90 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133598         - /*   100 */  1329, 1329, 1329, 1329, 1173, 1178, 1185, 1177, 1174, 1166,
133599         - /*   110 */  1165, 1167, 1168, 1329, 1017, 1065, 1329, 1329, 1329, 1169,
133600         - /*   120 */  1329, 1170, 1182, 1181, 1180, 1259, 1286, 1285, 1329, 1329,
133601         - /*   130 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133602         - /*   140 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133603         - /*   150 */  1329, 1329, 1329, 1329, 1329, 1278, 1268, 1023, 1023, 1329,
133604         - /*   160 */  1268, 1268, 1268, 1268, 1268, 1268, 1264, 1098, 1089, 1329,
133605         - /*   170 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133606         - /*   180 */  1256, 1254, 1329, 1215, 1329, 1329, 1329, 1329, 1329, 1329,
133607         - /*   190 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133608         - /*   200 */  1329, 1329, 1329, 1329, 1094, 1329, 1329, 1329, 1329, 1329,
133609         - /*   210 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1280, 1329, 1229,
133610         - /*   220 */  1094, 1094, 1094, 1096, 1078, 1088, 1002, 1133, 1112, 1112,
133611         - /*   230 */  1318, 1133, 1318, 1040, 1300, 1037, 1123, 1112, 1197, 1123,
133612         - /*   240 */  1123, 1095, 1088, 1329, 1321, 1103, 1103, 1320, 1320, 1103,
133613         - /*   250 */  1144, 1068, 1133, 1074, 1074, 1074, 1074, 1103, 1014, 1133,
133614         - /*   260 */  1144, 1068, 1068, 1133, 1103, 1014, 1233, 1315, 1103, 1103,
133615         - /*   270 */  1014, 1208, 1103, 1014, 1103, 1014, 1208, 1066, 1066, 1066,
133616         - /*   280 */  1055, 1208, 1066, 1040, 1066, 1055, 1066, 1066, 1116, 1111,
133617         - /*   290 */  1116, 1111, 1116, 1111, 1116, 1111, 1103, 1203, 1103, 1329,
133618         - /*   300 */  1208, 1212, 1212, 1208, 1128, 1117, 1126, 1124, 1133, 1020,
133619         - /*   310 */  1058, 1283, 1283, 1279, 1279, 1279, 1279, 1326, 1326, 1264,
133620         - /*   320 */  1295, 1295, 1042, 1042, 1295, 1329, 1329, 1329, 1329, 1329,
133621         - /*   330 */  1329, 1290, 1329, 1217, 1329, 1329, 1329, 1329, 1329, 1329,
133622         - /*   340 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133623         - /*   350 */  1329, 1329, 1150, 1329,  998, 1261, 1329, 1329, 1260, 1329,
133624         - /*   360 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133625         - /*   370 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1317,
133626         - /*   380 */  1329, 1329, 1329, 1329, 1329, 1329, 1232, 1231, 1329, 1329,
133627         - /*   390 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133628         - /*   400 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
133629         - /*   410 */  1329, 1080, 1329, 1329, 1329, 1304, 1329, 1329, 1329, 1329,
133630         - /*   420 */  1329, 1329, 1329, 1125, 1329, 1118, 1329, 1329, 1308, 1329,
133631         - /*   430 */  1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1270,
133632         - /*   440 */  1329, 1329, 1329, 1269, 1329, 1329, 1329, 1329, 1329, 1152,
133633         - /*   450 */  1329, 1151, 1155, 1329, 1008, 1329,
       133562  + /*     0 */  1281, 1271, 1271, 1271, 1203, 1203, 1203, 1203, 1271, 1096,
       133563  + /*    10 */  1125, 1125, 1255, 1332, 1332, 1332, 1332, 1332, 1332, 1202,
       133564  + /*    20 */  1332, 1332, 1332, 1332, 1271, 1100, 1131, 1332, 1332, 1332,
       133565  + /*    30 */  1332, 1204, 1205, 1332, 1332, 1332, 1254, 1256, 1141, 1140,
       133566  + /*    40 */  1139, 1138, 1237, 1112, 1136, 1129, 1133, 1204, 1198, 1199,
       133567  + /*    50 */  1197, 1201, 1205, 1332, 1132, 1167, 1182, 1166, 1332, 1332,
       133568  + /*    60 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133569  + /*    70 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133570  + /*    80 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133571  + /*    90 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133572  + /*   100 */  1332, 1332, 1332, 1332, 1176, 1181, 1188, 1180, 1177, 1169,
       133573  + /*   110 */  1168, 1170, 1171, 1332, 1019, 1067, 1332, 1332, 1332, 1172,
       133574  + /*   120 */  1332, 1173, 1185, 1184, 1183, 1262, 1289, 1288, 1332, 1332,
       133575  + /*   130 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133576  + /*   140 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133577  + /*   150 */  1332, 1332, 1332, 1332, 1332, 1281, 1271, 1025, 1025, 1332,
       133578  + /*   160 */  1271, 1271, 1271, 1271, 1271, 1271, 1267, 1100, 1091, 1332,
       133579  + /*   170 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133580  + /*   180 */  1259, 1257, 1332, 1218, 1332, 1332, 1332, 1332, 1332, 1332,
       133581  + /*   190 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133582  + /*   200 */  1332, 1332, 1332, 1332, 1096, 1332, 1332, 1332, 1332, 1332,
       133583  + /*   210 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1283, 1332, 1232,
       133584  + /*   220 */  1096, 1096, 1096, 1098, 1080, 1090, 1004, 1135, 1114, 1114,
       133585  + /*   230 */  1321, 1135, 1321, 1042, 1303, 1039, 1125, 1114, 1200, 1125,
       133586  + /*   240 */  1125, 1097, 1090, 1332, 1324, 1105, 1105, 1323, 1323, 1105,
       133587  + /*   250 */  1146, 1070, 1135, 1076, 1076, 1076, 1076, 1105, 1016, 1135,
       133588  + /*   260 */  1146, 1070, 1070, 1135, 1105, 1016, 1236, 1318, 1105, 1105,
       133589  + /*   270 */  1016, 1211, 1105, 1016, 1105, 1016, 1211, 1068, 1068, 1068,
       133590  + /*   280 */  1057, 1211, 1068, 1042, 1068, 1057, 1068, 1068, 1118, 1113,
       133591  + /*   290 */  1118, 1113, 1118, 1113, 1118, 1113, 1105, 1206, 1105, 1332,
       133592  + /*   300 */  1211, 1215, 1215, 1211, 1130, 1119, 1128, 1126, 1135, 1022,
       133593  + /*   310 */  1060, 1286, 1286, 1282, 1282, 1282, 1282, 1329, 1329, 1267,
       133594  + /*   320 */  1298, 1298, 1044, 1044, 1298, 1332, 1332, 1332, 1332, 1332,
       133595  + /*   330 */  1332, 1293, 1332, 1220, 1332, 1332, 1332, 1332, 1332, 1332,
       133596  + /*   340 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133597  + /*   350 */  1332, 1332, 1152, 1332, 1000, 1264, 1332, 1332, 1263, 1332,
       133598  + /*   360 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133599  + /*   370 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1320,
       133600  + /*   380 */  1332, 1332, 1332, 1332, 1332, 1332, 1235, 1234, 1332, 1332,
       133601  + /*   390 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133602  + /*   400 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
       133603  + /*   410 */  1332, 1082, 1332, 1332, 1332, 1307, 1332, 1332, 1332, 1332,
       133604  + /*   420 */  1332, 1332, 1332, 1127, 1332, 1120, 1332, 1332, 1311, 1332,
       133605  + /*   430 */  1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1273,
       133606  + /*   440 */  1332, 1332, 1332, 1272, 1332, 1332, 1332, 1332, 1332, 1154,
       133607  + /*   450 */  1332, 1153, 1157, 1332, 1010, 1332,
133634 133608   };
133635 133609   /********** End of lemon-generated parsing tables *****************************/
133636 133610   
133637 133611   /* The next table maps tokens (terminal symbols) into fallback tokens.  
133638 133612   ** If a construct like the following:
133639 133613   ** 
133640 133614   **      %fallback ID X Y Z.
................................................................................
133860 133834     "CHECK",         "REFERENCES",    "AUTOINCR",      "ON",          
133861 133835     "INSERT",        "DELETE",        "UPDATE",        "SET",         
133862 133836     "DEFERRABLE",    "FOREIGN",       "DROP",          "UNION",       
133863 133837     "ALL",           "EXCEPT",        "INTERSECT",     "SELECT",      
133864 133838     "VALUES",        "DISTINCT",      "DOT",           "FROM",        
133865 133839     "JOIN",          "USING",         "ORDER",         "GROUP",       
133866 133840     "HAVING",        "LIMIT",         "WHERE",         "INTO",        
133867         -  "INTEGER",       "FLOAT",         "BLOB",          "VARIABLE",    
       133841  +  "FLOAT",         "BLOB",          "INTEGER",       "VARIABLE",    
133868 133842     "CASE",          "WHEN",          "THEN",          "ELSE",        
133869 133843     "INDEX",         "ALTER",         "ADD",           "error",       
133870 133844     "input",         "cmdlist",       "ecmd",          "explain",     
133871 133845     "cmdx",          "cmd",           "transtype",     "trans_opt",   
133872 133846     "nm",            "savepoint_opt",  "create_table",  "create_table_args",
133873 133847     "createkw",      "temp",          "ifnotexists",   "dbnm",        
133874 133848     "columnlist",    "conslist_opt",  "table_options",  "select",      
................................................................................
134053 134027    /* 149 */ "idlist ::= nm",
134054 134028    /* 150 */ "expr ::= LP expr RP",
134055 134029    /* 151 */ "term ::= NULL",
134056 134030    /* 152 */ "expr ::= ID|INDEXED",
134057 134031    /* 153 */ "expr ::= JOIN_KW",
134058 134032    /* 154 */ "expr ::= nm DOT nm",
134059 134033    /* 155 */ "expr ::= nm DOT nm DOT nm",
134060         - /* 156 */ "term ::= INTEGER|FLOAT|BLOB",
       134034  + /* 156 */ "term ::= FLOAT|BLOB",
134061 134035    /* 157 */ "term ::= STRING",
134062         - /* 158 */ "expr ::= VARIABLE",
134063         - /* 159 */ "expr ::= expr COLLATE ID|STRING",
134064         - /* 160 */ "expr ::= CAST LP expr AS typetoken RP",
134065         - /* 161 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
134066         - /* 162 */ "expr ::= ID|INDEXED LP STAR RP",
134067         - /* 163 */ "term ::= CTIME_KW",
134068         - /* 164 */ "expr ::= LP nexprlist COMMA expr RP",
134069         - /* 165 */ "expr ::= expr AND expr",
134070         - /* 166 */ "expr ::= expr OR expr",
134071         - /* 167 */ "expr ::= expr LT|GT|GE|LE expr",
134072         - /* 168 */ "expr ::= expr EQ|NE expr",
134073         - /* 169 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
134074         - /* 170 */ "expr ::= expr PLUS|MINUS expr",
134075         - /* 171 */ "expr ::= expr STAR|SLASH|REM expr",
134076         - /* 172 */ "expr ::= expr CONCAT expr",
134077         - /* 173 */ "likeop ::= LIKE_KW|MATCH",
134078         - /* 174 */ "likeop ::= NOT LIKE_KW|MATCH",
134079         - /* 175 */ "expr ::= expr likeop expr",
134080         - /* 176 */ "expr ::= expr likeop expr ESCAPE expr",
134081         - /* 177 */ "expr ::= expr ISNULL|NOTNULL",
134082         - /* 178 */ "expr ::= expr NOT NULL",
134083         - /* 179 */ "expr ::= expr IS expr",
134084         - /* 180 */ "expr ::= expr IS NOT expr",
134085         - /* 181 */ "expr ::= NOT expr",
134086         - /* 182 */ "expr ::= BITNOT expr",
134087         - /* 183 */ "expr ::= MINUS expr",
134088         - /* 184 */ "expr ::= PLUS expr",
134089         - /* 185 */ "between_op ::= BETWEEN",
134090         - /* 186 */ "between_op ::= NOT BETWEEN",
134091         - /* 187 */ "expr ::= expr between_op expr AND expr",
134092         - /* 188 */ "in_op ::= IN",
134093         - /* 189 */ "in_op ::= NOT IN",
134094         - /* 190 */ "expr ::= expr in_op LP exprlist RP",
134095         - /* 191 */ "expr ::= LP select RP",
134096         - /* 192 */ "expr ::= expr in_op LP select RP",
134097         - /* 193 */ "expr ::= expr in_op nm dbnm paren_exprlist",
134098         - /* 194 */ "expr ::= EXISTS LP select RP",
134099         - /* 195 */ "expr ::= CASE case_operand case_exprlist case_else END",
134100         - /* 196 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
134101         - /* 197 */ "case_exprlist ::= WHEN expr THEN expr",
134102         - /* 198 */ "case_else ::= ELSE expr",
134103         - /* 199 */ "case_else ::=",
134104         - /* 200 */ "case_operand ::= expr",
134105         - /* 201 */ "case_operand ::=",
134106         - /* 202 */ "exprlist ::=",
134107         - /* 203 */ "nexprlist ::= nexprlist COMMA expr",
134108         - /* 204 */ "nexprlist ::= expr",
134109         - /* 205 */ "paren_exprlist ::=",
134110         - /* 206 */ "paren_exprlist ::= LP exprlist RP",
134111         - /* 207 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
134112         - /* 208 */ "uniqueflag ::= UNIQUE",
134113         - /* 209 */ "uniqueflag ::=",
134114         - /* 210 */ "eidlist_opt ::=",
134115         - /* 211 */ "eidlist_opt ::= LP eidlist RP",
134116         - /* 212 */ "eidlist ::= eidlist COMMA nm collate sortorder",
134117         - /* 213 */ "eidlist ::= nm collate sortorder",
134118         - /* 214 */ "collate ::=",
134119         - /* 215 */ "collate ::= COLLATE ID|STRING",
134120         - /* 216 */ "cmd ::= DROP INDEX ifexists fullname",
134121         - /* 217 */ "cmd ::= VACUUM",
134122         - /* 218 */ "cmd ::= VACUUM nm",
134123         - /* 219 */ "cmd ::= PRAGMA nm dbnm",
134124         - /* 220 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
134125         - /* 221 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
134126         - /* 222 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
134127         - /* 223 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
134128         - /* 224 */ "plus_num ::= PLUS INTEGER|FLOAT",
134129         - /* 225 */ "minus_num ::= MINUS INTEGER|FLOAT",
134130         - /* 226 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
134131         - /* 227 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
134132         - /* 228 */ "trigger_time ::= BEFORE",
134133         - /* 229 */ "trigger_time ::= AFTER",
134134         - /* 230 */ "trigger_time ::= INSTEAD OF",
134135         - /* 231 */ "trigger_time ::=",
134136         - /* 232 */ "trigger_event ::= DELETE|INSERT",
134137         - /* 233 */ "trigger_event ::= UPDATE",
134138         - /* 234 */ "trigger_event ::= UPDATE OF idlist",
134139         - /* 235 */ "when_clause ::=",
134140         - /* 236 */ "when_clause ::= WHEN expr",
134141         - /* 237 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
134142         - /* 238 */ "trigger_cmd_list ::= trigger_cmd SEMI",
134143         - /* 239 */ "trnm ::= nm DOT nm",
134144         - /* 240 */ "tridxby ::= INDEXED BY nm",
134145         - /* 241 */ "tridxby ::= NOT INDEXED",
134146         - /* 242 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
134147         - /* 243 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
134148         - /* 244 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
134149         - /* 245 */ "trigger_cmd ::= select",
134150         - /* 246 */ "expr ::= RAISE LP IGNORE RP",
134151         - /* 247 */ "expr ::= RAISE LP raisetype COMMA nm RP",
134152         - /* 248 */ "raisetype ::= ROLLBACK",
134153         - /* 249 */ "raisetype ::= ABORT",
134154         - /* 250 */ "raisetype ::= FAIL",
134155         - /* 251 */ "cmd ::= DROP TRIGGER ifexists fullname",
134156         - /* 252 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
134157         - /* 253 */ "cmd ::= DETACH database_kw_opt expr",
134158         - /* 254 */ "key_opt ::=",
134159         - /* 255 */ "key_opt ::= KEY expr",
134160         - /* 256 */ "cmd ::= REINDEX",
134161         - /* 257 */ "cmd ::= REINDEX nm dbnm",
134162         - /* 258 */ "cmd ::= ANALYZE",
134163         - /* 259 */ "cmd ::= ANALYZE nm dbnm",
134164         - /* 260 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
134165         - /* 261 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
134166         - /* 262 */ "add_column_fullname ::= fullname",
134167         - /* 263 */ "cmd ::= create_vtab",
134168         - /* 264 */ "cmd ::= create_vtab LP vtabarglist RP",
134169         - /* 265 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
134170         - /* 266 */ "vtabarg ::=",
134171         - /* 267 */ "vtabargtoken ::= ANY",
134172         - /* 268 */ "vtabargtoken ::= lp anylist RP",
134173         - /* 269 */ "lp ::= LP",
134174         - /* 270 */ "with ::=",
134175         - /* 271 */ "with ::= WITH wqlist",
134176         - /* 272 */ "with ::= WITH RECURSIVE wqlist",
134177         - /* 273 */ "wqlist ::= nm eidlist_opt AS LP select RP",
134178         - /* 274 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
134179         - /* 275 */ "input ::= cmdlist",
134180         - /* 276 */ "cmdlist ::= cmdlist ecmd",
134181         - /* 277 */ "cmdlist ::= ecmd",
134182         - /* 278 */ "ecmd ::= SEMI",
134183         - /* 279 */ "ecmd ::= explain cmdx SEMI",
134184         - /* 280 */ "explain ::=",
134185         - /* 281 */ "trans_opt ::=",
134186         - /* 282 */ "trans_opt ::= TRANSACTION",
134187         - /* 283 */ "trans_opt ::= TRANSACTION nm",
134188         - /* 284 */ "savepoint_opt ::= SAVEPOINT",
134189         - /* 285 */ "savepoint_opt ::=",
134190         - /* 286 */ "cmd ::= create_table create_table_args",
134191         - /* 287 */ "columnlist ::= columnlist COMMA columnname carglist",
134192         - /* 288 */ "columnlist ::= columnname carglist",
134193         - /* 289 */ "nm ::= ID|INDEXED",
134194         - /* 290 */ "nm ::= STRING",
134195         - /* 291 */ "nm ::= JOIN_KW",
134196         - /* 292 */ "typetoken ::= typename",
134197         - /* 293 */ "typename ::= ID|STRING",
134198         - /* 294 */ "signed ::= plus_num",
134199         - /* 295 */ "signed ::= minus_num",
134200         - /* 296 */ "carglist ::= carglist ccons",
134201         - /* 297 */ "carglist ::=",
134202         - /* 298 */ "ccons ::= NULL onconf",
134203         - /* 299 */ "conslist_opt ::= COMMA conslist",
134204         - /* 300 */ "conslist ::= conslist tconscomma tcons",
134205         - /* 301 */ "conslist ::= tcons",
134206         - /* 302 */ "tconscomma ::=",
134207         - /* 303 */ "defer_subclause_opt ::= defer_subclause",
134208         - /* 304 */ "resolvetype ::= raisetype",
134209         - /* 305 */ "selectnowith ::= oneselect",
134210         - /* 306 */ "oneselect ::= values",
134211         - /* 307 */ "sclp ::= selcollist COMMA",
134212         - /* 308 */ "as ::= ID|STRING",
134213         - /* 309 */ "expr ::= term",
134214         - /* 310 */ "exprlist ::= nexprlist",
134215         - /* 311 */ "nmnum ::= plus_num",
134216         - /* 312 */ "nmnum ::= nm",
134217         - /* 313 */ "nmnum ::= ON",
134218         - /* 314 */ "nmnum ::= DELETE",
134219         - /* 315 */ "nmnum ::= DEFAULT",
134220         - /* 316 */ "plus_num ::= INTEGER|FLOAT",
134221         - /* 317 */ "foreach_clause ::=",
134222         - /* 318 */ "foreach_clause ::= FOR EACH ROW",
134223         - /* 319 */ "trnm ::= nm",
134224         - /* 320 */ "tridxby ::=",
134225         - /* 321 */ "database_kw_opt ::= DATABASE",
134226         - /* 322 */ "database_kw_opt ::=",
134227         - /* 323 */ "kwcolumn_opt ::=",
134228         - /* 324 */ "kwcolumn_opt ::= COLUMNKW",
134229         - /* 325 */ "vtabarglist ::= vtabarg",
134230         - /* 326 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
134231         - /* 327 */ "vtabarg ::= vtabarg vtabargtoken",
134232         - /* 328 */ "anylist ::=",
134233         - /* 329 */ "anylist ::= anylist LP anylist RP",
134234         - /* 330 */ "anylist ::= anylist ANY",
       134036  + /* 158 */ "term ::= INTEGER",
       134037  + /* 159 */ "expr ::= VARIABLE",
       134038  + /* 160 */ "expr ::= expr COLLATE ID|STRING",
       134039  + /* 161 */ "expr ::= CAST LP expr AS typetoken RP",
       134040  + /* 162 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
       134041  + /* 163 */ "expr ::= ID|INDEXED LP STAR RP",
       134042  + /* 164 */ "term ::= CTIME_KW",
       134043  + /* 165 */ "expr ::= LP nexprlist COMMA expr RP",
       134044  + /* 166 */ "expr ::= expr AND expr",
       134045  + /* 167 */ "expr ::= expr OR expr",
       134046  + /* 168 */ "expr ::= expr LT|GT|GE|LE expr",
       134047  + /* 169 */ "expr ::= expr EQ|NE expr",
       134048  + /* 170 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
       134049  + /* 171 */ "expr ::= expr PLUS|MINUS expr",
       134050  + /* 172 */ "expr ::= expr STAR|SLASH|REM expr",
       134051  + /* 173 */ "expr ::= expr CONCAT expr",
       134052  + /* 174 */ "likeop ::= LIKE_KW|MATCH",
       134053  + /* 175 */ "likeop ::= NOT LIKE_KW|MATCH",
       134054  + /* 176 */ "expr ::= expr likeop expr",
       134055  + /* 177 */ "expr ::= expr likeop expr ESCAPE expr",
       134056  + /* 178 */ "expr ::= expr ISNULL|NOTNULL",
       134057  + /* 179 */ "expr ::= expr NOT NULL",
       134058  + /* 180 */ "expr ::= expr IS expr",
       134059  + /* 181 */ "expr ::= expr IS NOT expr",
       134060  + /* 182 */ "expr ::= NOT expr",
       134061  + /* 183 */ "expr ::= BITNOT expr",
       134062  + /* 184 */ "expr ::= MINUS expr",
       134063  + /* 185 */ "expr ::= PLUS expr",
       134064  + /* 186 */ "between_op ::= BETWEEN",
       134065  + /* 187 */ "between_op ::= NOT BETWEEN",
       134066  + /* 188 */ "expr ::= expr between_op expr AND expr",
       134067  + /* 189 */ "in_op ::= IN",
       134068  + /* 190 */ "in_op ::= NOT IN",
       134069  + /* 191 */ "expr ::= expr in_op LP exprlist RP",
       134070  + /* 192 */ "expr ::= LP select RP",
       134071  + /* 193 */ "expr ::= expr in_op LP select RP",
       134072  + /* 194 */ "expr ::= expr in_op nm dbnm paren_exprlist",
       134073  + /* 195 */ "expr ::= EXISTS LP select RP",
       134074  + /* 196 */ "expr ::= CASE case_operand case_exprlist case_else END",
       134075  + /* 197 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
       134076  + /* 198 */ "case_exprlist ::= WHEN expr THEN expr",
       134077  + /* 199 */ "case_else ::= ELSE expr",
       134078  + /* 200 */ "case_else ::=",
       134079  + /* 201 */ "case_operand ::= expr",
       134080  + /* 202 */ "case_operand ::=",
       134081  + /* 203 */ "exprlist ::=",
       134082  + /* 204 */ "nexprlist ::= nexprlist COMMA expr",
       134083  + /* 205 */ "nexprlist ::= expr",
       134084  + /* 206 */ "paren_exprlist ::=",
       134085  + /* 207 */ "paren_exprlist ::= LP exprlist RP",
       134086  + /* 208 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
       134087  + /* 209 */ "uniqueflag ::= UNIQUE",
       134088  + /* 210 */ "uniqueflag ::=",
       134089  + /* 211 */ "eidlist_opt ::=",
       134090  + /* 212 */ "eidlist_opt ::= LP eidlist RP",
       134091  + /* 213 */ "eidlist ::= eidlist COMMA nm collate sortorder",
       134092  + /* 214 */ "eidlist ::= nm collate sortorder",
       134093  + /* 215 */ "collate ::=",
       134094  + /* 216 */ "collate ::= COLLATE ID|STRING",
       134095  + /* 217 */ "cmd ::= DROP INDEX ifexists fullname",
       134096  + /* 218 */ "cmd ::= VACUUM",
       134097  + /* 219 */ "cmd ::= VACUUM nm",
       134098  + /* 220 */ "cmd ::= PRAGMA nm dbnm",
       134099  + /* 221 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
       134100  + /* 222 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
       134101  + /* 223 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
       134102  + /* 224 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
       134103  + /* 225 */ "plus_num ::= PLUS INTEGER|FLOAT",
       134104  + /* 226 */ "minus_num ::= MINUS INTEGER|FLOAT",
       134105  + /* 227 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
       134106  + /* 228 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
       134107  + /* 229 */ "trigger_time ::= BEFORE",
       134108  + /* 230 */ "trigger_time ::= AFTER",
       134109  + /* 231 */ "trigger_time ::= INSTEAD OF",
       134110  + /* 232 */ "trigger_time ::=",
       134111  + /* 233 */ "trigger_event ::= DELETE|INSERT",
       134112  + /* 234 */ "trigger_event ::= UPDATE",
       134113  + /* 235 */ "trigger_event ::= UPDATE OF idlist",
       134114  + /* 236 */ "when_clause ::=",
       134115  + /* 237 */ "when_clause ::= WHEN expr",
       134116  + /* 238 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
       134117  + /* 239 */ "trigger_cmd_list ::= trigger_cmd SEMI",
       134118  + /* 240 */ "trnm ::= nm DOT nm",
       134119  + /* 241 */ "tridxby ::= INDEXED BY nm",
       134120  + /* 242 */ "tridxby ::= NOT INDEXED",
       134121  + /* 243 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
       134122  + /* 244 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
       134123  + /* 245 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
       134124  + /* 246 */ "trigger_cmd ::= select",
       134125  + /* 247 */ "expr ::= RAISE LP IGNORE RP",
       134126  + /* 248 */ "expr ::= RAISE LP raisetype COMMA nm RP",
       134127  + /* 249 */ "raisetype ::= ROLLBACK",
       134128  + /* 250 */ "raisetype ::= ABORT",
       134129  + /* 251 */ "raisetype ::= FAIL",
       134130  + /* 252 */ "cmd ::= DROP TRIGGER ifexists fullname",
       134131  + /* 253 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
       134132  + /* 254 */ "cmd ::= DETACH database_kw_opt expr",
       134133  + /* 255 */ "key_opt ::=",
       134134  + /* 256 */ "key_opt ::= KEY expr",
       134135  + /* 257 */ "cmd ::= REINDEX",
       134136  + /* 258 */ "cmd ::= REINDEX nm dbnm",
       134137  + /* 259 */ "cmd ::= ANALYZE",
       134138  + /* 260 */ "cmd ::= ANALYZE nm dbnm",
       134139  + /* 261 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
       134140  + /* 262 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
       134141  + /* 263 */ "add_column_fullname ::= fullname",
       134142  + /* 264 */ "cmd ::= create_vtab",
       134143  + /* 265 */ "cmd ::= create_vtab LP vtabarglist RP",
       134144  + /* 266 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
       134145  + /* 267 */ "vtabarg ::=",
       134146  + /* 268 */ "vtabargtoken ::= ANY",
       134147  + /* 269 */ "vtabargtoken ::= lp anylist RP",
       134148  + /* 270 */ "lp ::= LP",
       134149  + /* 271 */ "with ::=",
       134150  + /* 272 */ "with ::= WITH wqlist",
       134151  + /* 273 */ "with ::= WITH RECURSIVE wqlist",
       134152  + /* 274 */ "wqlist ::= nm eidlist_opt AS LP select RP",
       134153  + /* 275 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
       134154  + /* 276 */ "input ::= cmdlist",
       134155  + /* 277 */ "cmdlist ::= cmdlist ecmd",
       134156  + /* 278 */ "cmdlist ::= ecmd",
       134157  + /* 279 */ "ecmd ::= SEMI",
       134158  + /* 280 */ "ecmd ::= explain cmdx SEMI",
       134159  + /* 281 */ "explain ::=",
       134160  + /* 282 */ "trans_opt ::=",
       134161  + /* 283 */ "trans_opt ::= TRANSACTION",
       134162  + /* 284 */ "trans_opt ::= TRANSACTION nm",
       134163  + /* 285 */ "savepoint_opt ::= SAVEPOINT",
       134164  + /* 286 */ "savepoint_opt ::=",
       134165  + /* 287 */ "cmd ::= create_table create_table_args",
       134166  + /* 288 */ "columnlist ::= columnlist COMMA columnname carglist",
       134167  + /* 289 */ "columnlist ::= columnname carglist",
       134168  + /* 290 */ "nm ::= ID|INDEXED",
       134169  + /* 291 */ "nm ::= STRING",
       134170  + /* 292 */ "nm ::= JOIN_KW",
       134171  + /* 293 */ "typetoken ::= typename",
       134172  + /* 294 */ "typename ::= ID|STRING",
       134173  + /* 295 */ "signed ::= plus_num",
       134174  + /* 296 */ "signed ::= minus_num",
       134175  + /* 297 */ "carglist ::= carglist ccons",
       134176  + /* 298 */ "carglist ::=",
       134177  + /* 299 */ "ccons ::= NULL onconf",
       134178  + /* 300 */ "conslist_opt ::= COMMA conslist",
       134179  + /* 301 */ "conslist ::= conslist tconscomma tcons",
       134180  + /* 302 */ "conslist ::= tcons",
       134181  + /* 303 */ "tconscomma ::=",
       134182  + /* 304 */ "defer_subclause_opt ::= defer_subclause",
       134183  + /* 305 */ "resolvetype ::= raisetype",
       134184  + /* 306 */ "selectnowith ::= oneselect",
       134185  + /* 307 */ "oneselect ::= values",
       134186  + /* 308 */ "sclp ::= selcollist COMMA",
       134187  + /* 309 */ "as ::= ID|STRING",
       134188  + /* 310 */ "expr ::= term",
       134189  + /* 311 */ "exprlist ::= nexprlist",
       134190  + /* 312 */ "nmnum ::= plus_num",
       134191  + /* 313 */ "nmnum ::= nm",
       134192  + /* 314 */ "nmnum ::= ON",
       134193  + /* 315 */ "nmnum ::= DELETE",
       134194  + /* 316 */ "nmnum ::= DEFAULT",
       134195  + /* 317 */ "plus_num ::= INTEGER|FLOAT",
       134196  + /* 318 */ "foreach_clause ::=",
       134197  + /* 319 */ "foreach_clause ::= FOR EACH ROW",
       134198  + /* 320 */ "trnm ::= nm",
       134199  + /* 321 */ "tridxby ::=",
       134200  + /* 322 */ "database_kw_opt ::= DATABASE",
       134201  + /* 323 */ "database_kw_opt ::=",
       134202  + /* 324 */ "kwcolumn_opt ::=",
       134203  + /* 325 */ "kwcolumn_opt ::= COLUMNKW",
       134204  + /* 326 */ "vtabarglist ::= vtabarg",
       134205  + /* 327 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
       134206  + /* 328 */ "vtabarg ::= vtabarg vtabargtoken",
       134207  + /* 329 */ "anylist ::=",
       134208  + /* 330 */ "anylist ::= anylist LP anylist RP",
       134209  + /* 331 */ "anylist ::= anylist ANY",
134235 134210   };
134236 134211   #endif /* NDEBUG */
134237 134212   
134238 134213   
134239 134214   #if YYSTACKDEPTH<=0
134240 134215   /*
134241 134216   ** Try to increase the size of the parser stack.  Return the number
................................................................................
134809 134784     { 172, 1 },
134810 134785     { 173, 1 },
134811 134786     { 173, 1 },
134812 134787     { 173, 3 },
134813 134788     { 173, 5 },
134814 134789     { 172, 1 },
134815 134790     { 172, 1 },
       134791  +  { 172, 1 },
134816 134792     { 173, 1 },
134817 134793     { 173, 3 },
134818 134794     { 173, 6 },
134819 134795     { 173, 5 },
134820 134796     { 173, 4 },
134821 134797     { 172, 1 },
134822 134798     { 173, 5 },
................................................................................
135103 135079         case 19: /* temp ::= */ yytestcase(yyruleno==19);
135104 135080         case 22: /* table_options ::= */ yytestcase(yyruleno==22);
135105 135081         case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
135106 135082         case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
135107 135083         case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
135108 135084         case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
135109 135085         case 90: /* distinct ::= */ yytestcase(yyruleno==90);
135110         -      case 214: /* collate ::= */ yytestcase(yyruleno==214);
       135086  +      case 215: /* collate ::= */ yytestcase(yyruleno==215);
135111 135087   {yymsp[1].minor.yy194 = 0;}
135112 135088           break;
135113 135089         case 17: /* ifnotexists ::= IF NOT EXISTS */
135114 135090   {yymsp[-2].minor.yy194 = 1;}
135115 135091           break;
135116 135092         case 18: /* temp ::= TEMP */
135117 135093         case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
................................................................................
135247 135223         case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
135248 135224         case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
135249 135225         case 144: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==144);
135250 135226   {yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;}
135251 135227           break;
135252 135228         case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
135253 135229         case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
135254         -      case 186: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==186);
135255         -      case 189: /* in_op ::= NOT IN */ yytestcase(yyruleno==189);
135256         -      case 215: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==215);
       135230  +      case 187: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==187);
       135231  +      case 190: /* in_op ::= NOT IN */ yytestcase(yyruleno==190);
       135232  +      case 216: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==216);
135257 135233   {yymsp[-1].minor.yy194 = 1;}
135258 135234           break;
135259 135235         case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
135260 135236   {yymsp[-1].minor.yy194 = 0;}
135261 135237           break;
135262 135238         case 61: /* tconscomma ::= COMMA */
135263 135239   {pParse->constraintName.n = 0;}
................................................................................
135413 135389           break;
135414 135390         case 89: /* distinct ::= ALL */
135415 135391   {yymsp[0].minor.yy194 = SF_All;}
135416 135392           break;
135417 135393         case 91: /* sclp ::= */
135418 135394         case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119);
135419 135395         case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126);
135420         -      case 202: /* exprlist ::= */ yytestcase(yyruleno==202);
135421         -      case 205: /* paren_exprlist ::= */ yytestcase(yyruleno==205);
135422         -      case 210: /* eidlist_opt ::= */ yytestcase(yyruleno==210);
       135396  +      case 203: /* exprlist ::= */ yytestcase(yyruleno==203);
       135397  +      case 206: /* paren_exprlist ::= */ yytestcase(yyruleno==206);
       135398  +      case 211: /* eidlist_opt ::= */ yytestcase(yyruleno==211);
135423 135399   {yymsp[1].minor.yy148 = 0;}
135424 135400           break;
135425 135401         case 92: /* selcollist ::= sclp expr as */
135426 135402   {
135427 135403      yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr);
135428 135404      if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0, 1);
135429 135405      sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy148,&yymsp[-1].minor.yy190);
................................................................................
135433 135409   {
135434 135410     Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
135435 135411     yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy148, p);
135436 135412   }
135437 135413           break;
135438 135414         case 94: /* selcollist ::= sclp nm DOT STAR */
135439 135415   {
135440         -  Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0, &yymsp[0].minor.yy0);
       135416  +  Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0, 0);
135441 135417     Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
135442 135418     Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
135443 135419     yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot);
135444 135420   }
135445 135421           break;
135446 135422         case 95: /* as ::= AS nm */
135447 135423         case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106);
135448         -      case 224: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==224);
135449         -      case 225: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==225);
       135424  +      case 225: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==225);
       135425  +      case 226: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==226);
135450 135426   {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
135451 135427           break;
135452 135428         case 97: /* from ::= */
135453 135429   {yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));}
135454 135430           break;
135455 135431         case 98: /* from ::= FROM seltablist */
135456 135432   {
................................................................................
135525 135501           break;
135526 135502         case 111: /* joinop ::= JOIN_KW nm nm JOIN */
135527 135503   {yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
135528 135504           break;
135529 135505         case 112: /* on_opt ::= ON expr */
135530 135506         case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129);
135531 135507         case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136);
135532         -      case 198: /* case_else ::= ELSE expr */ yytestcase(yyruleno==198);
       135508  +      case 199: /* case_else ::= ELSE expr */ yytestcase(yyruleno==199);
135533 135509   {yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;}
135534 135510           break;
135535 135511         case 113: /* on_opt ::= */
135536 135512         case 128: /* having_opt ::= */ yytestcase(yyruleno==128);
135537 135513         case 135: /* where_opt ::= */ yytestcase(yyruleno==135);
135538         -      case 199: /* case_else ::= */ yytestcase(yyruleno==199);
135539         -      case 201: /* case_operand ::= */ yytestcase(yyruleno==201);
       135514  +      case 200: /* case_else ::= */ yytestcase(yyruleno==200);
       135515  +      case 202: /* case_operand ::= */ yytestcase(yyruleno==202);
135540 135516   {yymsp[1].minor.yy72 = 0;}
135541 135517           break;
135542 135518         case 115: /* indexed_opt ::= INDEXED BY nm */
135543 135519   {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
135544 135520           break;
135545 135521         case 116: /* indexed_opt ::= NOT INDEXED */
135546 135522   {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
................................................................................
135648 135624         case 149: /* idlist ::= nm */
135649 135625   {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
135650 135626           break;
135651 135627         case 150: /* expr ::= LP expr RP */
135652 135628   {spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/  yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;}
135653 135629           break;
135654 135630         case 151: /* term ::= NULL */
135655         -      case 156: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==156);
       135631  +      case 156: /* term ::= FLOAT|BLOB */ yytestcase(yyruleno==156);
135656 135632         case 157: /* term ::= STRING */ yytestcase(yyruleno==157);
135657 135633   {spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/}
135658 135634           break;
135659 135635         case 152: /* expr ::= ID|INDEXED */
135660 135636         case 153: /* expr ::= JOIN_KW */ yytestcase(yyruleno==153);
135661 135637   {spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
135662 135638           break;
135663 135639         case 154: /* expr ::= nm DOT nm */
135664 135640   {
135665         -  Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
135666         -  Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
       135641  +  Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
       135642  +  Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
135667 135643     spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
135668 135644     yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
135669 135645   }
135670 135646           break;
135671 135647         case 155: /* expr ::= nm DOT nm DOT nm */
135672 135648   {
135673         -  Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0);
135674         -  Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
135675         -  Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
       135649  +  Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
       135650  +  Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
       135651  +  Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
135676 135652     Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
135677 135653     spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
135678 135654     yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
135679 135655   }
135680 135656           break;
135681         -      case 158: /* expr ::= VARIABLE */
       135657  +      case 158: /* term ::= INTEGER */
       135658  +{
       135659  +  yylhsminor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
       135660  +  yylhsminor.yy190.zStart = yymsp[0].minor.yy0.z;
       135661  +  yylhsminor.yy190.zEnd = yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n;
       135662  +  if( yylhsminor.yy190.pExpr ) yylhsminor.yy190.pExpr->flags |= EP_Leaf;
       135663  +}
       135664  +  yymsp[0].minor.yy190 = yylhsminor.yy190;
       135665  +        break;
       135666  +      case 159: /* expr ::= VARIABLE */
135682 135667   {
135683 135668     if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
       135669  +    u32 n = yymsp[0].minor.yy0.n;
135684 135670       spanExpr(&yymsp[0].minor.yy190, pParse, TK_VARIABLE, yymsp[0].minor.yy0);
135685         -    sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr);
       135671  +    sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr, n);
135686 135672     }else{
135687 135673       /* When doing a nested parse, one can include terms in an expression
135688 135674       ** that look like this:   #1 #2 ...  These terms refer to registers
135689 135675       ** in the virtual machine.  #N is the N-th register. */
135690 135676       Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
135691 135677       assert( t.n>=2 );
135692 135678       spanSet(&yymsp[0].minor.yy190, &t, &t);
135693 135679       if( pParse->nested==0 ){
135694 135680         sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
135695 135681         yymsp[0].minor.yy190.pExpr = 0;
135696 135682       }else{
135697         -      yymsp[0].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &t);
       135683  +      yymsp[0].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, 0);
135698 135684         if( yymsp[0].minor.yy190.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy190.pExpr->iTable);
135699 135685       }
135700 135686     }
135701 135687   }
135702 135688           break;
135703         -      case 159: /* expr ::= expr COLLATE ID|STRING */
       135689  +      case 160: /* expr ::= expr COLLATE ID|STRING */
135704 135690   {
135705 135691     yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1);
135706 135692     yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
135707 135693   }
135708 135694           break;
135709         -      case 160: /* expr ::= CAST LP expr AS typetoken RP */
       135695  +      case 161: /* expr ::= CAST LP expr AS typetoken RP */
135710 135696   {
135711 135697     spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
135712 135698     yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy190.pExpr, 0, &yymsp[-1].minor.yy0);
135713 135699   }
135714 135700           break;
135715         -      case 161: /* expr ::= ID|INDEXED LP distinct exprlist RP */
       135701  +      case 162: /* expr ::= ID|INDEXED LP distinct exprlist RP */
135716 135702   {
135717 135703     if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
135718 135704       sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
135719 135705     }
135720 135706     yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy148, &yymsp[-4].minor.yy0);
135721 135707     spanSet(&yylhsminor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
135722 135708     if( yymsp[-2].minor.yy194==SF_Distinct && yylhsminor.yy190.pExpr ){
135723 135709       yylhsminor.yy190.pExpr->flags |= EP_Distinct;
135724 135710     }
135725 135711   }
135726 135712     yymsp[-4].minor.yy190 = yylhsminor.yy190;
135727 135713           break;
135728         -      case 162: /* expr ::= ID|INDEXED LP STAR RP */
       135714  +      case 163: /* expr ::= ID|INDEXED LP STAR RP */
135729 135715   {
135730 135716     yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
135731 135717     spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
135732 135718   }
135733 135719     yymsp[-3].minor.yy190 = yylhsminor.yy190;
135734 135720           break;
135735         -      case 163: /* term ::= CTIME_KW */
       135721  +      case 164: /* term ::= CTIME_KW */
135736 135722   {
135737 135723     yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
135738 135724     spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
135739 135725   }
135740 135726     yymsp[0].minor.yy190 = yylhsminor.yy190;
135741 135727           break;
135742         -      case 164: /* expr ::= LP nexprlist COMMA expr RP */
       135728  +      case 165: /* expr ::= LP nexprlist COMMA expr RP */
135743 135729   {
135744 135730     ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy148, yymsp[-1].minor.yy190.pExpr);
135745 135731     yylhsminor.yy190.pExpr = sqlite3PExpr(pParse, TK_VECTOR, 0, 0, 0);
135746 135732     if( yylhsminor.yy190.pExpr ){
135747 135733       yylhsminor.yy190.pExpr->x.pList = pList;
135748 135734       spanSet(&yylhsminor.yy190, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
135749 135735     }else{
135750 135736       sqlite3ExprListDelete(pParse->db, pList);
135751 135737     }
135752 135738   }
135753 135739     yymsp[-4].minor.yy190 = yylhsminor.yy190;
135754 135740           break;
135755         -      case 165: /* expr ::= expr AND expr */
135756         -      case 166: /* expr ::= expr OR expr */ yytestcase(yyruleno==166);
135757         -      case 167: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==167);
135758         -      case 168: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==168);
135759         -      case 169: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==169);
135760         -      case 170: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==170);
135761         -      case 171: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==171);
135762         -      case 172: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==172);
       135741  +      case 166: /* expr ::= expr AND expr */
       135742  +      case 167: /* expr ::= expr OR expr */ yytestcase(yyruleno==167);
       135743  +      case 168: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==168);
       135744  +      case 169: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==169);
       135745  +      case 170: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==170);
       135746  +      case 171: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==171);
       135747  +      case 172: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==172);
       135748  +      case 173: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==173);
135763 135749   {spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);}
135764 135750           break;
135765         -      case 173: /* likeop ::= LIKE_KW|MATCH */
135766         -{yymsp[0].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[0].minor.yy392.bNot = 0;/*A-overwrites-X*/}
       135751  +      case 174: /* likeop ::= LIKE_KW|MATCH */
       135752  +{yymsp[0].minor.yy0=yymsp[0].minor.yy0;/*A-overwrites-X*/}
135767 135753           break;
135768         -      case 174: /* likeop ::= NOT LIKE_KW|MATCH */
135769         -{yymsp[-1].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[-1].minor.yy392.bNot = 1;}
       135754  +      case 175: /* likeop ::= NOT LIKE_KW|MATCH */
       135755  +{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
135770 135756           break;
135771         -      case 175: /* expr ::= expr likeop expr */
       135757  +      case 176: /* expr ::= expr likeop expr */
135772 135758   {
135773 135759     ExprList *pList;
       135760  +  int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
       135761  +  yymsp[-1].minor.yy0.n &= 0x7fffffff;
135774 135762     pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr);
135775 135763     pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy190.pExpr);
135776         -  yymsp[-2].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy392.eOperator);
135777         -  exprNot(pParse, yymsp[-1].minor.yy392.bNot, &yymsp[-2].minor.yy190);
       135764  +  yymsp[-2].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0);
       135765  +  exprNot(pParse, bNot, &yymsp[-2].minor.yy190);
135778 135766     yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
135779 135767     if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc;
135780 135768   }
135781 135769           break;
135782         -      case 176: /* expr ::= expr likeop expr ESCAPE expr */
       135770  +      case 177: /* expr ::= expr likeop expr ESCAPE expr */
135783 135771   {
135784 135772     ExprList *pList;
       135773  +  int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
       135774  +  yymsp[-3].minor.yy0.n &= 0x7fffffff;
135785 135775     pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
135786 135776     pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy190.pExpr);
135787 135777     pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);
135788         -  yymsp[-4].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy392.eOperator);
135789         -  exprNot(pParse, yymsp[-3].minor.yy392.bNot, &yymsp[-4].minor.yy190);
       135778  +  yymsp[-4].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0);
       135779  +  exprNot(pParse, bNot, &yymsp[-4].minor.yy190);
135790 135780     yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
135791 135781     if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc;
135792 135782   }
135793 135783           break;
135794         -      case 177: /* expr ::= expr ISNULL|NOTNULL */
       135784  +      case 178: /* expr ::= expr ISNULL|NOTNULL */
135795 135785   {spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);}
135796 135786           break;
135797         -      case 178: /* expr ::= expr NOT NULL */
       135787  +      case 179: /* expr ::= expr NOT NULL */
135798 135788   {spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);}
135799 135789           break;
135800         -      case 179: /* expr ::= expr IS expr */
       135790  +      case 180: /* expr ::= expr IS expr */
135801 135791   {
135802 135792     spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);
135803 135793     binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL);
135804 135794   }
135805 135795           break;
135806         -      case 180: /* expr ::= expr IS NOT expr */
       135796  +      case 181: /* expr ::= expr IS NOT expr */
135807 135797   {
135808 135798     spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190);
135809 135799     binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL);
135810 135800   }
135811 135801           break;
135812         -      case 181: /* expr ::= NOT expr */
135813         -      case 182: /* expr ::= BITNOT expr */ yytestcase(yyruleno==182);
       135802  +      case 182: /* expr ::= NOT expr */
       135803  +      case 183: /* expr ::= BITNOT expr */ yytestcase(yyruleno==183);
135814 135804   {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
135815 135805           break;
135816         -      case 183: /* expr ::= MINUS expr */
       135806  +      case 184: /* expr ::= MINUS expr */
135817 135807   {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
135818 135808           break;
135819         -      case 184: /* expr ::= PLUS expr */
       135809  +      case 185: /* expr ::= PLUS expr */
135820 135810   {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
135821 135811           break;
135822         -      case 185: /* between_op ::= BETWEEN */
135823         -      case 188: /* in_op ::= IN */ yytestcase(yyruleno==188);
       135812  +      case 186: /* between_op ::= BETWEEN */
       135813  +      case 189: /* in_op ::= IN */ yytestcase(yyruleno==189);
135824 135814   {yymsp[0].minor.yy194 = 0;}
135825 135815           break;
135826         -      case 187: /* expr ::= expr between_op expr AND expr */
       135816  +      case 188: /* expr ::= expr between_op expr AND expr */
135827 135817   {
135828 135818     ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
135829 135819     pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);
135830 135820     yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0, 0);
135831 135821     if( yymsp[-4].minor.yy190.pExpr ){
135832 135822       yymsp[-4].minor.yy190.pExpr->x.pList = pList;
135833 135823     }else{
135834 135824       sqlite3ExprListDelete(pParse->db, pList);
135835 135825     } 
135836 135826     exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
135837 135827     yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
135838 135828   }
135839 135829           break;
135840         -      case 190: /* expr ::= expr in_op LP exprlist RP */
       135830  +      case 191: /* expr ::= expr in_op LP exprlist RP */
135841 135831   {
135842 135832       if( yymsp[-1].minor.yy148==0 ){
135843 135833         /* Expressions of the form
135844 135834         **
135845 135835         **      expr1 IN ()
135846 135836         **      expr1 NOT IN ()
135847 135837         **
................................................................................
135886 135876           sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy148);
135887 135877         }
135888 135878         exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
135889 135879       }
135890 135880       yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
135891 135881     }
135892 135882           break;
135893         -      case 191: /* expr ::= LP select RP */
       135883  +      case 192: /* expr ::= LP select RP */
135894 135884   {
135895 135885       spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
135896 135886       yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
135897 135887       sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243);
135898 135888     }
135899 135889           break;
135900         -      case 192: /* expr ::= expr in_op LP select RP */
       135890  +      case 193: /* expr ::= expr in_op LP select RP */
135901 135891   {
135902 135892       yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0);
135903 135893       sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243);
135904 135894       exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
135905 135895       yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
135906 135896     }
135907 135897           break;
135908         -      case 193: /* expr ::= expr in_op nm dbnm paren_exprlist */
       135898  +      case 194: /* expr ::= expr in_op nm dbnm paren_exprlist */
135909 135899   {
135910 135900       SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
135911 135901       Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
135912 135902       if( yymsp[0].minor.yy148 )  sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148);
135913 135903       yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0);
135914 135904       sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect);
135915 135905       exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
135916 135906       yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n];
135917 135907     }
135918 135908           break;
135919         -      case 194: /* expr ::= EXISTS LP select RP */
       135909  +      case 195: /* expr ::= EXISTS LP select RP */
135920 135910   {
135921 135911       Expr *p;
135922 135912       spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
135923 135913       p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
135924 135914       sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243);
135925 135915     }
135926 135916           break;
135927         -      case 195: /* expr ::= CASE case_operand case_exprlist case_else END */
       135917  +      case 196: /* expr ::= CASE case_operand case_exprlist case_else END */
135928 135918   {
135929 135919     spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);  /*A-overwrites-C*/
135930 135920     yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0, 0);
135931 135921     if( yymsp[-4].minor.yy190.pExpr ){
135932 135922       yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148;
135933 135923       sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy190.pExpr);
135934 135924     }else{
135935 135925       sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148);
135936 135926       sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72);
135937 135927     }
135938 135928   }
135939 135929           break;
135940         -      case 196: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
       135930  +      case 197: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
135941 135931   {
135942 135932     yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr);
135943 135933     yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
135944 135934   }
135945 135935           break;
135946         -      case 197: /* case_exprlist ::= WHEN expr THEN expr */
       135936  +      case 198: /* case_exprlist ::= WHEN expr THEN expr */
135947 135937   {
135948 135938     yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
135949 135939     yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr);
135950 135940   }
135951 135941           break;
135952         -      case 200: /* case_operand ::= expr */
       135942  +      case 201: /* case_operand ::= expr */
135953 135943   {yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/}
135954 135944           break;
135955         -      case 203: /* nexprlist ::= nexprlist COMMA expr */
       135945  +      case 204: /* nexprlist ::= nexprlist COMMA expr */
135956 135946   {yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);}
135957 135947           break;
135958         -      case 204: /* nexprlist ::= expr */
       135948  +      case 205: /* nexprlist ::= expr */
135959 135949   {yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/}
135960 135950           break;
135961         -      case 206: /* paren_exprlist ::= LP exprlist RP */
135962         -      case 211: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==211);
       135951  +      case 207: /* paren_exprlist ::= LP exprlist RP */
       135952  +      case 212: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==212);
135963 135953   {yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;}
135964 135954           break;
135965         -      case 207: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
       135955  +      case 208: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
135966 135956   {
135967 135957     sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, 
135968 135958                        sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194,
135969 135959                         &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF);
135970 135960   }
135971 135961           break;
135972         -      case 208: /* uniqueflag ::= UNIQUE */
135973         -      case 249: /* raisetype ::= ABORT */ yytestcase(yyruleno==249);
       135962  +      case 209: /* uniqueflag ::= UNIQUE */
       135963  +      case 250: /* raisetype ::= ABORT */ yytestcase(yyruleno==250);
135974 135964   {yymsp[0].minor.yy194 = OE_Abort;}
135975 135965           break;
135976         -      case 209: /* uniqueflag ::= */
       135966  +      case 210: /* uniqueflag ::= */
135977 135967   {yymsp[1].minor.yy194 = OE_None;}
135978 135968           break;
135979         -      case 212: /* eidlist ::= eidlist COMMA nm collate sortorder */
       135969  +      case 213: /* eidlist ::= eidlist COMMA nm collate sortorder */
135980 135970   {
135981 135971     yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194);
135982 135972   }
135983 135973           break;
135984         -      case 213: /* eidlist ::= nm collate sortorder */
       135974  +      case 214: /* eidlist ::= nm collate sortorder */
135985 135975   {
135986 135976     yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/
135987 135977   }
135988 135978           break;
135989         -      case 216: /* cmd ::= DROP INDEX ifexists fullname */
       135979  +      case 217: /* cmd ::= DROP INDEX ifexists fullname */
135990 135980   {sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);}
135991 135981           break;
135992         -      case 217: /* cmd ::= VACUUM */
       135982  +      case 218: /* cmd ::= VACUUM */
135993 135983   {sqlite3Vacuum(pParse,0);}
135994 135984           break;
135995         -      case 218: /* cmd ::= VACUUM nm */
       135985  +      case 219: /* cmd ::= VACUUM nm */
135996 135986   {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
135997 135987           break;
135998         -      case 219: /* cmd ::= PRAGMA nm dbnm */
       135988  +      case 220: /* cmd ::= PRAGMA nm dbnm */
135999 135989   {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
136000 135990           break;
136001         -      case 220: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
       135991  +      case 221: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
136002 135992   {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
136003 135993           break;
136004         -      case 221: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
       135994  +      case 222: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
136005 135995   {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
136006 135996           break;
136007         -      case 222: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
       135997  +      case 223: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
136008 135998   {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
136009 135999           break;
136010         -      case 223: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
       136000  +      case 224: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
136011 136001   {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
136012 136002           break;
136013         -      case 226: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
       136003  +      case 227: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
136014 136004   {
136015 136005     Token all;
136016 136006     all.z = yymsp[-3].minor.yy0.z;
136017 136007     all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
136018 136008     sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all);
136019 136009   }
136020 136010           break;
136021         -      case 227: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
       136011  +      case 228: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
136022 136012   {
136023 136013     sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194);
136024 136014     yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
136025 136015   }
136026 136016           break;
136027         -      case 228: /* trigger_time ::= BEFORE */
       136017  +      case 229: /* trigger_time ::= BEFORE */
136028 136018   { yymsp[0].minor.yy194 = TK_BEFORE; }
136029 136019           break;
136030         -      case 229: /* trigger_time ::= AFTER */
       136020  +      case 230: /* trigger_time ::= AFTER */
136031 136021   { yymsp[0].minor.yy194 = TK_AFTER;  }
136032 136022           break;
136033         -      case 230: /* trigger_time ::= INSTEAD OF */
       136023  +      case 231: /* trigger_time ::= INSTEAD OF */
136034 136024   { yymsp[-1].minor.yy194 = TK_INSTEAD;}
136035 136025           break;
136036         -      case 231: /* trigger_time ::= */
       136026  +      case 232: /* trigger_time ::= */
136037 136027   { yymsp[1].minor.yy194 = TK_BEFORE; }
136038 136028           break;
136039         -      case 232: /* trigger_event ::= DELETE|INSERT */
136040         -      case 233: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==233);
       136029  +      case 233: /* trigger_event ::= DELETE|INSERT */
       136030  +      case 234: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==234);
136041 136031   {yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;}
136042 136032           break;
136043         -      case 234: /* trigger_event ::= UPDATE OF idlist */
       136033  +      case 235: /* trigger_event ::= UPDATE OF idlist */
136044 136034   {yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;}
136045 136035           break;
136046         -      case 235: /* when_clause ::= */
136047         -      case 254: /* key_opt ::= */ yytestcase(yyruleno==254);
       136036  +      case 236: /* when_clause ::= */
       136037  +      case 255: /* key_opt ::= */ yytestcase(yyruleno==255);
136048 136038   { yymsp[1].minor.yy72 = 0; }
136049 136039           break;
136050         -      case 236: /* when_clause ::= WHEN expr */
136051         -      case 255: /* key_opt ::= KEY expr */ yytestcase(yyruleno==255);
       136040  +      case 237: /* when_clause ::= WHEN expr */
       136041  +      case 256: /* key_opt ::= KEY expr */ yytestcase(yyruleno==256);
136052 136042   { yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; }
136053 136043           break;
136054         -      case 237: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
       136044  +      case 238: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
136055 136045   {
136056 136046     assert( yymsp[-2].minor.yy145!=0 );
136057 136047     yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145;
136058 136048     yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145;
136059 136049   }
136060 136050           break;
136061         -      case 238: /* trigger_cmd_list ::= trigger_cmd SEMI */
       136051  +      case 239: /* trigger_cmd_list ::= trigger_cmd SEMI */
136062 136052   { 
136063 136053     assert( yymsp[-1].minor.yy145!=0 );
136064 136054     yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145;
136065 136055   }
136066 136056           break;
136067         -      case 239: /* trnm ::= nm DOT nm */
       136057  +      case 240: /* trnm ::= nm DOT nm */
136068 136058   {
136069 136059     yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
136070 136060     sqlite3ErrorMsg(pParse, 
136071 136061           "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
136072 136062           "statements within triggers");
136073 136063   }
136074 136064           break;
136075         -      case 240: /* tridxby ::= INDEXED BY nm */
       136065  +      case 241: /* tridxby ::= INDEXED BY nm */
136076 136066   {
136077 136067     sqlite3ErrorMsg(pParse,
136078 136068           "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
136079 136069           "within triggers");
136080 136070   }
136081 136071           break;
136082         -      case 241: /* tridxby ::= NOT INDEXED */
       136072  +      case 242: /* tridxby ::= NOT INDEXED */
136083 136073   {
136084 136074     sqlite3ErrorMsg(pParse,
136085 136075           "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
136086 136076           "within triggers");
136087 136077   }
136088 136078           break;
136089         -      case 242: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
       136079  +      case 243: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
136090 136080   {yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);}
136091 136081           break;
136092         -      case 243: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
       136082  +      case 244: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
136093 136083   {yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/}
136094 136084           break;
136095         -      case 244: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
       136085  +      case 245: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
136096 136086   {yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);}
136097 136087           break;
136098         -      case 245: /* trigger_cmd ::= select */
       136088  +      case 246: /* trigger_cmd ::= select */
136099 136089   {yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/}
136100 136090           break;
136101         -      case 246: /* expr ::= RAISE LP IGNORE RP */
       136091  +      case 247: /* expr ::= RAISE LP IGNORE RP */
136102 136092   {
136103 136093     spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);  /*A-overwrites-X*/
136104 136094     yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); 
136105 136095     if( yymsp[-3].minor.yy190.pExpr ){
136106 136096       yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore;
136107 136097     }
136108 136098   }
136109 136099           break;
136110         -      case 247: /* expr ::= RAISE LP raisetype COMMA nm RP */
       136100  +      case 248: /* expr ::= RAISE LP raisetype COMMA nm RP */
136111 136101   {
136112 136102     spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);  /*A-overwrites-X*/
136113 136103     yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); 
136114 136104     if( yymsp[-5].minor.yy190.pExpr ) {
136115 136105       yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194;
136116 136106     }
136117 136107   }
136118 136108           break;
136119         -      case 248: /* raisetype ::= ROLLBACK */
       136109  +      case 249: /* raisetype ::= ROLLBACK */
136120 136110   {yymsp[0].minor.yy194 = OE_Rollback;}
136121 136111           break;
136122         -      case 250: /* raisetype ::= FAIL */
       136112  +      case 251: /* raisetype ::= FAIL */
136123 136113   {yymsp[0].minor.yy194 = OE_Fail;}
136124 136114           break;
136125         -      case 251: /* cmd ::= DROP TRIGGER ifexists fullname */
       136115  +      case 252: /* cmd ::= DROP TRIGGER ifexists fullname */
136126 136116   {
136127 136117     sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194);
136128 136118   }
136129 136119           break;
136130         -      case 252: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
       136120  +      case 253: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
136131 136121   {
136132 136122     sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72);
136133 136123   }
136134 136124           break;
136135         -      case 253: /* cmd ::= DETACH database_kw_opt expr */
       136125  +      case 254: /* cmd ::= DETACH database_kw_opt expr */
136136 136126   {
136137 136127     sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr);
136138 136128   }
136139 136129           break;
136140         -      case 256: /* cmd ::= REINDEX */
       136130  +      case 257: /* cmd ::= REINDEX */
136141 136131   {sqlite3Reindex(pParse, 0, 0);}
136142 136132           break;
136143         -      case 257: /* cmd ::= REINDEX nm dbnm */
       136133  +      case 258: /* cmd ::= REINDEX nm dbnm */
136144 136134   {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
136145 136135           break;
136146         -      case 258: /* cmd ::= ANALYZE */
       136136  +      case 259: /* cmd ::= ANALYZE */
136147 136137   {sqlite3Analyze(pParse, 0, 0);}
136148 136138           break;
136149         -      case 259: /* cmd ::= ANALYZE nm dbnm */
       136139  +      case 260: /* cmd ::= ANALYZE nm dbnm */
136150 136140   {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
136151 136141           break;
136152         -      case 260: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
       136142  +      case 261: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
136153 136143   {
136154 136144     sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0);
136155 136145   }
136156 136146           break;
136157         -      case 261: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
       136147  +      case 262: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
136158 136148   {
136159 136149     yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
136160 136150     sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
136161 136151   }
136162 136152           break;
136163         -      case 262: /* add_column_fullname ::= fullname */
       136153  +      case 263: /* add_column_fullname ::= fullname */
136164 136154   {
136165 136155     disableLookaside(pParse);
136166 136156     sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185);
136167 136157   }
136168 136158           break;
136169         -      case 263: /* cmd ::= create_vtab */
       136159  +      case 264: /* cmd ::= create_vtab */
136170 136160   {sqlite3VtabFinishParse(pParse,0);}
136171 136161           break;
136172         -      case 264: /* cmd ::= create_vtab LP vtabarglist RP */
       136162  +      case 265: /* cmd ::= create_vtab LP vtabarglist RP */
136173 136163   {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
136174 136164           break;
136175         -      case 265: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
       136165  +      case 266: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
136176 136166   {
136177 136167       sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194);
136178 136168   }
136179 136169           break;
136180         -      case 266: /* vtabarg ::= */
       136170  +      case 267: /* vtabarg ::= */
136181 136171   {sqlite3VtabArgInit(pParse);}
136182 136172           break;
136183         -      case 267: /* vtabargtoken ::= ANY */
136184         -      case 268: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==268);
136185         -      case 269: /* lp ::= LP */ yytestcase(yyruleno==269);
       136173  +      case 268: /* vtabargtoken ::= ANY */
       136174  +      case 269: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==269);
       136175  +      case 270: /* lp ::= LP */ yytestcase(yyruleno==270);
136186 136176   {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
136187 136177           break;
136188         -      case 270: /* with ::= */
       136178  +      case 271: /* with ::= */
136189 136179   {yymsp[1].minor.yy285 = 0;}
136190 136180           break;
136191         -      case 271: /* with ::= WITH wqlist */
       136181  +      case 272: /* with ::= WITH wqlist */
136192 136182   { yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; }
136193 136183           break;
136194         -      case 272: /* with ::= WITH RECURSIVE wqlist */
       136184  +      case 273: /* with ::= WITH RECURSIVE wqlist */
136195 136185   { yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; }
136196 136186           break;
136197         -      case 273: /* wqlist ::= nm eidlist_opt AS LP select RP */
       136187  +      case 274: /* wqlist ::= nm eidlist_opt AS LP select RP */
136198 136188   {
136199 136189     yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/
136200 136190   }
136201 136191           break;
136202         -      case 274: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
       136192  +      case 275: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
136203 136193   {
136204 136194     yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243);
136205 136195   }
136206 136196           break;
136207 136197         default:
136208         -      /* (275) input ::= cmdlist */ yytestcase(yyruleno==275);
136209         -      /* (276) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==276);
136210         -      /* (277) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=277);
136211         -      /* (278) ecmd ::= SEMI */ yytestcase(yyruleno==278);
136212         -      /* (279) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==279);
136213         -      /* (280) explain ::= */ yytestcase(yyruleno==280);
136214         -      /* (281) trans_opt ::= */ yytestcase(yyruleno==281);
136215         -      /* (282) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==282);
136216         -      /* (283) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==283);
136217         -      /* (284) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==284);
136218         -      /* (285) savepoint_opt ::= */ yytestcase(yyruleno==285);
136219         -      /* (286) cmd ::= create_table create_table_args */ yytestcase(yyruleno==286);
136220         -      /* (287) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==287);
136221         -      /* (288) columnlist ::= columnname carglist */ yytestcase(yyruleno==288);
136222         -      /* (289) nm ::= ID|INDEXED */ yytestcase(yyruleno==289);
136223         -      /* (290) nm ::= STRING */ yytestcase(yyruleno==290);
136224         -      /* (291) nm ::= JOIN_KW */ yytestcase(yyruleno==291);
136225         -      /* (292) typetoken ::= typename */ yytestcase(yyruleno==292);
136226         -      /* (293) typename ::= ID|STRING */ yytestcase(yyruleno==293);
136227         -      /* (294) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=294);
136228         -      /* (295) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);
136229         -      /* (296) carglist ::= carglist ccons */ yytestcase(yyruleno==296);
136230         -      /* (297) carglist ::= */ yytestcase(yyruleno==297);
136231         -      /* (298) ccons ::= NULL onconf */ yytestcase(yyruleno==298);
136232         -      /* (299) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==299);
136233         -      /* (300) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==300);
136234         -      /* (301) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=301);
136235         -      /* (302) tconscomma ::= */ yytestcase(yyruleno==302);
136236         -      /* (303) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=303);
136237         -      /* (304) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=304);
136238         -      /* (305) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=305);
136239         -      /* (306) oneselect ::= values */ yytestcase(yyruleno==306);
136240         -      /* (307) sclp ::= selcollist COMMA */ yytestcase(yyruleno==307);
136241         -      /* (308) as ::= ID|STRING */ yytestcase(yyruleno==308);
136242         -      /* (309) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=309);
136243         -      /* (310) exprlist ::= nexprlist */ yytestcase(yyruleno==310);
136244         -      /* (311) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=311);
136245         -      /* (312) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=312);
136246         -      /* (313) nmnum ::= ON */ yytestcase(yyruleno==313);
136247         -      /* (314) nmnum ::= DELETE */ yytestcase(yyruleno==314);
136248         -      /* (315) nmnum ::= DEFAULT */ yytestcase(yyruleno==315);
136249         -      /* (316) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==316);
136250         -      /* (317) foreach_clause ::= */ yytestcase(yyruleno==317);
136251         -      /* (318) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==318);
136252         -      /* (319) trnm ::= nm */ yytestcase(yyruleno==319);
136253         -      /* (320) tridxby ::= */ yytestcase(yyruleno==320);
136254         -      /* (321) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==321);
136255         -      /* (322) database_kw_opt ::= */ yytestcase(yyruleno==322);
136256         -      /* (323) kwcolumn_opt ::= */ yytestcase(yyruleno==323);
136257         -      /* (324) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==324);
136258         -      /* (325) vtabarglist ::= vtabarg */ yytestcase(yyruleno==325);
136259         -      /* (326) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==326);
136260         -      /* (327) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==327);
136261         -      /* (328) anylist ::= */ yytestcase(yyruleno==328);
136262         -      /* (329) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==329);
136263         -      /* (330) anylist ::= anylist ANY */ yytestcase(yyruleno==330);
       136198  +      /* (276) input ::= cmdlist */ yytestcase(yyruleno==276);
       136199  +      /* (277) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==277);
       136200  +      /* (278) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=278);
       136201  +      /* (279) ecmd ::= SEMI */ yytestcase(yyruleno==279);
       136202  +      /* (280) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==280);
       136203  +      /* (281) explain ::= */ yytestcase(yyruleno==281);
       136204  +      /* (282) trans_opt ::= */ yytestcase(yyruleno==282);
       136205  +      /* (283) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==283);
       136206  +      /* (284) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==284);
       136207  +      /* (285) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==285);
       136208  +      /* (286) savepoint_opt ::= */ yytestcase(yyruleno==286);
       136209  +      /* (287) cmd ::= create_table create_table_args */ yytestcase(yyruleno==287);
       136210  +      /* (288) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==288);
       136211  +      /* (289) columnlist ::= columnname carglist */ yytestcase(yyruleno==289);
       136212  +      /* (290) nm ::= ID|INDEXED */ yytestcase(yyruleno==290);
       136213  +      /* (291) nm ::= STRING */ yytestcase(yyruleno==291);
       136214  +      /* (292) nm ::= JOIN_KW */ yytestcase(yyruleno==292);
       136215  +      /* (293) typetoken ::= typename */ yytestcase(yyruleno==293);
       136216  +      /* (294) typename ::= ID|STRING */ yytestcase(yyruleno==294);
       136217  +      /* (295) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);
       136218  +      /* (296) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=296);
       136219  +      /* (297) carglist ::= carglist ccons */ yytestcase(yyruleno==297);
       136220  +      /* (298) carglist ::= */ yytestcase(yyruleno==298);
       136221  +      /* (299) ccons ::= NULL onconf */ yytestcase(yyruleno==299);
       136222  +      /* (300) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==300);
       136223  +      /* (301) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==301);
       136224  +      /* (302) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=302);
       136225  +      /* (303) tconscomma ::= */ yytestcase(yyruleno==303);
       136226  +      /* (304) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=304);
       136227  +      /* (305) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=305);
       136228  +      /* (306) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=306);
       136229  +      /* (307) oneselect ::= values */ yytestcase(yyruleno==307);
       136230  +      /* (308) sclp ::= selcollist COMMA */ yytestcase(yyruleno==308);
       136231  +      /* (309) as ::= ID|STRING */ yytestcase(yyruleno==309);
       136232  +      /* (310) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=310);
       136233  +      /* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311);
       136234  +      /* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312);
       136235  +      /* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313);
       136236  +      /* (314) nmnum ::= ON */ yytestcase(yyruleno==314);
       136237  +      /* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315);
       136238  +      /* (316) nmnum ::= DEFAULT */ yytestcase(yyruleno==316);
       136239  +      /* (317) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==317);
       136240  +      /* (318) foreach_clause ::= */ yytestcase(yyruleno==318);
       136241  +      /* (319) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==319);
       136242  +      /* (320) trnm ::= nm */ yytestcase(yyruleno==320);
       136243  +      /* (321) tridxby ::= */ yytestcase(yyruleno==321);
       136244  +      /* (322) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==322);
       136245  +      /* (323) database_kw_opt ::= */ yytestcase(yyruleno==323);
       136246  +      /* (324) kwcolumn_opt ::= */ yytestcase(yyruleno==324);
       136247  +      /* (325) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==325);
       136248  +      /* (326) vtabarglist ::= vtabarg */ yytestcase(yyruleno==326);
       136249  +      /* (327) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==327);
       136250  +      /* (328) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==328);
       136251  +      /* (329) anylist ::= */ yytestcase(yyruleno==329);
       136252  +      /* (330) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==330);
       136253  +      /* (331) anylist ::= anylist ANY */ yytestcase(yyruleno==331);
136264 136254           break;
136265 136255   /********** End reduce actions ************************************************/
136266 136256     };
136267 136257     assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
136268 136258     yygoto = yyRuleInfo[yyruleno].lhs;
136269 136259     yysize = yyRuleInfo[yyruleno].nrhs;
136270 136260     yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
................................................................................
136447 136437             fprintf(yyTraceFILE,"%sDiscard input token %s\n",
136448 136438                yyTracePrompt,yyTokenName[yymajor]);
136449 136439           }
136450 136440   #endif
136451 136441           yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
136452 136442           yymajor = YYNOCODE;
136453 136443         }else{
136454         -        while( yypParser->yytos >= &yypParser->yystack
       136444  +        while( yypParser->yytos >= yypParser->yystack
136455 136445               && yymx != YYERRORSYMBOL
136456 136446               && (yyact = yy_find_reduce_action(
136457 136447                           yypParser->yytos->stateno,
136458 136448                           YYERRORSYMBOL)) >= YY_MIN_REDUCE
136459 136449           ){
136460 136450             yy_pop_parser_stack(yypParser);
136461 136451           }
................................................................................
181138 181128             fprintf(fts5yyTraceFILE,"%sDiscard input token %s\n",
181139 181129                fts5yyTracePrompt,fts5yyTokenName[fts5yymajor]);
181140 181130           }
181141 181131   #endif
181142 181132           fts5yy_destructor(fts5yypParser, (fts5YYCODETYPE)fts5yymajor, &fts5yyminorunion);
181143 181133           fts5yymajor = fts5YYNOCODE;
181144 181134         }else{
181145         -        while( fts5yypParser->fts5yytos >= &fts5yypParser->fts5yystack
       181135  +        while( fts5yypParser->fts5yytos >= fts5yypParser->fts5yystack
181146 181136               && fts5yymx != fts5YYERRORSYMBOL
181147 181137               && (fts5yyact = fts5yy_find_reduce_action(
181148 181138                           fts5yypParser->fts5yytos->stateno,
181149 181139                           fts5YYERRORSYMBOL)) >= fts5YY_MIN_REDUCE
181150 181140           ){
181151 181141             fts5yy_pop_parser_stack(fts5yypParser);
181152 181142           }
................................................................................
195595 195585   static void fts5SourceIdFunc(
195596 195586     sqlite3_context *pCtx,          /* Function call context */
195597 195587     int nArg,                       /* Number of args */
195598 195588     sqlite3_value **apUnused        /* Function arguments */
195599 195589   ){
195600 195590     assert( nArg==0 );
195601 195591     UNUSED_PARAM2(nArg, apUnused);
195602         -  sqlite3_result_text(pCtx, "fts5: 2016-09-21 19:43:34 0741812d7fcd558479e4849fbb3ba8d03738d018", -1, SQLITE_TRANSIENT);
       195592  +  sqlite3_result_text(pCtx, "fts5: 2016-10-04 00:47:26 b10d0f939c82c4de3faa90b86de9ec4a89992856", -1, SQLITE_TRANSIENT);
195603 195593   }
195604 195594   
195605 195595   static int fts5Init(sqlite3 *db){
195606 195596     static const sqlite3_module fts5Mod = {
195607 195597       /* iVersion      */ 2,
195608 195598       /* xCreate       */ fts5CreateMethod,
195609 195599       /* xConnect      */ fts5ConnectMethod,

Changes to src/sqlite3.h.

   119    119   **
   120    120   ** See also: [sqlite3_libversion()],
   121    121   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
   122    122   ** [sqlite_version()] and [sqlite_source_id()].
   123    123   */
   124    124   #define SQLITE_VERSION        "3.15.0"
   125    125   #define SQLITE_VERSION_NUMBER 3015000
   126         -#define SQLITE_SOURCE_ID      "2016-09-22 18:53:13 c3774c6a5fe48af91fda28e9e18c6ed9053ea992"
          126  +#define SQLITE_SOURCE_ID      "2016-10-04 12:20:12 3a9d802fda10585654332b314d317250dc5d894e"
   127    127   
   128    128   /*
   129    129   ** CAPI3REF: Run-Time Library Version Numbers
   130    130   ** KEYWORDS: sqlite3_version, sqlite3_sourceid
   131    131   **
   132    132   ** These interfaces provide the same information as the [SQLITE_VERSION],
   133    133   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
  8653   8653     const char *zTab                /* Table name */
  8654   8654   );
  8655   8655   
  8656   8656   /*
  8657   8657   ** CAPI3REF: Set a table filter on a Session Object.
  8658   8658   **
  8659   8659   ** The second argument (xFilter) is the "filter callback". For changes to rows 
  8660         -** in tables that are not attached to the Session oject, the filter is called
         8660  +** in tables that are not attached to the Session object, the filter is called
  8661   8661   ** to determine whether changes to the table's rows should be tracked or not. 
  8662   8662   ** If xFilter returns 0, changes is not tracked. Note that once a table is 
  8663   8663   ** attached, xFilter will not be called again.
  8664   8664   */
  8665   8665   void sqlite3session_table_filter(
  8666   8666     sqlite3_session *pSession,      /* Session object */
  8667   8667     int(*xFilter)(
................................................................................
  8919   8919   ** destroyed.
  8920   8920   **
  8921   8921   ** Assuming the changeset blob was created by one of the
  8922   8922   ** [sqlite3session_changeset()], [sqlite3changeset_concat()] or
  8923   8923   ** [sqlite3changeset_invert()] functions, all changes within the changeset 
  8924   8924   ** that apply to a single table are grouped together. This means that when 
  8925   8925   ** an application iterates through a changeset using an iterator created by 
  8926         -** this function, all changes that relate to a single table are visted 
         8926  +** this function, all changes that relate to a single table are visited 
  8927   8927   ** consecutively. There is no chance that the iterator will visit a change 
  8928   8928   ** the applies to table X, then one for table Y, and then later on visit 
  8929   8929   ** another change for table X.
  8930   8930   */
  8931   8931   int sqlite3changeset_start(
  8932   8932     sqlite3_changeset_iter **pp,    /* OUT: New changeset iterator handle */
  8933   8933     int nChangeset,                 /* Size of changeset blob in bytes */
................................................................................
  9006   9006   ** This function is used to find which columns comprise the PRIMARY KEY of
  9007   9007   ** the table modified by the change that iterator pIter currently points to.
  9008   9008   ** If successful, *pabPK is set to point to an array of nCol entries, where
  9009   9009   ** nCol is the number of columns in the table. Elements of *pabPK are set to
  9010   9010   ** 0x01 if the corresponding column is part of the tables primary key, or
  9011   9011   ** 0x00 if it is not.
  9012   9012   **
  9013         -** If argumet pnCol is not NULL, then *pnCol is set to the number of columns
         9013  +** If argument pnCol is not NULL, then *pnCol is set to the number of columns
  9014   9014   ** in the table.
  9015   9015   **
  9016   9016   ** If this function is called when the iterator does not point to a valid
  9017   9017   ** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
  9018   9018   ** SQLITE_OK is returned and the output variables populated as described
  9019   9019   ** above.
  9020   9020   */
................................................................................
  9281   9281   ** to the changegroup.
  9282   9282   **
  9283   9283   ** Rows within the changeset and changegroup are identified by the values in
  9284   9284   ** their PRIMARY KEY columns. A change in the changeset is considered to
  9285   9285   ** apply to the same row as a change already present in the changegroup if
  9286   9286   ** the two rows have the same primary key.
  9287   9287   **
  9288         -** Changes to rows that that do not already appear in the changegroup are
         9288  +** Changes to rows that do not already appear in the changegroup are
  9289   9289   ** simply copied into it. Or, if both the new changeset and the changegroup
  9290   9290   ** contain changes that apply to a single row, the final contents of the
  9291   9291   ** changegroup depends on the type of each change, as follows:
  9292   9292   **
  9293   9293   ** <table border=1 style="margin-left:8ex;margin-right:8ex">
  9294   9294   **   <tr><th style="white-space:pre">Existing Change  </th>
  9295   9295   **       <th style="white-space:pre">New Change       </th>

Changes to src/stat.c.

   420    420     style_header("Repository Table Sizes");
   421    421     style_adunit_config(ADUNIT_RIGHT_OK);
   422    422     style_submenu_element("Stat", "Repository Stats", "stat");
   423    423     if( g.perm.Admin ){
   424    424       style_submenu_element("Schema", "Repository Schema", "repo_schema");
   425    425     }
   426    426     db_multi_exec(
   427         -    "CREATE VIRTUAL TABLE temp.dbx USING dbstat(repository);"
   428    427       "CREATE TEMP TABLE trans(name TEXT PRIMARY KEY,tabname TEXT)WITHOUT ROWID;"
   429    428       "INSERT INTO trans(name,tabname)"
   430    429       "   SELECT name, tbl_name FROM repository.sqlite_master;"
   431    430       "CREATE TEMP TABLE piechart(amt REAL, label TEXT);"
   432    431       "INSERT INTO piechart(amt,label)"
   433    432       "  SELECT count(*), "
   434         -    "    coalesce((SELECT tabname FROM trans WHERE trans.name=dbx.name),name)"
   435         -    "    FROM dbx"
          433  +    "  coalesce((SELECT tabname FROM trans WHERE trans.name=dbstat.name),name)"
          434  +    "    FROM dbstat('repository')"
   436    435       "   GROUP BY 2 ORDER BY 2;"
   437    436     );
   438    437     nPageFree = db_int(0, "PRAGMA repository.freelist_count");
   439    438     if( nPageFree>0 ){
   440    439       db_multi_exec(
   441    440         "INSERT INTO piechart(amt,label) VALUES(%d,'freelist')",
   442    441         nPageFree
................................................................................
   447    446     @ <h2>Repository Size: %s(zBuf)</h2>
   448    447     @ <center><svg width='800' height='500'>
   449    448     piechart_render(800,500,PIE_OTHER|PIE_PERCENT);
   450    449     @ </svg></center>
   451    450   
   452    451     if( g.localOpen ){
   453    452       db_multi_exec(
   454         -      "DROP TABLE temp.dbx;"
   455         -      "CREATE VIRTUAL TABLE temp.dbx USING dbstat(localdb);"
   456    453         "DELETE FROM trans;"
   457    454         "INSERT INTO trans(name,tabname)"
   458    455         "   SELECT name, tbl_name FROM localdb.sqlite_master;"
   459    456         "DELETE FROM piechart;"
   460    457         "INSERT INTO piechart(amt,label)"
   461    458         "  SELECT count(*), "
   462         -      "    coalesce((SELECT tabname FROM trans WHERE trans.name=dbx.name),name)"
   463         -      "    FROM dbx"
          459  +      " coalesce((SELECT tabname FROM trans WHERE trans.name=dbstat.name),name)"
          460  +      "    FROM dbstat('localdb')"
   464    461         "   GROUP BY 2 ORDER BY 2;"
   465    462       );
   466    463       nPageFree = db_int(0, "PRAGMA localdb.freelist_count");
   467    464       if( nPageFree>0 ){
   468    465         db_multi_exec(
   469    466           "INSERT INTO piechart(amt,label) VALUES(%d,'freelist')",
   470    467           nPageFree

Changes to src/tag.c.

   357    357       fossil_print("%s", blob_str(&ctrl));
   358    358       blob_reset(&ctrl);
   359    359     }else{
   360    360       nrid = content_put(&ctrl);
   361    361       manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS);
   362    362     }
   363    363     assert( blob_is_reset(&ctrl) );
          364  +  manifest_to_disk(rid);
   364    365   }
   365    366   
   366    367   /*
   367    368   ** COMMAND: tag
   368    369   **
   369    370   ** Usage: %fossil tag SUBCOMMAND ...
   370    371   **

Changes to src/tar.c.

   473    473     Glob *pExclude       /* Exclude files matching this pattern */
   474    474   ){
   475    475     Blob mfile, hash, file;
   476    476     Manifest *pManifest;
   477    477     ManifestFile *pFile;
   478    478     Blob filename;
   479    479     int nPrefix;
   480         -  char *zName;
          480  +  char *zName = 0;
   481    481     unsigned int mTime;
   482    482   
   483    483     content_get(rid, &mfile);
   484    484     if( blob_size(&mfile)==0 ){
   485    485       blob_zero(pTar);
   486    486       return;
   487    487     }
................................................................................
   491    491     if( zDir && zDir[0] ){
   492    492       blob_appendf(&filename, "%s/", zDir);
   493    493     }
   494    494     nPrefix = blob_size(&filename);
   495    495   
   496    496     pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
   497    497     if( pManifest ){
          498  +    int flg, eflg = 0;
   498    499       mTime = (pManifest->rDate - 2440587.5)*86400.0;
   499    500       tar_begin(mTime);
   500         -    if( (pInclude==0 || glob_match(pInclude, "manifest"))
   501         -     && !glob_match(pExclude, "manifest")
   502         -     && db_get_boolean("manifest", 0)
   503         -    ){
   504         -      blob_append(&filename, "manifest", -1);
   505         -      zName = blob_str(&filename);
   506         -      sha1sum_blob(&mfile, &hash);
   507         -      sterilize_manifest(&mfile);
   508         -      tar_add_file(zName, &mfile, 0, mTime);
          501  +    flg = db_get_manifest_setting();
          502  +    if( flg ){
          503  +      /* eflg is the effective flags, taking include/exclude into account */
          504  +      if( (pInclude==0 || glob_match(pInclude, "manifest"))
          505  +       && !glob_match(pExclude, "manifest")
          506  +       && (flg & MFESTFLG_RAW) ){
          507  +        eflg |= MFESTFLG_RAW;
          508  +      }
          509  +      if( (pInclude==0 || glob_match(pInclude, "manifest.uuid"))
          510  +       && !glob_match(pExclude, "manifest.uuid")
          511  +       && (flg & MFESTFLG_UUID) ){
          512  +        eflg |= MFESTFLG_UUID;
          513  +      }
          514  +      if( (pInclude==0 || glob_match(pInclude, "manifest.tags"))
          515  +       && !glob_match(pExclude, "manifest.tags")
          516  +       && (flg & MFESTFLG_TAGS) ){
          517  +        eflg |= MFESTFLG_TAGS;
          518  +      }
          519  +
          520  +      if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
          521  +        if( eflg & MFESTFLG_RAW ){
          522  +          blob_append(&filename, "manifest", -1);
          523  +          zName = blob_str(&filename);
          524  +        }
          525  +        if( eflg & MFESTFLG_UUID ){
          526  +          sha1sum_blob(&mfile, &hash);
          527  +        }
          528  +        if( eflg & MFESTFLG_RAW ) {
          529  +          sterilize_manifest(&mfile);
          530  +          tar_add_file(zName, &mfile, 0, mTime);
          531  +        }
          532  +      }
   509    533         blob_reset(&mfile);
   510         -      blob_append(&hash, "\n", 1);
   511         -      blob_resize(&filename, nPrefix);
   512         -      blob_append(&filename, "manifest.uuid", -1);
   513         -      zName = blob_str(&filename);
   514         -      tar_add_file(zName, &hash, 0, mTime);
   515         -      blob_reset(&hash);
          534  +      if( eflg & MFESTFLG_UUID ){
          535  +        blob_append(&hash, "\n", 1);
          536  +        blob_resize(&filename, nPrefix);
          537  +        blob_append(&filename, "manifest.uuid", -1);
          538  +        zName = blob_str(&filename);
          539  +        tar_add_file(zName, &hash, 0, mTime);
          540  +        blob_reset(&hash);
          541  +      }
          542  +      if( eflg & MFESTFLG_TAGS ){
          543  +        Blob tagslist;
          544  +        blob_zero(&tagslist);
          545  +        get_checkin_taglist(rid, &tagslist);
          546  +        blob_resize(&filename, nPrefix);
          547  +        blob_append(&filename, "manifest.tags", -1);
          548  +        zName = blob_str(&filename);
          549  +        tar_add_file(zName, &tagslist, 0, mTime);
          550  +        blob_reset(&tagslist);
          551  +      }
   516    552       }
   517    553       manifest_file_rewind(pManifest);
   518    554       while( (pFile = manifest_file_next(pManifest,0))!=0 ){
   519    555         int fid;
   520    556         if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue;
   521    557         if( glob_match(pExclude, pFile->zName) ) continue;
   522    558         fid = uuid_to_rid(pFile->zUuid, 0);

Changes to src/timeline.c.

    24     24   #include "timeline.h"
    25     25   
    26     26   /*
    27     27   ** The value of one second in julianday notation
    28     28   */
    29     29   #define ONE_SECOND (1.0/86400.0)
    30     30   
           31  +/*
           32  +** timeline mode options
           33  +*/
           34  +#define TIMELINE_MODE_NONE      0
           35  +#define TIMELINE_MODE_BEFORE    1
           36  +#define TIMELINE_MODE_AFTER     2
           37  +#define TIMELINE_MODE_CHILDREN  3
           38  +#define TIMELINE_MODE_PARENTS   4
           39  +
    31     40   /*
    32     41   ** Add an appropriate tag to the output if "rid" is unpublished (private)
    33     42   */
    34     43   #define UNPUB_TAG "<em>(unpublished)</em>"
    35     44   void tag_private_status(int rid){
    36     45     if( content_is_private(rid) ){
    37     46       cgi_printf("%s", UNPUB_TAG);
................................................................................
  2027   2036   static int isIsoDate(const char *z){
  2028   2037     return strlen(z)==10
  2029   2038         && z[4]=='-'
  2030   2039         && z[7]=='-'
  2031   2040         && fossil_isdigit(z[0])
  2032   2041         && fossil_isdigit(z[5]);
  2033   2042   }
         2043  +
         2044  +/*
         2045  +** Return true if the input string can be converted to a julianday.
         2046  +*/
         2047  +static int fossil_is_julianday(const char *zDate){
         2048  +  return db_int(0, "SELECT EXISTS (SELECT julianday(%Q) AS jd WHERE jd IS NOT NULL)", zDate);
         2049  +}
  2034   2050   
  2035   2051   /*
  2036   2052   ** COMMAND: timeline
  2037   2053   **
  2038   2054   ** Usage: %fossil timeline ?WHEN? ?CHECKIN|DATETIME? ?OPTIONS?
  2039   2055   **
  2040   2056   ** Print a summary of activity going backwards in date and time
................................................................................
  2085   2101     const char *zOffset;
  2086   2102     const char *zType;
  2087   2103     char *zOrigin;
  2088   2104     char *zDate;
  2089   2105     Blob sql;
  2090   2106     int objid = 0;
  2091   2107     Blob uuid;
  2092         -  int mode = 0 ;       /* 0:none  1: before  2:after  3:children  4:parents */
         2108  +  int mode = TIMELINE_MODE_NONE;
  2093   2109     int verboseFlag = 0 ;
  2094   2110     int iOffset;
  2095   2111     const char *zFilePattern = 0;
  2096   2112     Blob treeName;
  2097   2113   
  2098   2114     verboseFlag = find_option("verbose","v", 0)!=0;
  2099   2115     if( !verboseFlag){
................................................................................
  2126   2142   
  2127   2143     /* We should be done with options.. */
  2128   2144     verify_all_options();
  2129   2145   
  2130   2146     if( g.argc>=4 ){
  2131   2147       k = strlen(g.argv[2]);
  2132   2148       if( strncmp(g.argv[2],"before",k)==0 ){
  2133         -      mode = 1;
         2149  +      mode = TIMELINE_MODE_BEFORE;
  2134   2150       }else if( strncmp(g.argv[2],"after",k)==0 && k>1 ){
  2135         -      mode = 2;
         2151  +      mode = TIMELINE_MODE_AFTER;
  2136   2152       }else if( strncmp(g.argv[2],"descendants",k)==0 ){
  2137         -      mode = 3;
         2153  +      mode = TIMELINE_MODE_CHILDREN;
  2138   2154       }else if( strncmp(g.argv[2],"children",k)==0 ){
  2139         -      mode = 3;
         2155  +      mode = TIMELINE_MODE_CHILDREN;
  2140   2156       }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
  2141         -      mode = 4;
         2157  +      mode = TIMELINE_MODE_PARENTS;
  2142   2158       }else if( strncmp(g.argv[2],"parents",k)==0 ){
  2143         -      mode = 4;
         2159  +      mode = TIMELINE_MODE_PARENTS;
  2144   2160       }else if(!zType && !zLimit){
  2145   2161         usage("?WHEN? ?CHECKIN|DATETIME? ?-n|--limit #? ?-t|--type TYPE? "
  2146   2162               "?-W|--width WIDTH? ?-p|--path PATH");
  2147   2163       }
  2148   2164       if( '-' != *g.argv[3] ){
  2149   2165         zOrigin = g.argv[3];
  2150   2166       }else{
................................................................................
  2155   2171     }else{
  2156   2172       zOrigin = "now";
  2157   2173     }
  2158   2174     k = strlen(zOrigin);
  2159   2175     blob_zero(&uuid);
  2160   2176     blob_append(&uuid, zOrigin, -1);
  2161   2177     if( fossil_strcmp(zOrigin, "now")==0 ){
  2162         -    if( mode==3 || mode==4 ){
         2178  +    if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){
  2163   2179         fossil_fatal("cannot compute descendants or ancestors of a date");
  2164   2180       }
  2165   2181       zDate = mprintf("(SELECT datetime('now'))");
  2166   2182     }else if( strncmp(zOrigin, "current", k)==0 ){
  2167   2183       if( !g.localOpen ){
  2168   2184         fossil_fatal("must be within a local checkout to use 'current'");
  2169   2185       }
  2170   2186       objid = db_lget_int("checkout",0);
  2171   2187       zDate = mprintf("(SELECT mtime FROM plink WHERE cid=%d)", objid);
  2172   2188     }else if( name_to_uuid(&uuid, 0, "*")==0 ){
  2173   2189       objid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
  2174   2190       zDate = mprintf("(SELECT mtime FROM event WHERE objid=%d)", objid);
  2175         -  }else{
         2191  +  }else if( fossil_is_julianday(zOrigin) ){
  2176   2192       const char *zShift = "";
  2177         -    if( mode==3 || mode==4 ){
         2193  +    if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){
  2178   2194         fossil_fatal("cannot compute descendants or ancestors of a date");
  2179   2195       }
  2180         -    if( mode==0 ){
         2196  +    if( mode==TIMELINE_MODE_NONE ){
  2181   2197         if( isIsoDate(zOrigin) ) zShift = ",'+1 day'";
  2182   2198       }
  2183   2199       zDate = mprintf("(SELECT julianday(%Q%s, fromLocal()))", zOrigin, zShift);
         2200  +  }else{
         2201  +    fossil_fatal("unknown check-in or invalid date: %s", zOrigin);
  2184   2202     }
  2185   2203   
  2186   2204     if( zFilePattern ){
  2187   2205       if( zType==0 ){
  2188   2206         /* When zFilePattern is specified and type is not specified, only show
  2189   2207          * file check-ins */
  2190   2208         zType="ci";
................................................................................
  2193   2211       if( fossil_strcmp(blob_str(&treeName), ".")==0 ){
  2194   2212         /* When zTreeName refers to g.zLocalRoot, it's like not specifying
  2195   2213          * zFilePattern. */
  2196   2214         zFilePattern = 0;
  2197   2215       }
  2198   2216     }
  2199   2217   
  2200         -  if( mode==0 ) mode = 1;
         2218  +  if( mode==TIMELINE_MODE_NONE ) mode = TIMELINE_MODE_BEFORE;
  2201   2219     blob_zero(&sql);
  2202   2220     blob_append(&sql, timeline_query_for_tty(), -1);
  2203   2221     blob_append_sql(&sql, "\n  AND event.mtime %s %s",
  2204         -     (mode==1 || mode==4) ? "<=" : ">=",
  2205         -     zDate /*safe-for-%s*/
         2222  +     ( mode==TIMELINE_MODE_BEFORE ||
         2223  +       mode==TIMELINE_MODE_PARENTS ) ? "<=" : ">=", zDate /*safe-for-%s*/
  2206   2224     );
  2207   2225   
  2208         -  if( mode==3 || mode==4 ){
         2226  +  if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){
  2209   2227       db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
  2210         -    if( mode==3 ){
         2228  +    if( mode==TIMELINE_MODE_CHILDREN ){
  2211   2229         compute_descendants(objid, n);
  2212   2230       }else{
  2213   2231         compute_ancestors(objid, n, 0);
  2214   2232       }
  2215   2233       blob_append_sql(&sql, "\n  AND blob.rid IN ok");
  2216   2234     }
  2217   2235     if( zType && (zType[0]!='a') ){

Changes to src/undo.c.

   475    475     undo_available = db_lget_int("undo_available", 0);
   476    476     if( dryRunFlag ){
   477    477       if( undo_available==0 ){
   478    478         fossil_print("No undo or redo is available\n");
   479    479       }else{
   480    480         Stmt q;
   481    481         int nChng = 0;
          482  +      const char *zArticle = undo_available==1 ? "An" : "A";
   482    483         zCmd = undo_available==1 ? "undo" : "redo";
   483         -      fossil_print("A %s is available for the following command:\n\n"
          484  +      fossil_print("%s %s is available for the following command:\n\n"
   484    485                      "   %s %s\n\n",
   485         -                   zCmd, g.argv[0], db_lget("undo_cmdline", "???"));
          486  +                   zArticle, zCmd, g.argv[0], db_lget("undo_cmdline", "???"));
   486    487         db_prepare(&q,
   487    488           "SELECT existsflag, pathname FROM undo ORDER BY pathname"
   488    489         );
   489    490         while( db_step(&q)==SQLITE_ROW ){
   490    491           if( nChng==0 ){
   491    492             fossil_print("The following file changes would occur if the "
   492    493                          "command above is %sne:\n\n", zCmd);

Changes to src/vfile.c.

   262    262             file_set_mtime(zName, desiredMtime);
   263    263             currentMtime = file_wd_mtime(zName);
   264    264           }
   265    265         }
   266    266       }
   267    267   #ifndef _WIN32
   268    268       if( chnged==0 || chnged==6 || chnged==7 || chnged==8 || chnged==9 ){
   269         -      if( origPerm == currentPerm ){
          269  +      if( origPerm==currentPerm ){
   270    270           chnged = 0;
   271         -      }else if( currentPerm == PERM_EXE ){
          271  +      }else if( currentPerm==PERM_EXE ){
   272    272           chnged = 6;
   273         -      }else if( currentPerm == PERM_LNK ){
          273  +      }else if( currentPerm==PERM_LNK ){
   274    274           chnged = 7;
   275         -      }else if( origPerm == PERM_EXE ){
          275  +      }else if( origPerm==PERM_EXE ){
   276    276           chnged = 8;
   277         -      }else if( origPerm == PERM_LNK ){
          277  +      }else if( origPerm==PERM_LNK ){
   278    278           chnged = 9;
   279    279         }
   280    280       }
   281    281   #endif
   282    282       if( currentMtime!=oldMtime || chnged!=oldChnged ){
   283    283         db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d",
   284    284                       currentMtime, chnged, id);
................................................................................
   346    346           promptFlag = 0;
   347    347         } else if( cReply!='y' && cReply!='Y' ){
   348    348           blob_reset(&content);
   349    349           continue;
   350    350         }
   351    351       }
   352    352       if( verbose ) fossil_print("%s\n", &zName[nRepos]);
   353         -    if( file_wd_isdir(zName) == 1 ){
          353  +    if( file_wd_isdir(zName)==1 ){
   354    354         /*TODO(dchest): remove directories? */
   355    355         fossil_fatal("%s is directory, cannot overwrite\n", zName);
   356    356       }
   357    357       if( file_wd_size(zName)>=0 && (isLink || file_wd_islink(0)) ){
   358    358         file_delete(zName);
   359    359       }
   360    360       if( isLink ){

Changes to src/zip.c.

   348    348     if( zDir && zDir[0] ){
   349    349       blob_appendf(&filename, "%s/", zDir);
   350    350     }
   351    351     nPrefix = blob_size(&filename);
   352    352   
   353    353     pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
   354    354     if( pManifest ){
   355         -    char *zName;
          355  +    int flg, eflg = 0;
          356  +    char *zName = 0;
   356    357       zip_set_timedate(pManifest->rDate);
   357         -    if( (pInclude==0 || glob_match(pInclude, "manifest"))
   358         -     && !glob_match(pExclude, "manifest")
   359         -     && db_get_boolean("manifest", 0)
   360         -    ){
   361         -      blob_append(&filename, "manifest", -1);
   362         -      zName = blob_str(&filename);
   363         -      zip_add_folders(zName);
   364         -      sha1sum_blob(&mfile, &hash);
   365         -      sterilize_manifest(&mfile);
   366         -      zip_add_file(zName, &mfile, 0);
          358  +    flg = db_get_manifest_setting();
          359  +    if( flg ){
          360  +      /* eflg is the effective flags, taking include/exclude into account */
          361  +      if( (pInclude==0 || glob_match(pInclude, "manifest"))
          362  +       && !glob_match(pExclude, "manifest")
          363  +       && (flg & MFESTFLG_RAW) ){
          364  +        eflg |= MFESTFLG_RAW;
          365  +      }
          366  +      if( (pInclude==0 || glob_match(pInclude, "manifest.uuid"))
          367  +       && !glob_match(pExclude, "manifest.uuid")
          368  +       && (flg & MFESTFLG_UUID) ){
          369  +        eflg |= MFESTFLG_UUID;
          370  +      }
          371  +      if( (pInclude==0 || glob_match(pInclude, "manifest.tags"))
          372  +       && !glob_match(pExclude, "manifest.tags")
          373  +       && (flg & MFESTFLG_TAGS) ){
          374  +        eflg |= MFESTFLG_TAGS;
          375  +      }
          376  +
          377  +      if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
          378  +        if( eflg & MFESTFLG_RAW ){
          379  +          blob_append(&filename, "manifest", -1);
          380  +          zName = blob_str(&filename);
          381  +          zip_add_folders(zName);
          382  +        }
          383  +        if( eflg & MFESTFLG_UUID ){
          384  +          sha1sum_blob(&mfile, &hash);
          385  +        }
          386  +        if( eflg & MFESTFLG_RAW ){
          387  +          sterilize_manifest(&mfile);
          388  +          zip_add_file(zName, &mfile, 0);
          389  +        }
          390  +      }
   367    391         blob_reset(&mfile);
   368         -      blob_append(&hash, "\n", 1);
   369         -      blob_resize(&filename, nPrefix);
   370         -      blob_append(&filename, "manifest.uuid", -1);
   371         -      zName = blob_str(&filename);
   372         -      zip_add_file(zName, &hash, 0);
   373         -      blob_reset(&hash);
          392  +      if( eflg & MFESTFLG_UUID ){
          393  +        blob_append(&hash, "\n", 1);
          394  +        blob_resize(&filename, nPrefix);
          395  +        blob_append(&filename, "manifest.uuid", -1);
          396  +        zName = blob_str(&filename);
          397  +        zip_add_folders(zName);
          398  +        zip_add_file(zName, &hash, 0);
          399  +        blob_reset(&hash);
          400  +      }
          401  +      if( eflg & MFESTFLG_TAGS ){
          402  +        Blob tagslist;
          403  +        blob_zero(&tagslist);
          404  +        get_checkin_taglist(rid, &tagslist);
          405  +        blob_resize(&filename, nPrefix);
          406  +        blob_append(&filename, "manifest.tags", -1);
          407  +        zName = blob_str(&filename);
          408  +        zip_add_folders(zName);
          409  +        zip_add_file(zName, &tagslist, 0);
          410  +        blob_reset(&tagslist);
          411  +      }
   374    412       }
   375    413       manifest_file_rewind(pManifest);
   376    414       while( (pFile = manifest_file_next(pManifest,0))!=0 ){
   377    415         int fid;
   378    416         if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue;
   379    417         if( glob_match(pExclude, pFile->zName) ) continue;
   380    418         fid = uuid_to_rid(pFile->zUuid, 0);

Changes to test/amend.test.

   257    257   test amend-close-1.1.a {[string match "*uuid:*$UUIDC*" $RESULT]}
   258    258   test amend-close-1.1.b {
   259    259     [string match "*comment:*Create*new*branch*named*\"cllf\"*" $RESULT]
   260    260   }
   261    261   fossil tag ls --raw $UUIDC
   262    262   test amend-close-1.2 {[string first "closed" $RESULT] != -1}
   263    263   fossil timeline -n 1
   264         -test amend-close-1.3 {[string match {*Marked*"Closed".*} $RESULT]}
          264  +test amend-close-1.3 {[string match {*Mark*"Closed".*} $RESULT]}
   265    265   write_file datafile "cllf"
   266    266   fossil commit -m "should fail" -expectError
   267    267   test amend-close-2 {[string first "closed leaf" $RESULT] != -1}
   268    268   
   269    269   set UUID3 UUID3
   270    270   fossil revert
   271    271   fossil update trunk

Added test/commit-warning.test.

            1  +#
            2  +# Copyright (c) 2016 D. Richard Hipp
            3  +#
            4  +# This program is free software; you can redistribute it and/or
            5  +# modify it under the terms of the Simplified BSD License (also
            6  +# known as the "2-Clause License" or "FreeBSD License".)
            7  +#
            8  +# This program is distributed in the hope that it will be useful,
            9  +# but without any warranty; without even the implied warranty of
           10  +# merchantability or fitness for a particular purpose.
           11  +#
           12  +# Author contact information:
           13  +#   drh@hwaci.com
           14  +#   http://www.hwaci.com/drh/
           15  +#
           16  +############################################################################
           17  +#
           18  +# The focus of this file is to test pre-commit warnings.
           19  +#
           20  +
           21  +test_setup ""
           22  +
           23  +###############################################################################
           24  +
           25  +run_in_checkout {
           26  +  fossil test-commit-warning
           27  +}
           28  +
           29  +test pre-commit-warnings-1 {[normalize_result] eq \
           30  +    [subst -nocommands -novariables [string trim {
           31  +1\tart/branching.odp\tbinary data
           32  +1\tart/concept1.dia\tbinary data
           33  +1\tart/concept2.dia\tbinary data
           34  +1\tcompat/zlib/ChangeLog\tinvalid UTF-8
           35  +1\tcompat/zlib/contrib/README.contrib\tinvalid UTF-8
           36  +1\tcompat/zlib/contrib/blast/test.pk\tbinary data
           37  +1\tcompat/zlib/contrib/dotzlib/DotZLib.build\tCR/NL line endings
           38  +1\tcompat/zlib/contrib/dotzlib/DotZLib.chm\tbinary data
           39  +1\tcompat/zlib/contrib/dotzlib/DotZLib.sln\tCR/NL line endings
           40  +1\tcompat/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs\tCR/NL line endings
           41  +1\tcompat/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj\tCR/NL line endings
           42  +1\tcompat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs\tCR/NL line endings
           43  +1\tcompat/zlib/contrib/dotzlib/LICENSE_1_0.txt\tCR/NL line endings
           44  +1\tcompat/zlib/contrib/dotzlib/readme.txt\tCR/NL line endings
           45  +1\tcompat/zlib/contrib/gcc_gvmat64/gvmat64.S\tCR/NL line endings
           46  +1\tcompat/zlib/contrib/masmx64/bld_ml64.bat\tCR/NL line endings
           47  +1\tcompat/zlib/contrib/masmx64/gvmat64.asm\tCR/NL line endings
           48  +1\tcompat/zlib/contrib/masmx64/inffas8664.c\tCR/NL line endings
           49  +1\tcompat/zlib/contrib/masmx64/inffasx64.asm\tCR/NL line endings
           50  +1\tcompat/zlib/contrib/masmx64/readme.txt\tCR/NL line endings
           51  +1\tcompat/zlib/contrib/masmx86/bld_ml32.bat\tCR/NL line endings
           52  +1\tcompat/zlib/contrib/masmx86/inffas32.asm\tCR/NL line endings
           53  +1\tcompat/zlib/contrib/masmx86/match686.asm\tCR/NL line endings
           54  +1\tcompat/zlib/contrib/masmx86/readme.txt\tCR/NL line endings
           55  +1\tcompat/zlib/contrib/puff/zeros.raw\tbinary data
           56  +1\tcompat/zlib/contrib/testzlib/testzlib.c\tCR/NL line endings
           57  +1\tcompat/zlib/contrib/testzlib/testzlib.txt\tCR/NL line endings
           58  +1\tcompat/zlib/contrib/vstudio/readme.txt\tCR/NL line endings
           59  +1\tcompat/zlib/contrib/vstudio/vc10/miniunz.vcxproj\tCR/NL line endings
           60  +1\tcompat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters\tCR/NL line endings
           61  +1\tcompat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.user\tCR/NL line endings
           62  +1\tcompat/zlib/contrib/vstudio/vc10/minizip.vcxproj\tCR/NL line endings
           63  +1\tcompat/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters\tCR/NL line endings
           64  +1\tcompat/zlib/contrib/vstudio/vc10/minizip.vcxproj.user\tCR/NL line endings
           65  +1\tcompat/zlib/contrib/vstudio/vc10/testzlib.vcxproj\tCR/NL line endings
           66  +1\tcompat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters\tCR/NL line endings
           67  +1\tcompat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.user\tCR/NL line endings
           68  +1\tcompat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj\tCR/NL line endings
           69  +1\tcompat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters\tCR/NL line endings
           70  +1\tcompat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.user\tCR/NL line endings
           71  +1\tcompat/zlib/contrib/vstudio/vc10/zlib.rc\tCR/NL line endings
           72  +1\tcompat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj\tCR/NL line endings
           73  +1\tcompat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters\tCR/NL line endings
           74  +1\tcompat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.user\tCR/NL line endings
           75  +1\tcompat/zlib/contrib/vstudio/vc10/zlibvc.def\tCR/NL line endings
           76  +1\tcompat/zlib/contrib/vstudio/vc10/zlibvc.sln\tCR/NL line endings
           77  +1\tcompat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj\tCR/NL line endings
           78  +1\tcompat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters\tCR/NL line endings
           79  +1\tcompat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.user\tCR/NL line endings
           80  +1\tcompat/zlib/contrib/vstudio/vc11/miniunz.vcxproj\tCR/NL line endings
           81  +1\tcompat/zlib/contrib/vstudio/vc11/minizip.vcxproj\tCR/NL line endings
           82  +1\tcompat/zlib/contrib/vstudio/vc11/testzlib.vcxproj\tCR/NL line endings
           83  +1\tcompat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj\tCR/NL line endings
           84  +1\tcompat/zlib/contrib/vstudio/vc11/zlib.rc\tCR/NL line endings
           85  +1\tcompat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj\tCR/NL line endings
           86  +1\tcompat/zlib/contrib/vstudio/vc11/zlibvc.def\tCR/NL line endings
           87  +1\tcompat/zlib/contrib/vstudio/vc11/zlibvc.sln\tCR/NL line endings
           88  +1\tcompat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj\tCR/NL line endings
           89  +1\tcompat/zlib/contrib/vstudio/vc9/miniunz.vcproj\tCR/NL line endings
           90  +1\tcompat/zlib/contrib/vstudio/vc9/minizip.vcproj\tCR/NL line endings
           91  +1\tcompat/zlib/contrib/vstudio/vc9/testzlib.vcproj\tCR/NL line endings
           92  +1\tcompat/zlib/contrib/vstudio/vc9/testzlibdll.vcproj\tCR/NL line endings
           93  +1\tcompat/zlib/contrib/vstudio/vc9/zlib.rc\tCR/NL line endings
           94  +1\tcompat/zlib/contrib/vstudio/vc9/zlibstat.vcproj\tCR/NL line endings
           95  +1\tcompat/zlib/contrib/vstudio/vc9/zlibvc.def\tCR/NL line endings
           96  +1\tcompat/zlib/contrib/vstudio/vc9/zlibvc.sln\tCR/NL line endings
           97  +1\tcompat/zlib/contrib/vstudio/vc9/zlibvc.vcproj\tCR/NL line endings
           98  +1\tcompat/zlib/zlib.3.pdf\tbinary data
           99  +1\tsetup/fossil.iss\tCR/NL line endings
          100  +1\tskins/blitz/arrow_project.png\tbinary data
          101  +1\tskins/blitz/dir.png\tbinary data
          102  +1\tskins/blitz/file.png\tbinary data
          103  +1\tskins/blitz/fossil_100.png\tbinary data
          104  +1\tskins/blitz/fossil_80_reversed_darkcyan.png\tbinary data
          105  +1\tskins/blitz/fossil_80_reversed_darkcyan_text.png\tbinary data
          106  +1\tskins/blitz/rss_20.png\tbinary data
          107  +1\ttest/th1-docs-input.txt\tCR/NL line endings
          108  +1\ttest/th1-hooks-input.txt\tCR/NL line endings
          109  +1\ttest/utf16be.txt\tUnicode
          110  +1\ttest/utf16le.txt\tUnicode
          111  +1\twin/buildmsvc.bat\tCR/NL line endings
          112  +1\twin/fossil.ico\tbinary data
          113  +1\twww/CollRev1.gif\tbinary data
          114  +1\twww/CollRev2.gif\tbinary data
          115  +1\twww/CollRev3.gif\tbinary data
          116  +1\twww/CollRev4.gif\tbinary data
          117  +1\twww/apple-touch-icon.png\tbinary data
          118  +1\twww/background.jpg\tbinary data
          119  +1\twww/branch01.gif\tbinary data
          120  +1\twww/branch02.gif\tbinary data
          121  +1\twww/branch03.gif\tbinary data
          122  +1\twww/branch04.gif\tbinary data
          123  +1\twww/branch05.gif\tbinary data
          124  +1\twww/build-icons/linux.gif\tbinary data
          125  +1\twww/build-icons/linux64.gif\tbinary data
          126  +1\twww/build-icons/mac.gif\tbinary data
          127  +1\twww/build-icons/openbsd.gif\tbinary data
          128  +1\twww/build-icons/src.gif\tbinary data
          129  +1\twww/build-icons/win32.gif\tbinary data
          130  +1\twww/concept1.gif\tbinary data
          131  +1\twww/concept2.gif\tbinary data
          132  +1\twww/copyright-release.pdf\tbinary data
          133  +1\twww/delta1.gif\tbinary data
          134  +1\twww/delta2.gif\tbinary data
          135  +1\twww/delta3.gif\tbinary data
          136  +1\twww/delta4.gif\tbinary data
          137  +1\twww/delta5.gif\tbinary data
          138  +1\twww/delta6.gif\tbinary data
          139  +1\twww/encode1.gif\tbinary data
          140  +1\twww/encode10.gif\tbinary data
          141  +1\twww/encode2.gif\tbinary data
          142  +1\twww/encode3.gif\tbinary data
          143  +1\twww/encode4.gif\tbinary data
          144  +1\twww/encode5.gif\tbinary data
          145  +1\twww/encode6.gif\tbinary data
          146  +1\twww/encode7.gif\tbinary data
          147  +1\twww/encode8.gif\tbinary data
          148  +1\twww/encode9.gif\tbinary data
          149  +1\twww/fossil.gif\tbinary data
          150  +1\twww/fossil2.gif\tbinary data
          151  +1\twww/fossil3.gif\tbinary data
          152  +1\twww/fossil_logo_small.gif\tbinary data
          153  +1\twww/fossil_logo_small2.gif\tbinary data
          154  +1\twww/fossil_logo_small3.gif\tbinary data
          155  +1\twww/xkcd-git.gif\tbinary data
          156  +1}]]}
          157  +
          158  +###############################################################################
          159  +
          160  +test_cleanup

Changes to test/merge2.test.

    33     33       expr {srand($i*2+1)}
    34     34       write_file t3 [set f3 [random_changes $f1 2 4 2 0.1]]
    35     35       expr {srand($i*2+1)}
    36     36       write_file t23 [random_changes $f2 2 4 2 0.1]
    37     37       expr {srand($i*2)}
    38     38       write_file t32 [random_changes $f3 2 4 0 0.1]
    39     39       fossil 3-way-merge t1 t2 t3 a23
           40  +    if {[regexp {<<<<< BEGIN MERGE CONFLICT:} [read_file a23]]} continue
    40     41       test merge-$base-$i-23 {[same_file a23 t23]}
    41     42       fossil 3-way-merge t1 t3 t2 a32
    42     43       test merge-$base-$i-32 {[same_file a32 t32]}
    43     44     }
    44     45   }
    45     46   
    46     47   ###############################################################################
    47     48   
    48     49   test_cleanup

Added test/set-manifest.test.

            1  +#
            2  +# Copyright (c) 2016 D. Richard Hipp
            3  +#
            4  +# This program is free software; you can redistribute it and/or
            5  +# modify it under the terms of the Simplified BSD License (also
            6  +# known as the "2-Clause License" or "FreeBSD License".)
            7  +#
            8  +# This program is distributed in the hope that it will be useful,
            9  +# but without any warranty; without even the implied warranty of
           10  +# merchantability or fitness for a particular purpose.
           11  +#
           12  +# Author contact information:
           13  +#   drh@hwaci.com
           14  +#   http://www.hwaci.com/drh/
           15  +#
           16  +############################################################################
           17  +#
           18  +# Test manifest setting
           19  +#
           20  +
           21  +# We need SHA1 to effectively test the manifest files produced by
           22  +# fossil. It looks like the one from tcllib is exactly what we need.
           23  +# On ActiveTcl, add it with teacup. On other platforms, YMMV.
           24  +# teacup install sha1
           25  +package require sha1
           26  +
           27  +proc file_contains {fname match} {
           28  +  set fp [open $fname r]
           29  +  set contents [read $fp]
           30  +  close $fp
           31  +  set lines [split $contents "\n"]
           32  +  foreach line $lines {
           33  +    if {[regexp $match $line]} {
           34  +      return 1
           35  +    }
           36  +  }
           37  +  return 0
           38  +}
           39  +
           40  +# We need a respository, so let it have one.
           41  +test_setup
           42  +
           43  +#### Verify classic behavior of the manifest setting
           44  +
           45  +# Setting is off by default, and there are no extra files.
           46  +fossil settings manifest
           47  +test "set-manifest-1" {[regexp {^manifest *$} $RESULT]}
           48  +set filelist [glob -nocomplain manifest*]
           49  +test "set-manifest-1-n" {[llength $filelist] == 0}
           50  +
           51  +# Classic behavior: TRUE value creates manifest and manifest.uuid
           52  +set truths [list true on 1]
           53  +foreach v $truths {
           54  +  fossil settings manifest $v
           55  +  test "set-manifest-2-$v" {$RESULT eq ""}
           56  +  fossil settings manifest
           57  +  test "set-manifest-2-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
           58  +  set filelist [glob manifest*]
           59  +  test "set-manifest-2-$v-n" {[llength $filelist] == 2}
           60  +  foreach f $filelist {
           61  +    test "set-manifest-2-$v-f-$f" {[file isfile $f]}
           62  +  }
           63  +}
           64  +
           65  +# ... and manifest.uuid is the checkout's hash
           66  +fossil info
           67  +regexp {(?m)^checkout:\s+([0-9a-f]{40})\s.*$} $RESULT ckoutline ckid
           68  +set uuid [string trim [read_file "manifest.uuid"]]
           69  +test "set-manifest-2-uuid" {$ckid eq $uuid}
           70  +
           71  +# ... which is also the SHA1 of the file "manifest" before it was
           72  +# sterilized by appending an extra line when writing the file. The
           73  +# extra text begins with # and is a full line, so we'll just strip
           74  +# it with a brute-force substitution. This probably has the right
           75  +# effect even if the checkin was PGP-signed, but we don't have that
           76  +# setting turned on for this manifest in any case.
           77  +regsub {(?m)^#.*\n} [read_file "manifest"] "" manifest
           78  +set muuid [::sha1::sha1 $manifest]
           79  +test "set-manifest-2-manifest" {$muuid eq $uuid}
           80  +
           81  +
           82  +# Classic behavior: FALSE value removes manifest and manifest.uuid
           83  +set falses [list false off 0]
           84  +foreach v $falses {
           85  +  fossil settings manifest $v
           86  +  test "set-manifest-3-$v" {$RESULT eq ""}
           87  +  fossil settings manifest
           88  +  test "set-manifest-3-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
           89  +  set filelist [glob -nocomplain manifest*]
           90  +  test "set-manifest-3-$v-n" {[llength $filelist] == 0}
           91  +}
           92  +
           93  +
           94  +# Classic behavior: unset removes manifest and manifest.uuid
           95  +fossil unset manifest
           96  +test "set-manifest-4" {$RESULT eq ""}
           97  +fossil settings manifest
           98  +test "set-manifest-4-a" {[regexp {^manifest *$} $RESULT]}
           99  +set filelist [glob -nocomplain manifest*]
          100  +test "set-manifest-4-n" {[llength $filelist] == 0}
          101  +
          102  +
          103  +##### Tags Manifest feature extends the manifest setting
          104  +
          105  +# Manifest Tags: use letters r, u, and t to select each of manifest,
          106  +# manifest.uuid, and manifest.tags files.
          107  +set truths [list r u t ru ut rt rut]
          108  +foreach v $truths {
          109  +  fossil settings manifest $v
          110  +  test "set-manifest-5-$v" {$RESULT eq ""}
          111  +  fossil settings manifest
          112  +  test "set-manifest-5-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
          113  +  set filelist [glob manifest*]
          114  +  test "set-manifest-5-$v-n" {[llength $filelist] == [string length $v]}
          115  +  foreach f $filelist {
          116  +    test "set-manifest-5-$v-f-$f" {[file isfile $f]}
          117  +  }
          118  +}
          119  +
          120  +# Quick check for tags applied in trunk
          121  +test_file_contents "set-manifest-6" "manifest.tags" "branch trunk\ntag trunk\n"
          122  +
          123  +
          124  +##### Test manifest.tags file content updates after commits
          125  +
          126  +# Explicitly set manifest.tags mode
          127  +fossil set manifest t
          128  +test "set-manifest-7-1" {[file isfile manifest.tags]}
          129  +
          130  +# Add a tag and make sure it appears in manifest.tags
          131  +fossil tag add manifest-7-tag-1 tip
          132  +test "set-manifest-7-2" {[file_contains "manifest.tags" "^tag manifest-7-tag-1$"]}
          133  +
          134  +# Add a file and make sure tag has disappeared from manifest.tags
          135  +write_file file1 "file1 contents"
          136  +fossil add file1
          137  +fossil commit -m "Added file1."
          138  +test "set-manifest-7-3" {![file_contains "manifest.tags" "^tag manifest-7-tag-1$"]}
          139  +
          140  +# Add new tag and check that it is in manifest.tags
          141  +fossil tag add manifest-7-tag-2 tip
          142  +test "set-manifest-7-4" {[file_contains "manifest.tags" "^tag manifest-7-tag-2$"]}
          143  +
          144  +
          145  +##### Tags manifest branch= updates
          146  +
          147  +# Add file, create new branch on commit and check that
          148  +# manifest.tags has been updated appropriately
          149  +write_file file3 "file3 contents"
          150  +fossil add file3
          151  +fossil commit -m "Added file3." --branch manifest-8-branch
          152  +test "set-manifest-8" {[file_contains "manifest.tags" "^branch manifest-8-branch$"]}
          153  +
          154  +
          155  +test_cleanup

Added test/symlinks.test.

            1  +#
            2  +# Copyright (c) 2016 D. Richard Hipp
            3  +#
            4  +# This program is free software; you can redistribute it and/or
            5  +# modify it under the terms of the Simplified BSD License (also
            6  +# known as the "2-Clause License" or "FreeBSD License".)
            7  +#
            8  +# This program is distributed in the hope that it will be useful,
            9  +# but without any warranty; without even the implied warranty of
           10  +# merchantability or fitness for a particular purpose.
           11  +#
           12  +# Author contact information:
           13  +#   drh@hwaci.com
           14  +#   http://www.hwaci.com/drh/
           15  +#
           16  +############################################################################
           17  +#
           18  +# Symbolic link tests.
           19  +#
           20  +
           21  +if {$tcl_platform(platform) eq "windows"} {
           22  +  puts "Symlinks are not supported on Windows."
           23  +  test_cleanup_then_return
           24  +}
           25  +
           26  +fossil test-th-eval --open-config "setting allow-symlinks"
           27  +
           28  +if {![string is true -strict [normalize_result]]} {
           29  +  puts "Symlinks are not enabled."
           30  +  test_cleanup_then_return
           31  +}
           32  +
           33  +require_no_open_checkout
           34  +
           35  +###############################################################################
           36  +
           37  +test_setup; set rootDir [file normalize [pwd]]
           38  +
           39  +fossil test-th-eval --open-config {repository}
           40  +set repository [normalize_result]
           41  +
           42  +if {[string length $repository] == 0} {
           43  +  puts "Detection of the open repository file failed."
           44  +  test_cleanup_then_return
           45  +}
           46  +
           47  +#######################################
           48  +# Use symbolic link to a directory... #
           49  +#######################################
           50  +
           51  +file mkdir [file join $rootDir subdirA]
           52  +exec ln -s [file join $rootDir subdirA] symdirA
           53  +
           54  +###############################################################################
           55  +
           56  +write_file [file join $rootDir subdirA f1.txt] "f1"
           57  +write_file [file join $rootDir subdirA f2.txt] "f2"
           58  +
           59  +test symlinks-dir-1 {[file exists [file join $rootDir subdirA f1.txt]] eq 1}
           60  +test symlinks-dir-2 {[file exists [file join $rootDir symdirA f1.txt]] eq 1}
           61  +test symlinks-dir-3 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
           62  +test symlinks-dir-4 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
           63  +
           64  +fossil add [file join $rootDir symdirA f1.txt]
           65  +fossil commit -m "c1"
           66  +
           67  +###############################################################################
           68  +
           69  +fossil ls
           70  +test symlinks-dir-5 {[normalize_result] eq "symdirA/f1.txt"}
           71  +
           72  +###############################################################################
           73  +
           74  +fossil extras
           75  +test symlinks-dir-6 {[normalize_result] eq \
           76  +"subdirA/f1.txt\nsubdirA/f2.txt\nsymdirA/f2.txt"}
           77  +
           78  +###############################################################################
           79  +
           80  +fossil close
           81  +file delete [file join $rootDir subdirA f1.txt]
           82  +
           83  +test symlinks-dir-7 {[file exists [file join $rootDir subdirA f1.txt]] eq 0}
           84  +test symlinks-dir-8 {[file exists [file join $rootDir symdirA f1.txt]] eq 0}
           85  +test symlinks-dir-9 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
           86  +test symlinks-dir-10 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
           87  +
           88  +###############################################################################
           89  +
           90  +fossil open $repository
           91  +set code [catch {file readlink [file join $rootDir symdirA]} result]
           92  +
           93  +test symlinks-dir-11 {$code == 0}
           94  +test symlinks-dir-12 {$result eq [file join $rootDir subdirA]}
           95  +test symlinks-dir-13 {[file exists [file join $rootDir subdirA f1.txt]] eq 1}
           96  +test symlinks-dir-14 {[file exists [file join $rootDir symdirA f1.txt]] eq 1}
           97  +test symlinks-dir-15 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
           98  +test symlinks-dir-16 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
           99  +
          100  +###############################################################################
          101  +#
          102  +# TODO: Add tests for symbolic links as files here, including tests with the
          103  +#       "allow-symlinks" setting on and off.
          104  +#
          105  +###############################################################################
          106  +
          107  +test_cleanup

Changes to test/tester.tcl.

   268    268         repo-cksum \
   269    269         self-register \
   270    270         ssh-command \
   271    271         ssl-ca-location \
   272    272         ssl-identity \
   273    273         th1-setup \
   274    274         th1-uri-regexp \
          275  +      uv-sync \
   275    276         web-browser]
   276    277   
   277    278     fossil test-th-eval "hasfeature legacyMvRm"
   278    279   
   279    280     if {$::RESULT eq "1"} {
   280    281       lappend result mv-rm-files
   281    282     }

Changes to win/Makefile.PellesCGMake.

    81     81   UTILS_OBJ=$(UTILS:.exe=.obj)
    82     82   UTILS_SRC=$(foreach uf,$(UTILS),$(SRCDIR)$(uf:.exe=.c))
    83     83   
    84     84   # define the SQLite files, which need special flags on compile
    85     85   SQLITESRC=sqlite3.c
    86     86   ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf))
    87     87   SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj))
    88         -SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
           88  +SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
    89     89   
    90     90   # define the SQLite shell files, which need special flags on compile
    91     91   SQLITESHELLSRC=shell.c
    92     92   ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
    93     93   SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
    94     94   SQLITESHELLDEFINES=-Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
    95     95   

Changes to win/Makefile.dmc.

    22     22   SSL    =
    23     23   
    24     24   CFLAGS = -o
    25     25   BCC    = $(DMDIR)\bin\dmc $(CFLAGS)
    26     26   TCC    = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
    27     27   LIBS   = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
    28     28   
    29         -SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
           29  +SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
    30     30   
    31     31   SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
    32     32   
    33     33   SRC   = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c 
    34     34   
    35     35   OBJ   = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O 
    36     36   

Changes to win/Makefile.mingw.

   168    168   endif
   169    169   
   170    170   #### The directories where the OpenSSL include and library files are located.
   171    171   #    The recommended usage here is to use the Sysinternals junction tool
   172    172   #    to create a hard link between an "openssl-1.x" sub-directory of the
   173    173   #    Fossil source code directory and the target OpenSSL source directory.
   174    174   #
   175         -OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2i
          175  +OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2j
   176    176   OPENSSLINCDIR = $(OPENSSLDIR)/include
   177    177   OPENSSLLIBDIR = $(OPENSSLDIR)
   178    178   
   179    179   #### Either the directory where the Tcl library is installed or the Tcl
   180    180   #    source code directory resides (depending on the value of the macro
   181    181   #    FOSSIL_TCL_SOURCE).  If this points to the Tcl install directory,
   182    182   #    this directory must have "include" and "lib" sub-directories.  If
................................................................................
  2172   2172                    -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
  2173   2173                    -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
  2174   2174                    -DSQLITE_OMIT_DECLTYPE \
  2175   2175                    -DSQLITE_OMIT_DEPRECATED \
  2176   2176                    -DSQLITE_OMIT_PROGRESS_CALLBACK \
  2177   2177                    -DSQLITE_OMIT_SHARED_CACHE \
  2178   2178                    -DSQLITE_OMIT_LOAD_EXTENSION \
         2179  +                 -DSQLITE_MAX_EXPR_DEPTH=0 \
         2180  +                 -DSQLITE_USE_ALLOCA \
  2179   2181                    -DSQLITE_ENABLE_LOCKING_STYLE=0 \
  2180   2182                    -DSQLITE_DEFAULT_FILE_FORMAT=4 \
  2181   2183                    -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
  2182   2184                    -DSQLITE_ENABLE_FTS4 \
  2183   2185                    -DSQLITE_ENABLE_FTS3_PARENTHESIS \
  2184   2186                    -DSQLITE_ENABLE_DBSTAT_VTAB \
  2185   2187                    -DSQLITE_ENABLE_JSON1 \

Changes to win/Makefile.mingw.mistachkin.

   168    168   endif
   169    169   
   170    170   #### The directories where the OpenSSL include and library files are located.
   171    171   #    The recommended usage here is to use the Sysinternals junction tool
   172    172   #    to create a hard link between an "openssl-1.x" sub-directory of the
   173    173   #    Fossil source code directory and the target OpenSSL source directory.
   174    174   #
   175         -OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2i
          175  +OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2j
   176    176   OPENSSLINCDIR = $(OPENSSLDIR)/include
   177    177   OPENSSLLIBDIR = $(OPENSSLDIR)
   178    178   
   179    179   #### Either the directory where the Tcl library is installed or the Tcl
   180    180   #    source code directory resides (depending on the value of the macro
   181    181   #    FOSSIL_TCL_SOURCE).  If this points to the Tcl install directory,
   182    182   #    this directory must have "include" and "lib" sub-directories.  If
................................................................................
  2172   2172                    -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
  2173   2173                    -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
  2174   2174                    -DSQLITE_OMIT_DECLTYPE \
  2175   2175                    -DSQLITE_OMIT_DEPRECATED \
  2176   2176                    -DSQLITE_OMIT_PROGRESS_CALLBACK \
  2177   2177                    -DSQLITE_OMIT_SHARED_CACHE \
  2178   2178                    -DSQLITE_OMIT_LOAD_EXTENSION \
         2179  +                 -DSQLITE_MAX_EXPR_DEPTH=0 \
         2180  +                 -DSQLITE_USE_ALLOCA \
  2179   2181                    -DSQLITE_ENABLE_LOCKING_STYLE=0 \
  2180   2182                    -DSQLITE_DEFAULT_FILE_FORMAT=4 \
  2181   2183                    -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
  2182   2184                    -DSQLITE_ENABLE_FTS4 \
  2183   2185                    -DSQLITE_ENABLE_FTS3_PARENTHESIS \
  2184   2186                    -DSQLITE_ENABLE_DBSTAT_VTAB \
  2185   2187                    -DSQLITE_ENABLE_JSON1 \

Changes to win/Makefile.msc.

    96     96   
    97     97   # Enable support for the SQLite Encryption Extension?
    98     98   !ifndef USE_SEE
    99     99   USE_SEE = 0
   100    100   !endif
   101    101   
   102    102   !if $(FOSSIL_ENABLE_SSL)!=0
   103         -SSLDIR    = $(B)\compat\openssl-1.0.2i
          103  +SSLDIR    = $(B)\compat\openssl-1.0.2j
   104    104   SSLINCDIR = $(SSLDIR)\inc32
   105    105   !if $(FOSSIL_DYNAMIC_BUILD)!=0
   106    106   SSLLIBDIR = $(SSLDIR)\out32dll
   107    107   !else
   108    108   SSLLIBDIR = $(SSLDIR)\out32
   109    109   !endif
   110    110   SSLLFLAGS = /nologo /opt:ref /debug
................................................................................
   319    319                    /DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
   320    320                    /DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
   321    321                    /DSQLITE_OMIT_DECLTYPE \
   322    322                    /DSQLITE_OMIT_DEPRECATED \
   323    323                    /DSQLITE_OMIT_PROGRESS_CALLBACK \
   324    324                    /DSQLITE_OMIT_SHARED_CACHE \
   325    325                    /DSQLITE_OMIT_LOAD_EXTENSION \
          326  +                 /DSQLITE_MAX_EXPR_DEPTH=0 \
          327  +                 /DSQLITE_USE_ALLOCA \
   326    328                    /DSQLITE_ENABLE_LOCKING_STYLE=0 \
   327    329                    /DSQLITE_DEFAULT_FILE_FORMAT=4 \
   328    330                    /DSQLITE_ENABLE_EXPLAIN_COMMENTS \
   329    331                    /DSQLITE_ENABLE_FTS4 \
   330    332                    /DSQLITE_ENABLE_FTS3_PARENTHESIS \
   331    333                    /DSQLITE_ENABLE_DBSTAT_VTAB \
   332    334                    /DSQLITE_ENABLE_JSON1 \

Changes to www/build.wiki.

   139    139   file "<b>win\buildmsvc.bat</b>" may be used and it will attempt to
   140    140   detect and use the latest installed version of MSVC.<br><br>To enable
   141    141   the optional <a href="https://www.openssl.org/">OpenSSL</a> support,
   142    142   first <a href="https://www.openssl.org/source/">download the official
   143    143   source code for OpenSSL</a> and extract it to an appropriately named
   144    144   "<b>openssl-X.Y.ZA</b>" subdirectory within the local
   145    145   [/tree?ci=trunk&name=compat | compat] directory (e.g.
   146         -"<b>compat/openssl-1.0.2i</b>"), then make sure that some recent
          146  +"<b>compat/openssl-1.0.2j</b>"), then make sure that some recent
   147    147   <a href="http://www.perl.org/">Perl</a> binaries are installed locally,
   148    148   and finally run one of the following commands:
   149    149   <blockquote><pre>
   150    150   nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin
   151    151   </pre></blockquote>
   152    152   <blockquote><pre>
   153    153   buildmsvc.bat FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin

Changes to www/concepts.wiki.

    11     11   There are many such systems in use today.  Fossil strives to
    12     12   distinguish itself from the others by being extremely simple
    13     13   to setup and operate.
    14     14   
    15     15   This document is intended as a quick introduction to the concepts
    16     16   behind Fossil.
    17     17   
           18  +See also:
           19  +
           20  +  *  [./whyusefossil.wiki#definitions|Definitions]
           21  +  *  [./quickstart.wiki|Quick start guide]
           22  +
    18     23   <h2>2.0 Composition Of A Project</h2>
    19     24   <img src="concept1.gif" align="right" hspace="10">
    20     25   
    21     26   A software project normally consists of a "source tree".
    22     27   A source tree is a hierarchy of files that are used to generate
    23     28   the end product.  The source tree changes over time as the
    24     29   software grows and expands and as features are added and bugs

Changes to www/fileformat.wiki.

   164    164   
   165    165   A manifest has zero or one N-cards.  The N-card specifies the mimetype for the
   166    166   text in the comment of the C-card.  If the N-card is omitted, a default mimetype
   167    167   is used.
   168    168   
   169    169   A manifest has zero or one P-cards.  Most manifests have one P-card.
   170    170   The P-card has a varying number of arguments that
   171         -defines other manifests from which the current manifest
   172         -is derived.  Each argument is an 40-character lowercase 
   173         -hexadecimal SHA1 of the predecessor manifest.  All arguments
   174         -to the P-card must be unique to that line.
   175         -The first predecessor is the direct ancestor of the manifest.
          171  +define other manifests from which the current manifest
          172  +is derived.  Each argument is a 40-character lowercase 
          173  +hexadecimal SHA1 of a predecessor manifest.  All arguments
          174  +to the P-card must be unique within that card.
          175  +The first argument is the SHA1 of the direct ancestor of the manifest.
   176    176   Other arguments define manifests with which the first was
   177    177   merged to yield the current manifest.  Most manifests have
   178    178   a P-card with a single argument.  The first manifest in the
   179    179   project has no ancestors and thus has no P-card or (depending
   180    180   on the Fossil version) an empty P-card (no arguments).
   181    181   
   182    182   A manifest has zero or more Q-cards.  A Q-card is similar to a P-card
................................................................................
   197    197   
   198    198   The Q-card was added to the interface specification on 2011-02-26.  
   199    199   Older versions of Fossil will reject manifests that contain Q-cards.
   200    200   
   201    201   A manifest may optionally have a single R-card.  The R-card has
   202    202   a single argument which is the MD5 checksum of all files in 
   203    203   the check-in except the manifest itself.  The checksum is expressed
   204         -as 32-characters of lowercase hexadecimal.   The checksum is
          204  +as 32 characters of lowercase hexadecimal.   The checksum is
   205    205   computed as follows:  For each file in the check-in (except for
   206    206   the manifest itself) in strict sorted lexicographical order, 
   207    207   take the pathname of the file relative to the root of the
   208    208   repository, append a single space (ASCII 0x20), the
   209    209   size of the file in ASCII decimal, a single newline
   210    210   character (ASCII 0x0A), and the complete text of the file.
   211    211   Compute the MD5 checksum of the result.
................................................................................
   244    244   A cluster is an artifact that declares the existence of other artifacts.
   245    245   Clusters are used during repository synchronization to help 
   246    246   reduce network traffic.  As such, clusters are an optimization and
   247    247   may be removed from a repository without loss or damage to the
   248    248   underlying project code.
   249    249   
   250    250   Clusters follow a syntax that is very similar to manifests.
   251         -A Cluster is a line-oriented text file.  Newline characters
          251  +A cluster is a line-oriented text file.  Newline characters
   252    252   (ASCII 0x0a) separate the artifact into cards.  Each card begins with a single
   253    253   character "card type".  Zero or more arguments may follow
   254    254   the card type.  All arguments are separated from each other
   255    255   and from the card-type character by a single space
   256    256   character.  There is no surplus white space between arguments
   257    257   and no leading or trailing whitespace except for the newline 
   258    258   character that acts as the card separator.
................................................................................
   266    266   
   267    267   <blockquote>
   268    268   <b>M</b> <i>artifact-id</i><br />
   269    269   <b>Z</b> <i>checksum</i>
   270    270   </blockquote>
   271    271   
   272    272   A cluster contains one or more "M" cards followed by a single "Z"
   273         -line.  Each M card has a single argument which is the artifact ID of 
   274         -another artifact in the repository.  The Z card work exactly like
          273  +card.  Each M card has a single argument which is the artifact ID of 
          274  +another artifact in the repository.  The Z card works exactly like
   275    275   the Z card of a manifest.  The argument to the Z card is the
   276    276   lower-case hexadecimal representation of the MD5 checksum of all
   277    277   prior cards in the cluster.  The Z-card is required.
   278    278   
   279    279   An example cluster from Fossil can be seen
   280    280   [/artifact/d03dbdd73a2a8 | here].
   281    281   

Changes to www/server.wiki.

    37     37   Both of these commands start a Fossil server, usually on TCP port 8080, though
    38     38   a higher numbered port might also be used if 8080 is already occupied.  You can
    39     39   access these using URLs of the form <b>http://localhost:8080/</b>, or if 
    40     40   <i>REPOSITORY</i> is a directory, URLs of the form
    41     41   <b>http://localhost:8080/</b><i>repo</i><b>/</b> where <i>repo</i> is the base
    42     42   name of the repository file without the ".fossil" suffix.
    43     43   The difference between "ui" and "server" is that "ui" will
    44         -also start a web browser and points it
           44  +also start a web browser and point it
    45     45   to the URL mentioned above, and the "ui" command binds to
    46     46   the loopback IP address (127.0.0.1) only so that the "ui" command cannot be
    47     47   used to serve content to a different machine.
    48     48   </p>
    49     49   <p>
    50     50   If one of the commands above is run from within an open checkout,
    51     51   then the <i>REPOSITORY</i> argument can be omitted and the checkout is used as

Changes to www/whyusefossil.wiki.

    35     35        <ol type='i'>
    36     36        <li>Everyone always has the latest code
    37     37        <li>Failed disk-drives cause no loss of work
    38     38        <li>Avoid wasting time doing manual file copying
    39     39        <li>Avoid human errors during manual backups
    40     40        </ol>
    41     41     </ol>
           42  +<a name='definitions'></a>
    42     43   <li><p><b>Definitions</b></p>
    43     44     <ul>
    44     45     <li><p><b>Project</b> &rarr;
    45     46          a collection of computer files that serve some common
    46     47         purpose.  Often the project is a software application and the
    47     48         individual files are source code together with makefiles, scripts, and
    48     49         "README.txt" files.  Other examples of projects include books or
................................................................................
    57     58            directory hierarchy - a single folder possibly with layers
    58     59            of subfolders.  Fossil is not a good choice for managing a
    59     60            project that has files scattered hither and yon all over
    60     61            the disk.  In other words, Fossil only works for projects
    61     62            where the files are laid out such that they can be archived
    62     63            into a ZIP file or tarball.
    63     64        </ul>
    64         -  <li><p><b>Repository</b>
    65         -      (also called "repo") &rarr; a single file that contains
           65  +  <li><p><b>Repository</b> &rarr;
           66  +      (also called "repo") a single file that contains
    66     67         all historical versions of all files in a project.  A repo is similar
    67     68         to a ZIP archive in that it is a single file that stores compressed
    68     69         versions of many other files.  Files can be extracted from the
    69     70         repo and new files can be added to the repo, just as with a ZIP
    70     71         archive.  But a repo has other capabilities above and beyond
    71     72         what a ZIP archive can do.
    72     73         <ul>