| 1 |
#!sqlite3 |
| 2 |
# |
| 3 |
# 2026-01-30 |
| 4 |
# |
| 5 |
# The author disclaims copyright to this source code. In place of |
| 6 |
# a legal notice, here is a blessing: |
| 7 |
# |
| 8 |
# May you do good and not evil. |
| 9 |
# May you find forgiveness for yourself and forgive others. |
| 10 |
# May you share freely, never taking more than you give. |
| 11 |
# |
| 12 |
#*********************************************************************** |
| 13 |
# |
| 14 |
# Miscellaneous tests for dot-commands |
| 15 |
# |
| 16 |
# ./sqlite3 test/dotcmd01.sql |
| 17 |
# |
| 18 |
|
| 19 |
.testcase setup |
| 20 |
.open :memory: |
| 21 |
.mode tty |
| 22 |
.check '' |
| 23 |
|
| 24 |
# The ".eqp on" setting does not affect the output from .fullschema |
| 25 |
# and similar. |
| 26 |
# |
| 27 |
.testctrl opt -Stat4 |
| 28 |
.testcase 100 |
| 29 |
CREATE TABLE t1(a,b,c); |
| 30 |
WITH RECURSIVE c(n) AS (VALUES(1) UNION ALL SELECT n+1 FROM c WHERE n<300) |
| 31 |
INSERT INTO t1(a,b,c) |
| 32 |
SELECT n%10, n%30, n%100 FROM c; |
| 33 |
CREATE INDEX t1a ON t1(a); |
| 34 |
CREATE INDEX t1b ON t1(b); |
| 35 |
ANALYZE; |
| 36 |
.eqp on |
| 37 |
.fullschema |
| 38 |
.check <<END |
| 39 |
CREATE TABLE t1(a,b,c); |
| 40 |
CREATE INDEX t1a ON t1(a); |
| 41 |
CREATE INDEX t1b ON t1(b); |
| 42 |
ANALYZE sqlite_schema; |
| 43 |
INSERT INTO sqlite_stat1 VALUES('t1','t1b','300 10'), |
| 44 |
('t1','t1a','300 30'); |
| 45 |
ANALYZE sqlite_schema; |
| 46 |
END |
| 47 |
|
| 48 |
.testcase 110 |
| 49 |
.schema |
| 50 |
.check <<END |
| 51 |
CREATE TABLE t1(a,b,c); |
| 52 |
CREATE INDEX t1a ON t1(a); |
| 53 |
CREATE INDEX t1b ON t1(b); |
| 54 |
CREATE TABLE sqlite_stat1(tbl,idx,stat); |
| 55 |
END |
| 56 |
|
| 57 |
.testcase 120 |
| 58 |
.tables |
| 59 |
.check --glob "t1" |
| 60 |
|
| 61 |
.testcase 130 |
| 62 |
.indexes |
| 63 |
.check --glob t1a*t1b |