Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added an interrupt capability (CVS 153) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f7ea08b931b9b40831bfe73cd7afea17 |
User & Date: | drh 2000-10-16 22:06:41.000 |
Context
2000-10-16
| ||
22:06 | Added an interrupt capability (CVS 1706) (check-in: fb015479b1 user: drh tags: trunk) | |
22:06 | Added an interrupt capability (CVS 153) (check-in: f7ea08b931 user: drh tags: trunk) | |
2000-10-12
| ||
13:29 | Removed dlmalloc.c (CVS 1705) (check-in: d67884f627 user: drh tags: trunk) | |
Changes
Changes to VERSION.
| 1 | - + |
|
Changes to src/build.c.
︙ | |||
29 30 31 32 33 34 35 | 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 | - + + - - + + - - - + + + + | ** DROP TABLE ** CREATE INDEX ** DROP INDEX ** creating expressions and ID lists ** COPY ** VACUUM ** |
︙ |
Changes to src/main.c.
︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | - + | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** |
︙ | |||
150 151 152 153 154 155 156 | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | - + | { OP_Goto, 0, 18, 0}, { OP_Halt, 0, 0, 0}, /* 25 */ }; /* Create a virtual machine to run the initialization program. Run ** the program. The delete the virtual machine. */ |
︙ | |||
223 224 225 226 227 228 229 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | - + | db->file_format = 1; /* Attempt to read the schema */ rc = sqliteInit(db, pzErrMsg); if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){ sqlite_close(db); return 0; |
︙ | |||
307 308 309 310 311 312 313 | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | - + - - + | int rc = sqliteInit(db, pzErrMsg); if( rc!=SQLITE_OK ) return rc; } memset(&sParse, 0, sizeof(sParse)); sParse.db = db; sParse.xCallback = xCallback; sParse.pArg = pArg; |
︙ | |||
378 379 380 381 382 383 384 | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | + + + + + + + | void sqlite_busy_timeout(sqlite *db, int ms){ if( ms>0 ){ sqlite_busy_handler(db, sqlite_default_busy_callback, (void*)ms); }else{ sqlite_busy_handler(db, 0, 0); } } /* ** Cause any pending operation to stop at its earliest opportunity. */ void sqlite_interrupt(sqlite *db){ db->flags |= SQLITE_Interrupt; } |
Changes to src/select.c.
︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - + | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements. ** |
︙ | |||
420 421 422 423 424 425 426 | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | - + | /* ** Get a VDBE for the given parser context. Create a new one if necessary. ** If an error occurs, return NULL and leave a message in pParse. */ Vdbe *sqliteGetVdbe(Parse *pParse){ Vdbe *v = pParse->pVdbe; if( v==0 ){ |
︙ | |||
814 815 816 817 818 819 820 | 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | - + | } } /* Begin generating code. */ v = pParse->pVdbe; if( v==0 ){ |
︙ |
Changes to src/shell.c.
︙ | |||
20 21 22 23 24 25 26 | 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 | - + + + + + + + + + + + | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** |
︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | + + + + + + + | fprintf(out,"&"); }else{ break; } z += i + 1; } } /* ** This routine runs when the user presses Ctrl-C */ static void interrupt_handler(int NotUsed){ if( db ) sqlite_interrupt(db); } /* ** This is the callback routine that the SQLite library ** invokes for each row of a query result. */ static int callback(void *pArg, int nArg, char **azArg, char **azCol){ int i; |
︙ | |||
443 444 445 446 447 448 449 | 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | - | } /* Process the input line. */ if( nArg==0 ) return; n = strlen(azArg[0]); c = azArg[0][0]; |
︙ | |||
665 666 667 668 669 670 671 | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | - + + + | { fprintf(stderr, "unknown command: \"%s\". Enter \".help\" for help\n", azArg[0]); } } int main(int argc, char **argv){ |
︙ |
Changes to src/sqlite.h.in.
︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - + | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This header file defines the interface that the sqlite library ** presents to client programs. ** |
︙ | |||
126 127 128 129 130 131 132 | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | + - + - + + + + + + + + + + | char **errmsg /* Error msg written here */ ); /* ** Return values for sqlite_exec() */ #define SQLITE_OK 0 /* Successful result */ #define SQLITE_ERROR 1 /* SQL error or missing database */ |
︙ |
Changes to src/sqliteInt.h.
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** Internal interface definitions for SQLite. ** |
︙ | |||
131 132 133 134 135 136 137 | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | - - + + + | Table *apTblHash[N_HASH]; /* All tables of the database */ Index *apIdxHash[N_HASH]; /* All indices of the database */ }; /* ** Possible values for the sqlite.flags. */ |
︙ | |||
321 322 323 324 325 326 327 328 329 330 331 332 333 334 | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | + | }; /* ** An SQL parser context */ struct Parse { sqlite *db; /* The main database structure */ int rc; /* Return code from execution */ sqlite_callback xCallback; /* The callback function */ void *pArg; /* First argument to the callback function */ char *zErrMsg; /* An error message */ Token sErrToken; /* The token at which the error occurred */ Token sFirstToken; /* The first token parsed */ Token sLastToken; /* The last token parsed */ Table *pNewTable; /* A table being constructed by CREATE TABLE */ |
︙ |
Changes to src/tokenize.c.
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - + | ************************************************************************* ** An tokenizer for SQL ** ** This file contains C code that splits an SQL input string up into ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** |
︙ | |||
294 295 296 297 298 299 300 | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | - + + + + + + + + | } *tokenType = TK_ILLEGAL; return 1; } /* ** Run the parser on the given SQL string. The parser structure is |
︙ | |||
387 388 389 390 391 392 393 | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | - + | nErr++; sqliteFree(pParse->zErrMsg); pParse->zErrMsg = 0; } break; } } |
︙ | |||
419 420 421 422 423 424 425 426 427 | 426 427 428 429 430 431 432 433 434 435 436 437 438 | + + + + | pParse->pVdbe = 0; } if( pParse->pNewTable ){ sqliteDeleteTable(pParse->db, pParse->pNewTable); pParse->pNewTable = 0; } sqliteParseInfoReset(pParse); sqliteStrRealloc(pzErrMsg); if( nErr>0 && pParse->rc==SQLITE_OK ){ pParse->rc = SQLITE_ERROR; } return nErr; } |
Changes to src/vdbe.c.
︙ | |||
37 38 39 40 41 42 43 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - + | ** inplicit conversion from one type to the other occurs as necessary. ** ** Most of the code in this file is taken up by the sqliteVdbeExec() ** function which does the work of interpreting a VDBE program. ** But other routines are also provided to help in building up ** a program instruction by instruction. ** |
︙ | |||
165 166 167 168 169 170 171 172 173 174 175 176 177 178 | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | + | char zKey[1]; /* Value of this key */ }; /* ** An instance of the virtual machine */ struct Vdbe { sqlite *db; /* The whole database */ Dbbe *pBe; /* Opaque context structure used by DB backend */ FILE *trace; /* Write an execution trace here, if not NULL */ int nOp; /* Number of instructions in the program */ int nOpAlloc; /* Number of slots allocated for aOp[] */ Op *aOp; /* Space to hold the virtual machine's program */ int nLabel; /* Number of labels used */ int nLabelAlloc; /* Number of slots allocated in aLabel[] */ |
︙ | |||
200 201 202 203 204 205 206 | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | - + - + + | Set *aSet; /* An array of sets */ int nFetch; /* Number of OP_Fetch instructions executed */ }; /* ** Create a new virtual database engine. */ |
︙ | |||
832 833 834 835 836 837 838 839 840 841 842 843 844 845 | 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | + + + + + + | azValue[0] = zAddr; azValue[2] = zP1; azValue[3] = zP2; azValue[5] = 0; rc = SQLITE_OK; /* if( pzErrMsg ){ *pzErrMsg = 0; } */ for(i=0; rc==SQLITE_OK && i<p->nOp; i++){ if( p->db->flags & SQLITE_Interrupt ){ p->db->flags &= ~SQLITE_Interrupt; sqliteSetString(pzErrMsg, "interrupted", 0); rc = SQLITE_INTERRUPT; break; } sprintf(zAddr,"%d",i); sprintf(zP1,"%d", p->aOp[i].p1); sprintf(zP2,"%d", p->aOp[i].p2); azValue[4] = p->aOp[i].p3; azValue[1] = zOpName[p->aOp[i].opcode]; if( xCallback(pArg, 5, azValue, azColumnNames) ){ rc = SQLITE_ABORT; |
︙ | |||
924 925 926 927 928 929 930 931 932 933 934 935 936 937 | 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 | + + + + + + + + + | if( access("vdbe_trace",0)==0 ){ p->trace = stderr; } #endif /* if( pzErrMsg ){ *pzErrMsg = 0; } */ for(pc=0; rc==SQLITE_OK && pc<p->nOp && pc>=0; pc++){ pOp = &p->aOp[pc]; /* Interrupt processing if requested. */ if( p->db->flags & SQLITE_Interrupt ){ p->db->flags &= ~SQLITE_Interrupt; rc = SQLITE_INTERRUPT; sqliteSetString(pzErrMsg, "interrupted", 0); break; } /* Only allow tracing if NDEBUG is not defined. */ #ifndef NDEBUG if( p->trace ){ fprintf(p->trace,"%4d %-12s %4d %4d %s\n", pc, zOpName[pOp->opcode], pOp->p1, pOp->p2, |
︙ |
Changes to src/vdbe.h.
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - + | ************************************************************************* ** Header file for the Virtual DataBase Engine (VDBE) ** ** This header defines the interface to the virtual database engine ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. ** |
︙ | |||
178 179 180 181 182 183 184 | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | - + | #define OP_MAX 90 /* ** Prototypes for the VDBE interface. See comments on the implementation ** for a description of what each of these routines does. */ |
︙ |
Changes to test/dbbe.test.
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is exercising the code in dbbe.c. # |
︙ | |||
126 127 128 129 130 131 132 | 126 127 128 129 130 131 132 133 134 135 136 | - + | file delete -force testdb sqlite db testdb 0666 execsql {CREATE TABLE t1(x int)} db close sqlite db testdb 0444 set v [catch {execsql {INSERT INTO t1 VALUES(1)}} msg] lappend v $msg |
Changes to test/lock.test.
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is database locks. # |
︙ | |||
55 56 57 58 59 60 61 | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - + | } {} do_test lock-1.2 { # Now try to update the database # set v [catch {execsql {UPDATE big SET f2='xyz' WHERE f1=11}} msg] lappend v $msg |
︙ |
Changes to www/c_interface.tcl.
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 | - + | # # Run this Tcl script to generate the sqlite.html file. # |
︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | + + | char ***result, int *nrow, int *ncolumn, char **errmsg ); void sqlite_free_table(char**); void sqlite_interrupt(sqlite*); int sqlite_complete(const char *sql); void sqlite_busy_handler(sqlite*, int (*)(void*,const char*,int), void*); void sqlite_busy_timeout(sqlite*, int ms); |
︙ | |||
259 260 261 262 263 264 265 266 267 268 269 270 271 272 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | + + + + | </p></dd> <dt>SQLITE_READONLY</dt> <dd><p>This return code indicates that an attempt was made to write to a database file that was originally opened for reading only. This can happen if the callback from a query attempts to update the table being queried. </p></dd> <dt>SQLITE_INTERRUPT</dt> <dd><p>This value is returned if a call to <b>sqlite_interrupt()</b> interrupts a database operation in progress. </p></dd> </dl> </blockquote> <h2>Querying without using a callback function</h2> <p>The <b>sqlite_get_table()</b> function is a wrapper around <b>sqlite_exec()</b> that collects all the information from successive |
︙ | |||
313 314 315 316 317 318 319 320 321 322 323 324 325 326 | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | + + + + + + + + | is obtained from malloc(). But the calling function should not try to free this information directly. Instead, pass the complete table to <b>sqlite_free_table()</b> when the table is no longer needed.</p> <p>The <b>sqlite_get_table()</b> routine returns the same integer result code as <b>sqlite_exec()</b>.</p> <h2>Interrupting an SQLite operation</h2> <p>The <b>sqlite_interrupt()</b> function can be called from a different thread or from a signal handler to the current database operation to exit at its first opportunity. When this happens, the <b>sqlite_exec()</b> routine (or the equivalent) that started the database operation will return SQLITE_INTERRUPT.</p> <h2>Testing for a complete SQL statement</h2> <p>The next interface routine to SQLite is a convenience function used to test whether or not a string forms a complete SQL statement. If the <b>sqlite_complete()</b> function returns true when its input is a string, then the argument forms a complete SQL statement. There are no guarantees that the syntax of that statement is correct, |
︙ |
Changes to www/changes.tcl.
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | + + + + + + + - + | proc chng {date desc} { puts "<DT><B>$date</B></DT>" puts "<DD><P><UL>$desc</UL></P></DD>" } chng {2000 Oct 16 (1.0.11) <li>Added the <b>sqlite_interrupt()</b> interface.</li> <li>In the shell, <b>sqlite_interrupt()</b> is invoked when the user presses Control-C</li> <li>Fixed bugs in the return value of <b>sqlite_exec()</b>.</li> } |
︙ |