Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | loads the complete ACD database! (CVS 17) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
97a0fb780ea1992c4d681cc0301bbfa1 |
User & Date: | drh 2000-05-30 18:45:24.000 |
Context
2000-05-30
| ||
19:22 | :-) (CVS 18) (check-in: 2d41caec80 user: drh tags: trunk) | |
18:45 | loads the complete ACD database! (CVS 17) (check-in: 97a0fb780e user: drh tags: trunk) | |
17:30 | :-) (CVS 16) (check-in: b56d1b9c0f user: drh tags: trunk) | |
Changes
Changes to src/dbbe.c.
︙ | ︙ | |||
26 27 28 29 30 31 32 | ** sqlite and the code that does the actually reading and writing ** of information to the disk. ** ** This file uses GDBM as the database backend. It should be ** relatively simple to convert to a different database such ** as NDBM, SDBM, or BerkeleyDB. ** | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ** sqlite and the code that does the actually reading and writing ** of information to the disk. ** ** This file uses GDBM as the database backend. It should be ** relatively simple to convert to a different database such ** as NDBM, SDBM, or BerkeleyDB. ** ** $Id: dbbe.c,v 1.2 2000/05/30 18:45:24 drh Exp $ */ #include "sqliteInt.h" #include <gdbm.h> #include <sys/stat.h> #include <unistd.h> #include <ctype.h> #include <time.h> |
︙ | ︙ | |||
172 173 174 175 176 177 178 | pFile->nRef = 1; pFile->pPrev = 0; if( pBe->pOpen ){ pBe->pOpen->pPrev = pFile; } pFile->pNext = pBe->pOpen; pBe->pOpen = pFile; | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | pFile->nRef = 1; pFile->pPrev = 0; if( pBe->pOpen ){ pBe->pOpen->pPrev = pFile; } pFile->pNext = pBe->pOpen; pBe->pOpen = pFile; pFile->dbf = gdbm_open(pFile->zName, 0, GDBM_WRCREAT|GDBM_FAST, 0640, 0); }else{ sqliteFree(zFile); pFile->nRef++; } pTable->pBe = pBe; pTable->pFile = pFile; pTable->readPending = 0; |
︙ | ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 | void sqliteDbbeCloseTable(DbbeTable *pTable){ BeFile *pFile; Dbbe *pBe; if( pTable==0 ) return; pFile = pTable->pFile; pBe = pTable->pBe; pFile->nRef--; if( pFile->nRef<=0 ){ if( pFile->dbf!=NULL ){ gdbm_close(pFile->dbf); } if( pFile->pPrev ){ pFile->pPrev->pNext = pFile->pNext; }else{ | > > > | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | void sqliteDbbeCloseTable(DbbeTable *pTable){ BeFile *pFile; Dbbe *pBe; if( pTable==0 ) return; 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); } if( pFile->pPrev ){ pFile->pPrev->pNext = pFile->pNext; }else{ |
︙ | ︙ |
Changes to src/shell.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** ** $Id: shell.c,v 1.3 2000/05/30 18:45:24 drh Exp $ */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include "sqlite.h" #include <unistd.h> #include <ctype.h> #if !defined(NO_READLINE) # 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 ** state and mode information. */ struct callback_data { |
︙ | ︙ | |||
341 342 343 344 345 346 347 | strcpy(data.separator,"|"); data.showHeader = 0; if( istty ){ printf( "Enter \".help\" for instructions\n" ); } | | < | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | strcpy(data.separator,"|"); data.showHeader = 0; if( istty ){ printf( "Enter \".help\" for instructions\n" ); } while( (zLine = one_input_line(zSql, istty))!=0 ){ if( zLine && zLine[0]=='.' ){ do_meta_command(zLine, db, &data); free(zLine); continue; } if( zSql==0 ){ nSql = strlen(zLine); |
︙ | ︙ |