mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-24 14:17:58 +03:00
Speed and (slightly) simplify shell's input line early processing.
FossilOrigin-Name: a1c7f7f8e1b46440234be96e813e4c2c28150413dd95dcab5d13b9c80a202edf
This commit is contained in:
@@ -43,10 +43,10 @@ do_test shell2-1.1.1 {
|
||||
# Shell silently ignores extra parameters.
|
||||
# Ticket [f5cb008a65].
|
||||
do_test shell2-1.2.1 {
|
||||
set rc [catch { eval exec $CLI \":memory:\" \"select+3\" \"select+4\" } msg]
|
||||
list $rc $msg
|
||||
catchcmdex {:memory: "select+3" "select+4"}
|
||||
} {0 {3
|
||||
4}}
|
||||
4
|
||||
}}
|
||||
|
||||
# Test a problem reported on the mailing list. The shell was at one point
|
||||
# returning the generic SQLITE_ERROR message ("SQL error or missing database")
|
||||
@@ -123,7 +123,7 @@ SELECT * FROM foo;}
|
||||
# NB. whitespace is important
|
||||
do_test shell2-1.4.5 {
|
||||
forcedelete foo.db
|
||||
catchcmd "foo.db" {.echo ON
|
||||
catchcmdex "foo.db" {.echo ON
|
||||
CREATE TABLE foo1(a);
|
||||
INSERT INTO foo1(a) VALUES(1);
|
||||
CREATE TABLE foo2(b);
|
||||
@@ -155,7 +155,7 @@ SELECT * FROM foo2;
|
||||
# NB. whitespace is important
|
||||
do_test shell2-1.4.6 {
|
||||
forcedelete foo.db
|
||||
catchcmd "foo.db" {.echo ON
|
||||
catchcmdex "foo.db" {.echo ON
|
||||
.headers ON
|
||||
CREATE TABLE foo1(a);
|
||||
INSERT INTO foo1(a) VALUES(1);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#
|
||||
# shell3-1.*: Basic tests for running SQL statments from command line.
|
||||
# shell3-2.*: Basic tests for running SQL file from command line.
|
||||
# shell3-3.*: Basic tests for processing odd SQL constructs.
|
||||
#
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -26,6 +27,7 @@ db close
|
||||
forcedelete test.db test.db-journal test.db-wal
|
||||
sqlite3 db test.db
|
||||
|
||||
|
||||
# There are inconsistencies in command-line argument quoting on Windows.
|
||||
# In particular, individual applications are responsible for command-line
|
||||
# parsing in Windows, not the shell. Depending on whether the sqlite3.exe
|
||||
@@ -98,4 +100,39 @@ do_test shell3-2.7 {
|
||||
catchcmd "foo.db" "CREATE TABLE"
|
||||
} {1 {Error: near line 1: incomplete input}}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# shell3-3.*: Basic tests for processing odd SQL constructs.
|
||||
#
|
||||
|
||||
# Run combinations of odd identifiers, comments, semicolon placement
|
||||
do_test shell3-3.1 {
|
||||
forcedelete foo.db
|
||||
set rc [ catchcmd "foo.db" {CREATE TABLE t1("
|
||||
a--.
|
||||
" --x
|
||||
); CREATE TABLE t2("a[""b""]");
|
||||
.header on
|
||||
INSERT INTO t1 VALUES ('
|
||||
x''y');
|
||||
INSERT INTO t2 VALUES ('
|
||||
/*.
|
||||
.*/ x
|
||||
''y');
|
||||
SELECT * from t1 limit 1;
|
||||
SELECT * from t2 limit 1;
|
||||
} ]
|
||||
set fexist [file exist foo.db]
|
||||
list $rc $fexist
|
||||
} {{0 {
|
||||
a--.
|
||||
|
||||
|
||||
x'y
|
||||
a["b"]
|
||||
|
||||
/*.
|
||||
.*/ x
|
||||
'y}} 1}
|
||||
|
||||
finish_test
|
||||
|
||||
Reference in New Issue
Block a user