Fix a problem with the CLI where not all SQL commands were being echoed.
Added tests of same to tools/shell2.test. Ticket [eb620916be]. FossilOrigin-Name: 7080ae3bc3828168483ac23d5b8976d67ea5089e
This commit is contained in:
parent
1d0f43f0ae
commit
b7977c5539
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
|||||||
C Fix\stest\snumbering\sin\sfts3snippet.test.
|
C Fix\sa\sproblem\swith\sthe\sCLI\swhere\snot\sall\sSQL\scommands\swere\sbeing\sechoed.\s\s\nAdded\stests\sof\ssame\sto\stools/shell2.test.\s\sTicket\s[eb620916be].
|
||||||
D 2010-01-15T17:33:50
|
D 2010-01-18T18:17:10
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
|
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@ -163,7 +163,7 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
|||||||
F src/resolve.c 56ecd50851afa9dbcc1803ef86a9b17b3f3d3b89
|
F src/resolve.c 56ecd50851afa9dbcc1803ef86a9b17b3f3d3b89
|
||||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||||
F src/select.c 0109b993c360d649857523abb72919e1794f9b45
|
F src/select.c 0109b993c360d649857523abb72919e1794f9b45
|
||||||
F src/shell.c b95c5fcfe458027f192914a47474652969a1ec0f
|
F src/shell.c d7408dbe4d17fbefc0e63e85f6498634962922f9
|
||||||
F src/sqlite.h.in d493cf5029de67fe7252324473d89140a007a6c4
|
F src/sqlite.h.in d493cf5029de67fe7252324473d89140a007a6c4
|
||||||
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
|
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
|
||||||
F src/sqliteInt.h 84b20b8be124b9c1d4abfd79208710febba382fa
|
F src/sqliteInt.h 84b20b8be124b9c1d4abfd79208710febba382fa
|
||||||
@ -772,7 +772,7 @@ F tool/omittest.tcl 27d6f6e3b1e95aeb26a1c140e6eb57771c6d794a
|
|||||||
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
|
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
|
||||||
F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a
|
F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a
|
||||||
F tool/shell1.test ef08a3e738b9fee4fc228920956950bc35db0575
|
F tool/shell1.test ef08a3e738b9fee4fc228920956950bc35db0575
|
||||||
F tool/shell2.test 91824fff77514b6b00227744c475c09c34134a4e
|
F tool/shell2.test 8f51f61c13b88618e71c17439fe0847c2421c5d1
|
||||||
F tool/shell3.test ff663e83100670a295d473515c12beb8103a78b6
|
F tool/shell3.test ff663e83100670a295d473515c12beb8103a78b6
|
||||||
F tool/showdb.c 8ab8b3b53884312aafb7ef60982e255a6c31d238
|
F tool/showdb.c 8ab8b3b53884312aafb7ef60982e255a6c31d238
|
||||||
F tool/showjournal.c ec3b171be148656827c4949fbfb8ab4370822f87
|
F tool/showjournal.c ec3b171be148656827c4949fbfb8ab4370822f87
|
||||||
@ -785,7 +785,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 5e9d8ccae9731f380527463ef87ddcd216b4b721
|
P 34f6854685f00158bc536dd53ac5bc20e19fe071
|
||||||
R 6754ce2dfd9d134bc105f32a3aa30412
|
R 33c261ff7c30e0ad7a1793cafe971c5c
|
||||||
U dan
|
U shaneh
|
||||||
Z bbb4d86ef223195e8166a6c82a95bc90
|
Z 79aeb636bb9c2f44057691bade01f4e8
|
||||||
|
@ -1 +1 @@
|
|||||||
34f6854685f00158bc536dd53ac5bc20e19fe071
|
7080ae3bc3828168483ac23d5b8976d67ea5089e
|
10
src/shell.c
10
src/shell.c
@ -1501,10 +1501,6 @@ static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int
|
|||||||
int i;
|
int i;
|
||||||
struct callback_data *p = (struct callback_data*)pArg;
|
struct callback_data *p = (struct callback_data*)pArg;
|
||||||
|
|
||||||
if( p->echoOn && p->cnt==0 && p->pStmt){
|
|
||||||
printf("%s\n", sqlite3_sql(p->pStmt));
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( p->mode ){
|
switch( p->mode ){
|
||||||
case MODE_Line: {
|
case MODE_Line: {
|
||||||
int w = 5;
|
int w = 5;
|
||||||
@ -1855,6 +1851,12 @@ static int shell_exec(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* echo the sql statement if echo on */
|
||||||
|
if( pArg->echoOn ){
|
||||||
|
char *zStmtSql = sqlite3_sql(pStmt);
|
||||||
|
fprintf(pArg->out,"%s\n", zStmtSql ? zStmtSql : zSql);
|
||||||
|
}
|
||||||
|
|
||||||
/* perform the first step. this will tell us if we
|
/* perform the first step. this will tell us if we
|
||||||
** have a result set or not and how wide it is.
|
** have a result set or not and how wide it is.
|
||||||
*/
|
*/
|
||||||
|
119
tool/shell2.test
119
tool/shell2.test
@ -99,3 +99,122 @@ do_test shell2-1.3 {
|
|||||||
} {1 {Error: near line 9: too many levels of trigger recursion}}
|
} {1 {Error: near line 9: too many levels of trigger recursion}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Shell not echoing all commands with echo on.
|
||||||
|
# Ticket [eb620916be].
|
||||||
|
|
||||||
|
# Test with echo off
|
||||||
|
# NB. whitespace is important
|
||||||
|
do_test shell2-1.4.1 {
|
||||||
|
file delete -force foo.db
|
||||||
|
catchcmd "foo.db" {CREATE TABLE foo(a);
|
||||||
|
INSERT INTO foo(a) VALUES(1);
|
||||||
|
SELECT * FROM foo;}
|
||||||
|
} {0 1}
|
||||||
|
|
||||||
|
# Test with echo on using command line option
|
||||||
|
# NB. whitespace is important
|
||||||
|
do_test shell2-1.4.2 {
|
||||||
|
file delete -force foo.db
|
||||||
|
catchcmd "-echo foo.db" {CREATE TABLE foo(a);
|
||||||
|
INSERT INTO foo(a) VALUES(1);
|
||||||
|
SELECT * FROM foo;}
|
||||||
|
} {0 {CREATE TABLE foo(a);
|
||||||
|
INSERT INTO foo(a) VALUES(1);
|
||||||
|
SELECT * FROM foo;
|
||||||
|
1}}
|
||||||
|
|
||||||
|
# Test with echo on using dot command
|
||||||
|
# NB. whitespace is important
|
||||||
|
do_test shell2-1.4.3 {
|
||||||
|
file delete -force foo.db
|
||||||
|
catchcmd "foo.db" {.echo ON
|
||||||
|
CREATE TABLE foo(a);
|
||||||
|
INSERT INTO foo(a) VALUES(1);
|
||||||
|
SELECT * FROM foo;}
|
||||||
|
} {0 {CREATE TABLE foo(a);
|
||||||
|
INSERT INTO foo(a) VALUES(1);
|
||||||
|
SELECT * FROM foo;
|
||||||
|
1}}
|
||||||
|
|
||||||
|
# Test with echo on using dot command and
|
||||||
|
# turning off mid- processing.
|
||||||
|
# NB. whitespace is important
|
||||||
|
do_test shell2-1.4.4 {
|
||||||
|
file delete -force foo.db
|
||||||
|
catchcmd "foo.db" {.echo ON
|
||||||
|
CREATE TABLE foo(a);
|
||||||
|
.echo OFF
|
||||||
|
INSERT INTO foo(a) VALUES(1);
|
||||||
|
SELECT * FROM foo;}
|
||||||
|
} {0 {CREATE TABLE foo(a);
|
||||||
|
.echo OFF
|
||||||
|
1}}
|
||||||
|
|
||||||
|
# Test with echo on using dot command and
|
||||||
|
# multiple commands per line.
|
||||||
|
# NB. whitespace is important
|
||||||
|
do_test shell2-1.4.5 {
|
||||||
|
file delete -force foo.db
|
||||||
|
catchcmd "foo.db" {.echo ON
|
||||||
|
CREATE TABLE foo1(a);
|
||||||
|
INSERT INTO foo1(a) VALUES(1);
|
||||||
|
CREATE TABLE foo2(b);
|
||||||
|
INSERT INTO foo2(b) VALUES(1);
|
||||||
|
SELECT * FROM foo1; SELECT * FROM foo2;
|
||||||
|
INSERT INTO foo1(a) VALUES(2); INSERT INTO foo2(b) VALUES(2);
|
||||||
|
SELECT * FROM foo1; SELECT * FROM foo2;
|
||||||
|
}
|
||||||
|
} {0 {CREATE TABLE foo1(a);
|
||||||
|
INSERT INTO foo1(a) VALUES(1);
|
||||||
|
CREATE TABLE foo2(b);
|
||||||
|
INSERT INTO foo2(b) VALUES(1);
|
||||||
|
SELECT * FROM foo1;
|
||||||
|
1
|
||||||
|
SELECT * FROM foo2;
|
||||||
|
1
|
||||||
|
INSERT INTO foo1(a) VALUES(2);
|
||||||
|
INSERT INTO foo2(b) VALUES(2);
|
||||||
|
SELECT * FROM foo1;
|
||||||
|
1
|
||||||
|
2
|
||||||
|
SELECT * FROM foo2;
|
||||||
|
1
|
||||||
|
2}}
|
||||||
|
|
||||||
|
# Test with echo on and headers on using dot command and
|
||||||
|
# multiple commands per line.
|
||||||
|
# NB. whitespace is important
|
||||||
|
do_test shell2-1.4.6 {
|
||||||
|
file delete -force foo.db
|
||||||
|
catchcmd "foo.db" {.echo ON
|
||||||
|
.headers ON
|
||||||
|
CREATE TABLE foo1(a);
|
||||||
|
INSERT INTO foo1(a) VALUES(1);
|
||||||
|
CREATE TABLE foo2(b);
|
||||||
|
INSERT INTO foo2(b) VALUES(1);
|
||||||
|
SELECT * FROM foo1; SELECT * FROM foo2;
|
||||||
|
INSERT INTO foo1(a) VALUES(2); INSERT INTO foo2(b) VALUES(2);
|
||||||
|
SELECT * FROM foo1; SELECT * FROM foo2;
|
||||||
|
}
|
||||||
|
} {0 {.headers ON
|
||||||
|
CREATE TABLE foo1(a);
|
||||||
|
INSERT INTO foo1(a) VALUES(1);
|
||||||
|
CREATE TABLE foo2(b);
|
||||||
|
INSERT INTO foo2(b) VALUES(1);
|
||||||
|
SELECT * FROM foo1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
SELECT * FROM foo2;
|
||||||
|
b
|
||||||
|
1
|
||||||
|
INSERT INTO foo1(a) VALUES(2);
|
||||||
|
INSERT INTO foo2(b) VALUES(2);
|
||||||
|
SELECT * FROM foo1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
|
SELECT * FROM foo2;
|
||||||
|
b
|
||||||
|
1
|
||||||
|
2}}
|
||||||
|
Loading…
Reference in New Issue
Block a user