alignment for numeric values and left alignment for everything else. FossilOrigin-Name: 5fdedc69b1ac05bcdc40ee30c1473be75d3afe89e031d750c8fc3dcfa9846d5b
84 lines
2.8 KiB
Plaintext
84 lines
2.8 KiB
Plaintext
# 2025-11-12
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
#
|
|
# Test cases for the ".mode" command of the CLI.
|
|
# To run these tests:
|
|
#
|
|
# ./sqlite3 <test/modeA.clitest
|
|
#
|
|
#
|
|
CREATE TABLE t1(a,b,c,d,e);
|
|
INSERT INTO t1 VALUES(1,2.5,'three',x'4444',NULL);
|
|
INSERT INTO t1 SELECT b,c,d,e,a FROM t1;
|
|
INSERT INTO t1 SELECT d,e,a,b,c FROM t1;
|
|
.mode box
|
|
|
|
.output memory
|
|
SELECT * FROM t1;
|
|
.output --verify END
|
|
┌─────┬───────┬───────┬───────┬───────┐
|
|
│ a │ b │ c │ d │ e │
|
|
├─────┼───────┼───────┼───────┼───────┤
|
|
│ 1 │ 2.5 │ three │ DD │ │
|
|
│ 2.5 │ three │ DD │ │ 1 │
|
|
│ DD │ │ 1 │ 2.5 │ three │
|
|
│ │ 1 │ 2.5 │ three │ DD │
|
|
└─────┴───────┴───────┴───────┴───────┘
|
|
END
|
|
|
|
.output memory
|
|
.mode --null xyz
|
|
SELECT * FROM t1;
|
|
.output --verify END
|
|
┌─────┬───────┬───────┬───────┬───────┐
|
|
│ a │ b │ c │ d │ e │
|
|
├─────┼───────┼───────┼───────┼───────┤
|
|
│ 1 │ 2.5 │ three │ DD │ xyz │
|
|
│ 2.5 │ three │ DD │ xyz │ 1 │
|
|
│ DD │ xyz │ 1 │ 2.5 │ three │
|
|
│ xyz │ 1 │ 2.5 │ three │ DD │
|
|
└─────┴───────┴───────┴───────┴───────┘
|
|
END
|
|
|
|
.output memory --error-prefix "Error:"
|
|
.mode foo
|
|
.output --verify END
|
|
Error: .mode foo
|
|
Error: ^--- unknown mode
|
|
Error: Use ".help .mode" for more info
|
|
END
|
|
|
|
.output memory
|
|
.mode --null xyzzy -v
|
|
.output -glob ' --null "xyzzy"'
|
|
.output memory
|
|
.mode -null abcde -v
|
|
.output -glob ' --null "abcde"'
|
|
|
|
# Test cases for the ".explain off" command
|
|
.mode box -reset
|
|
.output memory
|
|
EXPLAIN SELECT * FROM t1;
|
|
.output --notglob *────* --keep
|
|
.output --notglob "* id │ parent │ notused │ detail *" --keep
|
|
.output --glob "* Init *"
|
|
.output memory
|
|
EXPLAIN QUERY PLAN SELECT * FROM t1;
|
|
.output --glob "*`--SCAN *"
|
|
.explain off
|
|
.output memory
|
|
EXPLAIN SELECT * FROM t1;
|
|
.output --glob *────*
|
|
.output memory
|
|
EXPLAIN QUERY PLAN SELECT * FROM t1;
|
|
.output --glob "* id │ parent │ notused │ detail *"
|
|
.explain auto
|