From: drh <> Date: Tue, 16 Dec 2025 13:25:45 +0000 (+0000) Subject: CLI improvements. In the .check command, ignore leading and trailing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c26b5db712828afd9bb33157bbebf4e897cfe0b;p=thirdparty%2Fsqlite.git CLI improvements. In the .check command, ignore leading and trailing whitespace unless the --exact option is used. In the .limit command, do not print the new limit when changing the limit, but only when requesting the current value of the limit. FossilOrigin-Name: d72cb66d672d514822b2fbb0be8880377628599f1f8e2a219d36791c125c6242 --- diff --git a/manifest b/manifest index 233e1e30a6..915793a79e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Stricter\senforcement\sof\sthe\sLIKE_PATTERN_LENGTH\sfor\sthe\sregexp\sextension. -D 2025-12-16T13:13:21.715 +C CLI\simprovements.\s\sIn\sthe\s.check\scommand,\signore\sleading\sand\strailing\nwhitespace\sunless\sthe\s--exact\soption\sis\sused.\s\sIn\sthe\s.limit\scommand,\sdo\nnot\sprint\sthe\snew\slimit\swhen\schanging\sthe\slimit,\sbut\sonly\swhen\srequesting\nthe\scurrent\svalue\sof\sthe\slimit. +D 2025-12-16T13:25:45.501 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -737,7 +737,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 47aa7fdc9ec4c19b103ac5e79d7887d30119b5675309facf5eed1118391c868b F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 344518c1bba9c4636bf651b7642304abd2e7075ba35feb4bae42a51e5efe991f -F src/shell.c.in e584486e622dea388ea18e34e31bc873e24c6c24f337f012b4bb21260a735dee +F src/shell.c.in 0b7ee46d65ff270ae4cdea2ee5cf1095668aaa8bf86003b92960d935f62fb05b F src/sqlite.h.in 706cacea5308b0244fb6cec92e08310fb427a125375c64137cc1f878ae4cf5c0 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 5d5330f5f8461f5ce74960436ddcfa53ecd09c2b8b23901e22ae38aec3243998 @@ -1531,7 +1531,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/readonly.test 0d307c335b3421898cfe64a783a376138aa003849b6bff61ee2d21e805bc0051 F test/recover.test 643139b911ac880a1e881d7621f02cfb546b608b8f2494d7d26fd5ed103b1ceb -F test/regexp1.sql 2d1ab671e03daff2f4c4dbd9b196697ace0fbd095bbca8a2b842a47f272ea2b3 +F test/regexp1.sql de2b5b33b16b664d655b41e780f2efca38de3e5559fc254b4c9783ff0bea96b0 F test/regexp1.test 8f2a8bc1569666e29a4cee6c1a666cd224eb6d50e2470d1dc1df995170f3e0f1 F test/regexp2.test 64f9726b2ddc71aea06725fcad53231833d038d58b936d49083ace658b370a13 F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d @@ -2186,8 +2186,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 80c0d922937615422e813593ac4eb83c3040a417fad97dba18a549de50a91b72 -R bef9b6b791509558835588637279fc72 +P c94b1e9c5674f7d0ad75d91085262f38cba6036979e8a0f9d39edc7db841915f +R 14bc874d2fda921d0411fdf028237c3f U drh -Z df65cf1ca598c3ab9c9a83d34629e6c5 +Z 0b4eb40e6c592a71700535333c2f2c5c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4aa5424bf9..f8fb4dbf64 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c94b1e9c5674f7d0ad75d91085262f38cba6036979e8a0f9d39edc7db841915f +d72cb66d672d514822b2fbb0be8880377628599f1f8e2a219d36791c125c6242 diff --git a/src/shell.c.in b/src/shell.c.in index 74fe997fa8..a76ead3a88 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -8550,6 +8550,8 @@ dotCmdOutput_error: ** ** Options: ** --error-prefix TEXT Change error message prefix text to TEXT +** --exact Do an exact comparison including leading and +** trailing whitespace. ** --glob Treat PATTERN as a GLOB ** --keep Do not reset the testcase. More .check commands ** will follow. @@ -8635,8 +8637,22 @@ static int dotCmdCheck(ShellState *p){ sqlite3_free(zGlob); break; } + case 3: { + isOk = cli_strcmp(zTest,zPattern)==0; + break; + } default: { - isOk = cli_strcmp(zPattern,zTest)==0; + /* Skip leading and trailing \n and \r on both pattern and test output */ + const char *z1 = zPattern; + const char *z2 = zTest; + size_t n1, n2; + while( z1[0]=='\n' || z1[0]=='\r' ) z1++; + n1 = strlen(z1); + while( n1>0 && (z1[n1-1]=='\n' || z1[n1-1]=='\r') ) n1--; + while( z2[0]=='\n' || z2[0]=='\r' ) z2++; + n2 = strlen(z2); + while( n2>0 && (z2[n2-1]=='\n' || z2[n2-1]=='\r') ) n2--; + isOk = n1==n2 && memcmp(z1,z2,n1)==0; break; } } @@ -9761,9 +9777,10 @@ static int do_meta_command(const char *zLine, ShellState *p){ if( nArg==3 ){ sqlite3_limit(p->db, aLimit[iLimit].limitCode, (int)integerValue(azArg[2])); + }else{ + cli_printf(stdout, "%20s %d\n", aLimit[iLimit].zLimitName, + sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1)); } - cli_printf(stdout, "%20s %d\n", aLimit[iLimit].zLimitName, - sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1)); } }else diff --git a/test/regexp1.sql b/test/regexp1.sql index f1a16a695a..c1938885a6 100644 --- a/test/regexp1.sql +++ b/test/regexp1.sql @@ -19,14 +19,14 @@ -- 0 1 2 3 4 -- 123456789 123456789 123456789 123456789 123 SELECT 'abcdefg' REGEXP '((((((((((((((((((abcdefg))))))))))))))))))'; -.check "1\n" +.check 1 -.limit like_pattern_length 42 .testcase 110 +.limit like_pattern_length 42 SELECT 'abcdefg' REGEXP '((((((((((((((((((abcdefg))))))))))))))))))'; .check -glob "Error near line #: REGEXP pattern too big*" -.limit like_pattern_length 43 .testcase 120 +.limit like_pattern_length 43 SELECT 'abcdefg' REGEXP '((((((((((((((((((abcdefg))))))))))))))))))'; -.check "1\n" +.check 1