Index: src/shell.c ================================================================== --- src/shell.c +++ src/shell.c @@ -22,11 +22,11 @@ ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** -** $Id: shell.c,v 1.28 2001/01/04 14:20:18 drh Exp $ +** $Id: shell.c,v 1.29 2001/01/04 14:27:08 drh Exp $ */ #include #include #include #include "sqlite.h" @@ -686,10 +686,11 @@ int main(int argc, char **argv){ char *zErrMsg = 0; char *argv0 = argv[0]; struct callback_data data; + int echo = 0; memset(&data, 0, sizeof(data)); data.mode = MODE_List; strcpy(data.separator,"|"); data.showHeader = 0; @@ -718,10 +719,14 @@ argc--; argv++; }else if( strcmp(argv[1],"-noheader")==0 ){ data.showHeader = 0; argc--; + argv++; + }else if( strcmp(argv[1],"-echo")==0 ){ + echo = 1; + argc--; argv++; }else{ fprintf(stderr,"%s: unknown option: %s\n", argv0, argv[1]); return 1; } @@ -761,10 +766,11 @@ "Enter \".help\" for instructions\n", sqlite_version ); } while( (zLine = one_input_line(zSql, istty))!=0 ){ + if( echo ) printf("%s\n", zLine); if( zLine && zLine[0]=='.' ){ do_meta_command(zLine, db, &data); free(zLine); continue; } @@ -790,11 +796,11 @@ free(zLine); if( zSql && sqlite_complete(zSql) ){ data.cnt = 0; if( sqlite_exec(db, zSql, callback, &data, &zErrMsg)!=0 && zErrMsg!=0 ){ - if( !istty ) printf("%s\n",zSql); + if( !istty && !echo ) printf("%s\n",zSql); printf("SQL error: %s\n", zErrMsg); free(zErrMsg); zErrMsg = 0; } free(zSql); Index: www/changes.tcl ================================================================== --- www/changes.tcl +++ www/changes.tcl @@ -18,10 +18,11 @@ } chng {2001 Jan 4 (1.0.18)} {
  • Print the offending SQL statement when an error occurs.
  • Do not require commas between constraints in CREATE TABLE statements.
  • +
  • Added the "-echo" option to the shell.
  • Changes to comments.
  • } chng {2000 Dec 10 (1.0.17)} {
  • Rewrote sqlite_complete() to make it faster.