Fossil SCM

merge trunk

jan.nijtmans 2014-10-06 01:57 sqlite3-compat merge
Commit 569d3ade54dd03ea21cbe59ebdee85349aab4940
+1 -3
--- src/browse.c
+++ src/browse.c
@@ -514,13 +514,11 @@
514514
515515
db_multi_exec(
516516
"CREATE TEMP TABLE filelist("
517517
" x TEXT PRIMARY KEY COLLATE nocase,"
518518
" uuid TEXT"
519
- ")%s;",
520
- /* Can be removed as soon as SQLite 3.8.2 is sufficiently wide-spread */
521
- sqlite3_libversion_number()>=3008002 ? " WITHOUT ROWID" : ""
519
+ ") WITHOUT ROWID;"
522520
);
523521
db_prepare(&ins, "INSERT OR IGNORE INTO filelist VALUES(:f,:u)");
524522
manifest_file_rewind(pM);
525523
while( (pFile = manifest_file_next(pM,0))!=0 ){
526524
if( nD>0
527525
--- src/browse.c
+++ src/browse.c
@@ -514,13 +514,11 @@
514
515 db_multi_exec(
516 "CREATE TEMP TABLE filelist("
517 " x TEXT PRIMARY KEY COLLATE nocase,"
518 " uuid TEXT"
519 ")%s;",
520 /* Can be removed as soon as SQLite 3.8.2 is sufficiently wide-spread */
521 sqlite3_libversion_number()>=3008002 ? " WITHOUT ROWID" : ""
522 );
523 db_prepare(&ins, "INSERT OR IGNORE INTO filelist VALUES(:f,:u)");
524 manifest_file_rewind(pM);
525 while( (pFile = manifest_file_next(pM,0))!=0 ){
526 if( nD>0
527
--- src/browse.c
+++ src/browse.c
@@ -514,13 +514,11 @@
514
515 db_multi_exec(
516 "CREATE TEMP TABLE filelist("
517 " x TEXT PRIMARY KEY COLLATE nocase,"
518 " uuid TEXT"
519 ") WITHOUT ROWID;"
 
 
520 );
521 db_prepare(&ins, "INSERT OR IGNORE INTO filelist VALUES(:f,:u)");
522 manifest_file_rewind(pM);
523 while( (pFile = manifest_file_next(pM,0))!=0 ){
524 if( nD>0
525
--- src/descendants.c
+++ src/descendants.c
@@ -162,46 +162,10 @@
162162
/*
163163
** Load the record ID rid and up to N-1 closest ancestors into
164164
** the "ok" table.
165165
*/
166166
void compute_ancestors(int rid, int N, int directOnly){
167
-#if USE_SYSTEM_SQLITE+0==1
168
- if( sqlite3_libversion_number()<3008003 ){
169
- Bag seen;
170
- PQueue queue;
171
- Stmt ins;
172
- Stmt q;
173
- bag_init(&seen);
174
- pqueuex_init(&queue);
175
- bag_insert(&seen, rid);
176
- pqueuex_insert(&queue, rid, 0.0, 0);
177
- db_prepare(&ins, "INSERT OR IGNORE INTO ok VALUES(:rid)");
178
- db_prepare(&q,
179
- "SELECT a.pid, b.mtime FROM plink a LEFT JOIN plink b ON b.cid=a.pid"
180
- " WHERE a.cid=:rid %s",
181
- directOnly ? " AND a.isprim" : ""
182
- );
183
- while( (N--)>0 && (rid = pqueuex_extract(&queue, 0))!=0 ){
184
- db_bind_int(&ins, ":rid", rid);
185
- db_step(&ins);
186
- db_reset(&ins);
187
- db_bind_int(&q, ":rid", rid);
188
- while( db_step(&q)==SQLITE_ROW ){
189
- int pid = db_column_int(&q, 0);
190
- double mtime = db_column_double(&q, 1);
191
- if( bag_insert(&seen, pid) ){
192
- pqueuex_insert(&queue, pid, -mtime, 0);
193
- }
194
- }
195
- db_reset(&q);
196
- }
197
- bag_clear(&seen);
198
- pqueuex_clear(&queue);
199
- db_finalize(&ins);
200
- db_finalize(&q);
201
- } else
202
-#endif
203167
db_multi_exec(
204168
"WITH RECURSIVE "
205169
" ancestor(rid, mtime) AS ("
206170
" SELECT %d, mtime FROM event WHERE objid=%d "
207171
" UNION "
208172
--- src/descendants.c
+++ src/descendants.c
@@ -162,46 +162,10 @@
162 /*
163 ** Load the record ID rid and up to N-1 closest ancestors into
164 ** the "ok" table.
165 */
166 void compute_ancestors(int rid, int N, int directOnly){
167 #if USE_SYSTEM_SQLITE+0==1
168 if( sqlite3_libversion_number()<3008003 ){
169 Bag seen;
170 PQueue queue;
171 Stmt ins;
172 Stmt q;
173 bag_init(&seen);
174 pqueuex_init(&queue);
175 bag_insert(&seen, rid);
176 pqueuex_insert(&queue, rid, 0.0, 0);
177 db_prepare(&ins, "INSERT OR IGNORE INTO ok VALUES(:rid)");
178 db_prepare(&q,
179 "SELECT a.pid, b.mtime FROM plink a LEFT JOIN plink b ON b.cid=a.pid"
180 " WHERE a.cid=:rid %s",
181 directOnly ? " AND a.isprim" : ""
182 );
183 while( (N--)>0 && (rid = pqueuex_extract(&queue, 0))!=0 ){
184 db_bind_int(&ins, ":rid", rid);
185 db_step(&ins);
186 db_reset(&ins);
187 db_bind_int(&q, ":rid", rid);
188 while( db_step(&q)==SQLITE_ROW ){
189 int pid = db_column_int(&q, 0);
190 double mtime = db_column_double(&q, 1);
191 if( bag_insert(&seen, pid) ){
192 pqueuex_insert(&queue, pid, -mtime, 0);
193 }
194 }
195 db_reset(&q);
196 }
197 bag_clear(&seen);
198 pqueuex_clear(&queue);
199 db_finalize(&ins);
200 db_finalize(&q);
201 } else
202 #endif
203 db_multi_exec(
204 "WITH RECURSIVE "
205 " ancestor(rid, mtime) AS ("
206 " SELECT %d, mtime FROM event WHERE objid=%d "
207 " UNION "
208
--- src/descendants.c
+++ src/descendants.c
@@ -162,46 +162,10 @@
162 /*
163 ** Load the record ID rid and up to N-1 closest ancestors into
164 ** the "ok" table.
165 */
166 void compute_ancestors(int rid, int N, int directOnly){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167 db_multi_exec(
168 "WITH RECURSIVE "
169 " ancestor(rid, mtime) AS ("
170 " SELECT %d, mtime FROM event WHERE objid=%d "
171 " UNION "
172
+3 -4
--- src/main.c
+++ src/main.c
@@ -580,17 +580,16 @@
580580
#endif
581581
{
582582
const char *zCmdName = "unknown";
583583
int idx;
584584
int rc;
585
- if( sqlite3_libversion_number()<3007017 ){
586
- fossil_fatal("Unsuitable SQLite version %s, must be at least 3.7.17",
585
+ if( sqlite3_libversion_number()<3008003 ){
586
+ fossil_fatal("Unsuitable SQLite version %s, must be at least 3.8.3",
587587
sqlite3_libversion());
588588
}
589
- sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
590
- sqlite3_config(32); /* SQLITE_CONFIG_EXPLAIN_COMMENTS (old) */
591589
sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
590
+ sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
592591
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
593592
memset(&g, 0, sizeof(g));
594593
g.now = time(0);
595594
g.httpHeader = empty_blob;
596595
#ifdef FOSSIL_ENABLE_JSON
597596
--- src/main.c
+++ src/main.c
@@ -580,17 +580,16 @@
580 #endif
581 {
582 const char *zCmdName = "unknown";
583 int idx;
584 int rc;
585 if( sqlite3_libversion_number()<3007017 ){
586 fossil_fatal("Unsuitable SQLite version %s, must be at least 3.7.17",
587 sqlite3_libversion());
588 }
589 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
590 sqlite3_config(32); /* SQLITE_CONFIG_EXPLAIN_COMMENTS (old) */
591 sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
 
592 sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
593 memset(&g, 0, sizeof(g));
594 g.now = time(0);
595 g.httpHeader = empty_blob;
596 #ifdef FOSSIL_ENABLE_JSON
597
--- src/main.c
+++ src/main.c
@@ -580,17 +580,16 @@
580 #endif
581 {
582 const char *zCmdName = "unknown";
583 int idx;
584 int rc;
585 if( sqlite3_libversion_number()<3008003 ){
586 fossil_fatal("Unsuitable SQLite version %s, must be at least 3.8.3",
587 sqlite3_libversion());
588 }
 
 
589 sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
590 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
591 sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
592 memset(&g, 0, sizeof(g));
593 g.now = time(0);
594 g.httpHeader = empty_blob;
595 #ifdef FOSSIL_ENABLE_JSON
596
+3 -4
--- src/main.c
+++ src/main.c
@@ -580,17 +580,16 @@
580580
#endif
581581
{
582582
const char *zCmdName = "unknown";
583583
int idx;
584584
int rc;
585
- if( sqlite3_libversion_number()<3007017 ){
586
- fossil_fatal("Unsuitable SQLite version %s, must be at least 3.7.17",
585
+ if( sqlite3_libversion_number()<3008003 ){
586
+ fossil_fatal("Unsuitable SQLite version %s, must be at least 3.8.3",
587587
sqlite3_libversion());
588588
}
589
- sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
590
- sqlite3_config(32); /* SQLITE_CONFIG_EXPLAIN_COMMENTS (old) */
591589
sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
590
+ sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
592591
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
593592
memset(&g, 0, sizeof(g));
594593
g.now = time(0);
595594
g.httpHeader = empty_blob;
596595
#ifdef FOSSIL_ENABLE_JSON
597596
--- src/main.c
+++ src/main.c
@@ -580,17 +580,16 @@
580 #endif
581 {
582 const char *zCmdName = "unknown";
583 int idx;
584 int rc;
585 if( sqlite3_libversion_number()<3007017 ){
586 fossil_fatal("Unsuitable SQLite version %s, must be at least 3.7.17",
587 sqlite3_libversion());
588 }
589 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
590 sqlite3_config(32); /* SQLITE_CONFIG_EXPLAIN_COMMENTS (old) */
591 sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
 
592 sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
593 memset(&g, 0, sizeof(g));
594 g.now = time(0);
595 g.httpHeader = empty_blob;
596 #ifdef FOSSIL_ENABLE_JSON
597
--- src/main.c
+++ src/main.c
@@ -580,17 +580,16 @@
580 #endif
581 {
582 const char *zCmdName = "unknown";
583 int idx;
584 int rc;
585 if( sqlite3_libversion_number()<3008003 ){
586 fossil_fatal("Unsuitable SQLite version %s, must be at least 3.8.3",
587 sqlite3_libversion());
588 }
 
 
589 sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
590 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
591 sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
592 memset(&g, 0, sizeof(g));
593 g.now = time(0);
594 g.httpHeader = empty_blob;
595 #ifdef FOSSIL_ENABLE_JSON
596
+2 -16
--- src/shell.c
+++ src/shell.c
@@ -1176,14 +1176,12 @@
11761176
fprintf(pArg->out, "Fullscan Steps: %d\n", iCur);
11771177
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
11781178
fprintf(pArg->out, "Sort Operations: %d\n", iCur);
11791179
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
11801180
fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur);
1181
- if( sqlite3_libversion_number()>=3008000 ){
1182
- iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1183
- fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
1184
- }
1181
+ iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1182
+ fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
11851183
}
11861184
11871185
return 0;
11881186
}
11891187
@@ -1353,21 +1351,10 @@
13531351
}
13541352
sqlite3_finalize(pExplain);
13551353
sqlite3_free(zEQP);
13561354
}
13571355
1358
-#if USE_SYSTEM_SQLITE+0==1
1359
- /* Output TESTCTRL_EXPLAIN text of requested */
1360
- if( pArg && pArg->mode==MODE_Explain && sqlite3_libversion_number()<3008007 ){
1361
- const char *zExplain = 0;
1362
- sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
1363
- if( zExplain && zExplain[0] ){
1364
- fprintf(pArg->out, "%s", zExplain);
1365
- }
1366
- }
1367
-#endif
1368
-
13691356
/* If the shell is currently in ".explain" mode, gather the extra
13701357
** data required to add indents to the output.*/
13711358
if( pArg && pArg->mode==MODE_Explain ){
13721359
explain_data_prepare(pArg, pStmt);
13731360
}
@@ -3909,11 +3896,10 @@
39093896
data->showHeader = 0;
39103897
data->shellFlgs = SHFLG_Lookaside;
39113898
sqlite3_config(SQLITE_CONFIG_URI, 1);
39123899
sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
39133900
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
3914
- sqlite3_config(32); /* SQLITE_CONFIG_EXPLAIN_COMMENTS (old) */
39153901
sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
39163902
sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
39173903
sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
39183904
}
39193905
39203906
--- src/shell.c
+++ src/shell.c
@@ -1176,14 +1176,12 @@
1176 fprintf(pArg->out, "Fullscan Steps: %d\n", iCur);
1177 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
1178 fprintf(pArg->out, "Sort Operations: %d\n", iCur);
1179 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
1180 fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur);
1181 if( sqlite3_libversion_number()>=3008000 ){
1182 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1183 fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
1184 }
1185 }
1186
1187 return 0;
1188 }
1189
@@ -1353,21 +1351,10 @@
1353 }
1354 sqlite3_finalize(pExplain);
1355 sqlite3_free(zEQP);
1356 }
1357
1358 #if USE_SYSTEM_SQLITE+0==1
1359 /* Output TESTCTRL_EXPLAIN text of requested */
1360 if( pArg && pArg->mode==MODE_Explain && sqlite3_libversion_number()<3008007 ){
1361 const char *zExplain = 0;
1362 sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
1363 if( zExplain && zExplain[0] ){
1364 fprintf(pArg->out, "%s", zExplain);
1365 }
1366 }
1367 #endif
1368
1369 /* If the shell is currently in ".explain" mode, gather the extra
1370 ** data required to add indents to the output.*/
1371 if( pArg && pArg->mode==MODE_Explain ){
1372 explain_data_prepare(pArg, pStmt);
1373 }
@@ -3909,11 +3896,10 @@
3909 data->showHeader = 0;
3910 data->shellFlgs = SHFLG_Lookaside;
3911 sqlite3_config(SQLITE_CONFIG_URI, 1);
3912 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
3913 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
3914 sqlite3_config(32); /* SQLITE_CONFIG_EXPLAIN_COMMENTS (old) */
3915 sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
3916 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
3917 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
3918 }
3919
3920
--- src/shell.c
+++ src/shell.c
@@ -1176,14 +1176,12 @@
1176 fprintf(pArg->out, "Fullscan Steps: %d\n", iCur);
1177 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
1178 fprintf(pArg->out, "Sort Operations: %d\n", iCur);
1179 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
1180 fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur);
1181 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1182 fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
 
 
1183 }
1184
1185 return 0;
1186 }
1187
@@ -1353,21 +1351,10 @@
1351 }
1352 sqlite3_finalize(pExplain);
1353 sqlite3_free(zEQP);
1354 }
1355
 
 
 
 
 
 
 
 
 
 
 
1356 /* If the shell is currently in ".explain" mode, gather the extra
1357 ** data required to add indents to the output.*/
1358 if( pArg && pArg->mode==MODE_Explain ){
1359 explain_data_prepare(pArg, pStmt);
1360 }
@@ -3909,11 +3896,10 @@
3896 data->showHeader = 0;
3897 data->shellFlgs = SHFLG_Lookaside;
3898 sqlite3_config(SQLITE_CONFIG_URI, 1);
3899 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
3900 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
 
3901 sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
3902 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
3903 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
3904 }
3905
3906
+2 -16
--- src/shell.c
+++ src/shell.c
@@ -1176,14 +1176,12 @@
11761176
fprintf(pArg->out, "Fullscan Steps: %d\n", iCur);
11771177
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
11781178
fprintf(pArg->out, "Sort Operations: %d\n", iCur);
11791179
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
11801180
fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur);
1181
- if( sqlite3_libversion_number()>=3008000 ){
1182
- iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1183
- fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
1184
- }
1181
+ iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1182
+ fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
11851183
}
11861184
11871185
return 0;
11881186
}
11891187
@@ -1353,21 +1351,10 @@
13531351
}
13541352
sqlite3_finalize(pExplain);
13551353
sqlite3_free(zEQP);
13561354
}
13571355
1358
-#if USE_SYSTEM_SQLITE+0==1
1359
- /* Output TESTCTRL_EXPLAIN text of requested */
1360
- if( pArg && pArg->mode==MODE_Explain && sqlite3_libversion_number()<3008007 ){
1361
- const char *zExplain = 0;
1362
- sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
1363
- if( zExplain && zExplain[0] ){
1364
- fprintf(pArg->out, "%s", zExplain);
1365
- }
1366
- }
1367
-#endif
1368
-
13691356
/* If the shell is currently in ".explain" mode, gather the extra
13701357
** data required to add indents to the output.*/
13711358
if( pArg && pArg->mode==MODE_Explain ){
13721359
explain_data_prepare(pArg, pStmt);
13731360
}
@@ -3909,11 +3896,10 @@
39093896
data->showHeader = 0;
39103897
data->shellFlgs = SHFLG_Lookaside;
39113898
sqlite3_config(SQLITE_CONFIG_URI, 1);
39123899
sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
39133900
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
3914
- sqlite3_config(32); /* SQLITE_CONFIG_EXPLAIN_COMMENTS (old) */
39153901
sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
39163902
sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
39173903
sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
39183904
}
39193905
39203906
--- src/shell.c
+++ src/shell.c
@@ -1176,14 +1176,12 @@
1176 fprintf(pArg->out, "Fullscan Steps: %d\n", iCur);
1177 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
1178 fprintf(pArg->out, "Sort Operations: %d\n", iCur);
1179 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
1180 fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur);
1181 if( sqlite3_libversion_number()>=3008000 ){
1182 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1183 fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
1184 }
1185 }
1186
1187 return 0;
1188 }
1189
@@ -1353,21 +1351,10 @@
1353 }
1354 sqlite3_finalize(pExplain);
1355 sqlite3_free(zEQP);
1356 }
1357
1358 #if USE_SYSTEM_SQLITE+0==1
1359 /* Output TESTCTRL_EXPLAIN text of requested */
1360 if( pArg && pArg->mode==MODE_Explain && sqlite3_libversion_number()<3008007 ){
1361 const char *zExplain = 0;
1362 sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
1363 if( zExplain && zExplain[0] ){
1364 fprintf(pArg->out, "%s", zExplain);
1365 }
1366 }
1367 #endif
1368
1369 /* If the shell is currently in ".explain" mode, gather the extra
1370 ** data required to add indents to the output.*/
1371 if( pArg && pArg->mode==MODE_Explain ){
1372 explain_data_prepare(pArg, pStmt);
1373 }
@@ -3909,11 +3896,10 @@
3909 data->showHeader = 0;
3910 data->shellFlgs = SHFLG_Lookaside;
3911 sqlite3_config(SQLITE_CONFIG_URI, 1);
3912 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
3913 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
3914 sqlite3_config(32); /* SQLITE_CONFIG_EXPLAIN_COMMENTS (old) */
3915 sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
3916 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
3917 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
3918 }
3919
3920
--- src/shell.c
+++ src/shell.c
@@ -1176,14 +1176,12 @@
1176 fprintf(pArg->out, "Fullscan Steps: %d\n", iCur);
1177 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
1178 fprintf(pArg->out, "Sort Operations: %d\n", iCur);
1179 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
1180 fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur);
1181 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1182 fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
 
 
1183 }
1184
1185 return 0;
1186 }
1187
@@ -1353,21 +1351,10 @@
1351 }
1352 sqlite3_finalize(pExplain);
1353 sqlite3_free(zEQP);
1354 }
1355
 
 
 
 
 
 
 
 
 
 
 
1356 /* If the shell is currently in ".explain" mode, gather the extra
1357 ** data required to add indents to the output.*/
1358 if( pArg && pArg->mode==MODE_Explain ){
1359 explain_data_prepare(pArg, pStmt);
1360 }
@@ -3909,11 +3896,10 @@
3896 data->showHeader = 0;
3897 data->shellFlgs = SHFLG_Lookaside;
3898 sqlite3_config(SQLITE_CONFIG_URI, 1);
3899 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
3900 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
 
3901 sqlite3_config(64); /* SQLITE_CONFIG_EXPLAIN_COMMENTS */
3902 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
3903 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
3904 }
3905
3906
+9
--- src/util.c
+++ src/util.c
@@ -78,10 +78,19 @@
7878
free(zNewCmd);
7979
#else
8080
/* On unix, evaluate the command directly.
8181
*/
8282
if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
83
+
84
+ /* Unix systems should never shell-out while processing an HTTP request,
85
+ ** either via CGI, SCGI, or direct HTTP. The following assert verifies
86
+ ** this. And the following assert proves that Fossil is not vulnerable
87
+ ** to the ShellShock or BashDoor bug.
88
+ */
89
+ assert( g.cgiOutput==0 );
90
+
91
+ /* The regular system() call works to get a shell on unix */
8392
rc = system(zOrigCmd);
8493
#endif
8594
return rc;
8695
}
8796
8897
--- src/util.c
+++ src/util.c
@@ -78,10 +78,19 @@
78 free(zNewCmd);
79 #else
80 /* On unix, evaluate the command directly.
81 */
82 if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
 
 
 
 
 
 
 
 
 
83 rc = system(zOrigCmd);
84 #endif
85 return rc;
86 }
87
88
--- src/util.c
+++ src/util.c
@@ -78,10 +78,19 @@
78 free(zNewCmd);
79 #else
80 /* On unix, evaluate the command directly.
81 */
82 if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
83
84 /* Unix systems should never shell-out while processing an HTTP request,
85 ** either via CGI, SCGI, or direct HTTP. The following assert verifies
86 ** this. And the following assert proves that Fossil is not vulnerable
87 ** to the ShellShock or BashDoor bug.
88 */
89 assert( g.cgiOutput==0 );
90
91 /* The regular system() call works to get a shell on unix */
92 rc = system(zOrigCmd);
93 #endif
94 return rc;
95 }
96
97

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button