Fossil

Check-in [b6670e0545]
Login

Check-in [b6670e0545]

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

Overview
Comment:Compatibility back to SQLite 3.7.17 (when configuring with --disable-internal-sqlite)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sqlite3-compat
Files: files | file ages | folders
SHA1: b6670e0545f456132ca1f9d011a4907b0d8f5236
User & Date: jan.nijtmans 2014-06-05 08:12:09.595
Context
2014-10-05
22:41
merge trunk ... (check-in: 4c84ee3bac user: jan.nijtmans tags: sqlite3-compat)
2014-06-05
08:12
Compatibility back to SQLite 3.7.17 (when configuring with --disable-internal-sqlite) ... (check-in: b6670e0545 user: jan.nijtmans tags: sqlite3-compat)
08:05
Remove the Cygwin-specific Makefile, as the option --disable-internal-sqlite has the same effect. Document this. ... (check-in: 5610dc4edf user: jan.nijtmans tags: trunk)
2014-04-21
18:41
Compatibility with SQLite 3.8.2 as external library ... (check-in: 09472e8897 user: jan.nijtmans tags: sqlite3-compat)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/browse.c.
512
513
514
515
516
517
518


519
520
521
522
523
524
525
526
    Stmt ins, q;
    ManifestFile *pFile;

    db_multi_exec(
        "CREATE TEMP TABLE filelist("
        "   x TEXT PRIMARY KEY COLLATE nocase,"
        "   uuid TEXT"


        ") WITHOUT ROWID;"
    );
    db_prepare(&ins, "INSERT OR IGNORE INTO filelist VALUES(:f,:u)");
    manifest_file_rewind(pM);
    while( (pFile = manifest_file_next(pM,0))!=0 ){
      if( nD>0
       && (fossil_strncmp(pFile->zName, zD, nD-1)!=0
           || pFile->zName[nD-1]!='/')







>
>
|







512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
    Stmt ins, q;
    ManifestFile *pFile;

    db_multi_exec(
        "CREATE TEMP TABLE filelist("
        "   x TEXT PRIMARY KEY COLLATE nocase,"
        "   uuid TEXT"
        ")%s;",
        /* Can be removed as soon as SQLite 3.8.2 is sufficiently wide-spread */
        sqlite3_libversion_number()>=3008002 ? " WITHOUT ROWID" : ""
    );
    db_prepare(&ins, "INSERT OR IGNORE INTO filelist VALUES(:f,:u)");
    manifest_file_rewind(pM);
    while( (pFile = manifest_file_next(pM,0))!=0 ){
      if( nD>0
       && (fossil_strncmp(pFile->zName, zD, nD-1)!=0
           || pFile->zName[nD-1]!='/')
Changes to src/descendants.c.
155
156
157
158
159
160
161




































162
163
164
165
166
167
168
}

/*
** Load the record ID rid and up to N-1 closest ancestors into
** the "ok" table.
*/
void compute_ancestors(int rid, int N, int directOnly){




































  db_multi_exec(
    "WITH RECURSIVE "
    "  ancestor(rid, mtime) AS ("
    "    SELECT %d, mtime FROM event WHERE objid=%d "
    "    UNION "
    "    SELECT plink.pid, event.mtime"
    "      FROM ancestor, plink, event"







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







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
}

/*
** Load the record ID rid and up to N-1 closest ancestors into
** the "ok" table.
*/
void compute_ancestors(int rid, int N, int directOnly){
#if USE_SYSTEM_SQLITE+0==1
  if( sqlite3_libversion_number()<3008003 ){
    Bag seen;
    PQueue queue;
    Stmt ins;
    Stmt q;
    bag_init(&seen);
    pqueuex_init(&queue);
    bag_insert(&seen, rid);
    pqueuex_insert(&queue, rid, 0.0, 0);
    db_prepare(&ins, "INSERT OR IGNORE INTO ok VALUES(:rid)");
    db_prepare(&q,
      "SELECT a.pid, b.mtime FROM plink a LEFT JOIN plink b ON b.cid=a.pid"
      " WHERE a.cid=:rid %s",
      directOnly ? " AND a.isprim" : ""
    );
    while( (N--)>0 && (rid = pqueuex_extract(&queue, 0))!=0 ){
      db_bind_int(&ins, ":rid", rid);
      db_step(&ins);
      db_reset(&ins);
      db_bind_int(&q, ":rid", rid);
      while( db_step(&q)==SQLITE_ROW ){
        int pid = db_column_int(&q, 0);
        double mtime = db_column_double(&q, 1);
        if( bag_insert(&seen, pid) ){
          pqueuex_insert(&queue, pid, -mtime, 0);
        }
      }
      db_reset(&q);
    }
    bag_clear(&seen);
    pqueuex_clear(&queue);
    db_finalize(&ins);
    db_finalize(&q);
  } else
#endif
  db_multi_exec(
    "WITH RECURSIVE "
    "  ancestor(rid, mtime) AS ("
    "    SELECT %d, mtime FROM event WHERE objid=%d "
    "    UNION "
    "    SELECT plink.pid, event.mtime"
    "      FROM ancestor, plink, event"
Changes to src/main.c.
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
#endif
int main(int argc, char **argv)
#endif
{
  const char *zCmdName = "unknown";
  int idx;
  int rc;
  if( sqlite3_libversion_number()<3008003 ){
    fossil_fatal("Unsuitable SQLite version %s, must be at least 3.8.3",
                 sqlite3_libversion());
  }
  sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
  sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
  memset(&g, 0, sizeof(g));
  g.now = time(0);
  g.httpHeader = empty_blob;







|
|







568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
#endif
int main(int argc, char **argv)
#endif
{
  const char *zCmdName = "unknown";
  int idx;
  int rc;
  if( sqlite3_libversion_number()<3007017 ){
    fossil_fatal("Unsuitable SQLite version %s, must be at least 3.7.17",
                 sqlite3_libversion());
  }
  sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
  sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
  memset(&g, 0, sizeof(g));
  g.now = time(0);
  g.httpHeader = empty_blob;
Changes to src/shell.c.
1148
1149
1150
1151
1152
1153
1154

1155
1156

1157
1158
1159
1160
1161
1162
1163
  if( pArg && pArg->out && db && pArg->pStmt ){
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, bReset);
    fprintf(pArg->out, "Fullscan Steps:                      %d\n", iCur);
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
    fprintf(pArg->out, "Sort Operations:                     %d\n", iCur);
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
    fprintf(pArg->out, "Autoindex Inserts:                   %d\n", iCur);

    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
    fprintf(pArg->out, "Virtual Machine Steps:               %d\n", iCur);

  }

  return 0;
}

/*
** Parameter azArray points to a zero-terminated array of strings. zStr







>
|
|
>







1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
  if( pArg && pArg->out && db && pArg->pStmt ){
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, bReset);
    fprintf(pArg->out, "Fullscan Steps:                      %d\n", iCur);
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
    fprintf(pArg->out, "Sort Operations:                     %d\n", iCur);
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
    fprintf(pArg->out, "Autoindex Inserts:                   %d\n", iCur);
    if( sqlite3_libversion_number()>=3008000 ){
      iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
      fprintf(pArg->out, "Virtual Machine Steps:               %d\n", iCur);
    }
  }

  return 0;
}

/*
** Parameter azArray points to a zero-terminated array of strings. zStr