aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest16
-rw-r--r--manifest.uuid2
-rw-r--r--src/shell.c.in44
-rw-r--r--test/shell1.test4
4 files changed, 41 insertions, 25 deletions
diff --git a/manifest b/manifest
index e7fde4d1c..58b04384a 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplified\s"hidden"\sand\s"no-expand"\shandling\sin\sthe\s*-expander.
-D 2022-05-10T00:24:01.438
+C Sync\sw/\strunk
+D 2022-05-10T14:57:38.059
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -554,7 +554,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
F src/resolve.c e9ee235c4151d2b7fa47435a219bfd30bf516a804d2f004639858087ebf3137b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c cd17de0cab436f0efc4cfeeeef1b8e03c41c40335ec757eff68e341e6a3f763f
-F src/shell.c.in ae0a6fae983caac6f8c824733f0599dfdf7b3a7e8efdef3cb5e3ab2e457ffc35
+F src/shell.c.in af2e55dbd1b3d1ea5b8c677f815ec8180aefef22299996f8ae64090d02d51aca
F src/sqlite.h.in 2a35f62185eb5e7ecc64a2f68442b538ce9be74f80f28a00abc24837edcf1c17
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h f49e28c25bd941e79794db5415fdf7b202deb3bc072ed6f1ed273d578703684e
@@ -1397,7 +1397,7 @@ F test/sharedA.test 49d87ec54ab640fbbc3786ee3c01de94aaa482a3a9f834ad3fe92770eb69
F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
-F test/shell1.test f7a2ef8260aa01f20be3185118213b1ae70518fdcd2105f3e25b021b5ca800ac
+F test/shell1.test eb2a7b768a1a20d70a8a205b11a8e3fd94b7f8d98d45aa9fb90433202609b0c3
F test/shell2.test 7a3a23a9f57b99453f1679b1fe8072cb30e382a622874c0c4d97695fadb0a787
F test/shell3.test a50628ab1d78d90889d9d3f32fb2c084ee15674771e96afe954aaa0accd1de3c
F test/shell4.test 8f6c0fce4abed19a8a7f7262517149812a04caa905d01bdc8f5e92573504b759
@@ -1953,8 +1953,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 8ce2fecb580da53fc01c53d8de10e2cc99499094215429ba925e777717e369b2
-R 1d734b9b8260c8ccdbe3f05b6dc084ca
-U drh
-Z 5869ac2082a6ad38c03068b658209d1b
+P 35cef458ca114649ee16e00714d817d57673b96c007454946cc411ae90fd06ce c6c3115f3a008cf9b0d7c5c812f17e38c8a75a904032c5f05f0bea03a7340527
+R f7b2f45a58e73d19b8d50de0bb6840c3
+U larrybr
+Z 774454cea980d5e07191a21244229d21
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index cc85684e9..152665be1 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-c6c3115f3a008cf9b0d7c5c812f17e38c8a75a904032c5f05f0bea03a7340527 \ No newline at end of file
+b7285f92bb9bfd8471e51ee5b6dbd7030b1f731683876e8ecca4a8c033688736 \ No newline at end of file
diff --git a/src/shell.c.in b/src/shell.c.in
index 95a32f524..1f446cadb 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -1191,10 +1191,11 @@ struct ShellState {
#define SHFLG_PreserveRowid 0x00000008 /* .dump preserves rowid values */
#define SHFLG_Newlines 0x00000010 /* .dump --newline flag */
#define SHFLG_CountChanges 0x00000020 /* .changes setting */
-#define SHFLG_Echo 0x00000040 /* .echo or --echo setting */
-#define SHFLG_HeaderSet 0x00000080 /* showHeader has been specified */
-#define SHFLG_DumpDataOnly 0x00000100 /* .dump show data only */
-#define SHFLG_DumpNoSys 0x00000200 /* .dump omits system tables */
+#define SHFLG_Echo 0x00000040 /* .echo on/off, or --echo setting */
+#define SHFLG_EchoSql 0x00000080 /* .echo sql, before prepare */
+#define SHFLG_HeaderSet 0x00000100 /* showHeader has been specified */
+#define SHFLG_DumpDataOnly 0x00000200 /* .dump show data only */
+#define SHFLG_DumpNoSys 0x00000400 /* .dump omits system tables */
/*
** Macros for testing and setting shellFlgs
@@ -3796,6 +3797,11 @@ static int shell_exec(
}
#endif
+ /* Echo the sql statement(s) if echoing SQL early (before prepare.) */
+ if( pArg && ShellHasFlag(pArg, SHFLG_EchoSql) ){
+ utf8_printf(pArg->out, "%s\n", zSql);
+ }
+
while( zSql[0] && (SQLITE_OK == rc) ){
static const char *zStmtSql;
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
@@ -3824,7 +3830,6 @@ static int shell_exec(
if( pArg && ShellHasFlag(pArg, SHFLG_Echo) ){
utf8_printf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
}
-
/* Show the EXPLAIN QUERY PLAN if .eqp is on */
if( pArg && pArg->autoEQP && sqlite3_stmt_isexplain(pStmt)==0 ){
sqlite3_stmt *pExplain;
@@ -8437,8 +8442,8 @@ static int do_meta_command(char *zLine, ShellState *p){
int i;
int savedShowHeader = p->showHeader;
int savedShellFlags = p->shellFlgs;
- ShellClearFlag(p,
- SHFLG_PreserveRowid|SHFLG_Newlines|SHFLG_Echo
+ ShellClearFlag(p,
+ SHFLG_PreserveRowid|SHFLG_Newlines|SHFLG_Echo|SHFLG_EchoSql
|SHFLG_DumpDataOnly|SHFLG_DumpNoSys);
for(i=1; i<nArg; i++){
if( azArg[i][0]=='-' ){
@@ -8545,9 +8550,14 @@ static int do_meta_command(char *zLine, ShellState *p){
if( c=='e' && strncmp(azArg[0], "echo", n)==0 ){
if( nArg==2 ){
- setOrClearFlag(p, SHFLG_Echo, azArg[1]);
+ ShellClearFlag(p,(SHFLG_Echo|SHFLG_EchoSql));
+ if( strcmp(azArg[1],"sql")==0 ){
+ ShellSetFlag(p,(SHFLG_EchoSql));
+ }else{
+ setOrClearFlag(p, SHFLG_Echo, azArg[1]);
+ }
}else{
- raw_printf(stderr, "Usage: .echo on|off\n");
+ raw_printf(stderr, "Usage: .echo on|off|sql\n");
rc = 1;
}
}else
@@ -9667,7 +9677,7 @@ static int do_meta_command(char *zLine, ShellState *p){
if( eMode=='x' ){
/* spreadsheet mode. Output as CSV. */
newTempFile(p, "csv");
- ShellClearFlag(p, SHFLG_Echo);
+ ShellClearFlag(p, SHFLG_Echo|SHFLG_EchoSql);
p->mode = MODE_Csv;
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf);
@@ -10629,7 +10639,8 @@ static int do_meta_command(char *zLine, ShellState *p){
goto meta_command_exit;
}
utf8_printf(p->out, "%12.12s: %s\n","echo",
- azBool[ShellHasFlag(p, SHFLG_Echo)]);
+ (ShellHasFlag(p, SHFLG_EchoSql))
+ ? "sql" : azBool[ShellHasFlag(p, SHFLG_Echo)]);
utf8_printf(p->out, "%12.12s: %s\n","eqp", azBool[p->autoEQP&3]);
utf8_printf(p->out, "%12.12s: %s\n","explain",
p->mode==MODE_Explain ? "on" : p->autoExplain ? "auto" : "off");
@@ -11379,7 +11390,7 @@ static QuickScanState quickscan(char *zLine, QuickScanState qss){
cWait = 0;
qss = QSS_SETV(qss, 0);
goto PlainScan;
- default: assert(0);
+ default: assert(0);
}
}
}
@@ -11400,7 +11411,7 @@ static int line_is_command_terminator(char *zLine){
zLine += 2; /* SQL Server */
else
return 0;
- return quickscan(zLine,QSS_Start)==QSS_Start;
+ return quickscan(zLine, QSS_Start)==QSS_Start;
}
/*
@@ -11722,7 +11733,8 @@ static const char zOptions[] =
#if !defined(SQLITE_OMIT_DESERIALIZE)
" -deserialize open the database using sqlite3_deserialize()\n"
#endif
- " -echo print commands before execution\n"
+ " -echo print inputs before execution\n"
+ " -echo-sql print SQL before prepare\n"
" -init FILENAME read/process named file\n"
" -[no]header turn headers on or off\n"
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
@@ -12229,7 +12241,11 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
data.showHeader = 0;
ShellSetFlag(&data, SHFLG_HeaderSet);
}else if( strcmp(z,"-echo")==0 ){
+ ShellClearFlag(&data, SHFLG_EchoSql);
ShellSetFlag(&data, SHFLG_Echo);
+ }else if( strcmp(z,"-echo-sql")==0 ){
+ ShellClearFlag(&data, SHFLG_Echo);
+ ShellSetFlag(&data, SHFLG_EchoSql);
}else if( strcmp(z,"-eqp")==0 ){
data.autoEQP = AUTOEQP_on;
}else if( strcmp(z,"-eqpfull")==0 ){
diff --git a/test/shell1.test b/test/shell1.test
index 3c7061c55..f2aac1a52 100644
--- a/test/shell1.test
+++ b/test/shell1.test
@@ -313,7 +313,7 @@ do_test shell1-3.4.2 {
# .echo ON|OFF Turn command echo on or off
do_test shell1-3.5.1 {
catchcmd "test.db" ".echo"
-} {1 {Usage: .echo on|off}}
+} {1 {Usage: .echo on|off|sql}}
do_test shell1-3.5.2 {
catchcmd "test.db" ".echo ON"
} {0 {}}
@@ -323,7 +323,7 @@ do_test shell1-3.5.3 {
do_test shell1-3.5.4 {
# too many arguments
catchcmd "test.db" ".echo OFF BAD"
-} {1 {Usage: .echo on|off}}
+} {1 {Usage: .echo on|off|sql}}
# .exit Exit this program
do_test shell1-3.6.1 {