-C Rewrite\sthe\s".schema"\sand\s".fullschema"\scommands\sin\sthe\sCLI\sso\sas\sto\neliminate\sthe\sneed\sfor\sMODE_Pretty\sand\sMODE_Semi.
-D 2025-11-10T15:01:57.916
+C The\s".www"\scommand\sis\snow\shandled\sby\sQRF.\s\sSo\sat\sthis\spoint,\sQRF\shandles\nall\squery\sresult\sformatting\sin\sthe\sCLI\sand\sthe\slegacy\sformatter\shas\sbeen\nremoved\sfrom\sthe\scode.
+D 2025-11-10T15:56:18.937
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F src/resolve.c 5616fbcf3b833c7c705b24371828215ad0925d0c0073216c4f153348d5753f0a
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c ba9cd07ffa3277883c1986085f6ddc4320f4d35d5f212ab58df79a7ecc1a576a
-F src/shell.c.in 67b7893f9f9c992d616a3de8b20a0ae7b9add36f533e752497e259555c354977
+F src/shell.c.in 2de811229c16b13c38c019d9ce449ba40f93734681a4d5c6d194c44fe9c1f75c
F src/sqlite.h.in 7403a952a8f1239de7525b73c4e3a0f9540ec0607ed24fec887f5832642d44b8
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 7f236ca1b175ffe03316d974ef57df79b3938466c28d2f95caef5e08c57f3a52
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 2ba92320db3c16c3c91e29ea935ae92da546261f25846d242bd2dd27e0b7e032
-R 9da3decf0638564c4eb7bbfbd4a9d2e1
+P 0eb0410f725eed44973cf8712ab2d24c16fb5cbb249b5780f8fe5d41b2193d79
+R 00bfc0527e98b76f591e01157abf37f0
U drh
-Z ddcc91cce64e019052cede211043e861
+Z a342d7d49c0ab55f3ea5c8cac28ceec8
# Remove this line to create a well-formed Fossil manifest.
/* box */ QRF_STYLE_Box,
/* count */ QRF_STYLE_Count,
/* off */ QRF_STYLE_Off,
- /* www */ 108,
+ /* www */ QRF_STYLE_Html,
};
/*
sqlite3_fputs(zq, out);
}
-/*
-** Output the given string with characters that are special to
-** HTML escaped.
-*/
-static void output_html_string(FILE *out, const char *z){
- int i;
- if( z==0 ) z = "";
- while( *z ){
- for(i=0; z[i]
- && z[i]!='<'
- && z[i]!='&'
- && z[i]!='>'
- && z[i]!='\"'
- && z[i]!='\'';
- i++){}
- if( i>0 ){
- sqlite3_fprintf(out, "%.*s",i,z);
- }
- if( z[i]=='<' ){
- sqlite3_fputs("<", out);
- }else if( z[i]=='&' ){
- sqlite3_fputs("&", out);
- }else if( z[i]=='>' ){
- sqlite3_fputs(">", out);
- }else if( z[i]=='\"' ){
- sqlite3_fputs(""", out);
- }else if( z[i]=='\'' ){
- sqlite3_fputs("'", out);
- }else{
- break;
- }
- z += i + 1;
- }
-}
-
/*
** This routine runs when the user presses Ctrl-C
*/
}
#endif /* SQLITE_OMIT_PROGRESS_CALLBACK */
-/*
-** This is the callback routine that the shell
-** invokes for each row of a query result.
-*/
-static int shell_callback(
- void *pArg,
- int nArg, /* Number of result columns */
- char **azArg, /* Text of each result column */
- char **azCol, /* Column names */
- int *aiType /* Column types. Might be NULL */
-){
- int i;
- ShellState *p = (ShellState*)pArg;
-
- if( azArg==0 ) return 0;
- switch( p->cMode ){
- case MODE_Count: assert(0); break;
- case MODE_Off: assert(0); break;
- case MODE_Line: assert(0); break;
- case MODE_List: assert(0); break;
- case MODE_Html: assert(0); break;
- case MODE_Www: {
- if( p->cnt==0 && p->cMode==MODE_Www ){
- sqlite3_fputs(
- "</PRE>\n"
- "<TABLE border='1' cellspacing='0' cellpadding='2'>\n"
- ,p->out
- );
- }
- if( p->cnt==0 && (p->showHeader || p->cMode==MODE_Www) ){
- sqlite3_fputs("<TR>", p->out);
- for(i=0; i<nArg; i++){
- sqlite3_fputs("<TH>", p->out);
- output_html_string(p->out, azCol[i]);
- sqlite3_fputs("</TH>\n", p->out);
- }
- sqlite3_fputs("</TR>\n", p->out);
- }
- p->cnt++;
- if( azArg==0 ) break;
- sqlite3_fputs("<TR>", p->out);
- for(i=0; i<nArg; i++){
- sqlite3_fputs("<TD>", p->out);
- output_html_string(p->out, azArg[i] ? azArg[i] : p->nullValue);
- sqlite3_fputs("</TD>\n", p->out);
- }
- sqlite3_fputs("</TR>\n", p->out);
- break;
- }
- case MODE_Tcl: assert(0); break;
- case MODE_Csv: assert(0); break;
- case MODE_Insert: assert(0); break;
- case MODE_Json: assert(0); break;
- case MODE_Quote: assert(0); break;
- case MODE_Ascii: assert(0); break;
- }
- return 0;
-}
-
/*
** This is the callback routine from sqlite3_exec() that appends all
** output onto the end of a ShellText object.
sqlite3_finalize(pQ);
}
-/*
-** Run a prepared statement
-*/
-static void exec_prepared_stmt(
- ShellState *pArg, /* Pointer to ShellState */
- sqlite3_stmt *pStmt /* Statement to run */
-){
- int rc;
- sqlite3_uint64 nRow = 0;
-
- assert( pArg->cMode!=MODE_Column );
- assert( pArg->cMode!=MODE_Table );
- assert( pArg->cMode!=MODE_Box );
- assert( pArg->cMode!=MODE_Markdown );
-
- /* perform the first step. this will tell us if we
- ** have a result set or not and how wide it is.
- */
- rc = sqlite3_step(pStmt);
- /* if we have a result set... */
- if( SQLITE_ROW == rc ){
- /* allocate space for col name ptr, value ptr, and type */
- int nCol = sqlite3_column_count(pStmt);
- void *pData = sqlite3_malloc64(3*nCol*sizeof(const char*) + 1);
- if( !pData ){
- shell_out_of_memory();
- }else{
- char **azCols = (char **)pData; /* Names of result columns */
- char **azVals = &azCols[nCol]; /* Results */
- int *aiTypes = (int *)&azVals[nCol]; /* Result types */
- int i, x;
- assert(sizeof(int) <= sizeof(char *));
- /* save off ptrs to column names */
- for(i=0; i<nCol; i++){
- azCols[i] = (char *)sqlite3_column_name(pStmt, i);
- }
- do{
- nRow++;
- /* extract the data and data types */
- for(i=0; i<nCol; i++){
- aiTypes[i] = x = sqlite3_column_type(pStmt, i);
- if( x==SQLITE_BLOB
- && pArg
- && (pArg->cMode==MODE_Insert || pArg->cMode==MODE_Quote)
- ){
- azVals[i] = "";
- }else{
- azVals[i] = (char*)sqlite3_column_text(pStmt, i);
- }
- if( !azVals[i] && (aiTypes[i]!=SQLITE_NULL) ){
- rc = SQLITE_NOMEM;
- break; /* from for */
- }
- } /* end for */
-
- /* if data and types extracted successfully... */
- if( SQLITE_ROW == rc ){
- /* call the supplied callback with the result row data */
- if( shell_callback(pArg, nCol, azVals, azCols, aiTypes) ){
- rc = SQLITE_ABORT;
- }else{
- rc = sqlite3_step(pStmt);
- }
- }
- } while( SQLITE_ROW == rc );
- sqlite3_free(pData);
- if( pArg->cMode==MODE_Json ){
- sqlite3_fputs("]\n", pArg->out);
- }else if( pArg->cMode==MODE_Www ){
- sqlite3_fputs("</TABLE>\n<PRE>\n", pArg->out);
- }else if( pArg->cMode==MODE_Count ){
- char zBuf[200];
- sqlite3_snprintf(sizeof(zBuf), zBuf, "%llu row%s\n",
- nRow, nRow!=1 ? "s" : "");
- printf("%s", zBuf);
- }
- }
- }
-}
-
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_AUTHORIZATION)
/*
** This function is called to process SQL if the previous shell command
default: spec.eEsc = QRF_ESC_Off; break;
}
spec.bColumnNames = pArg->showHeader!=0 ? QRF_SW_On : QRF_SW_Off;
- switch( pArg->cMode ){
+ switch( pArg->mode ){
case MODE_Insert: {
if( ShellHasFlag(pArg, SHFLG_PreserveRowid) ){
spec.bColumnNames = QRF_SW_On;
break;
}
}
- if( pArg->cMode>=0
- && pArg->cMode<ArraySize(aQrfStyle)
- && aQrfStyle[pArg->cMode]<100
- ){
- eStyle = aQrfStyle[pArg->cMode];
- }else{
- eStyle = 199;
- }
+ assert( pArg->mode>=0 && pArg->mode<ArraySize(aQrfStyle) );
+ eStyle = aQrfStyle[pArg->mode];
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_AUTHORIZATION)
if( pArg->expert.pExpert ){
if( isExplain && pArg->autoExplain ){
spec.eStyle = isExplain==1 ? QRF_STYLE_Explain : QRF_STYLE_Eqp;
sqlite3_format_query_result(pStmt, &spec, pzErrMsg);
- }else if( eStyle<100 ){
- spec.eStyle = eStyle;
+ }else if( pArg->mode==MODE_Www ){
+ sqlite3_fprintf(pArg->out,
+ "</PRE>\n"
+ "<TABLE border='1' cellspacing='0' cellpadding='2'>\n");
+ spec.eStyle = QRF_STYLE_Html;
sqlite3_format_query_result(pStmt, &spec, pzErrMsg);
+ sqlite3_fprintf(pArg->out,
+ "</TABLE>\n"
+ "<PRE>");
}else{
- exec_prepared_stmt(pArg, pStmt);
+ spec.eStyle = eStyle;
+ sqlite3_format_query_result(pStmt, &spec, pzErrMsg);
}
/* print usage stats if stats on */