/ Check-in [049c3c42]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Include more detailed version information in the command-line shell output.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 049c3c42fdefea8de7ec7008871963e37ce2d7bc
User & Date: drh 2011-06-03 13:28:22
Context
2011-06-03
14:19
Hush some harmless compiler warnings in the URI parsing logic. check-in: 0206bc6f user: drh tags: trunk
13:28
Include more detailed version information in the command-line shell output. check-in: 049c3c42 user: drh tags: trunk
13:06
Add shell scripts used for testing compiler warnings (tool/warnings.sh), for verifying that the library exports the correct symbols (tool/symbols.sh), and to demonstrate building a full-featured command-line shell (tool/build-shell.sh). check-in: 3aca9a92 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/shell.c.

  2297   2297     }else
  2298   2298       
  2299   2299     if( HAS_TIMER && c=='t' && n>=5 && strncmp(azArg[0], "timer", n)==0
  2300   2300      && nArg==2
  2301   2301     ){
  2302   2302       enableTimer = booleanValue(azArg[1]);
  2303   2303     }else
         2304  +  
         2305  +  if( c=='v' && strncmp(azArg[0], "version", n)==0 ){
         2306  +    printf("SQLite %s %s\n",
         2307  +        sqlite3_libversion(), sqlite3_sourceid());
         2308  +  }else
  2304   2309     
  2305   2310     if( c=='w' && strncmp(azArg[0], "width", n)==0 && nArg>1 ){
  2306   2311       int j;
  2307   2312       assert( nArg<=ArraySize(azArg) );
  2308   2313       for(j=1; j<nArg && j<ArraySize(p->colWidth); j++){
  2309   2314         p->colWidth[j-1] = atoi(azArg[j]);
  2310   2315       }
................................................................................
  2832   2837       }else if( strcmp(z,"-echo")==0 ){
  2833   2838         data.echoOn = 1;
  2834   2839       }else if( strcmp(z,"-stats")==0 ){
  2835   2840         data.statsOn = 1;
  2836   2841       }else if( strcmp(z,"-bail")==0 ){
  2837   2842         bail_on_error = 1;
  2838   2843       }else if( strcmp(z,"-version")==0 ){
  2839         -      printf("%s\n", sqlite3_libversion());
         2844  +      printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
  2840   2845         return 0;
  2841   2846       }else if( strcmp(z,"-interactive")==0 ){
  2842   2847         stdin_is_interactive = 1;
  2843   2848       }else if( strcmp(z,"-batch")==0 ){
  2844   2849         stdin_is_interactive = 0;
  2845   2850       }else if( strcmp(z,"-heap")==0 ){
  2846   2851         i++;
................................................................................
  2877   2882       /* Run commands received from standard input
  2878   2883       */
  2879   2884       if( stdin_is_interactive ){
  2880   2885         char *zHome;
  2881   2886         char *zHistory = 0;
  2882   2887         int nHistory;
  2883   2888         printf(
  2884         -        "SQLite version %s\n"
         2889  +        "SQLite version %s %.19s\n"
  2885   2890           "Enter \".help\" for instructions\n"
  2886   2891           "Enter SQL statements terminated with a \";\"\n",
  2887         -        sqlite3_libversion()
         2892  +        sqlite3_libversion(), sqlite3_sourceid()
  2888   2893         );
  2889   2894         zHome = find_home_dir();
  2890   2895         if( zHome ){
  2891   2896           nHistory = strlen30(zHome) + 20;
  2892   2897           if( (zHistory = malloc(nHistory))!=0 ){
  2893   2898             sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
  2894   2899           }

Changes to tool/shell1.test.

   195    195     set rc [lindex $res 0]
   196    196     list $rc \
   197    197          [regexp {Error: missing argument for option: -nullvalue} $res]
   198    198   } {1 1}
   199    199   
   200    200   # -version             show SQLite version
   201    201   do_test shell1-1.16.1 {
   202         -  catchcmd "-version test.db" "" 
   203         -} {0 3.7.7}
          202  +  set x [catchcmd "-version test.db" ""]
          203  +  regexp {0 \{3.\d.\d+ 20\d\d-[01]\d-\d\d \d\d:\d\d:\d\d [0-9a-f]+\}} $x 
          204  +} 1
   204    205   
   205    206   #----------------------------------------------------------------------------
   206    207   # Test cases shell1-2.*: Basic "dot" command token parsing.
   207    208   #
   208    209   
   209    210   # check first token handling
   210    211   do_test shell1-2.1.1 {