In the command-line shell, on the banner, warn about the use of a

transient in-memory database in bold red text.

FossilOrigin-Name: 0fbc0fcec1b3a67065fa0ebb49375bf675789edc
This commit is contained in:
drh 2014-02-10 19:27:05 +00:00
parent b373591c5e
commit 1247aa4e4a
3 changed files with 38 additions and 18 deletions

View File

@ -1,5 +1,5 @@
C Modify\sthe\scommand-line\sshell\sto\sprint\sa\swarning\swhen\susing\san\sin-memory\ndatabase.
D 2014-02-10T16:13:42.339
C In\sthe\scommand-line\sshell,\son\sthe\sbanner,\swarn\sabout\sthe\suse\sof\sa\ntransient\sin-memory\sdatabase\sin\sbold\sred\stext.
D 2014-02-10T19:27:05.611
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -220,7 +220,7 @@ F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
F src/resolve.c 7eda9097b29fcf3d2b42fdc17d1de672134e09b6
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
F src/select.c c055a9fa25a4e7fc8c1652c44a31d6382dbb1e8a
F src/shell.c df7d96e50415a0aaf63a6cc96c15643229a603ac
F src/shell.c 7e4d5dcb21c860137748899d5025594cd993458e
F src/sqlite.h.in eed7f7d66a60daaa7b4a597dcd9bad87aad9611b
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
@ -1152,10 +1152,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P 0dfa7ee9157ea6b1c745732d6c3fcd066cf4f849
R 795791e045aa26fa5bb54a48e6e7e719
T *branch * memdb-warning
T *sym-memdb-warning *
T -sym-trunk *
P 90e9deae4a2bf63308a212226314aa7838c161d9
R f1273e6958b105060eecb1997e0942c3
U drh
Z fcf385e884073e6fe85607df422ee196
Z 7cce0cacf21f263fd79f8eafb0090d99

View File

@ -1 +1 @@
90e9deae4a2bf63308a212226314aa7838c161d9
0fbc0fcec1b3a67065fa0ebb49375bf675789edc

View File

@ -3500,6 +3500,29 @@ static void main_init(struct callback_data *data) {
sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
}
/*
** Arrange for subsequent text console output to be RED or normal. Use
** the SetConsoleTextAttribute() function on windows. On all other
** platforms, assume VT100 escape sequences are recognized.
*/
#ifdef _WIN32
static void outputRed(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
FOREGROUND_RED|FOREGROUND_INTENSITY);
}
static void outputNormal(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
}
#else
static void outputRed(void){
printf("\033[1;31m");
}
static void outputNormal(void){
printf("\033[0m");
}
#endif
/*
** Get the argument to an --option. Throw an error and die if no argument
** is available.
@ -3615,7 +3638,7 @@ int main(int argc, char **argv){
if( data.zDbFilename==0 ){
#ifndef SQLITE_OMIT_MEMORYDB
data.zDbFilename = ":memory:";
warnInmemoryDb = 1;
warnInmemoryDb = argc==1;
#else
fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
return 1;
@ -3752,16 +3775,16 @@ int main(int argc, char **argv){
int nHistory;
printf(
"SQLite version %s %.19s\n" /*extra-version-info*/
"Enter \".help\" for instructions\n"
"Enter SQL statements terminated with a \";\"\n",
"Enter \".help\" for usage hints.\n",
sqlite3_libversion(), sqlite3_sourceid()
);
if( warnInmemoryDb ){
printf(
"Warning: connected to an in-memory database. "
"Use \".open FILENAME\" to change\nto a persistent "
"on-disk database.\n"
);
printf("Connected to a ");
outputRed();
printf("transient in-memory database");
outputNormal();
printf(".\nUse \".open FILENAME\" to reopen on a "
"persistent database.\n");
}
zHome = find_home_dir();
if( zHome ){