In CLI, ensure correct line-accumulation state whenever line(s) are dumped or processed. And test this.

FossilOrigin-Name: be211a9c59234ef202e772fcaae18be43c44e1e00674f137cad2d903e00bfcab
This commit is contained in:
larrybr 2021-10-03 22:03:59 +00:00
parent 5bf4715e01
commit d797d6b626
4 changed files with 34 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Add\sthe\ssqlite3ResultStrAccum()\sinternal\sinterface\sto\ssimplify\sthe\nthe\simplementation\sof\sfunctions\sthat\sreturn\sstrings.
D 2021-10-03T00:12:43.656
C In\sCLI,\sensure\scorrect\sline-accumulation\sstate\swhenever\sline(s)\sare\sdumped\sor\sprocessed.\sAnd\stest\sthis.
D 2021-10-03T22:03:59.982
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -550,7 +550,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
F src/resolve.c b9e60afa56d0484ee573aba54d9e73603736236df33d2ae3421b4cd0367d907d
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 916d18b586d8efad5a46040e48405f42e7f90fff33bca1cfab040169515ec525
F src/shell.c.in 5a4ccff506efcc58b72df1bff13d9f54c1534887c93d42746d6f1ccf1d0a815a
F src/shell.c.in 923671ae56ad899db71296d0ebefea9c85e7e52ef087c8a097f3f3a3a3ade98c
F src/sqlite.h.in 4e977a5e2ed1a9e8987ff65a2cab5f99a4298ebf040ea5ff636e1753339ff45a
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h e97f4e9b509408fea4c4e9bef5a41608dfac343b4d3c7a990dedde1e19af9510
@ -1376,7 +1376,7 @@ F test/sharedA.test 49d87ec54ab640fbbc3786ee3c01de94aaa482a3a9f834ad3fe92770eb69
F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell1.test 56a7358a2a05e850e9e4aa24629db9c8975e8038dbe8debd2d95be22a5f03612
F test/shell1.test d014dc15876233d06df1eaf5a22275653a1d391abf1ca28df5ef3ac688df72e9
F test/shell2.test a03b835a9e7dcc1f79b471e4d62e0c85bdc4cb954a00820702603f1409553caf
F test/shell3.test 1586a163e7918775d3c25530bf84200453f30a77cc338490389114a67352f4d9
F test/shell4.test 3ed6c4b42fd695efcbc25d69ef759dbb15855ca8e52ba6c5ee076f8b435f48be
@ -1929,7 +1929,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 5906a0152deded614d965e790a33c67832890828a4835451d65c06414ba71f8b
R 899d8dbf1371ef1c2da55d4150a8c0b1
U drh
Z 0fd44f9546cbcefb4424b0b49d87120d
P e548e9299d3fd6ce5b647cf0dd93ff8e917a5eda43076c6a02389c52640e2e50
R 38415c55bb15ec5e5592551fc07b2f41
U larrybr
Z ce1b9939396109dd8b1cf40d551b3704

View File

@ -1 +1 @@
e548e9299d3fd6ce5b647cf0dd93ff8e917a5eda43076c6a02389c52640e2e50
be211a9c59234ef202e772fcaae18be43c44e1e00674f137cad2d903e00bfcab

View File

@ -10832,7 +10832,8 @@ static int process_input(ShellState *p){
if( QSS_PLAINWHITE(qss) && nSql==0 ){
if( ShellHasFlag(p, SHFLG_Echo) )
printf("%s\n", zLine);
/* Just swallow leading whitespace */
/* Just swallow single-line whitespace */
qss = QSS_Start;
continue;
}
if( zLine && (zLine[0]=='.' || zLine[0]=='#') && nSql==0 ){
@ -10848,6 +10849,7 @@ static int process_input(ShellState *p){
qss = QSS_Start;
continue;
}
/* No single-line dispositions remain; accumulate line(s). */
nLine = strlen30(zLine);
if( nSql+nLine+2>=nAlloc ){
/* Grow buffer by half-again increments when big. */
@ -10877,9 +10879,11 @@ static int process_input(ShellState *p){
clearTempFile(p);
}
p->bSafeMode = p->bSafeModePersist;
qss = QSS_Start;
}else if( nSql && QSS_PLAINWHITE(qss) ){
if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zSql);
nSql = 0;
qss = QSS_Start;
}
}
if( nSql && QSS_PLAINDARK(qss) ){

View File

@ -18,6 +18,8 @@
# shell1-1.*: Basic command line option handling.
# shell1-2.*: Basic "dot" command token parsing.
# shell1-3.*: Basic test that "dot" command can be called.
# shell1-{4-8}.*: Test various "dot" commands's functionality.
# shell1-9.*: Basic test that "dot" commands and SQL intermix ok.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -1224,4 +1226,22 @@ do_test shell1-8.4 {
| 6683623321994527 | -47 |
+------------------+-----+}}
#----------------------------------------------------------------------------
# Test cases shell1-9.*: Basic test that "dot" commands and SQL intermix ok.
#
do_test shell1-9.1 {
catchcmd :memory: {
.mode csv
/*
x */ select 1,2; --x
-- .nada
;
.mode csv
--x
select 2,1; select 3,4;
}
} {0 {1,2
2,1
3,4}}
finish_test