Fix a problem in the shell preventing it from working with

SQLITE_OMIT_AUTOINIT builds.

FossilOrigin-Name: 89209000a205c685bb6bd941376ef16e507919d192d606c1be110ccf2921d9bd
This commit is contained in:
dan 2018-04-18 09:16:11 +00:00
parent ed0c15b52e
commit 16a474273e
3 changed files with 24 additions and 17 deletions

View File

@ -1,5 +1,5 @@
C Lemon\senhancements:\s\s(1)\sDo\snot\sallocate\sspace\sfor\sthe\s'error'\snon-terminal\nif\sit\sis\snot\sused.\s(2)\sFix\san\soff-by-one\sproblem\sso\sthat\s'unsigned\schar'\scan\nbe\sused\sfor\ssymbol\snumbers\sif\sthe\snumber\sof\ssymbols\sis\s256.
D 2018-04-16T14:31:34.763
C Fix\sa\sproblem\sin\sthe\sshell\spreventing\sit\sfrom\sworking\swith\nSQLITE_OMIT_AUTOINIT\sbuilds.
D 2018-04-18T09:16:11.382
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 7016fc56c6b9bfe5daac4f34be8be38d8c0b5fab79ccbfb764d3b23bf1c6fff3
@ -492,7 +492,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c b3ace63b0470cb0063c2acc3a1dcb95eb432be45ed3c931854694f8a000cd763
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
F src/select.c 3e84cb869930aa8fcacd3acbb1a0ec2d82736c8479d6a4367a5f1a926fb8a763
F src/shell.c.in cc960721e56ebc1a78773bb5d2f5608b54275f945cbe49e4afe919d6888062a7
F src/shell.c.in 7fbdc5c59265f50f266f45e822234d2c0911b96486b41a2970b19157f5bb3b37
F src/sqlite.h.in e0be726ea6e4e6571724d39d242472ecd8bd1ba6f84ade88e1641bde98a6d02b
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 83a3c4ce93d650bedfd1aa558cb85a516bd6d094445ee989740827d0d944368d
@ -1717,7 +1717,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f94528e1c70765c8649750b2d9c17f23e81f191554ff56d905a9abe3fb6037b7
R 18b312f44245c8bb0efcaee081107bdf
U drh
Z 3fd29baec877178d68467f0290bb20cf
P 3b7801acff91905d0e78e06121ebcf2664f6de5f605699dc8726ec9bcb558eb8
R a0146e2418a1016db3981cef5d6586f3
U dan
Z 637909db0518eab1f4c770ca4f8eeed3

View File

@ -1 +1 @@
3b7801acff91905d0e78e06121ebcf2664f6de5f605699dc8726ec9bcb558eb8
89209000a205c685bb6bd941376ef16e507919d192d606c1be110ccf2921d9bd

View File

@ -3484,7 +3484,6 @@ static int deduceDatabaseType(const char *zName, int dfltZip){
*/
static void open_db(ShellState *p, int keepAlive){
if( p->db==0 ){
sqlite3_initialize();
if( p->openMode==SHELL_OPEN_UNSPEC && access(p->zDbFilename,0)==0 ){
p->openMode = (u8)deduceDatabaseType(p->zDbFilename, 0);
}
@ -8025,7 +8024,6 @@ static void process_sqliterc(
" cannot read ~/.sqliterc\n");
return;
}
sqlite3_initialize();
zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
sqliterc = zBuf;
}
@ -8173,6 +8171,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
int readStdin = 1;
int nCmd = 0;
char **azCmd = 0;
const char *zVfs = 0; /* Value of -vfs command-line option */
setBinaryMode(stdin, 0);
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
@ -8332,13 +8331,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
}else if( strcmp(z,"-vfs")==0 ){
sqlite3_vfs *pVfs = sqlite3_vfs_find(cmdline_option_value(argc,argv,++i));
if( pVfs ){
sqlite3_vfs_register(pVfs, 1);
}else{
utf8_printf(stderr, "no such VFS: \"%s\"\n", argv[i]);
exit(1);
}
zVfs = cmdline_option_value(argc, argv, ++i);
#ifdef SQLITE_HAVE_ZLIB
}else if( strcmp(z,"-zip")==0 ){
data.openMode = SHELL_OPEN_ZIPFILE;
@ -8355,6 +8348,20 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
#endif
}
}
/* All the sqlite3_config() calls have now been made. So it is safe
** to call sqlite3_initialize() and process any command line -vfs option. */
sqlite3_initialize();
if( zVfs ){
sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs);
if( pVfs ){
sqlite3_vfs_register(pVfs, 1);
}else{
utf8_printf(stderr, "no such VFS: \"%s\"\n", argv[i]);
exit(1);
}
}
if( data.zDbFilename==0 ){
#ifndef SQLITE_OMIT_MEMORYDB
data.zDbFilename = ":memory:";