/ Check-in [5ddeeb47]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment::-) (CVS 174)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5ddeeb477148295b66fdd78d102827386852fed3
User & Date: drh 2001-01-04 14:27:07
Original User & Date: drh 2001-01-04 14:27:08
Context
2001-01-04
14:27
branches: 1.55.2; :-) (CVS 175) check-in: 81815a9c user: drh tags: trunk
14:27
:-) (CVS 174) check-in: 5ddeeb47 user: drh tags: trunk
14:20
:-) (CVS 173) check-in: e54b0c5e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

    20     20   **   drh@hwaci.com
    21     21   **   http://www.hwaci.com/drh/
    22     22   **
    23     23   *************************************************************************
    24     24   ** This file contains code to implement the "sqlite" command line
    25     25   ** utility for accessing SQLite databases.
    26     26   **
    27         -** $Id: shell.c,v 1.28 2001/01/04 14:20:18 drh Exp $
           27  +** $Id: shell.c,v 1.29 2001/01/04 14:27:08 drh Exp $
    28     28   */
    29     29   #include <stdlib.h>
    30     30   #include <string.h>
    31     31   #include <stdio.h>
    32     32   #include "sqlite.h"
    33     33   #include <unistd.h>
    34     34   #include <ctype.h>
................................................................................
   684    684     }
   685    685   }
   686    686   
   687    687   int main(int argc, char **argv){
   688    688     char *zErrMsg = 0;
   689    689     char *argv0 = argv[0];
   690    690     struct callback_data data;
          691  +  int echo = 0;
   691    692   
   692    693     memset(&data, 0, sizeof(data));
   693    694     data.mode = MODE_List;
   694    695     strcpy(data.separator,"|");
   695    696     data.showHeader = 0;
   696    697   #ifdef SIGINT
   697    698     signal(SIGINT, interrupt_handler);
................................................................................
   716    717       }else if( strcmp(argv[1],"-header")==0 ){
   717    718         data.showHeader = 1;
   718    719         argc--;
   719    720         argv++;
   720    721       }else if( strcmp(argv[1],"-noheader")==0 ){
   721    722         data.showHeader = 0;
   722    723         argc--;
          724  +      argv++;
          725  +    }else if( strcmp(argv[1],"-echo")==0 ){
          726  +      echo = 1;
          727  +      argc--;
   723    728         argv++;
   724    729       }else{
   725    730         fprintf(stderr,"%s: unknown option: %s\n", argv0, argv[1]);
   726    731         return 1;
   727    732       }
   728    733     }
   729    734     if( argc!=2 && argc!=3 ){
................................................................................
   759    764         printf(
   760    765           "SQLite version %s\n"
   761    766           "Enter \".help\" for instructions\n",
   762    767           sqlite_version
   763    768         );
   764    769       }
   765    770       while( (zLine = one_input_line(zSql, istty))!=0 ){
          771  +      if( echo ) printf("%s\n", zLine);
   766    772         if( zLine && zLine[0]=='.' ){
   767    773           do_meta_command(zLine, db, &data);
   768    774           free(zLine);
   769    775           continue;
   770    776         }
   771    777         if( zSql==0 ){
   772    778           int i;
................................................................................
   788    794           nSql += len;
   789    795         }
   790    796         free(zLine);
   791    797         if( zSql && sqlite_complete(zSql) ){
   792    798           data.cnt = 0;
   793    799           if( sqlite_exec(db, zSql, callback, &data, &zErrMsg)!=0 
   794    800                && zErrMsg!=0 ){
   795         -          if( !istty ) printf("%s\n",zSql);
          801  +          if( !istty && !echo ) printf("%s\n",zSql);
   796    802             printf("SQL error: %s\n", zErrMsg);
   797    803             free(zErrMsg);
   798    804             zErrMsg = 0;
   799    805           }
   800    806           free(zSql);
   801    807           zSql = 0;
   802    808           nSql = 0;
   803    809         }
   804    810       }
   805    811     }
   806    812     sqlite_close(db);
   807    813     return 0;
   808    814   }

Changes to www/changes.tcl.

    16     16     puts "<DT><B>$date</B></DT>"
    17     17     puts "<DD><P><UL>$desc</UL></P></DD>"
    18     18   }
    19     19   
    20     20   chng {2001 Jan 4 (1.0.18)} {
    21     21   <li>Print the offending SQL statement when an error occurs.</li>
    22     22   <li>Do not require commas between constraints in CREATE TABLE statements.</li>
           23  +<li>Added the "-echo" option to the shell.</li>
    23     24   <li>Changes to comments.</li>
    24     25   }
    25     26   
    26     27   chng {2000 Dec 10 (1.0.17)} {
    27     28   <li>Rewrote <b>sqlite_complete()</b> to make it faster.</li>
    28     29   <li>Minor tweaks to other code to make it run a little faster.</li>
    29     30   <li>Added new tests for <b>sqlite_complete()</b> and for memory leaks.</li>