-C :-)\s(CVS\s16)
-D 2000-05-30T17:30:36
+C loads\sthe\scomplete\sACD\sdatabase!\s(CVS\s17)
+D 2000-05-30T18:45:24
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 89921c1ee4de75275bfadfbac198396da31704d1
F README 6b5960603c7f8bf42fc022b4b6436f242f238dbb
F configure.in 6ccfd5fc80517f7cfe605a7fc7e0f62d962a233c
F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47
F src/build.c 82e7dfdf900428d706ab4f50e72732ce9110767a
-F src/dbbe.c ab05293e89525041eaab8b4aca10516db3648792
+F src/dbbe.c 159c39f8bf5475c34904786fad4f3f0f579d9eb6
F src/dbbe.h bedeb3a0985bb584458e7849fb59927e99e751e6
F src/main.c 25cce7bce0eb3ba10bada7c05f4b38dc6dbbc86f
F src/parse.y 50ca06d471132e16bb47c56f19553e4efd5b3d4a
-F src/shell.c 125f84ea5f8b725ba474d4702b575d062cc94d92
+F src/shell.c 3ffa9059514cd4db3bd64e0797bf7ebbe1ea8ee3
F src/sqlite.h 2397c17a8f4ca90c09acab0100dc7e2f8f441b69
F src/sqliteInt.h 749da8b3e4ce146fd172aeb59b6db04c57726d7a
F src/tclsqlite.c 9efd29f79ded6a900aa3d142169c8bfe03b7affd
F www/c_interface.tcl f875864edf7974157d1c257ca08de854660882a5
F www/index.tcl 2466d1b2e26c6f354b0acedee12025309a216799
F www/sqlite.tcl 947e067bcc347dc767af4c1a6e5a8d47d8404aa3
-P 8d66c7355de1d87b25c4fb92d0ef3603da72899a
-R d80f9589af9e1517c7c756c7ca40c0f1
+P b56d1b9c0f957f3dfb380c01d31ff7c08bcd523b
+R 78e3e4cb06d949e0d5e02f0a9620a6a4
U drh
-Z 0d13d400c7a8e0dc46e87c85f7c6e1d5
+Z 714853e59d436eb6b69d3e7abbbbb4c3
** relatively simple to convert to a different database such
** as NDBM, SDBM, or BerkeleyDB.
**
-** $Id: dbbe.c,v 1.1 2000/05/29 14:26:01 drh Exp $
+** $Id: dbbe.c,v 1.2 2000/05/30 18:45:24 drh Exp $
*/
#include "sqliteInt.h"
#include <gdbm.h>
}
pFile->pNext = pBe->pOpen;
pBe->pOpen = pFile;
- pFile->dbf = gdbm_open(pFile->zName, 0, GDBM_WRCREAT, 0640, 0);
+ pFile->dbf = gdbm_open(pFile->zName, 0, GDBM_WRCREAT|GDBM_FAST, 0640, 0);
}else{
sqliteFree(zFile);
pFile->nRef++;
pFile = pTable->pFile;
pBe = pTable->pBe;
pFile->nRef--;
+ if( pFile->dbf!=NULL ){
+ gdbm_sync(pFile->dbf);
+ }
if( pFile->nRef<=0 ){
if( pFile->dbf!=NULL ){
gdbm_close(pFile->dbf);
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
-** $Id: shell.c,v 1.2 2000/05/29 17:44:25 drh Exp $
+** $Id: shell.c,v 1.3 2000/05/30 18:45:24 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#if !defined(NO_READLINE)
-#include <readline/readline.h>
-#include <readline/history.h>
+# include <readline/readline.h>
+# include <readline/history.h>
+#else
+# define readline getline
+# define add_history(X)
#endif
+/*
+** This routine reads a line of text from standard input, stores
+** the text in memory obtained from malloc() and returns a pointer
+** to the text. NULL is returned at end of file, or if malloc()
+** fails.
+**
+** The interface is like "readline" but no command-line editing
+** is done.
+*/
+static char *getline(char *zPrompt){
+ char *zLine;
+ int nLine;
+ char *z;
+ int n;
+ int eol;
+
+ if( zPrompt && *zPrompt ){
+ printf("%s",zPrompt);
+ fflush(stdout);
+ }
+ nLine = 100;
+ zLine = malloc( nLine );
+ if( zLine==0 ) return 0;
+ n = 0;
+ eol = 0;
+ while( !eol ){
+ if( n+100>nLine ){
+ nLine = nLine*2 + 100;
+ zLine = realloc(zLine, nLine);
+ if( zLine==0 ) return 0;
+ }
+ if( fgets(&zLine[n], nLine - n, stdin)==0 ){
+ if( n==0 ){
+ free(zLine);
+ return 0;
+ }
+ zLine[n] = 0;
+ eol = 1;
+ break;
+ }
+ while( zLine[n] ){ n++; }
+ if( n>0 && zLine[n-1]=='\n' ){
+ n--;
+ zLine[n] = 0;
+ eol = 1;
+ }
+ }
+ zLine = realloc( zLine, n+1 );
+ return zLine;
+}
+
+/*
+** Retrieve a single line of input text. "isatty" is true if text
+** is coming from a terminal. In that case, we issue a prompt and
+** attempt to use "readline" for command-line editing. If "isatty"
+** is false, use "getline" instead of "readline" and issue to prompt.
+**
+** zPrior is a string of prior text retrieved. If not the empty
+** string, then issue a continuation prompt.
+*/
+static char *one_input_line(const char *zPrior, int isatty){
+ char *zPrompt;
+ char *zResult;
+ if( !isatty ){
+ return getline(0);
+ }
+ if( zPrior && zPrior[0] ){
+ zPrompt = " ...> ";
+ }else{
+ zPrompt = "sqlite> ";
+ }
+ zResult = readline(zPrompt);
+ add_history(zResult);
+ return zResult;
+}
+
/*
** An pointer to an instance of this structure is passed from
** the main program to the callback. This is used to communicate
"Enter \".help\" for instructions\n"
);
}
- while( (zLine = readline(istty ? (zSql==0 ? "sql> " : ".... ") : 0))!=0 ){
- add_history(zLine);
+ while( (zLine = one_input_line(zSql, istty))!=0 ){
if( zLine && zLine[0]=='.' ){
do_meta_command(zLine, db, &data);
free(zLine);