]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
CLI: for columnar output modes, make sure the header is not too big.
authordrh <>
Mon, 31 Jan 2022 22:14:53 +0000 (22:14 +0000)
committerdrh <>
Mon, 31 Jan 2022 22:14:53 +0000 (22:14 +0000)
Also, improve the help text.

FossilOrigin-Name: 070fae3a09cea675e722340870cb2bee9e1ac96954d3baacfdb7f5400ddb1b20

manifest
manifest.uuid
src/shell.c.in

index 1f7354f999821eced5172db09d5a874637060ee1..941a125836ad0a1b9784db78b872052042c2deac 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C CLI:\sFix\sa\sproblem\swith\stabs\sin\sthe\snew\sqbox\smode.
-D 2022-01-31T20:39:27.381
+C CLI:\sfor\scolumnar\soutput\smodes,\smake\ssure\sthe\sheader\sis\snot\stoo\sbig.\nAlso,\simprove\sthe\shelp\stext.
+D 2022-01-31T22:14:53.379
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -553,7 +553,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
 F src/resolve.c 24032ae57aec10df2f3fa2e20be0aae7d256bc704124b76c52d763440c7c0fe9
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
 F src/select.c a6d2d4bed279d7fe4fcedaf297eaf6441e8e17c6e3947a32d24d23be52ac02f2
-F src/shell.c.in 52a69e2611100fbd0cb4adea8d669cb4ae692de2e1ee989eea90b9d2216fc0b7
+F src/shell.c.in 5f848589c29cd03a9ccde31f1507379eb926ff8352a92ecf7ea4baf00823138d
 F src/sqlite.h.in eaade58049152dac850d57415bcced885ca27ae9582f8aea2cfb7f1db78a521b
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 5d54cf13d3406d8eb65d921a0d3c349de6126b732e695e79ecd4830ce86b4f8a
@@ -1942,8 +1942,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 3ec6141c41a71eea0d96a65aa35c828e4d852d60e090513c312b925d0e257f9a
-R 653501eaadaf515fee417911e957f02f
+P ca96ab3ef78479d95e831cacdb80f23c119cbaa77b3821eac7a3f110bfe20cc9
+R 7edb6446ecfd92c5152a5ff12c329ed4
 U drh
-Z 96fbc4796acfbba99607741d48514123
+Z ad9f462a73710576b722f55f5a4feb61
 # Remove this line to create a well-formed Fossil manifest.
index 1a434190f871b6eb0d3730b32da16a7a2a233c8d..9706a31c8a5ac206b9e511760d968adf7fd1f46a 100644 (file)
@@ -1 +1 @@
-ca96ab3ef78479d95e831cacdb80f23c119cbaa77b3821eac7a3f110bfe20cc9
\ No newline at end of file
+070fae3a09cea675e722340870cb2bee9e1ac96954d3baacfdb7f5400ddb1b20
\ No newline at end of file
index d44048aa3fb0198ab6f7e250e6bd6022be0a7f52..f412f345d96109a870c2f269990437822e8dba86 100644 (file)
@@ -3333,7 +3333,12 @@ static void exec_prepared_stmt_columnar(
     p->actualWidth[i] = w;
   }
   for(i=0; i<nColumn; i++){
-    azData[i] = strdup(sqlite3_column_name(pStmt,i));
+    const unsigned char *zNotUsed;
+    int wx = p->colWidth[i];
+    if( wx==0 ) wx = p->iWrap;
+    if( wx<0 ) wx = -wx;
+    uz = (const unsigned char*)sqlite3_column_name(pStmt,i);
+    azData[i] = translateForDisplayAndDup(uz, &zNotUsed, wx);
   }
   do{
     int useNextLine = bNextLine;
@@ -3350,6 +3355,7 @@ static void exec_prepared_stmt_columnar(
     for(i=0; i<nColumn; i++){
       int wx = p->colWidth[i];
       if( wx==0 ) wx = p->iWrap;
+      if( wx<0 ) wx = -wx;
       if( useNextLine ){
         uz = azNextLine[i];
       }else if( p->bQuote ){
@@ -4257,7 +4263,7 @@ static const char *(azHelp[]) = {
   ".load FILE ?ENTRY?       Load an extension library",
 #endif
   ".log FILE|off            Turn logging on or off.  FILE can be stderr/stdout",
-  ".mode MODE ?TABLE? ?OPTIONS?      Set output mode",
+  ".mode MODE ?OPTIONS?     Set output mode",
   "   MODE is one of:",
   "     ascii       Columns/rows delimited by 0x1F and 0x1E",
   "     box         Tables using unicode box-drawing characters",
@@ -4278,6 +4284,7 @@ static const char *(azHelp[]) = {
   "     --wrap N    Wrap output lines longer than N character",
   "     --quote     Quote output text as SQL literals",
   "     --noquote   Do not quote output text",
+  "     TABLE       The name of SQL table used for \"insert\" mode",
   ".nonce STRING            Disable safe mode for one command if the nonce matches",
   ".nullvalue STRING        Use STRING in place of NULL values",
   ".once ?OPTIONS? ?FILE?   Output for the next SQL command only to FILE",