aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2018-10-30 15:31:22 +0000
committerdrh <drh@noemail.net>2018-10-30 15:31:22 +0000
commita751f39c3fb8f9abd162b44c6d754142f232f1dd (patch)
treee86af7a1ed340b615dc5368f15801e0d681df34a /src
parentad9bfa5e075731baeb0f3df69466fbe15618fb81 (diff)
downloadsqlite-a751f39c3fb8f9abd162b44c6d754142f232f1dd.tar.gz
sqlite-a751f39c3fb8f9abd162b44c6d754142f232f1dd.zip
Modify the CLI so that the --deserialize option is only available if it is
compiled with SQLITE_ENABLE_DESERIALIZE. DESERIALIZE is now off by default for the main.mk makefile, but on for Makefile.in and Makefile.msc. FossilOrigin-Name: 90b2a684f775e1468d63bf950119cf0aaa62b5a449f518e7cc513c314191dd14
Diffstat (limited to 'src')
-rw-r--r--src/shell.c.in13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/shell.c.in b/src/shell.c.in
index 3ec31f83d..4fcd93c01 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -3434,7 +3434,9 @@ static const char *(azHelp[]) = {
".open ?OPTIONS? ?FILE? Close existing database and reopen FILE",
" Options:",
" --append Use appendvfs to append database to the end of FILE",
+#ifdef SQLITE_ENABLE_DESERIALIZE
" --deserialize Load into memory useing sqlite3_deserialize()",
+#endif
" --new Initialize FILE to an empty database",
" --readonly Open FILE readonly",
" --zip FILE is a ZIP archive",
@@ -3783,7 +3785,9 @@ static void open_db(ShellState *p, int openFlags){
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", p->zDbFilename);
sqlite3_exec(p->db, zSql, 0, 0, 0);
sqlite3_free(zSql);
- }else if( p->openMode==SHELL_OPEN_DESERIALIZE ){
+ }
+#ifdef SQLITE_ENABLE_DESERIALIZE
+ else if( p->openMode==SHELL_OPEN_DESERIALIZE ){
int nData = 0;
unsigned char *aData = (unsigned char*)readFile(p->zDbFilename, &nData);
int rc = sqlite3_deserialize(p->db, "main", aData, nData, nData,
@@ -3793,6 +3797,7 @@ static void open_db(ShellState *p, int openFlags){
utf8_printf(stderr, "Error: sqlite3_deserialize() returns %d\n", rc);
}
}
+#endif
}
}
@@ -6673,8 +6678,10 @@ static int do_meta_command(char *zLine, ShellState *p){
p->openMode = SHELL_OPEN_APPENDVFS;
}else if( optionMatch(z, "readonly") ){
p->openMode = SHELL_OPEN_READONLY;
+#ifdef SQLITE_ENABLE_DESERIALIZE
}else if( optionMatch(z, "deserialize") ){
p->openMode = SHELL_OPEN_DESERIALIZE;
+#endif
}else if( z[0]=='-' ){
utf8_printf(stderr, "unknown option: %s\n", z);
rc = 1;
@@ -8643,8 +8650,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
#endif
}else if( strcmp(z,"-append")==0 ){
data.openMode = SHELL_OPEN_APPENDVFS;
+#ifdef SQLITE_ENABLE_DESERIALIZE
}else if( strcmp(z,"-deserialize")==0 ){
data.openMode = SHELL_OPEN_DESERIALIZE;
+#endif
}else if( strcmp(z,"-readonly")==0 ){
data.openMode = SHELL_OPEN_READONLY;
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
@@ -8740,8 +8749,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
#endif
}else if( strcmp(z,"-append")==0 ){
data.openMode = SHELL_OPEN_APPENDVFS;
+#ifdef SQLITE_ENABLE_DESERIALIZE
}else if( strcmp(z,"-deserialize")==0 ){
data.openMode = SHELL_OPEN_DESERIALIZE;
+#endif
}else if( strcmp(z,"-readonly")==0 ){
data.openMode = SHELL_OPEN_READONLY;
}else if( strcmp(z,"-ascii")==0 ){