]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove about a thousand lines of dead code from shell.c.in.
authordrh <>
Sat, 8 Nov 2025 23:35:57 +0000 (23:35 +0000)
committerdrh <>
Sat, 8 Nov 2025 23:35:57 +0000 (23:35 +0000)
FossilOrigin-Name: efbcc7decd5347e3460cc3ed62720c8c3932225dfdf92293a990c51895450906

manifest
manifest.uuid
src/shell.c.in
test/shell1.test

index e8647c10998508c29a861b185131b7e0742fb6bf..eaec1683cad1c554facdd58c9fc9a01f622a329b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Name\schanges.\s\sQRF_TEXT_Off\sbecomes\sQRF_TEXT_Plain.\s\smxTotalWidth\sbecomes\nnScreenWidth.
-D 2025-11-08T22:46:29.898
+C Remove\sabout\sa\sthousand\slines\sof\sdead\scode\sfrom\sshell.c.in.
+D 2025-11-08T23:35:57.752
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -735,7 +735,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c 5616fbcf3b833c7c705b24371828215ad0925d0c0073216c4f153348d5753f0a
 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
 F src/select.c ba9cd07ffa3277883c1986085f6ddc4320f4d35d5f212ab58df79a7ecc1a576a
-F src/shell.c.in d355f1254c435152c65a3df76d117342bfe3ef84a94c05be84d1e246c2c8d5d2
+F src/shell.c.in b4c486e6ba11aa5639e8abe90b4e093b6b233d5b833d90c8c344ec959c7b0446
 F src/sqlite.h.in 43f60117ce68847b9d4e7fa43c2ac42bb324185e66b924d3114b24d4037fc263
 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
 F src/sqlite3ext.h 7f236ca1b175ffe03316d974ef57df79b3938466c28d2f95caef5e08c57f3a52
@@ -1601,7 +1601,7 @@ F test/sharedA.test 64bdd21216dda2c6a3bd3475348ccdc108160f34682c97f2f51c19fc0e21
 F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8ee707
 F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
-F test/shell1.test 5b72afb03752278e18c7faeda7329e6118a04e07a4203837bea9d66866d2cd0b
+F test/shell1.test 25c90db401a323ab65c299728446ca6042388acdca3b4883a48e10e8aeda61ec
 F test/shell2.test d8da6a06dcce1d8f04f776f918d4d57c28ddc28c54f3a44f95429794892e3a91
 F test/shell3.test 603b448e917537cf77be0f265c05c6f63bc677c63a533c8e96aae923b56f4a0e
 F test/shell4.test 03593fa7908a55f255916ffeda707cdf55680c777736e3da62b1d78cde0d684d
@@ -2173,8 +2173,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 23ddc38cf19845a385c8b33002805c3c864ab9b2e36c3d609794444b06d20c89
-R b6f6aa554fc5421ef5be83514503ceb2
+P 871567e377e976e0bb191d466019d1d4abe126f2da1880f1e25cd92b06a666d1
+R 7f92fe9bce1195a07bb82051f285216a
 U drh
-Z 55336ab4764d6f83d6e0beaecb47e53f
+Z 0c39792436bfc66d82520f9e3f716ced
 # Remove this line to create a well-formed Fossil manifest.
index 7b1bcd2489220b84a190d3cfe2cb0dbf4bd06229..06f60e03b3441b6a832ef9fed1a36c85f8031321 100644 (file)
@@ -1 +1 @@
-871567e377e976e0bb191d466019d1d4abe126f2da1880f1e25cd92b06a666d1
+efbcc7decd5347e3460cc3ed62720c8c3932225dfdf92293a990c51895450906
index 51a615aa18a171c48407b67d9e249dbac6de277b..30a80accce0e869d8868d832a773f00d98f358e7 100644 (file)
@@ -653,136 +653,6 @@ static void SQLITE_CDECL iotracePrintf(const char *zFormat, ...){
 }
 #endif
 
-/*
-** Compute the value and length of a multi-byte UTF-8 character that
-** begins at z[0].   Return the length.  Write the Unicode value into *pU.
-**
-** This routine only works for *multi-byte* UTF-8 characters.
-*/
-static int decodeUtf8(const unsigned char *z, int *pU){
-  if( (z[0] & 0xe0)==0xc0 && (z[1] & 0xc0)==0x80 ){
-    *pU = ((z[0] & 0x1f)<<6) | (z[1] & 0x3f);
-    return 2;
-  }
-  if( (z[0] & 0xf0)==0xe0 && (z[1] & 0xc0)==0x80 && (z[2] & 0xc0)==0x80 ){
-    *pU = ((z[0] & 0x0f)<<12) | ((z[1] & 0x3f)<<6) | (z[2] & 0x3f);
-    return 3;
-  }
-  if( (z[0] & 0xf8)==0xf0 && (z[1] & 0xc0)==0x80 && (z[2] & 0xc0)==0x80
-   && (z[3] & 0xc0)==0x80
-  ){
-    *pU = ((z[0] & 0x0f)<<18) | ((z[1] & 0x3f)<<12) | ((z[2] & 0x3f))<<6
-                              | (z[3] & 0x3f);
-    return 4;
-  }
-  *pU = 0;
-  return 1;
-}
-
-
-#if 0 /* NOT USED */
-/*
-** Return the width, in display columns, of a UTF-8 string.
-**
-** Each normal character counts as 1.  Zero-width characters count
-** as zero, and double-width characters count as 2.
-*/
-int cli_wcswidth(const char *z){
-  const unsigned char *a = (const unsigned char*)z;
-  int n = 0;
-  int i = 0;
-  unsigned char c;
-  while( (c = a[i])!=0 ){
-    if( c>=0xc0 ){
-      int u;
-      int len = decodeUtf8(&a[i], &u);
-      i += len;
-      n += sqlite3_qrf_wcwidth(u);
-    }else if( c>=' ' ){
-      n++;
-      i++;
-    }else{
-      i++;
-    }
-  }
-  return n;
-}
-#endif
-
-/*
-** Check to see if z[] is a valid VT100 escape.  If it is, then
-** return the number of bytes in the escape sequence.  Return 0 if
-** z[] is not a VT100 escape.
-**
-** This routine assumes that z[0] is \033 (ESC).
-*/
-static int isVt100(const unsigned char *z){
-  int i;
-  if( z[1]!='[' ) return 0;
-  i = 2;
-  while( z[i]>=0x30 && z[i]<=0x3f ){ i++; }
-  while( z[i]>=0x20 && z[i]<=0x2f ){ i++; }
-  if( z[i]<0x40 || z[i]>0x7e ) return 0;
-  return i+1;
-}
-
-/*
-** Output string zUtf to stdout as w characters.  If w is negative,
-** then right-justify the text.  W is the width in UTF-8 characters, not
-** in bytes.  This is different from the %*.*s specification in printf
-** since with %*.*s the width is measured in bytes, not characters.
-**
-** Take into account zero-width and double-width Unicode characters.
-** In other words, a zero-width character does not count toward the
-** the w limit.  A double-width character counts as two.
-**
-** w should normally be a small number.  A couple hundred at most.  This
-** routine caps w at 100 million to avoid integer overflow issues.
-*/
-static void utf8_width_print(FILE *out, int w, const char *zUtf){
-  const unsigned char *a = (const unsigned char*)zUtf;
-  static const int mxW = 10000000;
-  unsigned char c;
-  int i = 0;
-  int n = 0;
-  int k;
-  int aw;
-  if( w<-mxW ){
-    w = -mxW;
-  }else if( w>mxW ){
-    w= mxW;
-  }
-  aw = w<0 ? -w : w;
-  if( zUtf==0 ) zUtf = "";
-  while( (c = a[i])!=0 ){
-    if( (c&0xc0)==0xc0 ){
-      int u;
-      int len = decodeUtf8(a+i, &u);
-      int x = sqlite3_qrf_wcwidth(u);
-      if( x+n>aw ){
-        break;
-      }
-      i += len;
-      n += x;
-    }else if( c==0x1b && (k = isVt100(&a[i]))>0 ){
-      i += k;       
-    }else if( n>=aw ){
-      break;
-    }else{
-      n++;
-      i++;
-    }
-  }
-  if( n>=aw ){
-    sqlite3_fprintf(out, "%.*s", i, zUtf);
-  }else if( w<0 ){
-    sqlite3_fprintf(out, "%*s%s", aw-n, "", zUtf);
-  }else{
-    sqlite3_fprintf(out, "%s%*s", zUtf, aw-n, "");
-  }
-}
-
-
 /*
 ** Determines if a string is a number of not.
 */
@@ -820,27 +690,6 @@ static int strlen30(const char *z){
   return 0x3fffffff & (int)(z2 - z);
 }
 
-/*
-** Return the length of a string in characters.  Multibyte UTF8 characters
-** count as a single character for single-width characters, or as two
-** characters for double-width characters.
-*/
-static int strlenChar(const char *z){
-  int n = 0;
-  while( *z ){
-    if( (0x80&z[0])==0 ){
-      n++;
-      z++;
-    }else{
-      int u = 0;
-      int len = decodeUtf8((const u8*)z, &u);
-      z += len;
-      n += sqlite3_qrf_wcwidth(u);
-    }
-  }
-  return n;
-}
-
 /*
 ** Return open FILE * if zFile exists, can be opened for read
 ** and is an ordinary file or a character stream source.
@@ -1440,9 +1289,6 @@ struct ShellState {
 #endif
   } aAuxDb[5],           /* Array of all database connections */
     *pAuxDb;             /* Currently active database connection */
-  int *aiIndent;         /* Array of indents used in MODE_Explain */
-  int nIndent;           /* Size of array aiIndent[] */
-  int iIndent;           /* Index of current op in aiIndent[] */
   char *zNonce;          /* Nonce for temporary safe-mode escapes */
 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_AUTHORIZATION)
   ExpertInfo expert;     /* Valid if previous command was ".expert OPT..." */
@@ -1533,18 +1379,15 @@ static const char *shell_EscModeNames[] = { "ascii", "symbol", "off" };
 #define MODE_Quote    6  /* Quote values as for SQL */
 #define MODE_Tcl      7  /* Generate ANSI-C or TCL quoted elements */
 #define MODE_Csv      8  /* Quote strings, numbers are plain */
-#define MODE_Explain  9  /* Like MODE_Column, but do not truncate data */
-#define MODE_Ascii   10  /* Use ASCII unit and record separators (0x1F/0x1E) */
-#define MODE_Pretty  11  /* Pretty-print schemas */
-#define MODE_EQP     12  /* Converts EXPLAIN QUERY PLAN output into a graph */
-#define MODE_Json    13  /* Output JSON */
-#define MODE_Markdown 14 /* Markdown formatting */
-#define MODE_Table   15  /* MySQL-style table formatting */
-#define MODE_Box     16  /* Unicode box-drawing characters */
-#define MODE_Count   17  /* Output only a count of the rows of output */
-#define MODE_Off     18  /* No query output shown */
-#define MODE_ScanExp 19  /* Like MODE_Explain, but for ".scanstats vm" */
-#define MODE_Www     20  /* Full web-page output */
+#define MODE_Ascii    9  /* Use ASCII unit and record separators (0x1F/0x1E) */
+#define MODE_Pretty  10  /* Pretty-print schemas */
+#define MODE_Json    11  /* Output JSON */
+#define MODE_Markdown 12 /* Markdown formatting */
+#define MODE_Table   13  /* MySQL-style table formatting */
+#define MODE_Box     14  /* Unicode box-drawing characters */
+#define MODE_Count   15  /* Output only a count of the rows of output */
+#define MODE_Off     16  /* No query output shown */
+#define MODE_Www     17  /* Full web-page output */
 
 static const char *modeDescr[] = {
   "line",
@@ -1556,17 +1399,14 @@ static const char *modeDescr[] = {
   "quote",
   "tcl",
   "csv",
-  "explain",
   "ascii",
   "prettyprint",
-  "eqp",
   "json",
   "markdown",
   "table",
   "box",
   "count",
   "off",
-  "scanexp",
   "www",
 };
 
@@ -1581,17 +1421,14 @@ static const unsigned char aQrfStyle[] = {
   /* quote */        QRF_STYLE_Quote,
   /* tcl */          102,
   /* csv */          QRF_STYLE_Csv,
-  /* explain */      103,
   /* ascii */        104,
   /* prettyprint */  105,
-  /* eqp */          106,
   /* json */         QRF_STYLE_Json,
   /* markdown */     QRF_STYLE_Markdown,
   /* table */        QRF_STYLE_Table,
   /* box */          QRF_STYLE_Box,
   /* count */        QRF_STYLE_Count,
   /* off */          QRF_STYLE_Off,
-  /* scanexp */      107,
   /* www */          108,
 };
 
@@ -2477,40 +2314,6 @@ static int progress_handler(void *pClientData) {
 }
 #endif /* SQLITE_OMIT_PROGRESS_CALLBACK */
 
-/*
-** Print N dashes
-*/
-static void print_dashes(FILE *out, int N){
-  const char zDash[] = "--------------------------------------------------";
-  const int nDash = sizeof(zDash) - 1;
-  while( N>nDash ){
-    sqlite3_fputs(zDash, out);
-    N -= nDash;
-  }
-  sqlite3_fprintf(out, "%.*s", N, zDash);
-}
-
-/*
-** Print a markdown or table-style row separator using ascii-art
-*/
-static void print_row_separator(
-  ShellState *p,
-  int nArg,
-  const char *zSep
-){
-  int i;
-  if( nArg>0 ){
-    sqlite3_fputs(zSep, p->out);
-    print_dashes(p->out, p->actualWidth[0]+2);
-    for(i=1; i<nArg; i++){
-      sqlite3_fputs(zSep, p->out);
-      print_dashes(p->out, p->actualWidth[i]+2);
-    }
-    sqlite3_fputs(zSep, p->out);
-  }
-  sqlite3_fputs("\n", p->out);
-}
-
 /*
 ** This is the callback routine that the shell
 ** invokes for each row of a query result.
@@ -2527,83 +2330,9 @@ static int shell_callback(
 
   if( azArg==0 ) return 0;
   switch( p->cMode ){
-    case MODE_Count:
-    case MODE_Off: {
-      break;
-    }
-    case MODE_Line: {
-      int w = 5;
-      if( azArg==0 ) break;
-      for(i=0; i<nArg; i++){
-        int len = strlen30(azCol[i] ? azCol[i] : "");
-        if( len>w ) w = len;
-      }
-      if( p->cnt++>0 ) sqlite3_fputs(p->rowSeparator, p->out);
-      for(i=0; i<nArg; i++){
-        char *pFree = 0;
-        const char *pDisplay;
-        pDisplay = escapeOutput(p, azArg[i] ? azArg[i] : p->nullValue, &pFree);
-        sqlite3_fprintf(p->out, "%*s = %s%s", w, azCol[i],
-                        pDisplay, p->rowSeparator);
-        if( pFree ) sqlite3_free(pFree);
-      }
-      break;
-    }
-    case MODE_ScanExp:
-    case MODE_Explain: {
-      static const int aExplainWidth[] = {4,       13, 4, 4, 4, 13, 2, 13};
-      static const int aExplainMap[] =   {0,       1,  2, 3, 4, 5,  6, 7 };
-      static const int aScanExpWidth[] = {4, 15, 6, 13, 4, 4, 4, 13, 2, 13};
-      static const int aScanExpMap[] =   {0, 9, 8, 1,  2, 3, 4, 5,  6, 7 };
-
-      const int *aWidth = aExplainWidth;
-      const int *aMap = aExplainMap;
-      int nWidth = ArraySize(aExplainWidth);
-      int iIndent = 1;
-
-      if( p->cMode==MODE_ScanExp ){
-        aWidth = aScanExpWidth;
-        aMap = aScanExpMap;
-        nWidth = ArraySize(aScanExpWidth);
-        iIndent = 3;
-      }
-      if( nArg>nWidth ) nArg = nWidth;
-
-      /* If this is the first row seen, print out the headers */
-      if( p->cnt++==0 ){
-        for(i=0; i<nArg; i++){
-          utf8_width_print(p->out, aWidth[i], azCol[ aMap[i] ]);
-          sqlite3_fputs(i==nArg-1 ? "\n" : "  ", p->out);
-        }
-        for(i=0; i<nArg; i++){
-          print_dashes(p->out, aWidth[i]);
-          sqlite3_fputs(i==nArg-1 ? "\n" : "  ", p->out);
-        }
-      }
-
-      /* If there is no data, exit early. */
-      if( azArg==0 ) break;
-
-      for(i=0; i<nArg; i++){
-        const char *zSep = "  ";
-        int w = aWidth[i];
-        const char *zVal = azArg[ aMap[i] ];
-        if( i==nArg-1 ) w = 0;
-        if( zVal && strlenChar(zVal)>w ){
-          w = strlenChar(zVal);
-          zSep = " ";
-        }
-        if( i==iIndent && p->aiIndent && p->pStmt ){
-          if( p->iIndent<p->nIndent ){
-            sqlite3_fprintf(p->out, "%*.s", p->aiIndent[p->iIndent], "");
-          }
-          p->iIndent++;
-        }
-        utf8_width_print(p->out, w, zVal ? zVal : p->nullValue);
-        sqlite3_fputs(i==nArg-1 ? "\n" : zSep, p->out);
-      }
-      break;
-    }
+    case MODE_Count:  assert(0);   break;
+    case MODE_Off:    assert(0);   break;
+    case MODE_Line:   assert(0);   break;
     case MODE_Semi: {   /* .schema and .fullschema output */
       printSchemaLine(p->out, azArg[0], ";\n");
       break;
@@ -2690,32 +2419,9 @@ static int shell_callback(
       sqlite3_free(z);
       break;
     }
-    case MODE_List: {
-      if( p->cnt++==0 && p->showHeader ){
-        for(i=0; i<nArg; i++){
-          char *z = azCol[i];
-          char *pFree;
-          const char *zOut = escapeOutput(p, z, &pFree);
-          sqlite3_fprintf(p->out, "%s%s", zOut,
-                          i==nArg-1 ? p->rowSeparator : p->colSeparator);
-          if( pFree ) sqlite3_free(pFree);
-        }
-      }
-      if( azArg==0 ) break;
-      for(i=0; i<nArg; i++){
-        char *z = azArg[i];
-        char *pFree;
-        const char *zOut;
-        if( z==0 ) z = p->nullValue;
-        zOut = escapeOutput(p, z, &pFree);
-        sqlite3_fputs(zOut, p->out);
-        if( pFree ) sqlite3_free(pFree);
-        sqlite3_fputs((i<nArg-1)? p->colSeparator : p->rowSeparator, p->out);
-      }
-      break;
-    }
-    case MODE_Www:
-    case MODE_Html: {
+    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"
@@ -2759,165 +2465,10 @@ static int shell_callback(
       sqlite3_fputs(p->rowSeparator, p->out);
       break;
     }
-    case MODE_Csv: {
-      sqlite3_fsetmode(p->out, _O_BINARY);
-      if( p->cnt++==0 && p->showHeader ){
-        for(i=0; i<nArg; i++){
-          output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
-        }
-        sqlite3_fputs(p->rowSeparator, p->out);
-      }
-      if( nArg>0 ){
-        for(i=0; i<nArg; i++){
-          output_csv(p, azArg[i], i<nArg-1);
-        }
-        sqlite3_fputs(p->rowSeparator, p->out);
-      }
-      setCrlfMode(p);
-      break;
-    }
-    case MODE_Insert: {
-      if( azArg==0 ) break;
-      sqlite3_fprintf(p->out, "INSERT INTO %s",p->zDestTable);
-      if( p->showHeader ){
-        sqlite3_fputs("(", p->out);
-        for(i=0; i<nArg; i++){
-          if( i>0 ) sqlite3_fputs(",", p->out);
-          if( quoteChar(azCol[i]) ){
-            char *z = sqlite3_mprintf("\"%w\"", azCol[i]);
-            shell_check_oom(z);
-            sqlite3_fputs(z, p->out);
-            sqlite3_free(z);
-          }else{
-            sqlite3_fprintf(p->out, "%s", azCol[i]);
-          }
-        }
-        sqlite3_fputs(")", p->out);
-      }
-      p->cnt++;
-      for(i=0; i<nArg; i++){
-        sqlite3_fputs(i>0 ? "," : " VALUES(", p->out);
-        if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
-          sqlite3_fputs("NULL", p->out);
-        }else if( aiType && aiType[i]==SQLITE_TEXT ){
-          if( ShellHasFlag(p, SHFLG_Newlines) ){
-            output_quoted_string(p, azArg[i]);
-          }else{
-            output_quoted_escaped_string(p, azArg[i]);
-          }
-        }else if( aiType && aiType[i]==SQLITE_INTEGER ){
-          sqlite3_fputs(azArg[i], p->out);
-        }else if( aiType && aiType[i]==SQLITE_FLOAT ){
-          char z[50];
-          double r = sqlite3_column_double(p->pStmt, i);
-          sqlite3_uint64 ur;
-          memcpy(&ur,&r,sizeof(r));
-          if( ur==0x7ff0000000000000LL ){
-            sqlite3_fputs("9.0e+999", p->out);
-          }else if( ur==0xfff0000000000000LL ){
-            sqlite3_fputs("-9.0e+999", p->out);
-          }else{
-            sqlite3_int64 ir = (sqlite3_int64)r;
-            if( r==(double)ir ){
-              sqlite3_snprintf(50,z,"%lld.0", ir);
-            }else{
-              sqlite3_snprintf(50,z,"%!.20g", r);
-            }
-            sqlite3_fputs(z, p->out);
-          }
-        }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
-          const void *pBlob = sqlite3_column_blob(p->pStmt, i);
-          int nBlob = sqlite3_column_bytes(p->pStmt, i);
-          output_hex_blob(p->out, pBlob, nBlob);
-        }else if( isNumber(azArg[i], 0) ){
-          sqlite3_fputs(azArg[i], p->out);
-        }else if( ShellHasFlag(p, SHFLG_Newlines) ){
-          output_quoted_string(p, azArg[i]);
-        }else{
-          output_quoted_escaped_string(p, azArg[i]);
-        }
-      }
-      sqlite3_fputs(");\n", p->out);
-      break;
-    }
-    case MODE_Json: {
-      if( azArg==0 ) break;
-      if( p->cnt==0 ){
-        sqlite3_fputs("[{", p->out);
-      }else{
-        sqlite3_fputs(",\n{", p->out);
-      }
-      p->cnt++;
-      for(i=0; i<nArg; i++){
-        output_json_string(p->out, azCol[i], -1);
-        sqlite3_fputs(":", p->out);
-        if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
-          sqlite3_fputs("null", p->out);
-        }else if( aiType && aiType[i]==SQLITE_FLOAT ){
-          char z[50];
-          double r = sqlite3_column_double(p->pStmt, i);
-          sqlite3_uint64 ur;
-          memcpy(&ur,&r,sizeof(r));
-          if( ur==0x7ff0000000000000LL ){
-            sqlite3_fputs("9.0e+999", p->out);
-          }else if( ur==0xfff0000000000000LL ){
-            sqlite3_fputs("-9.0e+999", p->out);
-          }else{
-            sqlite3_snprintf(50,z,"%!.20g", r);
-            sqlite3_fputs(z, p->out);
-          }
-        }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
-          const void *pBlob = sqlite3_column_blob(p->pStmt, i);
-          int nBlob = sqlite3_column_bytes(p->pStmt, i);
-          output_json_string(p->out, pBlob, nBlob);
-        }else if( aiType && aiType[i]==SQLITE_TEXT ){
-          output_json_string(p->out, azArg[i], -1);
-        }else{
-          sqlite3_fputs(azArg[i], p->out);
-        }
-        if( i<nArg-1 ){
-          sqlite3_fputs(",", p->out);
-        }
-      }
-      sqlite3_fputs("}", p->out);
-      break;
-    }
-    case MODE_Quote: {
-      if( azArg==0 ) break;
-      if( p->cnt==0 && p->showHeader ){
-        for(i=0; i<nArg; i++){
-          if( i>0 ) sqlite3_fputs(p->colSeparator, p->out);
-          output_quoted_string(p, azCol[i]);
-        }
-        sqlite3_fputs(p->rowSeparator, p->out);
-      }
-      p->cnt++;
-      for(i=0; i<nArg; i++){
-        if( i>0 ) sqlite3_fputs(p->colSeparator, p->out);
-        if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
-          sqlite3_fputs("NULL", p->out);
-        }else if( aiType && aiType[i]==SQLITE_TEXT ){
-          output_quoted_string(p, azArg[i]);
-        }else if( aiType && aiType[i]==SQLITE_INTEGER ){
-          sqlite3_fputs(azArg[i], p->out);
-        }else if( aiType && aiType[i]==SQLITE_FLOAT ){
-          char z[50];
-          double r = sqlite3_column_double(p->pStmt, i);
-          sqlite3_snprintf(50,z,"%!.20g", r);
-          sqlite3_fputs(z, p->out);
-        }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
-          const void *pBlob = sqlite3_column_blob(p->pStmt, i);
-          int nBlob = sqlite3_column_bytes(p->pStmt, i);
-          output_hex_blob(p->out, pBlob, nBlob);
-        }else if( isNumber(azArg[i], 0) ){
-          sqlite3_fputs(azArg[i], p->out);
-        }else{
-          output_quoted_string(p, azArg[i]);
-        }
-      }
-      sqlite3_fputs(p->rowSeparator, p->out);
-      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: {
       if( p->cnt++==0 && p->showHeader ){
         for(i=0; i<nArg; i++){
@@ -2934,9 +2485,6 @@ static int shell_callback(
       sqlite3_fputs(p->rowSeparator, p->out);
       break;
     }
-    case MODE_EQP: {
-      break;
-    }
   }
   return 0;
 }
@@ -3383,8 +2931,6 @@ static int display_stats(
   return 0;
 }
 
-static void exec_prepared_stmt(ShellState*, sqlite3_stmt*);
-
 /*
 ** Disable and restore .wheretrace and .treetrace/.selecttrace settings.
 */
@@ -3514,504 +3060,6 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){
   sqlite3_finalize(pQ);
 }
 
-/*
-** UTF8 box-drawing characters.  Imagine box lines like this:
-**
-**           1
-**           |
-**       4 --+-- 2
-**           |
-**           3
-**
-** Each box characters has between 2 and 4 of the lines leading from
-** the center.  The characters are here identified by the numbers of
-** their corresponding lines.
-*/
-#define BOX_24   "\342\224\200"  /* U+2500 --- */
-#define BOX_13   "\342\224\202"  /* U+2502  |  */
-#define BOX_23   "\342\224\214"  /* U+250c  ,- */
-#define BOX_34   "\342\224\220"  /* U+2510 -,  */
-#define BOX_12   "\342\224\224"  /* U+2514  '- */
-#define BOX_14   "\342\224\230"  /* U+2518 -'  */
-#define BOX_123  "\342\224\234"  /* U+251c  |- */
-#define BOX_134  "\342\224\244"  /* U+2524 -|  */
-#define BOX_234  "\342\224\254"  /* U+252c -,- */
-#define BOX_124  "\342\224\264"  /* U+2534 -'- */
-#define BOX_1234 "\342\224\274"  /* U+253c -|- */
-
-/* Draw horizontal line N characters long using unicode box
-** characters
-*/
-static void print_box_line(FILE *out, int N){
-  const char zDash[] =
-      BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24
-      BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24;
-  const int nDash = sizeof(zDash) - 1;
-  N *= 3;
-  while( N>nDash ){
-    sqlite3_fputs(zDash, out);
-    N -= nDash;
-  }
-  sqlite3_fprintf(out, "%.*s", N, zDash);
-}
-
-/*
-** Draw a horizontal separator for a MODE_Box table.
-*/
-static void print_box_row_separator(
-  ShellState *p,
-  int nArg,
-  const char *zSep1,
-  const char *zSep2,
-  const char *zSep3
-){
-  int i;
-  if( nArg>0 ){
-    sqlite3_fputs(zSep1, p->out);
-    print_box_line(p->out, p->actualWidth[0]+2);
-    for(i=1; i<nArg; i++){
-      sqlite3_fputs(zSep2, p->out);
-      print_box_line(p->out, p->actualWidth[i]+2);
-    }
-    sqlite3_fputs(zSep3, p->out);
-  }
-  sqlite3_fputs("\n", p->out);
-}
-
-/*
-** z[] is a line of text that is to be displayed the .mode box or table or
-** similar tabular formats.  z[] might contain control characters such
-** as \n, \t, \f, or \r.
-**
-** Compute characters to display on the first line of z[].  Stop at the
-** first \r, \n, or \f.  Expand \t into spaces.  Return a copy (obtained
-** from malloc()) of that first line, which caller should free sometime.
-** Write anything to display on the next line into *pzTail.  If this is
-** the last line, write a NULL into *pzTail. (*pzTail is not allocated.)
-*/
-static char *translateForDisplayAndDup(
-  ShellState *p,                     /* To access current settings */
-  const unsigned char *z,            /* Input text to be transformed */
-  const unsigned char **pzTail,      /* OUT: Tail of the input for next line */
-  int mxWidth,                       /* Max width.  0 means no limit */
-  u8 bWordWrap                       /* If true, avoid breaking mid-word */
-){
-  int i;                 /* Input bytes consumed */
-  int j;                 /* Output bytes generated */
-  int k;                 /* Input bytes to be displayed */
-  int n;                 /* Output column number */
-  unsigned char *zOut;   /* Output text */
-
-  if( z==0 ){
-    *pzTail = 0;
-    return 0;
-  }
-  if( mxWidth<0 ) mxWidth = -mxWidth;
-  if( mxWidth==0 ) mxWidth = 1000000;
-  i = j = n = 0;
-  while( n<mxWidth ){
-    unsigned char c = z[i];
-    if( c>=0xc0 ){
-      int u;
-      int len = decodeUtf8(&z[i], &u);
-      i += len;
-      j += len;
-      n += sqlite3_qrf_wcwidth(u);
-      continue;
-    }
-    if( c>=' ' ){
-      n++;
-      i++;
-      j++;
-      continue;
-    }
-    if( c==0 || c=='\n' || (c=='\r' && z[i+1]=='\n') ) break;
-    if( c=='\t' ){
-      do{
-        n++;
-        j++;
-      }while( (n&7)!=0 && n<mxWidth );
-      i++;
-      continue;
-    }
-    if( c==0x1b && p->eEscMode==SHELL_ESC_OFF && (k = isVt100(&z[i]))>0 ){
-      i += k;
-      j += k;
-    }else{
-      n++;
-      j += 3;
-      i++;
-    }
-  }
-  if( n>=mxWidth && bWordWrap  ){
-    /* Perhaps try to back up to a better place to break the line */
-    for(k=i; k>i/2; k--){
-      if( IsSpace(z[k-1]) ) break;
-    }
-    if( k<=i/2 ){
-      for(k=i; k>i/2; k--){
-        if( IsAlnum(z[k-1])!=IsAlnum(z[k]) && (z[k]&0xc0)!=0x80 ) break;
-      }
-    }
-    if( k<=i/2 ){
-      k = i;
-    }else{
-      i = k;
-      while( z[i]==' ' ) i++;
-    }
-  }else{
-    k = i;
-  }
-  if( n>=mxWidth && z[i]>=' ' ){
-   *pzTail = &z[i];
-  }else if( z[i]=='\r' && z[i+1]=='\n' ){
-    *pzTail = z[i+2] ? &z[i+2] : 0;
-  }else if( z[i]==0 || z[i+1]==0 ){
-    *pzTail = 0;
-  }else{
-    *pzTail = &z[i+1];
-  }
-  zOut = malloc( j+1 );
-  shell_check_oom(zOut);
-  i = j = n = 0;
-  while( i<k ){
-    unsigned char c = z[i];
-    if( c>=0xc0 ){
-      int u;
-      int len = decodeUtf8(&z[i], &u);
-      do{ zOut[j++] = z[i++]; }while( (--len)>0 );
-      n += sqlite3_qrf_wcwidth(u);
-      continue;
-    }
-    if( c>=' ' ){
-      n++;
-      zOut[j++] = z[i++];
-      continue;
-    }
-    if( c==0 ) break;
-    if( z[i]=='\t' ){
-      do{
-        n++;
-        zOut[j++] = ' ';
-      }while( (n&7)!=0 && n<mxWidth );
-      i++;
-      continue;
-    }
-    switch( p->eEscMode ){
-      case SHELL_ESC_SYMBOL:
-        zOut[j++] = 0xe2;
-        zOut[j++] = 0x90;
-        zOut[j++] = 0x80 + c;
-        break;
-      case SHELL_ESC_ASCII:
-        zOut[j++] = '^';
-        zOut[j++] = 0x40 + c;
-        break;
-      case SHELL_ESC_OFF: {
-        int nn;
-        if( c==0x1b && (nn = isVt100(&z[i]))>0 ){
-          memcpy(&zOut[j], &z[i], nn);
-          j += nn;
-          i += nn - 1;
-        }else{
-          zOut[j++] = c;
-        }
-        break;
-      }
-    }
-    i++;
-  }
-  zOut[j] = 0;
-  return (char*)zOut;
-}
-
-/* Return true if the text string z[] contains characters that need
-** unistr() escaping.
-*/
-static int needUnistr(const unsigned char *z){
-  unsigned char c;
-  if( z==0 ) return 0;
-  while( (c = *z)>0x1f || c=='\t' || c=='\n' || (c=='\r' && z[1]=='\n') ){ z++; }
-  return c!=0;
-}
-
-/* Extract the value of the i-th current column for pStmt as an SQL literal
-** value.  Memory is obtained from sqlite3_malloc64() and must be freed by
-** the caller.
-*/
-static char *quoted_column(sqlite3_stmt *pStmt, int i){
-  switch( sqlite3_column_type(pStmt, i) ){
-    case SQLITE_NULL: {
-      return sqlite3_mprintf("NULL");
-    }
-    case SQLITE_INTEGER:
-    case SQLITE_FLOAT: {
-      return sqlite3_mprintf("%s",sqlite3_column_text(pStmt,i));
-    }
-    case SQLITE_TEXT: {
-      const unsigned char *zText = sqlite3_column_text(pStmt,i);
-      return sqlite3_mprintf(needUnistr(zText)?"%#Q":"%Q",zText);
-    }
-    case SQLITE_BLOB: {
-      int j;
-      sqlite3_str *pStr = sqlite3_str_new(0);
-      const unsigned char *a = sqlite3_column_blob(pStmt,i);
-      int n = sqlite3_column_bytes(pStmt,i);
-      sqlite3_str_append(pStr, "x'", 2);
-      for(j=0; j<n; j++){
-        sqlite3_str_appendf(pStr, "%02x", a[j]);
-      }
-      sqlite3_str_append(pStr, "'", 1);
-      return sqlite3_str_finish(pStr);
-    }
-  }
-  return 0; /* Not reached */
-}
-
-/*
-** Run a prepared statement and output the result in one of the
-** table-oriented formats: MODE_Column, MODE_Markdown, MODE_Table,
-** or MODE_Box.
-**
-** This is different from ordinary exec_prepared_stmt() in that
-** it has to run the entire query and gather the results into memory
-** first, in order to determine column widths, before providing
-** any output.
-*/
-static void exec_prepared_stmt_columnar(
-  ShellState *p,                        /* Pointer to ShellState */
-  sqlite3_stmt *pStmt                   /* Statement to run */
-){
-  sqlite3_int64 nRow = 0;
-  int nColumn = 0;
-  char **azData = 0;
-  sqlite3_int64 nAlloc = 0;
-  char *abRowDiv = 0;
-  const unsigned char *uz;
-  const char *z;
-  char **azQuoted = 0;
-  int rc;
-  sqlite3_int64 i, nData;
-  int j, nTotal, w, n;
-  const char *colSep = 0;
-  const char *rowSep = 0;
-  const unsigned char **azNextLine = 0;
-  int bNextLine = 0;
-  int bMultiLineRowExists = 0;
-  int bw = p->cmOpts.bWordWrap;
-  const char *zEmpty = "";
-  const char *zShowNull = p->nullValue;
-
-  rc = sqlite3_step(pStmt);
-  if( rc!=SQLITE_ROW ) return;
-  nColumn = sqlite3_column_count(pStmt);
-  if( nColumn==0 ) goto columnar_end;
-  nAlloc = nColumn*4;
-  if( nAlloc<=0 ) nAlloc = 1;
-  azData = sqlite3_malloc64( nAlloc*sizeof(char*) );
-  shell_check_oom(azData);
-  azNextLine = sqlite3_malloc64( nColumn*sizeof(char*) );
-  shell_check_oom(azNextLine);
-  memset((void*)azNextLine, 0, nColumn*sizeof(char*) );
-  if( p->cmOpts.bQuote ){
-    azQuoted = sqlite3_malloc64( nColumn*sizeof(char*) );
-    shell_check_oom(azQuoted);
-    memset(azQuoted, 0, nColumn*sizeof(char*) );
-  }
-  abRowDiv = sqlite3_malloc64( nAlloc/nColumn );
-  shell_check_oom(abRowDiv);
-  if( nColumn>p->nWidth ){
-    sqlite3_int64 nByte = (nColumn+1)*2*(sizeof(short int));
-    p->colWidth = realloc(p->colWidth,  nByte);
-    shell_check_oom(p->colWidth);
-    for(i=p->nWidth; i<nColumn; i++) p->colWidth[i] = 0;
-    p->nWidth = nColumn;
-    p->actualWidth = &p->colWidth[nColumn];
-  }
-  memset(p->actualWidth, 0, nColumn*sizeof(short int));
-  for(i=0; i<nColumn; i++){
-    w = p->colWidth[i];
-    if( w==(-32768) ) w = 0;
-    if( w<0 ) w = -w;
-    p->actualWidth[i] = w;
-  }
-  for(i=0; i<nColumn; i++){
-    const unsigned char *zNotUsed;
-    int wx = p->colWidth[i];
-    if( wx==0 ){
-      wx = p->cmOpts.iWrap;
-    }
-    if( wx<0 ) wx = -wx;
-    uz = (const unsigned char*)sqlite3_column_name(pStmt,i);
-    if( uz==0 ) uz = (u8*)"";
-    azData[i] = translateForDisplayAndDup(p, uz, &zNotUsed, wx, bw);
-  }
-  do{
-    int useNextLine = bNextLine;
-    bNextLine = 0;
-    if( (nRow+2)*nColumn >= nAlloc ){
-      nAlloc *= 2;
-      azData = sqlite3_realloc64(azData, nAlloc*sizeof(char*));
-      shell_check_oom(azData);
-      abRowDiv = sqlite3_realloc64(abRowDiv, nAlloc/nColumn);
-      shell_check_oom(abRowDiv);
-    }
-    abRowDiv[nRow] = 1;
-    nRow++;
-    for(i=0; i<nColumn; i++){
-      int wx = p->colWidth[i];
-      if( wx==0 ){
-        wx = p->cmOpts.iWrap;
-      }
-      if( wx<0 ) wx = -wx;
-      if( useNextLine ){
-        uz = azNextLine[i];
-        if( uz==0 ) uz = (u8*)zEmpty;
-      }else if( p->cmOpts.bQuote ){
-        assert( azQuoted!=0 );
-        sqlite3_free(azQuoted[i]);
-        azQuoted[i] = quoted_column(pStmt,i);
-        uz = (const unsigned char*)azQuoted[i];
-      }else{
-        uz = (const unsigned char*)sqlite3_column_text(pStmt,i);
-        if( uz==0 ) uz = (u8*)zShowNull;
-      }
-      azData[nRow*nColumn + i]
-        = translateForDisplayAndDup(p, uz, &azNextLine[i], wx, bw);
-      if( azNextLine[i] ){
-        bNextLine = 1;
-        abRowDiv[nRow-1] = 0;
-        bMultiLineRowExists = 1;
-      }
-    }
-  }while( bNextLine || sqlite3_step(pStmt)==SQLITE_ROW );
-  nTotal = nColumn*(nRow+1);
-  for(i=0; i<nTotal; i++){
-    z = azData[i];
-    if( z==0 ) z = (char*)zEmpty;
-    n = strlenChar(z);
-    j = i%nColumn;
-    if( n>p->actualWidth[j] ){
-      if( n>QRF_MAX_WIDTH ){
-        p->actualWidth[j] = QRF_MAX_WIDTH;
-      }else {
-        p->actualWidth[j] = n;
-      }
-    }
-  }
-  if( seenInterrupt ) goto columnar_end;
-  switch( p->cMode ){
-    case MODE_Column: {
-      colSep = "  ";
-      rowSep = "\n";
-      if( p->showHeader ){
-        for(i=0; i<nColumn; i++){
-          w = p->actualWidth[i];
-          if( p->colWidth[i]<0 ) w = -w;
-          utf8_width_print(p->out, w, azData[i]);
-          sqlite3_fputs(i==nColumn-1?"\n":"  ", p->out);
-        }
-        for(i=0; i<nColumn; i++){
-          print_dashes(p->out, p->actualWidth[i]);
-          sqlite3_fputs(i==nColumn-1?"\n":"  ", p->out);
-        }
-      }
-      break;
-    }
-    case MODE_Table: {
-      colSep = " | ";
-      rowSep = " |\n";
-      print_row_separator(p, nColumn, "+");
-      sqlite3_fputs("| ", p->out);
-      for(i=0; i<nColumn; i++){
-        w = p->actualWidth[i];
-        n = strlenChar(azData[i]);
-        sqlite3_fprintf(p->out, "%*s%s%*s", (w-n)/2, "",
-                        azData[i], (w-n+1)/2, "");
-        sqlite3_fputs(i==nColumn-1?" |\n":" | ", p->out);
-      }
-      print_row_separator(p, nColumn, "+");
-      break;
-    }
-    case MODE_Markdown: {
-      colSep = " | ";
-      rowSep = " |\n";
-      sqlite3_fputs("| ", p->out);
-      for(i=0; i<nColumn; i++){
-        w = p->actualWidth[i];
-        n = strlenChar(azData[i]);
-        sqlite3_fprintf(p->out, "%*s%s%*s", (w-n)/2, "",
-                        azData[i], (w-n+1)/2, "");
-        sqlite3_fputs(i==nColumn-1?" |\n":" | ", p->out);
-      }
-      print_row_separator(p, nColumn, "|");
-      break;
-    }
-    case MODE_Box: {
-      colSep = " " BOX_13 " ";
-      rowSep = " " BOX_13 "\n";
-      print_box_row_separator(p, nColumn, BOX_23, BOX_234, BOX_34);
-      sqlite3_fputs(BOX_13 " ", p->out);
-      for(i=0; i<nColumn; i++){
-        w = p->actualWidth[i];
-        n = strlenChar(azData[i]);
-        sqlite3_fprintf(p->out, "%*s%s%*s%s",
-              (w-n)/2, "", azData[i], (w-n+1)/2, "",
-              i==nColumn-1?" "BOX_13"\n":" "BOX_13" ");
-      }
-      print_box_row_separator(p, nColumn, BOX_123, BOX_1234, BOX_134);
-      break;
-    }
-  }
-  for(i=nColumn, j=0; i<nTotal; i++, j++){
-    if( j==0 && p->cMode!=MODE_Column ){
-      sqlite3_fputs(p->cMode==MODE_Box?BOX_13" ":"| ", p->out);
-    }
-    z = azData[i];
-    if( z==0 ) z = p->nullValue;
-    w = p->actualWidth[j];
-    if( p->colWidth[j]<0 ) w = -w;
-    utf8_width_print(p->out, w, z);
-    if( j==nColumn-1 ){
-      sqlite3_fputs(rowSep, p->out);
-      if( bMultiLineRowExists && abRowDiv[i/nColumn-1] && i+1<nTotal ){
-        if( p->cMode==MODE_Table ){
-          print_row_separator(p, nColumn, "+");
-        }else if( p->cMode==MODE_Box ){
-          print_box_row_separator(p, nColumn, BOX_123, BOX_1234, BOX_134);
-        }else if( p->cMode==MODE_Column ){
-          sqlite3_fputs("\n", p->out);
-        }
-      }
-      j = -1;
-      if( seenInterrupt ) goto columnar_end;
-    }else{
-      sqlite3_fputs(colSep, p->out);
-    }
-  }
-  if( p->cMode==MODE_Table ){
-    print_row_separator(p, nColumn, "+");
-  }else if( p->cMode==MODE_Box ){
-    print_box_row_separator(p, nColumn, BOX_12, BOX_124, BOX_14);
-  }
-columnar_end:
-  if( seenInterrupt ){
-    sqlite3_fputs("Interrupt\n", p->out);
-  }
-  nData = (nRow+1)*nColumn;
-  for(i=0; i<nData; i++){
-    z = azData[i];
-    if( z!=zEmpty && z!=zShowNull ) free(azData[i]);
-  }
-  sqlite3_free(azData);
-  sqlite3_free((void*)azNextLine);
-  sqlite3_free(abRowDiv);
-  if( azQuoted ){
-    for(i=0; i<nColumn; i++) sqlite3_free(azQuoted[i]);
-    sqlite3_free(azQuoted);
-  }
-}
-
 /*
 ** Run a prepared statement
 */
@@ -4022,14 +3070,10 @@ static void exec_prepared_stmt(
   int rc;
   sqlite3_uint64 nRow = 0;
 
-  if( pArg->cMode==MODE_Column
-   || pArg->cMode==MODE_Table
-   || pArg->cMode==MODE_Box
-   || pArg->cMode==MODE_Markdown
-  ){
-    exec_prepared_stmt_columnar(pArg, pStmt);
-    return;
-  }
+  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.
@@ -8904,25 +7948,8 @@ static int do_meta_command(char *zLine, ShellState *p){
   /* The ".explain" command is automatic now.  It is largely pointless.  It
   ** retained purely for backwards compatibility */
   if( c=='e' && cli_strncmp(azArg[0], "explain", n)==0 ){
-    int val = 1;
-    if( nArg>=2 ){
-      if( cli_strcmp(azArg[1],"auto")==0 ){
-        val = 99;
-      }else{
-        val =  booleanValue(azArg[1]);
-      }
-    }
-    if( val==1 && p->mode!=MODE_Explain ){
-      p->normalMode = p->mode;
-      p->mode = MODE_Explain;
-      p->autoExplain = 0;
-    }else if( val==0 ){
-      if( p->mode==MODE_Explain ) p->mode = p->normalMode;
-      p->autoExplain = 0;
-    }else if( val==99 ){
-      if( p->mode==MODE_Explain ) p->mode = p->normalMode;
-      p->autoExplain = 1;
-    }
+    eputz("EXPLAIN output formatting is now automatic. "
+          "\".explain\" is pointless.\n");
   }else
 
 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_AUTHORIZATION)
@@ -11188,8 +10215,6 @@ static int do_meta_command(char *zLine, ShellState *p){
     sqlite3_fprintf(p->out, "%12.12s: %s\n","echo",
           azBool[ShellHasFlag(p, SHFLG_Echo)]);
     sqlite3_fprintf(p->out, "%12.12s: %s\n","eqp", azBool[p->autoEQP&3]);
-    sqlite3_fprintf(p->out, "%12.12s: %s\n","explain",
-          p->mode==MODE_Explain ? "on" : p->autoExplain ? "auto" : "off");
     sqlite3_fprintf(p->out, "%12.12s: %s\n","headers",
           azBool[p->showHeader!=0]);
     if( p->mode==MODE_Column
index 7feed9395313de994fff5f957ca10bca91b5f79a..efe80430bd4ee73b45d2b7c8fd7ae4eeddc773ca 100644 (file)
@@ -208,12 +208,6 @@ do_test shell1-2.2.1 {
 do_test shell1-2.2.2 {
   catchcmd "test.db" ".\'foo OFF"
 } {1 {Error: unknown command or invalid arguments:  "foo OFF". Enter ".help" for help}}
-do_test shell1-2.2.3 {
-  catchcmd "test.db" ".explain \"OFF"
-} {0 {}}
-do_test shell1-2.2.4 {
-  catchcmd "test.db" ".explain \'OFF"
-} {0 {}}
 do_test shell1-2.2.5 {
   catchcmd "test.db" ".mode \"insert FOO"
 } {1 {Error: mode should be one of: ascii box column csv html insert json line list markdown qbox quote table tabs tcl}}
@@ -221,29 +215,6 @@ do_test shell1-2.2.6 {
   catchcmd "test.db" ".mode \'insert FOO"
 } {1 {Error: mode should be one of: ascii box column csv html insert json line list markdown qbox quote table tabs tcl}}
 
-# check multiple tokens, and quoted tokens
-do_test shell1-2.3.1 {
-  catchcmd "test.db" ".explain 1"
-} {0 {}}
-do_test shell1-2.3.2 {
-  catchcmd "test.db" ".explain on"
-} {0 {}}
-do_test shell1-2.3.3 {
-  catchcmd "test.db" ".explain \"1 2 3\""
-} {1 {ERROR: Not a boolean value: "1 2 3". Assuming "no".}}
-do_test shell1-2.3.4 {
-  catchcmd "test.db" ".explain \"OFF\""
-} {0 {}}
-do_test shell1-2.3.5 {
-  catchcmd "test.db" ".\'explain\' \'OFF\'"
-} {0 {}}
-do_test shell1-2.3.6 {
-  catchcmd "test.db" ".explain \'OFF\'"
-} {0 {}}
-do_test shell1-2.3.7 {
-  catchcmd "test.db" ".\'explain\' \'OFF\'"
-} {0 {}}
-
 # check quoted args are unquoted
 do_test shell1-2.4.1 {
   catchcmd "test.db" ".mode FOO"
@@ -348,23 +319,6 @@ do_test shell1-3.6.1 {
   catchcmd "test.db" ".exit"
 } {0 {}}
 
-# .explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
-do_test shell1-3.7.1 {
-  catchcmd "test.db" ".explain"
-  # explain is the exception to the booleans.  without an option, it turns it on.
-} {0 {}}
-do_test shell1-3.7.2 {
-  catchcmd "test.db" ".explain ON"
-} {0 {}}
-do_test shell1-3.7.3 {
-  catchcmd "test.db" ".explain OFF"
-} {0 {}}
-do_test shell1-3.7.4 {
-  # extra arguments ignored
-  catchcmd "test.db" ".explain OFF BAD"
-} {0 {}}
-
-
 # .header(s) ON|OFF      Turn display of headers on or off
 do_test shell1-3.9.1 {
   catchcmd "test.db" ".header"
@@ -645,7 +599,6 @@ do_test shell1-3.22.4 {
 do_test shell1-3.23.1 {
   set res [catchcmd "test.db" ".show"]
   list [regexp {echo:} $res] \
-       [regexp {explain:} $res] \
        [regexp {headers:} $res] \
        [regexp {mode:} $res] \
        [regexp {nullvalue:} $res] \
@@ -654,7 +607,7 @@ do_test shell1-3.23.1 {
        [regexp {rowseparator:} $res] \
        [regexp {stats:} $res] \
        [regexp {width:} $res]
-} {1 1 1 1 1 1 1 1 1 1}
+} {1 1 1 1 1 1 1 1 1}
 do_test shell1-3.23.2 {
   # too many arguments
   catchcmd "test.db" ".show BAD"