Fossil SCM
Cherry-pick [http://www.sqlite.org/src/info/19fe4a0a475bd94f491031aea7a183f7c0515cf3|19fe4a0a47]: Fix a (probably harmless) bug in the CSV output mode of the command-line shell. Put back some code, removed by [http://fossil-scm.org/index.html/fdiff?v1=c00220cdd7f2027780bc25b78376c16dc24e4b7d&v2=38f627b0885191357f55902a3ac199de90d79715&sbs=1|c001fa0edf]: when fossil is linked with SQLite < 3.8.7 it might still be needed to produce the same EXPLAIN output.
Commit
f6b69db3c88cb96e25fac3bfda4baad56760e717
Parent
0ab00799595231f…
1 file changed
+12
-1
+12
-1
| --- src/shell.c | ||
| +++ src/shell.c | ||
| @@ -880,11 +880,11 @@ | ||
| 880 | 880 | for(i=0; i<nArg; i++){ |
| 881 | 881 | output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1); |
| 882 | 882 | } |
| 883 | 883 | fprintf(p->out,"%s",p->newline); |
| 884 | 884 | } |
| 885 | - if( azArg>0 ){ | |
| 885 | + if( nArg>0 ){ | |
| 886 | 886 | for(i=0; i<nArg; i++){ |
| 887 | 887 | output_csv(p, azArg[i], i<nArg-1); |
| 888 | 888 | } |
| 889 | 889 | fprintf(p->out,"%s",p->newline); |
| 890 | 890 | } |
| @@ -1350,10 +1350,21 @@ | ||
| 1350 | 1350 | } |
| 1351 | 1351 | } |
| 1352 | 1352 | sqlite3_finalize(pExplain); |
| 1353 | 1353 | sqlite3_free(zEQP); |
| 1354 | 1354 | } |
| 1355 | + | |
| 1356 | +#if USE_SYSTEM_SQLITE+0==1 | |
| 1357 | + /* Output TESTCTRL_EXPLAIN text of requested */ | |
| 1358 | + if( pArg && pArg->mode==MODE_Explain && sqlite3_libversion_number()<3008007 ){ | |
| 1359 | + const char *zExplain = 0; | |
| 1360 | + sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain); | |
| 1361 | + if( zExplain && zExplain[0] ){ | |
| 1362 | + fprintf(pArg->out, "%s", zExplain); | |
| 1363 | + } | |
| 1364 | + } | |
| 1365 | +#endif | |
| 1355 | 1366 | |
| 1356 | 1367 | /* If the shell is currently in ".explain" mode, gather the extra |
| 1357 | 1368 | ** data required to add indents to the output.*/ |
| 1358 | 1369 | if( pArg && pArg->mode==MODE_Explain ){ |
| 1359 | 1370 | explain_data_prepare(pArg, pStmt); |
| 1360 | 1371 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -880,11 +880,11 @@ | |
| 880 | for(i=0; i<nArg; i++){ |
| 881 | output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1); |
| 882 | } |
| 883 | fprintf(p->out,"%s",p->newline); |
| 884 | } |
| 885 | if( azArg>0 ){ |
| 886 | for(i=0; i<nArg; i++){ |
| 887 | output_csv(p, azArg[i], i<nArg-1); |
| 888 | } |
| 889 | fprintf(p->out,"%s",p->newline); |
| 890 | } |
| @@ -1350,10 +1350,21 @@ | |
| 1350 | } |
| 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 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -880,11 +880,11 @@ | |
| 880 | for(i=0; i<nArg; i++){ |
| 881 | output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1); |
| 882 | } |
| 883 | fprintf(p->out,"%s",p->newline); |
| 884 | } |
| 885 | if( nArg>0 ){ |
| 886 | for(i=0; i<nArg; i++){ |
| 887 | output_csv(p, azArg[i], i<nArg-1); |
| 888 | } |
| 889 | fprintf(p->out,"%s",p->newline); |
| 890 | } |
| @@ -1350,10 +1350,21 @@ | |
| 1350 | } |
| 1351 | } |
| 1352 | sqlite3_finalize(pExplain); |
| 1353 | sqlite3_free(zEQP); |
| 1354 | } |
| 1355 | |
| 1356 | #if USE_SYSTEM_SQLITE+0==1 |
| 1357 | /* Output TESTCTRL_EXPLAIN text of requested */ |
| 1358 | if( pArg && pArg->mode==MODE_Explain && sqlite3_libversion_number()<3008007 ){ |
| 1359 | const char *zExplain = 0; |
| 1360 | sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain); |
| 1361 | if( zExplain && zExplain[0] ){ |
| 1362 | fprintf(pArg->out, "%s", zExplain); |
| 1363 | } |
| 1364 | } |
| 1365 | #endif |
| 1366 | |
| 1367 | /* If the shell is currently in ".explain" mode, gather the extra |
| 1368 | ** data required to add indents to the output.*/ |
| 1369 | if( pArg && pArg->mode==MODE_Explain ){ |
| 1370 | explain_data_prepare(pArg, pStmt); |
| 1371 |