]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Space to hold the ".width" of columns in the CLI is now obtained from
authordrh <drh@noemail.net>
Fri, 29 May 2020 14:38:43 +0000 (14:38 +0000)
committerdrh <drh@noemail.net>
Fri, 29 May 2020 14:38:43 +0000 (14:38 +0000)
malloc() and hence is not limited in the number of columns supported.

FossilOrigin-Name: 445ed5dab2c26e9f4a7fb5277abdba3359d23cf5318cfd0d8322162d9616ee7a

manifest
manifest.uuid
src/shell.c.in

index 4061939f7de9cdc68902f17cd959cdb830f34e60..edf9e43a801fb0bcf391606e0290524679d2d24c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Incremental\simprovements\sto\stabular\soutput\smodes\sin\sthe\sCLI.\s\sThe\n"markdown"\sand\s"table"\smodes\sno\shave\sheaders\sturned\son\sby\sdefault.
-D 2020-05-29T12:31:53.495
+C Space\sto\shold\sthe\s".width"\sof\scolumns\sin\sthe\sCLI\sis\snow\sobtained\sfrom\nmalloc()\sand\shence\sis\snot\slimited\sin\sthe\snumber\sof\scolumns\ssupported.
+D 2020-05-29T14:38:43.840
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -534,7 +534,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
 F src/resolve.c c2008519a0654f1e7490e9281ed0397d0f14bb840d81f0b96946248afcbdb25d
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
 F src/select.c 39a00a8bc89596dfb37c16afcbb1d33de5085b9963564b58aafe1566d08c0881
-F src/shell.c.in 17fff6834b839d684371a436f6c863dfbb8cb82ea8e4210b6090d9e8a6829dc3
+F src/shell.c.in 77530a909ab0e8e44c7797993b0f3143e95226380bc5f311158ad3e3209abf28
 F src/sqlite.h.in 74342b41e9d68ff9e56b192009046f8dd0aa2bd76ce1a588f330de614ba61de7
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
@@ -1866,7 +1866,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 77933dc4dbe0e0af3b13a14293a8bd684edc5056f4ae9291c6f95d4433bf90ce
-R dbd1cec93fc87562979dbfde2067c782
+P af28bff91ad7e2d69db0052323c9c05c75a41d4134974bd1305f1c4f579d3558
+R 7199cbe7bb1c2e7279bcd8d792b04d19
 U drh
-Z 42d147ea1b5d379198ee1e0c91039dc7
+Z e4dd532cb0e0bd045df8215b6bacef2f
index 50bd455119ac77f25f150d4b6314d3f2ebaeb568..589b69c5fc72c95bcd4fa296b93d77a1025e1609 100644 (file)
@@ -1 +1 @@
-af28bff91ad7e2d69db0052323c9c05c75a41d4134974bd1305f1c4f579d3558
\ No newline at end of file
+445ed5dab2c26e9f4a7fb5277abdba3359d23cf5318cfd0d8322162d9616ee7a
\ No newline at end of file
index 517a09fc80e6d078e556f678b305c5fcd546fc74..299670755d2734ccc292470519a72d29051a492e 100644 (file)
@@ -1104,8 +1104,9 @@ struct ShellState {
   char rowSeparator[20]; /* Row separator character for MODE_Ascii */
   char colSepPrior[20];  /* Saved column separator */
   char rowSepPrior[20];  /* Saved row separator */
-  int colWidth[100];     /* Requested width of each column when in column mode*/
-  int actualWidth[100];  /* Actual width of each column */
+  int *colWidth;         /* Requested width of each column in columnar modes */
+  int *actualWidth;      /* Actual width of each column */
+  int nWidth;            /* Number of slots in colWidth[] and actualWidth[] */
   char nullValue[20];    /* The text to print when a NULL comes back from
                          ** the database */
   char outfile[FILENAME_MAX]; /* Filename for *out */
@@ -2027,7 +2028,7 @@ static int shell_callback(
           nWidth = ArraySize(aExplainWidths);
         }else{
           colWidth = p->colWidth;
-          nWidth = ArraySize(p->colWidth);
+          nWidth = p->nWidth;
         }
         for(i=0; i<nArg; i++){
           int w, n;
@@ -9510,7 +9511,7 @@ static int do_meta_command(char *zLine, ShellState *p){
       raw_printf(p->out, "\n");
     utf8_printf(p->out, "%12.12s: %s\n","stats", azBool[p->statsOn!=0]);
     utf8_printf(p->out, "%12.12s: ", "width");
-    for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
+    for (i=0;i<p->nWidth;i++) {
       raw_printf(p->out, "%d ", p->colWidth[i]);
     }
     raw_printf(p->out, "\n");
@@ -10059,7 +10060,11 @@ static int do_meta_command(char *zLine, ShellState *p){
   if( c=='w' && strncmp(azArg[0], "width", n)==0 ){
     int j;
     assert( nArg<=ArraySize(azArg) );
-    for(j=1; j<nArg && j<ArraySize(p->colWidth); j++){
+    p->nWidth = nArg-1;
+    p->colWidth = realloc(p->colWidth, p->nWidth*sizeof(int)*2);
+    if( p->colWidth==0 && p->nWidth>0 ) shell_out_of_memory();
+    if( p->nWidth ) p->actualWidth = &p->colWidth[p->nWidth];
+    for(j=1; j<nArg; j++){
       p->colWidth[j-1] = (int)integerValue(azArg[j]);
     }
   }else
@@ -11068,6 +11073,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
   for(i=0; i<argcToFree; i++) free(argvToFree[i]);
   free(argvToFree);
 #endif
+  free(data.colWidth);
   /* Clear the global data structure so that valgrind will detect memory
   ** leaks */
   memset(&data, 0, sizeof(data));