/ Check-in [90e9deae]
Login

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

Overview
Comment:Modify the command-line shell to print a warning when using an in-memory database.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | memdb-warning
Files: files | file ages | folders
SHA1: 90e9deae4a2bf63308a212226314aa7838c161d9
User & Date: drh 2014-02-10 16:13:42
Context
2014-02-10
19:27
In the command-line shell, on the banner, warn about the use of a transient in-memory database in bold red text. check-in: 0fbc0fce user: drh tags: memdb-warning
16:13
Modify the command-line shell to print a warning when using an in-memory database. check-in: 90e9deae user: drh tags: memdb-warning
15:56
Improvements to a "Synopsis:" comment in the VDBE engine. check-in: 0dfa7ee9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

  3516   3516   int main(int argc, char **argv){
  3517   3517     char *zErrMsg = 0;
  3518   3518     struct callback_data data;
  3519   3519     const char *zInitFile = 0;
  3520   3520     char *zFirstCmd = 0;
  3521   3521     int i;
  3522   3522     int rc = 0;
         3523  +  int warnInmemoryDb = 0;
  3523   3524   
  3524   3525     if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
  3525   3526       fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
  3526   3527               sqlite3_sourceid(), SQLITE_SOURCE_ID);
  3527   3528       exit(1);
  3528   3529     }
  3529   3530     Argv0 = argv[0];
................................................................................
  3610   3611           exit(1);
  3611   3612         }
  3612   3613       }
  3613   3614     }
  3614   3615     if( data.zDbFilename==0 ){
  3615   3616   #ifndef SQLITE_OMIT_MEMORYDB
  3616   3617       data.zDbFilename = ":memory:";
         3618  +    warnInmemoryDb = 1;
  3617   3619   #else
  3618   3620       fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
  3619   3621       return 1;
  3620   3622   #endif
  3621   3623     }
  3622   3624     data.out = stdout;
  3623   3625   
................................................................................
  3750   3752         int nHistory;
  3751   3753         printf(
  3752   3754           "SQLite version %s %.19s\n" /*extra-version-info*/
  3753   3755           "Enter \".help\" for instructions\n"
  3754   3756           "Enter SQL statements terminated with a \";\"\n",
  3755   3757           sqlite3_libversion(), sqlite3_sourceid()
  3756   3758         );
         3759  +      if( warnInmemoryDb ){
         3760  +         printf(
         3761  +            "Warning: connected to an in-memory database. "
         3762  +            "Use \".open FILENAME\" to change\nto a persistent "
         3763  +            "on-disk database.\n"
         3764  +         );
         3765  +      }
  3757   3766         zHome = find_home_dir();
  3758   3767         if( zHome ){
  3759   3768           nHistory = strlen30(zHome) + 20;
  3760   3769           if( (zHistory = malloc(nHistory))!=0 ){
  3761   3770             sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
  3762   3771           }
  3763   3772         }