]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a bug in ".show". Adjust test cases for the new default mode.
authordrh <>
Sun, 16 Nov 2025 23:06:45 +0000 (23:06 +0000)
committerdrh <>
Sun, 16 Nov 2025 23:06:45 +0000 (23:06 +0000)
FossilOrigin-Name: 2aebd7bfecaaf1f75b52b05a0d3009fc0dc61289ae666d24cb4e3ddfaf251645

manifest
manifest.uuid
src/shell.c.in
test/shell1.test
test/shell2.test
test/shell3.test
test/shell4.test
test/shell5.test
test/shellA.test

index 71c1ad44b7044a678e8dc458ca11a0e9f48f67cd..04a12ee6db31d6f5613f87b8dfc251335d7af5ac 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Default\s.mode\sis\snow\sqbox\swith\slimits.\s\sNew\s--compat\sYYYYMMDD\scommand-line\noption,\sand\snew\s-DCOMPATIBILITY_DATE=YYYYMMDD\scompile-time\soptions\scan\noverride.\s\sCommand\s".mode\sYYYYMMDD"\ssets\sthe\smode\sto\sthe\sdefault\sfor\sthe\ndate\sgiven.
-D 2025-11-16T17:27:21.262
+C Fix\sa\sbug\sin\s".show".\s\sAdjust\stest\scases\sfor\sthe\snew\sdefault\smode.
+D 2025-11-16T23:06:45.485
 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 2044498d05ffcaccdd713cce4d8482f6f3f66dbafb911c782a85bbfb47a8ca27
+F src/shell.c.in 64f777047c972c46df3f04597367980732a58aa0b58a21e4862812a225edee12
 F src/sqlite.h.in 795ce84cc136b4e74d882cf4fab56d2927c20b9af9fd2fcea27760a6fe50851b
 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
 F src/sqlite3ext.h 5d5330f5f8461f5ce74960436ddcfa53ecd09c2b8b23901e22ae38aec3243998
@@ -1603,16 +1603,16 @@ 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 c651b6d9d89293a1c6803d2970deba50d8fa5075ee2cb191c245d7bffff4c36b
-F test/shell2.test d8da6a06dcce1d8f04f776f918d4d57c28ddc28c54f3a44f95429794892e3a91
-F test/shell3.test 603b448e917537cf77be0f265c05c6f63bc677c63a533c8e96aae923b56f4a0e
-F test/shell4.test 03593fa7908a55f255916ffeda707cdf55680c777736e3da62b1d78cde0d684d
-F test/shell5.test 683f9b5df61192426d030874a04adcb15b5f14c5f3062e2637d4378a3e7224f8
+F test/shell1.test 88acfa38c2ecfd5beb25825fdd3a93f4a81573a736c04de82e6e377efa6f6efd
+F test/shell2.test 38c394063f9398bc559fbe5b232c8e7f0c817dd33edd21ee8c4c4c1b650530db
+F test/shell3.test 840192774cc4edf7653520c0434a311c7477b9bc324abbc7bd2887915792fa8c
+F test/shell4.test e25580a792b7b54560c3a76b6968bd8189261f38979fe28e6bc6312c5db280db
+F test/shell5.test ed3c2cf47330134ab91e5b16dbdc34a7fb955ff2999ff69bac908cc2238b2b7f
 F test/shell6.test e3b883b61d4916b6906678a35f9d19054861123ad91b856461e0a456273bdbb8
 F test/shell7.test 43fd8e511c533bab5232e95c7b4be93b243451709e89582600d4b6e67693d5c3
 F test/shell8.test 641cf21a99c59404c24e3062923734951c4099a6b6b6520de00cf7a1249ee871
 F test/shell9.test 8742a5b390cdcef6369f5aa223e415aa4255a4129ef249b177887dc635a87209
-F test/shellA.test 3a3ccbac90367d51f12c3d762c90e84723492e3bc5d228cfefd4c6ebfc72394d
+F test/shellA.test 4ece22f204532fb04ab702c5b9c70d8680ff610bff1e82c849c16a7b5cd57d83
 F test/shellB.test ca8a5ce5b9a59098732fa140c911162f0306f70239c6c2de6da9b718ca304cad
 F test/shmlock.test 9f1f729a7fe2c46c88b156af819ac9b72c0714ac6f7246638a73c5752b5fd13c
 F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
@@ -2176,8 +2176,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 404576214fc20161cdcb031d57696d6068506309c8faecd3e4424e5ced28046b
-R 656e4e2e056e170cfa1c688265c9909d
+P 52e022375961ad9460412e40e100219ee59055eb0ab309cbfc2ab19f61929a45
+R 90207c5bcf877b0621eec6aeeab42653
 U drh
-Z 2168f764ba4213c8e8606210a6330583
+Z 04f01ffacb993786991c47ce0eda4152
 # Remove this line to create a well-formed Fossil manifest.
index 4b5ec8de963d717a10af3f0245c17305fcb5888f..81d750b4a18cd15cc47e09d7416a2be19e5141cc 100644 (file)
@@ -1 +1 @@
-52e022375961ad9460412e40e100219ee59055eb0ab309cbfc2ab19f61929a45
+2aebd7bfecaaf1f75b52b05a0d3009fc0dc61289ae666d24cb4e3ddfaf251645
index b60d38c2f46c009959d9f177345159035814dee1..dc1ad60b872cabde341abe6e1f856cc56b72a775 100644 (file)
@@ -1975,6 +1975,7 @@ static void output_c_string(FILE *out, const char *z){
   char ace[3] = "\\?";
   char cbsSay;
   cli_puts(zq, out);
+  if( z==0 ) z = "";
   while( *z!=0 ){
     const char *pcDQBSRO = anyOfInStr(z, zDQBSRO, ~(size_t)0);
     const char *pcPast = zSkipValidUtf8(z, INT_MAX, ctrlMask);
index 2251826608f43e9750c7bb845e12ed18e1fc2bff..3f0e19e7bee2791c2075c0da99e3ffdd89372e94 100644 (file)
@@ -48,7 +48,7 @@ do_test shell1-1.1.1b {
 } {1 1}
 # error on extra options
 do_test shell1-1.1.2 {
-  catchcmd "test.db \"select+3\" \"select+4\"" ""
+  catchcmd "-compat 20250101 test.db \"select+3\" \"select+4\"" ""
 } {0 {3
 4}}
 # error on extra options
@@ -182,7 +182,7 @@ do_test shell1-1.17.1 {
   catchcmd {-- --db "CREATE TABLE T(c1);"}
 } {0 {}}
 do_test shell1-1.17.2 {
-  catchcmd {-- --db "SELECT name from sqlite_schema;"}
+  catchcmd {-compat 20250101 -- --db "SELECT name from sqlite_schema;"}
 } {0 T}
 forcedelete ./--db
 
@@ -456,7 +456,7 @@ do_test shell1-3.12.3 {
 #                          tabs     Tab-separated values
 #                          tcl      TCL list elements
 do_test shell1-3.13.1 {
-  catchcmd "test.db" ".mode"
+  catchcmd "test.db" ".mode 20250101\n.mode"
 } {0 {current output mode: list}}
 do_test shell1-3.13.2 {
   catchcmd "test.db" ".mode FOO"
@@ -510,7 +510,7 @@ do_test shell1-3.15.1 {
 .print x"
 } {0 x}
 do_test shell1-3.15.2 {
-  catchcmd "test.db" ".output FOO
+  catchcmd "test.db" ".mode 20250101\n.output FOO
 .print x
 .output
 SELECT readfile('FOO');"
@@ -632,7 +632,7 @@ do_test shell1-3.22.4 {
 
 # .show                  Show the current values for various settings
 do_test shell1-3.23.1 {
-  set res [catchcmd "test.db" ".show"]
+  set res [catchcmd "test.db" ".mode 20250101\n.show"]
   list [regexp {echo:} $res] \
        [regexp {explain:} $res] \
        [regexp {headers:} $res] \
@@ -668,7 +668,7 @@ do_test shell1-3.23b.4 {
 # Adverse interaction between .stats and .eqp
 #
 do_test shell1-3.23b.5 {
-  catchcmd "test.db" [string map {"\n    " "\n"} {
+  catchcmd "test.db" [string map {"\n    " "\n"} {.mode 20250101
     CREATE TEMP TABLE t1(x);
     INSERT INTO t1 VALUES(1),(2);
     .stats on
@@ -751,9 +751,9 @@ do_test shell1-3.27.4 {
   catchcmd "test.db" ".timer OFF BAD"
 } {1 {Usage: .timer on|off}}
 
-do_test shell1-3-28.1 {
+do_test shell1-3.28.1 {
   catchcmd test.db \
-     ".log stdout\nSELECT coalesce(sqlite_log(123,'hello'),'456');"
+     ".mode 20250101\n.log stdout\nSELECT coalesce(sqlite_log(123,'hello'),'456');"
 } "0 {(123) hello\n456}"
 
 do_test shell1-3-29.1 {
@@ -1263,7 +1263,7 @@ do_test shell1-7.1.7 {
 # information.
 #
 do_test shell1-8.1 {
-  catchcmd ":memory:" {
+  catchcmd ":memory:" {.mode 20250101
     -- The pow2 table will hold all the necessary powers of two.
     CREATE TABLE pow2(x INTEGER PRIMARY KEY, v TEXT);
     WITH RECURSIVE c(x,v) AS (
index eb1903ce27d04b483ed6ac2f9465d26732bbab49..dcf2942e180ea16df8f30151ebc1de80bfe74c02 100644 (file)
@@ -44,7 +44,7 @@ do_test shell2-1.1.1 {
 # Shell silently ignores extra parameters.
 # Ticket [f5cb008a65].
 do_test shell2-1.2.1 {
-  catchcmdex {:memory: "select+3" "select+4"}
+  catchcmdex {:memory: -list "select+3" "select+4"}
 } {0 {3
 4
 }}
@@ -75,7 +75,8 @@ do_test shell2-1.3 {
 # NB. whitespace is important
 do_test shell2-1.4.1 {
   forcedelete foo.db
-  catchcmd "foo.db" {CREATE TABLE foo(a);
+  catchcmd "foo.db" {.mode 20250101
+CREATE TABLE foo(a);
 INSERT INTO foo(a) VALUES(1);
 SELECT * FROM foo;}
 } {0 1}
@@ -84,7 +85,7 @@ SELECT * FROM foo;}
 # NB. whitespace is important
 do_test shell2-1.4.2 {
   forcedelete foo.db
-  catchcmd "-echo foo.db" {CREATE TABLE foo(a);
+  catchcmd "-compat 20250101 -echo foo.db" {CREATE TABLE foo(a);
 INSERT INTO foo(a) VALUES(1);
 SELECT * FROM foo;}
 } {0 {CREATE TABLE foo(a);
@@ -96,7 +97,9 @@ SELECT * FROM foo;
 # NB. whitespace is important
 do_test shell2-1.4.3 {
   forcedelete foo.db
-  catchcmd "foo.db" {.echo ON
+  catchcmd "foo.db" {
+.mode 20250101
+.echo ON
 CREATE TABLE foo(a);
 INSERT INTO foo(a) VALUES(1);
 SELECT * FROM foo;}
@@ -110,7 +113,9 @@ SELECT * FROM foo;
 # NB. whitespace is important
 do_test shell2-1.4.4 {
   forcedelete foo.db
-  catchcmd "foo.db" {.echo ON
+  catchcmd "foo.db" {
+.mode 20250101
+.echo ON
 CREATE TABLE foo(a);
 .echo OFF
 INSERT INTO foo(a) VALUES(1);
@@ -124,7 +129,9 @@ SELECT * FROM foo;}
 # NB. whitespace is important
 do_test shell2-1.4.5 {
   forcedelete foo.db
-  catchcmdex "foo.db" {.echo ON
+  catchcmdex "foo.db" {
+.mode 20250101
+.echo ON
 CREATE TABLE foo1(a);
 INSERT INTO foo1(a) VALUES(1);
 CREATE TABLE foo2(b);
@@ -153,7 +160,9 @@ SELECT * FROM foo1; SELECT * FROM foo2;
 # NB. whitespace is important
 do_test shell2-1.4.6 {
   forcedelete foo.db
-  catchcmdex "foo.db" {.echo ON
+  catchcmdex "foo.db" {
+.mode 20250101
+.echo ON
 .headers ON
 CREATE TABLE foo1(a);
 INSERT INTO foo1(a) VALUES(1);
@@ -208,6 +217,7 @@ do_test shell2-1.4.9 {
 do_test shell2-1.4.9 {
   forcedelete clone.db
   set res [catchcmd :memory: [string trim {
+.mode 20250101
  CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT);
  INSERT INTO t VALUES (1),(2);
 .clone clone.db
@@ -222,6 +232,7 @@ ifcapable vtab {
 # See overflow report at https://sqlite.org/forum/forumpost/5d34ce5280
 do_test shell2-1.4.10 {
  set res [catchcmd :memory: [string trim {
+ .mode 20250101
  SELECT * FROM generate_series(9223372036854775807,9223372036854775807,1);
  SELECT * FROM generate_series(9223372036854775807,9223372036854775807,-1);
  SELECT avg(value),min(value),max(value) FROM generate_series(
@@ -248,6 +259,65 @@ do_test shell2-1.4.10 {
 0
 1
 2}}
+do_test shell2-1.4.10b {
+ set res [catchcmd :memory: [string trim {
+ .mode 20251116
+.print
+ SELECT * FROM generate_series(9223372036854775807,9223372036854775807,1);
+ SELECT * FROM generate_series(9223372036854775807,9223372036854775807,-1);
+ SELECT avg(value),min(value),max(value) FROM generate_series(
+  -9223372036854775808,9223372036854775807,1085102592571150095);
+ SELECT * FROM generate_series(-9223372036854775808,9223372036854775807,
+  9223372036854775807);
+ SELECT value FROM generate_series(-4611686018427387904,
+  4611686018427387904, 4611686018427387904) ORDER BY value DESC;
+ SELECT * FROM generate_series(0,-2,-1);
+ SELECT * FROM generate_series(0,-2);
+ SELECT * FROM generate_series(0,2) LIMIT 3;}]]
+} {0 {
+┌─────────────────────┐
+│        value        │
+├─────────────────────┤
+│ 9223372036854775807 │
+└─────────────────────┘
+┌─────────────────────┐
+│        value        │
+├─────────────────────┤
+│ 9223372036854775807 │
+└─────────────────────┘
+┌────────────┬──────────────────────┬─────────────────────┐
+│ avg(value) │      min(value)      │     max(value)      │
+├────────────┼──────────────────────┼─────────────────────┤
+│ -0.5       │ -9223372036854775808 │ 9223372036854775807 │
+└────────────┴──────────────────────┴─────────────────────┘
+┌──────────────────────┐
+│        value         │
+├──────────────────────┤
+│ -9223372036854775808 │
+│ -1                   │
+│ 9223372036854775806  │
+└──────────────────────┘
+┌──────────────────────┐
+│        value         │
+├──────────────────────┤
+│ 4611686018427387904  │
+│ 0                    │
+│ -4611686018427387904 │
+└──────────────────────┘
+┌───────┐
+│ value │
+├───────┤
+│ 0     │
+│ -1    │
+│ -2    │
+└───────┘
+┌───────┐
+│ value │
+├───────┤
+│ 0     │
+│ 1     │
+│ 2     │
+└───────┘}}
 }  ;# ifcapable vtab
 
 ifcapable vtab {
@@ -270,7 +340,7 @@ do_test shell2-1.4.11 {
 # Bug from forum post 7cbe081746dd3803
 # Keywords as column names were producing an error message.
 do_test shell2-1.4.12 {
-  set res [catchcmd :memory: [string trim {
+  set res [catchcmd :memory: [string trim {.mode 20250101
  CREATE TABLE "group"("order" text);
  INSERT INTO "group" VALUES ('ABC');
 .sha3sum}]]
index 6bb49f5c3d9468b92cd206cc7a3c99ad0b36bdfc..5d7e311b968ae13c3d066bc0fccb55840e163f2f 100644 (file)
@@ -109,7 +109,7 @@ do_test shell3-2.7 {
 # Run combinations of odd identifiers, comments, semicolon placement
 do_test shell3-3.1 {
   forcedelete foo.db
-  set rc [ catchcmd "foo.db" {CREATE TABLE t1("
+  set rc [ catchcmd "foo.db -compat 20250101" {CREATE TABLE t1("
 a--.
 " --x
 ); CREATE TABLE t2("a[""b""]");
index 3ced0702e4de76f5860853a1487a500685e97fd9..3614909c7bbc0fdbb9baabf3fd916cfb92559cf5 100644 (file)
@@ -136,15 +136,15 @@ SELECT * FROM t1;}
 
 do_test shell4-3.1 {
   set fd [open t1.txt wb]
-  puts $fd "SELECT 'squirrel';"
+  puts $fd ".mode list\nSELECT 'squirrel';"
   close $fd
-  exec $::CLI_ONLY :memory: --interactive ".read t1.txt"
+  exec $::CLI_ONLY --noinit :memory: --interactive ".read t1.txt"
 } {squirrel}
 do_test_with_ansi_output shell4-3.2 {
   set fd [open t1.txt wb]
-  puts $fd "SELECT 'pound: \302\243';"
+  puts $fd ".mode list\nSELECT 'pound: \302\243';"
   close $fd
-  exec $::CLI_ONLY :memory: --interactive ".read t1.txt"
+  exec $::CLI_ONLY --noinit :memory: --interactive ".read t1.txt"
 } {pound: £}
 
 do_test shell4-4.1 {
index 9298f15e5bb9cc87a6b3caab24fe646e2c8811c2..de64c3198ad1df388da3a351ac5094e140b434bd 100644 (file)
@@ -59,13 +59,13 @@ do_test shell5-1.2.4 {
 
 # column separator should default to "|"
 do_test shell5-1.3.1.1 {
-  set res [catchcmd "test.db" ".show"]
+  set res [catchcmd "test.db" ".mode list\n.show"]
   list [regexp {colseparator: \"\|\"} $res]
 } {1}
 
 # row separator should default to "\n"
 do_test shell5-1.3.1.2 {
-  set res [catchcmd "test.db" ".show"]
+  set res [catchcmd "test.db" ".mode list\n.show"]
   list [regexp {rowseparator: \"\\n\"} $res]
 } {1}
 
@@ -97,7 +97,9 @@ do_test shell5-1.4.2 {
   forcedelete shell5.csv
   set in [open shell5.csv w]
   close $in
-  set res [catchcmd ":memory:" {ATTACH 'test.db' AS test;
+  set res [catchcmd ":memory:" {
+.mode list
+ATTACH 'test.db' AS test;
 .import -schema test shell5.csv t1
 SELECT COUNT(*) FROM test.t1;}]
 } {0 0}
@@ -116,7 +118,7 @@ do_test shell5-1.4.4 {
   set in [open shell5.csv w]
   puts $in "1|2|3"
   close $in
-  set res [catchcmd ":memory:" {ATTACH 'test.db' AS test;
+  set res [catchcmd ":memory: --list" {ATTACH 'test.db' AS test;
 .import --schema test shell5.csv t1}]
 } {1 {shell5.csv:1: expected 2 columns but found 3 - extras ignored}}
 
@@ -125,7 +127,7 @@ do_test shell5-1.4.5 {
   set in [open shell5.csv w]
   puts $in "1|2"
   close $in
-  set res [catchcmd "test.db" {DELETE FROM t1;
+  set res [catchcmd "test.db -list" {DELETE FROM t1;
 .import shell5.csv t1
 SELECT COUNT(*) FROM t1;}]
 } {0 1}
@@ -138,7 +140,9 @@ do_test shell5-1.4.6 {
   puts $in "2|3"
   puts $in "3|4"
   close $in
-  set res [catchcmd ":memory:" {ATTACH 'test.db' AS test;
+  set res [catchcmd ":memory:" {
+.mode list
+ATTACH 'test.db' AS test;
 .import -schema test shell5.csv t1
 SELECT COUNT(*) FROM test.t1;}]
 } {0 3}
@@ -148,7 +152,9 @@ do_test shell5-1.4.7 {
   set in [open shell5.csv w]
   puts $in "4,5"
   close $in
-  set res [catchcmd ":memory:" {ATTACH 'test.db' AS test;
+  set res [catchcmd ":memory:" {
+.mode list
+ATTACH 'test.db' AS test;
 .separator ,
 .import --schema test shell5.csv t1
 SELECT COUNT(*) FROM test.t1;}]
@@ -159,12 +165,13 @@ do_test shell5-1.4.8.1 {
   set in [open shell5.csv w]
   puts $in "5|Now is the time for all good men to come to the aid of their country."
   close $in
-  set res [catchcmd "test.db" {.import shell5.csv t1
+  set res [catchcmd "test.db" {.mode list
+.import shell5.csv t1
 SELECT COUNT(*) FROM t1;}]
 } {0 5}
 
 do_test shell5-1.4.8.2 {
-  catchcmd "test.db" {SELECT b FROM t1 WHERE a='5';}
+  catchcmd "test.db -list" {SELECT b FROM t1 WHERE a='5';}
 } {0 {Now is the time for all good men to come to the aid of their country.}}
 
 # import file with 1 row, 2 columns, quoted text data
@@ -174,12 +181,12 @@ do_test shell5-1.4.9.1 {
   set in [open shell5.csv w]
   puts $in "6|'Now is the time for all good men to come to the aid of their country.'"
   close $in
-  set res [catchcmd "test.db" {.import shell5.csv t1
+  set res [catchcmd "test.db -list" {.import shell5.csv t1
 SELECT COUNT(*) FROM t1;}]
 } {0 6}
 
 do_test shell5-1.4.9.2 {
-  catchcmd "test.db" {SELECT b FROM t1 WHERE a='6';}
+  catchcmd "test.db -list" {SELECT b FROM t1 WHERE a='6';}
 } {0 {'Now is the time for all good men to come to the aid of their country.'}}
 
 # import file with 1 row, 2 columns, quoted text data
@@ -187,12 +194,12 @@ do_test shell5-1.4.10.1 {
   set in [open shell5.csv w]
   puts $in "7|\"Now is the time for all good men to come to the aid of their country.\""
   close $in
-  set res [catchcmd "test.db" {.import shell5.csv t1
+  set res [catchcmd "test.db -list" {.import shell5.csv t1
 SELECT COUNT(*) FROM t1;}]
 } {0 7}
 
 do_test shell5-1.4.10.2 {
-  catchcmd "test.db" {SELECT b FROM t1 WHERE a='7';}
+  catchcmd "test.db -list" {SELECT b FROM t1 WHERE a='7';}
 } {0 {Now is the time for all good men to come to the aid of their country.}}
 
 # import file with 2 rows, 2 columns and an initial BOM
@@ -203,7 +210,7 @@ do_test shell5-1.4.11 {
   puts $in "2|3"
   puts $in "4|5"
   close $in
-  set res [catchcmd "test.db" {CREATE TABLE t2(x INT, y INT);
+  set res [catchcmd "test.db -list" {CREATE TABLE t2(x INT, y INT);
 .import shell5.csv t2
 .mode quote
 .header on
@@ -218,7 +225,7 @@ do_test shell5-1.4.12 {
   puts $in "\xef\xbb\xbf\"two\"|3"
   puts $in "4|5"
   close $in
-  set res [catchcmd "test.db" {DELETE FROM t2;
+  set res [catchcmd "test.db -list" {DELETE FROM t2;
 .import shell5.csv t2
 .mode quote
 .header on
@@ -232,7 +239,7 @@ do_test shell5-1.5.1 {
   set in [open shell5.csv w]
   puts $in "8|$str"
   close $in
-  set res [catchcmd "test.db" {.import shell5.csv t1
+  set res [catchcmd "test.db -list" {.import shell5.csv t1
 SELECT length(b) FROM t1 WHERE a='8';}]
 } {0 999}
 
@@ -252,7 +259,7 @@ do_test shell5-1.6.1 {
   set in [open shell5.csv w]
   puts $in $data
   close $in
-  set res [catchcmd "test.db" {DROP TABLE IF EXISTS t2;
+  set res [catchcmd "test.db -list" {DROP TABLE IF EXISTS t2;
 .import shell5.csv t2
 SELECT COUNT(*) FROM t2;}]
 } {0 1}
@@ -588,7 +595,7 @@ do_test shell5-7.1 {
   puts $out {aaa|bbb}
   close $out
   forcedelete test.db
-  catchcmd :memory: {CREATE TABLE t1(a TEXT, b TEXT, c AS (a||b));
+  catchcmd ":memory: -list" {CREATE TABLE t1(a TEXT, b TEXT, c AS (a||b));
 .import shell5.csv t1
 SELECT * FROM t1;}
 } {0 aaa|bbb|aaabbb}
index fac9ea25344a95f90947b366bc69f889573ee31c..c2694479b9d8932591198736f60ef3704b91fadf 100644 (file)
@@ -36,7 +36,7 @@ do_execsql_test shellA-1.0 {
 # and that our calls to the CLI are working.
 #
 do_test_with_ansi_output shellA-1.2 {
-  exec {*}$CLI test.db {.mode box --escape symbol} {SELECT * FROM t1;}
+  exec {*}$CLI -noinit test.db {.mode box -quote off --escape symbol} {SELECT * FROM t1;}
 } {
 ┌───┬──────────────────────────┐
 │ a │            x             │
@@ -63,33 +63,33 @@ do_test_with_ansi_output shellA-1.2 {
 # ".mode list"
 #
 do_test shellA-1.3 {
-  exec {*}$CLI test.db {SELECT x FROM t1 WHERE a=2;}
+  exec {*}$CLI -noinit -list test.db {SELECT x FROM t1 WHERE a=2;}
 } {
 ^[[31mVT-100 codes^[[0m
 }
 do_test_with_ansi_output shellA-1.4 {
-  exec {*}$CLI test.db --escape symbol {SELECT x FROM t1 WHERE a=2;}
+  exec {*}$CLI -noinit -list test.db --escape symbol {SELECT x FROM t1 WHERE a=2;}
 } {
 ␛[31mVT-100 codes␛[0m
 }
 do_test shellA-1.5 {
-  exec {*}$CLI test.db --escape ascii {SELECT x FROM t1 WHERE a=2;}
+  exec {*}$CLI -noinit -list test.db --escape ascii {SELECT x FROM t1 WHERE a=2;}
 } {
 ^[[31mVT-100 codes^[[0m
 }
 do_test_with_ansi_output shellA-1.6 {
-  exec {*}$CLI test.db {.mode list --escape symbol} {SELECT x FROM t1 WHERE a=2;}
+  exec {*}$CLI -noinit test.db {.mode list --escape symbol} {SELECT x FROM t1 WHERE a=2;}
 } {
 ␛[31mVT-100 codes␛[0m
 }
 do_test shellA-1.7 {
-  exec {*}$CLI test.db {.mode list --escape ascii} {SELECT x FROM t1 WHERE a=2;}
+  exec {*}$CLI -noinit test.db {.mode list --escape ascii} {SELECT x FROM t1 WHERE a=2;}
 } {
 ^[[31mVT-100 codes^[[0m
 }
 do_test shellA-1.8 {
   file delete -force out.txt
-  exec {*}$CLI test.db {.mode list --escape off} {SELECT x FROM t1 WHERE a=7;} \
+  exec {*}$CLI -noinit test.db {.mode list --escape off} {SELECT x FROM t1 WHERE a=7;} \
      >out.txt
   set fd [open out.txt rb]
   set res [read $fd]
@@ -98,15 +98,15 @@ do_test shellA-1.8 {
 } "carriage\rreturn"
 do_test shellA-1.9 {
   set rc [catch {
-     exec {*}$CLI test.db {.mode test --escape xyz}
+     exec {*}$CLI -noinit test.db {.mode test --escape xyz}
   } msg]
   lappend rc $msg
-} {1 {argv[2]: .mode test --escape xyz
-argv[2]:       ^--- unknown mode
-argv[2]: Use ".help .mode" for more info}}
+} {1 {argv[3]: .mode test --escape xyz
+argv[3]:       ^--- unknown mode
+argv[3]: Use ".help .mode" for more info}}
 do_test shellA-1.10 {
   set rc [catch {
-     exec {*}$CLI --escape abc test.db .q
+     exec {*}$CLI --noinit --escape abc test.db .q
   } msg]
   lappend rc $msg
 } {1 {unknown control character escape mode "abc" - choices: auto off ascii symbol}}
@@ -114,7 +114,7 @@ do_test shellA-1.10 {
 # ".mode quote"
 #
 do_test shellA-2.1 {
- exec {*}$CLI test.db --quote {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
+ exec {*}$CLI -noinit test.db --quote {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
 } {
 1,'line with '' single quote'
 2,unistr('\u001b[31mVT-100 codes\u001b[0m')
@@ -123,20 +123,20 @@ do_test shellA-2.1 {
 8,'last line'
 }
 do_test shellA-2.2 {
-  exec {*}$CLI test.db --quote {.mode -v}
+  exec {*}$CLI -noinit test.db --quote {.mode -v}
 } {/*current output mode: quote* --escape auto*/}
 do_test shellA-2.3 {
-  exec {*}$CLI test.db --quote --escape SYMBOL {.mode}
+  exec {*}$CLI -noinit -compat 20250101 test.db --quote --escape SYMBOL {.mode}
 } {current output mode: quote --escape symbol}
 do_test shellA-2.4 {
-  exec {*}$CLI test.db --quote --escape OFF {.mode}
+  exec {*}$CLI -noinit -compat 20250101 test.db --quote --escape OFF {.mode}
 } {current output mode: quote --escape off}
 
 
 # ".mode line"
 #
 do_test_with_ansi_output shellA-3.1 {
- exec {*}$CLI test.db --line --escape symbol \
+ exec {*}$CLI -noinit test.db --line --escape symbol \
     {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
 } {
     a = 1
@@ -156,7 +156,7 @@ line
     x = last line
 }
 do_test shellA-3.2 {
- exec {*}$CLI test.db --line --escape ascii \
+ exec {*}$CLI -noinit test.db --line --escape ascii \
     {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
 } {
     a = 1
@@ -179,7 +179,7 @@ line
 # ".mode box"
 #
 do_test_with_ansi_output shellA-4.1 {
- exec {*}$CLI test.db --box --escape ascii \
+ exec {*}$CLI -noinit test.db --box --escape ascii \
     {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
 } {
 ┌───┬──────────────────────────┐
@@ -198,7 +198,7 @@ do_test_with_ansi_output shellA-4.1 {
 └───┴──────────────────────────┘
 }
 do_test_with_ansi_output shellA-4.2 {
- exec {*}$CLI test.db {.mode qbox} {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
+ exec {*}$CLI -noinit test.db {.mode qbox} {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
 } {
 ┌───┬───────────────────────────────────────────┐
 │ a │                     x                     │
@@ -214,7 +214,7 @@ do_test_with_ansi_output shellA-4.2 {
 # ".mode insert"
 #
 do_test shellA-5.1 {
- exec {*}$CLI test.db {.mode insert t1 --escape ascii} \
+ exec {*}$CLI -noinit test.db {.mode insert t1 --escape ascii} \
     {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
 } {
 INSERT INTO t1 VALUES(1,'line with '' single quote');
@@ -224,7 +224,7 @@ INSERT INTO t1 VALUES(7,unistr('carriage\u000dreturn'));
 INSERT INTO t1 VALUES(8,'last line');
 }
 do_test shellA-5.2 {
- exec {*}$CLI test.db {.mode insert t1 --escape symbol} \
+ exec {*}$CLI -noinit test.db {.mode insert t1 --escape symbol} \
     {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
 } {
 INSERT INTO t1 VALUES(1,'line with '' single quote');
@@ -235,7 +235,7 @@ INSERT INTO t1 VALUES(8,'last line');
 }
 do_test shellA-5.3 {
   file delete -force out.txt
-  exec {*}$CLI test.db {.mode insert t1 --escape off} \
+  exec {*}$CLI -noinit test.db {.mode insert t1 --escape off} \
     {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)} >out.txt
   set fd [open out.txt rb]
   set res [read $fd]