From: drh <> Date: Tue, 25 Nov 2025 12:16:56 +0000 (+0000) Subject: Fixes to .mode in the CLI. "qbox" sets the correct null value. X-Git-Tag: artiphishell~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=993b38f0f3201860e12c6210e0a36974caa8e1b5;p=thirdparty%2Fsqlite.git Fixes to .mode in the CLI. "qbox" sets the correct null value. The "--quote on" option sets the null value to NULL. FossilOrigin-Name: 5454ec46e162247afa178c8532a0fa19eb05897417ac5b3d2a2ed14bfd331a75 --- diff --git a/manifest b/manifest index 41d0ec22f4..f838f91092 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\sthe\sunused\sbTextNull\sflag\sfrom\sthe\sQRF\sspec\sobject. -D 2025-11-25T10:53:39.167 +C Fixes\sto\s.mode\sin\sthe\sCLI.\s\s"qbox"\ssets\sthe\scorrect\snull\svalue.\nThe\s"--quote\son"\soption\ssets\sthe\snull\svalue\sto\sNULL. +D 2025-11-25T12:16:56.112 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 6a509cddd815d64f6141e539fff633a518a393772a44dffb4490f7fc3f0d83a9 -F src/shell.c.in 30a40097831a312e35f67866ed9d880362bdb481b70245005154dfe7a884e70d +F src/shell.c.in cb6f5d86ca4c30ca927b1fa1e4d3a66c00e61ca5a0c8ebaa56978d47f916b8c9 F src/sqlite.h.in f1363321ca55cc2feaa289e9fe6dfb08102a28c54edf005564711a2348b06eef F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 5d5330f5f8461f5ce74960436ddcfa53ecd09c2b8b23901e22ae38aec3243998 @@ -2179,8 +2179,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 fddb99c5162ba12a6e3c87e96583d57bae217339b4dd6dc44c3538e738fbf625 -R 19c8024eece0b94602f3e973f1400c0b +P 4bbf176a87b1bedcce0359b70bbf6831a1e458d48c91dcba49f5e00bb38ecaa1 +R 74f3b291e747fe509d4f704a9c1e06b5 U drh -Z e4e4a6ce87bae873cadc031e73619545 +Z 4f4e03b6b93652799e17c3373c085b47 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5385e1ac0c..4c639c3b0a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4bbf176a87b1bedcce0359b70bbf6831a1e458d48c91dcba49f5e00bb38ecaa1 +5454ec46e162247afa178c8532a0fa19eb05897417ac5b3d2a2ed14bfd331a75 diff --git a/src/shell.c.in b/src/shell.c.in index a57a927d63..509801741d 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -1483,7 +1483,7 @@ static const ModeInfo aModeInfo[] = { { "list", 2, 1, 9, 1, 1, 0, 1, 12, 0 }, { "markdown", 0, 0, 9, 1, 1, 0, 2, 13, 2 }, { "off", 0, 0, 0, 0, 0, 0, 0, 14, 0 }, - { "qbox", 0, 0, 9, 2, 1, 0, 2, 1, 2 }, + { "qbox", 0, 0, 10, 2, 1, 0, 2, 1, 2 }, { "quote", 4, 1, 10, 2, 2, 0, 1, 12, 0 }, { "split", 0, 0, 9, 1, 1, 0, 1, 2, 2 }, { "table", 0, 0, 9, 1, 1, 0, 2, 19, 2 }, @@ -7907,6 +7907,8 @@ static int dotCmdMode(ShellState *p){ } switch( k ){ case 1: /* on */ + modeSetStr(&p->mode.spec.zNull, "NULL"); + /* Fall through */ case 2: /* sql */ p->mode.spec.eText = QRF_TEXT_Sql; break; @@ -8101,7 +8103,7 @@ static int dotCmdMode(ShellState *p){ u8 e = p->mode.spec.eBlob; sqlite3_str_appendf(pDesc, " --blob-quote %s", azBQuote[e]); } - if( bAll || p->mode.spec.nCharLimit>0 ){ + if( !bAll && p->mode.spec.nLineLimit==0 && p->mode.spec.nCharLimit>0 ){ sqlite3_str_appendf(pDesc, " --charlimit %d",p->mode.spec.nCharLimit); } zSetting = aModeStr[pI->eCSep]; @@ -8112,7 +8114,15 @@ static int dotCmdMode(ShellState *p){ if( bAll || p->mode.spec.eEsc!=QRF_Auto ){ sqlite3_str_appendf(pDesc, " --escape %s",qrfEscNames[p->mode.spec.eEsc]); } - if( bAll || (p->mode.spec.nLineLimit>0 && pI->eCx>0) ){ + if( bAll || (p->mode.spec.nLineLimit>0 && p->mode.spec.nCharLimit>0) ){ + if( p->mode.spec.nLineLimit==0 && p->mode.spec.nCharLimit==0 ){ + sqlite3_str_appendf(pDesc, " --limits off"); + }else{ + sqlite3_str_appendf(pDesc, " --limits %d,%d", + p->mode.spec.nLineLimit, p->mode.spec.nCharLimit); + } + }else + if( p->mode.spec.nCharLimit==0 && p->mode.spec.nLineLimit>0 && pI->eCx>0 ){ sqlite3_str_appendf(pDesc, " --linelimit %d",p->mode.spec.nLineLimit); } zSetting = aModeStr[pI->eNull];