]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Assigned widths and alignments on columns.
authordrh <>
Wed, 22 Oct 2025 21:24:17 +0000 (21:24 +0000)
committerdrh <>
Wed, 22 Oct 2025 21:24:17 +0000 (21:24 +0000)
FossilOrigin-Name: f6359f2fa776ef04449660a3452fdf7ee943523bf3290f3c0e15693962bca1db

ext/qrf/qrf-tester.c
ext/qrf/qrf.c
ext/qrf/qrf.h
manifest
manifest.uuid

index b17bc0df1e03e63866c01c5a0227d8a6c65d8e3f..6d194be8af994918d50fd957284ba764642443ce 100644 (file)
@@ -90,6 +90,7 @@ int main(int argc, char **argv){
   int rc;
   int lineNum = 0;
   int bUseWriter = 1;
+  short int aWidth[100];
   sqlite3_qrf_spec spec;
   char zLine[1000];
 
@@ -303,6 +304,29 @@ int main(int argc, char **argv){
     if( strncmp(zLine, "--zRowSep=", 10)==0 ){
       spec.zRowSep = tempStrdup(&zLine[10]);
     }else
+    if( strncmp(zLine, "--mxWidth=", 10)==0 ){
+      spec.mxWidth = (short int)atoi(&zLine[10]);
+    }else
+    if( strncmp(zLine, "--aWidth=", 9)==0 ){
+      const char *zArg = &zLine[9];
+      int n = 0;
+      while( isspace(zArg[0]) ) zArg++;
+      while( zArg[0]!=0 && n<COUNT(aWidth) ){
+        int w = atoi(zArg);
+        if( w>QRF_MX_WIDTH ){
+          w = QRF_MX_WIDTH;
+        }else if( w<QRF_MN_WIDTH ){
+          w = QRF_MN_WIDTH;
+        }else if( w==0 && zArg[0]=='-' ){
+          w = QRF_MINUS_ZERO;
+        }
+        aWidth[n++] = w;
+        while( zArg[0] && !isspace(zArg[0]) ) zArg++;
+        while( isspace(zArg[0]) ) zArg++;
+      }
+      spec.aWidth = aWidth;
+      spec.nWidth = n;
+    }else
     if( strcmp(zLine, "--exit")==0 ){
       break;
     }else
index 44d94ed09442e7aa3c5e5ae470178fa22ee41d5d..f23a1729d9a1ca46052aee317dd75ab7dbe15fc6 100644 (file)
@@ -877,7 +877,10 @@ static void qrfColumnar(Qrf *p){
   if( p->actualWidth==0 ){ qrfOom(p); goto qrf_column_end; }
   for(i=0; i<p->spec.nWidth && i<nColumn; i++){
     int w = i<p->spec.nWidth ? p->spec.aWidth[i] : 0;
-    if( w<0 ) w = -w;
+    if( w<0 ){
+      if( w==QRF_MINUS_ZERO ){ w = 0; }
+      else{ w = -w; }
+    }
     p->actualWidth[i] = w;
   }
   while( i<nColumn ){
@@ -932,7 +935,7 @@ static void qrfColumnar(Qrf *p){
       nRow++;
       for(i=0; i<nColumn; i++){
         int wx = i<p->spec.nWidth ? p->spec.aWidth[i] : 0;
-        if( wx==0 ){
+        if( wx==0 || wx==QRF_MINUS_ZERO ){
           wx = p->spec.mxWidth;
         }
         if( wx<0 ) wx = -wx;
index 18b7b9ceba719c9d0010e8f26b8792e5c511d266..abe3b37506db106c9bad167235853ae0096d2039 100644 (file)
@@ -43,6 +43,13 @@ struct sqlite3_qrf_spec {
   /* Additional fields may be added in the future */
 };
 
+/*
+** Range of values for sqlite3_qrf_spec.aWidth[] entries:
+*/
+#define QRF_MX_WIDTH    (10000)
+#define QRF_MN_WIDTH    (-10000)
+#define QRF_MINUS_ZERO  (-32768)    /* Special value meaning -0 */
+
 /*
 ** Interfaces
 */
index 8060808449ac23483b80ba85d3a7a109edac6b8e..32589a8d6b4ad9925c8d78f8125aab00967ee559 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Column\smodes\sare\snow\sworking.
-D 2025-10-22T21:00:52.621
+C Assigned\swidths\sand\salignments\son\scolumns.
+D 2025-10-22T21:24:17.507
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -416,9 +416,9 @@ F ext/misc/wholenumber.c 0fa0c082676b7868bf2fa918e911133f2b349bcdceabd1198bba5f6
 F ext/misc/windirent.h 02211ce51f3034c675f2dbf4d228194d51b3ee05734678bad5106fff6292e60c
 F ext/misc/zipfile.c 09e6e3a3ff40a99677de3c0bc6569bd5f4709b1844ac3d1c1452a456c5a62f1c
 F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee
-F ext/qrf/qrf-tester.c 59cb5b1ed889ba57836d0fbb07b583fdfdfe409b1344f4f119fc13dff3a7356a
-F ext/qrf/qrf.c 8f39553c203d704d271b37d2d3cd8c01bafef9ef0154af8ef20a4bb2335ab4fe
-F ext/qrf/qrf.h e9585fbadc45e8182faf208a0f86984d5130d89742364424fd1c39f12457f013
+F ext/qrf/qrf-tester.c 4212d01e1408591c6e6b081d119e125c97efea5a2f97f4ff05c28b8a5e1272bc
+F ext/qrf/qrf.c 7a7ffe0839f36618dd16139c9452b609732a374fa56010cf6f69850b60255ca1
+F ext/qrf/qrf.h 8ad45ac2a8661010c936778bb017cb691fddf2fe27546feb28ca67a0f88967e3
 F ext/qrf/qrf.md 4eea619191dab7bbf483eff3fe3b074a07d7c8c50bc86070a4485797d386d1ff
 F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8
 F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255
@@ -2175,8 +2175,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P a05e021354ff5868f75ac01d384c3aaaedb7c483dd8f9533f6ab9fbb66b5f077
-R 024ce8fdd2ea788432f0d90e246824c6
+P ed1c8a62ff6985845a2b664f12752f97404b0449e4290d8604a215406590290c
+R 225cfbc7236ef4dc95d19fc105dec938
 U drh
-Z bc27d118506f791034d30a910452eace
+Z bcc06565d01477b5bd4c299226559b64
 # Remove this line to create a well-formed Fossil manifest.
index 2a2cfcb7a1286ea65827d1d75d3619f21779f557..3e7797477bb9e76b08164e47e4759b0d0c42c428 100644 (file)
@@ -1 +1 @@
-ed1c8a62ff6985845a2b664f12752f97404b0449e4290d8604a215406590290c
+f6359f2fa776ef04449660a3452fdf7ee943523bf3290f3c0e15693962bca1db