In the shell, make sure the database is opened before trying to do

an ".import".  Bug reported on the mailing list. (CVS 3209)

FossilOrigin-Name: 39e3427813135601a7417c96e55b410fa89ac1f5
This commit is contained in:
drh 2006-06-08 16:10:14 +00:00
parent f1952c5d27
commit a543c82d75
3 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Unload\sshared\slibraries\swhen\sa\sdatabase\sconnection\scloses.\s(CVS\s3208) C In\sthe\sshell,\smake\ssure\sthe\sdatabase\sis\sopened\sbefore\strying\sto\sdo\nan\s".import".\s\sBug\sreported\son\sthe\smailing\slist.\s(CVS\s3209)
D 2006-06-08T15:48:01 D 2006-06-08T16:10:15
F Makefile.in 50d948a8c4eda30ebb5799b661bd4c2de11824d0 F Makefile.in 50d948a8c4eda30ebb5799b661bd4c2de11824d0
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -71,7 +71,7 @@ F src/printf.c 7029e5f7344a478394a02c52837ff296ee1ab240
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261 F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
F src/select.c 8daba07a04a6d41f5267ea8353324cbe5a210e14 F src/select.c 8daba07a04a6d41f5267ea8353324cbe5a210e14
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 4f1e4a4d3e7aadd1369604a30293fc3e1726c78c F src/shell.c b9eb3ed4d3ab41fbf630eabb602f3c9d20fc737a
F src/sqlite.h.in d33c4688ba292af5f84fea49b2e3946b9129673a F src/sqlite.h.in d33c4688ba292af5f84fea49b2e3946b9129673a
F src/sqlite3ext.h 127bd394c8eea481f2ac9b754bf399dbfc818b75 F src/sqlite3ext.h 127bd394c8eea481f2ac9b754bf399dbfc818b75
F src/sqliteInt.h 029ae294180139e3ead077b548dd9e08f99010aa F src/sqliteInt.h 029ae294180139e3ead077b548dd9e08f99010aa
@ -360,7 +360,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 4ca932d3ae9bb97b819b5baf6fd3e1cebda9e0e2 P 327e6909c9d35b651ab6f3a1a270022b354538c6
R 0158de9b8b4c84dbf29d65b8d8634e42 R 021001a8617a3717aaf8a0dc8bd5a726
U drh U drh
Z 1d4147161dab15313c86f0f2346a379f Z b4d12d966b938862d92a3ccf0d06a9d1

View File

@ -1 +1 @@
327e6909c9d35b651ab6f3a1a270022b354538c6 39e3427813135601a7417c96e55b410fa89ac1f5

View File

@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line ** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases. ** utility for accessing SQLite databases.
** **
** $Id: shell.c,v 1.139 2006/06/08 15:28:44 drh Exp $ ** $Id: shell.c,v 1.140 2006/06/08 16:10:15 drh Exp $
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -1033,6 +1033,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
FILE *in; /* The input file */ FILE *in; /* The input file */
int lineno = 0; /* Line number of input file */ int lineno = 0; /* Line number of input file */
open_db(p);
nSep = strlen(p->separator); nSep = strlen(p->separator);
if( nSep==0 ){ if( nSep==0 ){
fprintf(stderr, "non-null separator required for import\n"); fprintf(stderr, "non-null separator required for import\n");