-C Add\s"split"\smode\sin\sthe\sCLI.\s\sFix\sCLI\scommands\sgiven\son\sthe\scommand\sline\nso\sthat\sthey\shonor\s--once\sin\sprior\scommands.
-D 2025-11-22T23:34:53.769
+C Use\sthe\snew\s"split"\smode\sto\ssimplify\sand\simprove\sthe\simplementation\sof\nthe\s".tables"\sand\s".indexes"\scommands\sin\sthe\sCLI.\s\sFix\sa\sbug\sin\sQRF\nthat\sthis\snew\simplementation\sfound.
+D 2025-11-23T00:10:06.101
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F ext/misc/zipfile.c 09e6e3a3ff40a99677de3c0bc6569bd5f4709b1844ac3d1c1452a456c5a62f1c
F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee
F ext/qrf/README.md dd565fd1ca0c46ea37dbf4d496e368b9ecade768c92669640bc106e039629016
-F ext/qrf/qrf.c 032b61e09ace375674d27789688a957ee38518850b0fa588b6cf828850f62345
+F ext/qrf/qrf.c 1dea934e7af5718ce64c8101182250cdfcf2954ec6263496ed2847ca39e336e2
F ext/qrf/qrf.h bccc9d1c1b6a05fa0da56332bba29d85782318926f022c849114a63da916393f
F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8
F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255
F src/resolve.c 5616fbcf3b833c7c705b24371828215ad0925d0c0073216c4f153348d5753f0a
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c ba9cd07ffa3277883c1986085f6ddc4320f4d35d5f212ab58df79a7ecc1a576a
-F src/shell.c.in 977f8b9b108f37cdcce4c1a0f17e7809666aaa6c504f0752eb8c4ec7122999c4
+F src/shell.c.in 7f4a56ac62b5030755e72c5a9598b45782a0deccba350605b13d6d7b48e58b2d
F src/sqlite.h.in f1363321ca55cc2feaa289e9fe6dfb08102a28c54edf005564711a2348b06eef
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 5d5330f5f8461f5ce74960436ddcfa53ecd09c2b8b23901e22ae38aec3243998
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 3cee168e8801481f6d909fb5d20a773b9c6ca0b8daedfc301c9d762a17f9d839
-R 53605c07fff250aecf8e1982cc6fddce
+P 2530f04d1bb02b800fda83544f5b5dcd42f52b3e56ad625cd03b40e42f24ac6b
+R 51d2374ea006c46fbfbd23ef805a7a3f
U drh
-Z 5d5dcf7a665f0cd59987ab755e809ab9
+Z 753707664ad527223b8edfa6977e8080
# Remove this line to create a well-formed Fossil manifest.
|| (c=='i' && (cli_strncmp(azArg[0], "indices", n)==0
|| cli_strncmp(azArg[0], "indexes", n)==0) )
){
- sqlite3_stmt *pStmt;
- char **azResult;
- int nRow, nAlloc;
int ii;
- ShellText s;
- initText(&s);
+ sqlite3_stmt *pStmt;
+ sqlite3_str *pSql;
+ const char *zPattern = nArg>1 ? azArg[1] : 0;
+
open_db(p, 0);
rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
if( rc ){
sqlite3_finalize(pStmt);
goto meta_command_exit;
}
+ pSql = sqlite3_str_new(p->db);
for(ii=0; sqlite3_step(pStmt)==SQLITE_ROW; ii++){
const char *zDbName = (const char*)sqlite3_column_text(pStmt, 1);
if( zDbName==0 ) continue;
- if( s.zTxt && s.zTxt[0] ) appendText(&s, " UNION ALL ", 0);
+ if( sqlite3_str_length(pSql) ){
+ sqlite3_str_appendall(pSql, " UNION ALL ");
+ }
if( sqlite3_stricmp(zDbName, "main")==0 ){
- appendText(&s, "SELECT name FROM ", 0);
+ sqlite3_str_appendall(pSql, "SELECT name FROM ");
}else{
- appendText(&s, "SELECT ", 0);
- appendText(&s, zDbName, '\'');
- appendText(&s, "||'.'||name FROM ", 0);
+ sqlite3_str_appendf(pSql, "SELECT %Q||'.'||name FROM ", zDbName);
}
- appendText(&s, zDbName, '"');
- appendText(&s, ".sqlite_schema ", 0);
+ sqlite3_str_appendf(pSql, "\"%w\".sqlite_schema", zDbName);
if( c=='t' ){
- appendText(&s," WHERE type IN ('table','view')"
- " AND name NOT LIKE 'sqlite__%' ESCAPE '_'"
- " AND name LIKE ?1", 0);
+ sqlite3_str_appendf(pSql,
+ " WHERE type IN ('table','view')"
+ " AND name NOT LIKE 'sqlite__%%' ESCAPE '_'"
+ );
+ if( zPattern ){
+ sqlite3_str_appendf(pSql," AND name LIKE %Q", zPattern);
+ }
}else{
- appendText(&s," WHERE type='index'"
- " AND tbl_name LIKE ?1", 0);
+ sqlite3_str_appendf(pSql, " WHERE type='index'");
+ if( zPattern ){
+ sqlite3_str_appendf(pSql," AND tbl_name LIKE %Q", zPattern);
+ }
}
}
rc = sqlite3_finalize(pStmt);
if( rc==SQLITE_OK ){
- appendText(&s, " ORDER BY 1", 0);
- rc = sqlite3_prepare_v2(p->db, s.zTxt, -1, &pStmt, 0);
+ sqlite3_str_appendall(pSql, " ORDER BY 1");
}
- freeText(&s);
- if( rc ) return shellDatabaseError(p->db);
- /* Run the SQL statement prepared by the above block. Store the results
- ** as an array of nul-terminated strings in azResult[]. */
- nRow = nAlloc = 0;
- azResult = 0;
- if( nArg>1 ){
- sqlite3_bind_text(pStmt, 1, azArg[1], -1, SQLITE_TRANSIENT);
- }else{
- sqlite3_bind_text(pStmt, 1, "%", -1, SQLITE_STATIC);
- }
- while( sqlite3_step(pStmt)==SQLITE_ROW ){
- if( nRow>=nAlloc ){
- char **azNew;
- sqlite3_int64 n2 = 2*(sqlite3_int64)nAlloc + 10;
- azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2);
- shell_check_oom(azNew);
- nAlloc = (int)n2;
- azResult = azNew;
- }
- azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
- shell_check_oom(azResult[nRow]);
- nRow++;
- }
- if( sqlite3_finalize(pStmt)!=SQLITE_OK ){
- rc = shellDatabaseError(p->db);
- }
-
- /* Pretty-print the contents of array azResult[] to the output */
- if( rc==0 && nRow>0 ){
- int len, maxlen = 0;
- int i, j;
- int nPrintCol, nPrintRow;
- for(i=0; i<nRow; i++){
- len = strlen30(azResult[i]);
- if( len>maxlen ) maxlen = len;
- }
- nPrintCol = shellScreenWidth()/(maxlen+2);
- if( nPrintCol<1 ) nPrintCol = 1;
- nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
- for(i=0; i<nPrintRow; i++){
- for(j=i; j<nRow; j+=nPrintRow){
- char *zSp = j<nPrintRow ? "" : " ";
- cli_printf(p->out,
- "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j]:"");
- }
- cli_puts("\n", p->out);
- }
- }
-
- for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
- sqlite3_free(azResult);
+ /* Run the SQL statement in "split" mode. */
+ modePush(p);
+ modeChange(p, MODE_Split);
+ shell_exec(p, sqlite3_str_value(pSql), 0);
+ sqlite3_str_free(pSql);
+ modePop(p);
+ if( rc ) return shellDatabaseError(p->db);
}else
#ifndef SQLITE_SHELL_FIDDLE