From ec27a2e7e5c73107f8588360c4ec05e6f106f68b Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 7 Nov 2025 19:20:49 +0000 Subject: [PATCH] Fix some problems. But there is a need to do major surgery on the table layout algorithm, so it seems good to snapshot before proceeding. FossilOrigin-Name: 9052991a897ad12ac54476d9a370d1ad18937abc3c3fc11efcb678f21cb5ef69 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 22 +++++++++++++++------- test/shell1.test | 31 ++++++++++++++++--------------- 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/manifest b/manifest index 99f699e58b..d0078130b0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Incremental\scheck-in.\s\sQRF\sis\sworking,\sbut\sthere\sare\smany\stest\sfailures\nin\sthe\sshell\stest\smodules. -D 2025-11-07T17:48:14.716 +C Fix\ssome\sproblems.\s\sBut\sthere\sis\sa\sneed\sto\sdo\smajor\ssurgery\son\sthe\ntable\slayout\salgorithm,\sso\sit\sseems\sgood\sto\ssnapshot\sbefore\sproceeding. +D 2025-11-07T19:20:49.895 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 ba9cd07ffa3277883c1986085f6ddc4320f4d35d5f212ab58df79a7ecc1a576a -F src/shell.c.in 767763acc62d90814c70b678ac7d57855a4ab3252438b147337ad09b79d2e22c +F src/shell.c.in 08e9032b9069ba0d08fccc012962a9fb859830ace7a73b78acf85979380542e7 F src/sqlite.h.in 43f60117ce68847b9d4e7fa43c2ac42bb324185e66b924d3114b24d4037fc263 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 7f236ca1b175ffe03316d974ef57df79b3938466c28d2f95caef5e08c57f3a52 @@ -1601,7 +1601,7 @@ F test/sharedA.test 64bdd21216dda2c6a3bd3475348ccdc108160f34682c97f2f51c19fc0e21 F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8ee707 F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test 1c968056fa4579b7036257c1b7035fe43bd36e8008802d035fb108ba98652aab +F test/shell1.test 5b72afb03752278e18c7faeda7329e6118a04e07a4203837bea9d66866d2cd0b F test/shell2.test ab23f01ea2347e4b72bb2399af7ee82aa00f9c059141749f7c4064abca5ad728 F test/shell3.test 603b448e917537cf77be0f265c05c6f63bc677c63a533c8e96aae923b56f4a0e F test/shell4.test 03593fa7908a55f255916ffeda707cdf55680c777736e3da62b1d78cde0d684d @@ -2173,8 +2173,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 7596fc32b371e5e657e830c2e80e61b0947320a7359833e915a888a438c2e935 -R 9afc4ad39bbb2e2f476eec0945e613ea +P de7fc9afc43d4bd5f5995832cd698633e0e7213c190fa044856c9f82512161f9 +R d7dd914866de963dc2cf233d6a5493f5 U drh -Z 86aaea013274b68cb46dbbf7c4e3c80e +Z feff0772021bea128322542ff15b0626 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 80da10129e..60a0b4ee73 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -de7fc9afc43d4bd5f5995832cd698633e0e7213c190fa044856c9f82512161f9 +9052991a897ad12ac54476d9a370d1ad18937abc3c3fc11efcb678f21cb5ef69 diff --git a/src/shell.c.in b/src/shell.c.in index d027f62442..694167f161 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -4274,7 +4274,7 @@ static int shell_exec( spec.zColumnSep = pArg->colSeparator; spec.zNull = pArg->nullValue; spec.zTableName = pArg->zDestTable; - spec.bWordWrap = pArg->cmOpts.bWordWrap; + spec.bWordWrap = pArg->cmOpts.bWordWrap!=0 ? QRF_SW_On : QRF_SW_Off; spec.mxColWidth = pArg->cmOpts.iWrap; switch( pArg->eEscMode ){ case SHELL_ESC_ASCII: spec.eEsc = QRF_ESC_Ascii; break; @@ -4282,11 +4282,19 @@ static int shell_exec( default: spec.eEsc = QRF_ESC_Off; break; } spec.bColumnNames = pArg->showHeader!=0 ? QRF_SW_On : QRF_SW_Off; - if( pArg->cMode==MODE_Box - || pArg->cMode==MODE_Table - || pArg->cMode==MODE_Markdown - ){ - spec.bColumnNames = QRF_SW_On; + switch( pArg->cMode ){ + case MODE_Insert: { + if( ShellHasFlag(pArg, SHFLG_PreserveRowid) ){ + spec.bColumnNames = QRF_SW_On; + } + break; + } + case MODE_Box: + case MODE_Table: + case MODE_Markdown: { + spec.bColumnNames = QRF_SW_On; + break; + } } if( sqlite3_stmt_isexplain(pStmt) ){ eStyle = QRF_STYLE_Auto; @@ -4657,7 +4665,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){ savedShowHdr = p->showHeader; p->zDestTable = (char*)zTable; p->mode = p->cMode = MODE_Insert; - p->showHeader = 1; +// p->showHeader = 1; rc = shell_exec(p, sSelect.zTxt, 0); if( (rc&0xff)==SQLITE_CORRUPT ){ sqlite3_fputs("/****** CORRUPTION ERROR *******/\n", p->out); diff --git a/test/shell1.test b/test/shell1.test index 8f7d923571..7feed93953 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -854,12 +854,12 @@ do_test shell1-4.1.2 { } {0 {PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE t1(x INTEGER PRIMARY KEY, y); -INSERT INTO t1 VALUES(1,NULL); -INSERT INTO t1 VALUES(2,''); -INSERT INTO t1 VALUES(3,1); -INSERT INTO t1 VALUES(4,2.25); -INSERT INTO t1 VALUES(5,'hello'); -INSERT INTO t1 VALUES(6,x'807f'); +INSERT INTO t1(x,y) VALUES(1,NULL); +INSERT INTO t1(x,y) VALUES(2,''); +INSERT INTO t1(x,y) VALUES(3,1); +INSERT INTO t1(x,y) VALUES(4,2.25); +INSERT INTO t1(x,y) VALUES(5,'hello'); +INSERT INTO t1(x,y) VALUES(6,x'807f'); COMMIT;}} # Verify that the table named [table] is correctly quoted and that @@ -902,12 +902,12 @@ do_test shell1-4.1.4 { } {0 {PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE [ta<>ble](x INTEGER PRIMARY KEY, y) WITHOUT ROWID; -INSERT INTO "ta<>ble" VALUES(1,NULL); -INSERT INTO "ta<>ble" VALUES(12,''); -INSERT INTO "ta<>ble" VALUES(23,1); -INSERT INTO "ta<>ble" VALUES(34,2.25); -INSERT INTO "ta<>ble" VALUES(45,'hello'); -INSERT INTO "ta<>ble" VALUES(56,x'807f'); +INSERT INTO "ta<>ble"(x,y) VALUES(1,NULL); +INSERT INTO "ta<>ble"(x,y) VALUES(12,''); +INSERT INTO "ta<>ble"(x,y) VALUES(23,1); +INSERT INTO "ta<>ble"(x,y) VALUES(34,2.25); +INSERT INTO "ta<>ble"(x,y) VALUES(45,'hello'); +INSERT INTO "ta<>ble"(x,y) VALUES(56,x'807f'); COMMIT;}} # Do not record rowids if the rowid is inaccessible @@ -924,9 +924,9 @@ do_test shell1-4.1.5 { } {0 {PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE t1(_ROWID_,rowid,oid); -INSERT INTO t1 VALUES(1,NULL,'alpha'); -INSERT INTO t1 VALUES(12,'',99); -INSERT INTO t1 VALUES(23,1,x'b0b1b2'); +INSERT INTO t1(_ROWID_,rowid,oid) VALUES(1,NULL,'alpha'); +INSERT INTO t1(_ROWID_,rowid,oid) VALUES(12,'',99); +INSERT INTO t1(_ROWID_,rowid,oid) VALUES(23,1,x'b0b1b2'); COMMIT;}} } else { @@ -1326,6 +1326,7 @@ do_test_with_ansi_output shell1-8.5 { create table t(a text, b int); insert into t values ('too long for one line', 1), ('shorter', NULL); .header on +.mode box --wordwrap off .width 10 10 .nullvalue NADA select * from t;} -- 2.47.3