Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When an automatic re-prepare occurs, take care not to reset the internal schema symbol table. Ticket #2156. This change also includes some debugging enhancements. (CVS 3578) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
43fe7fc1c38f8d9b3c1346cb1d890c2e |
User & Date: | drh 2007-01-09 14:01:13.000 |
Context
2007-01-09
| ||
14:37 | Do not use the symbol "interrupt" since that is a reserved word in OpenWatcom. Ticket #2159. (CVS 3579) (check-in: 9960ba5768 user: drh tags: trunk) | |
14:01 | When an automatic re-prepare occurs, take care not to reset the internal schema symbol table. Ticket #2156. This change also includes some debugging enhancements. (CVS 3578) (check-in: 43fe7fc1c3 user: drh tags: trunk) | |
2007-01-08
| ||
22:40 | Additional tests of sqlite3_prepare_v2. (CVS 3577) (check-in: b0650aa6cf user: drh tags: trunk) | |
Changes
Changes to src/prepare.c.
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the implementation of the sqlite3_prepare() ** interface, and routines that contribute to loading the database schema ** from disk. ** |
︙ | |||
573 574 575 576 577 578 579 | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | + - + | assert( pNew==0 ); return 0; }else{ assert( pNew!=0 ); } sqlite3VdbeSwap(pNew, p); sqlite3_transfer_bindings((sqlite3_stmt*)pNew, (sqlite3_stmt*)p); sqlite3VdbeResetStepResult(pNew); |
︙ |
Changes to src/test1.c.
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** |
︙ | |||
755 756 757 758 759 760 761 762 763 764 765 766 767 768 | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | + + + + + + + + + + + + + + + + + + + + + + + + | sqlite3_create_function(db, "x_count", 1, SQLITE_UTF8, 0, 0, countStep,countFinalize); } if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR; return TCL_OK; } /* ** Usage: printf TEXT ** ** Send output to printf. Use this rather than puts to merge the output ** in the correct sequence with debugging printfs inserted into C code. ** Puts uses a separate buffer and debugging statements will be out of ** sequence if it is used. */ static int test_printf( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ if( argc!=2 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " TEXT\"", 0); return TCL_ERROR; } printf("%s\n", argv[1]); return TCL_OK; } /* ** Usage: sqlite3_mprintf_int FORMAT INTEGER INTEGER INTEGER ** ** Call mprintf with three integer arguments */ |
︙ | |||
4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 | 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 | + | { "sqlite_set_magic", (Tcl_CmdProc*)sqlite_set_magic }, { "sqlite3_interrupt", (Tcl_CmdProc*)test_interrupt }, { "sqlite_delete_function", (Tcl_CmdProc*)delete_function }, { "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation }, { "sqlite3_get_autocommit", (Tcl_CmdProc*)get_autocommit }, { "sqlite3_stack_used", (Tcl_CmdProc*)test_stack_used }, { "sqlite3_busy_timeout", (Tcl_CmdProc*)test_busy_timeout }, { "printf", (Tcl_CmdProc*)test_printf }, }; static struct { char *zName; Tcl_ObjCmdProc *xProc; void *clientData; } aObjCmd[] = { { "sqlite3_connection_pointer", get_sqlite_pointer, 0 }, |
︙ |
Changes to src/vdbe.c.
︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - + | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** |
︙ | |||
450 451 452 453 454 455 456 457 458 459 460 461 462 463 | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | + + + + + + + + + + + + + + + | if( p->popStack ){ popStack(&pTos, p->popStack); p->popStack = 0; } p->resOnStack = 0; db->busyHandler.nBusy = 0; CHECK_FOR_INTERRUPT; #ifdef SQLITE_DEBUG if( (p->db->flags & SQLITE_VdbeListing)!=0 || sqlite3OsFileExists("vdbe_explain") ){ int i; printf("VDBE Program Listing:\n"); sqlite3VdbePrintSql(p); for(i=0; i<p->nOp; i++){ sqlite3VdbePrintOp(stdout, i, &p->aOp[i]); } } if( sqlite3OsFileExists("vdbe_trace") ){ p->trace = stdout; } #endif for(pc=p->pc; rc==SQLITE_OK; pc++){ assert( pc>=0 && pc<p->nOp ); assert( pTos<=&p->aStack[pc] ); if( sqlite3MallocFailed() ) goto no_mem; #ifdef VDBE_PROFILE origPc = pc; start = hwtime(); |
︙ | |||
4000 4001 4002 4003 4004 4005 4006 | 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 | - + - + + + + + - + + + | pTos->flags = MEM_Int; }else{ pTos->flags = MEM_Null; } break; } |
︙ |
Changes to src/vdbe.h.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - + | ************************************************************************* ** 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. ** |
︙ | |||
125 126 127 128 129 130 131 132 133 134 135 136 137 138 | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | + | int sqlite3VdbeMakeLabel(Vdbe*); void sqlite3VdbeDelete(Vdbe*); void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int); int sqlite3VdbeFinalize(Vdbe*); void sqlite3VdbeResolveLabel(Vdbe*, int); int sqlite3VdbeCurrentAddr(Vdbe*); void sqlite3VdbeTrace(Vdbe*,FILE*); void sqlite3VdbeResetStepResult(Vdbe*); int sqlite3VdbeReset(Vdbe*); int sqliteVdbeSetVariables(Vdbe*,int,const char**); void sqlite3VdbeSetNumCols(Vdbe*,int); int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, int); void sqlite3VdbeCountChanges(Vdbe*); sqlite3 *sqlite3VdbeDb(Vdbe*); void sqlite3VdbeSetSql(Vdbe*, const char *z, int n); |
︙ |
Changes to src/vdbeaux.c.
︙ | |||
848 849 850 851 852 853 854 | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | - - - - - - - - - - - - - - - | } } } for(n=0; n<p->nMem; n++){ p->aMem[n].flags = MEM_Null; } |
︙ | |||
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 | + + + + + + + + | db->activeVdbeCnt--; } p->magic = VDBE_MAGIC_HALT; checkActiveVdbeCnt(db); return SQLITE_OK; } /* ** Each VDBE holds the result of the most recent sqlite3_step() call ** in p->rc. This routine sets that result back to SQLITE_OK. */ void sqlite3VdbeResetStepResult(Vdbe *p){ p->rc = SQLITE_OK; } /* ** Clean up a VDBE after execution but do not delete the VDBE just yet. ** Write any error messages into *pzErrMsg. Return the result code. ** ** After this routine is run, the VDBE should be ready to be executed ** again. |
︙ |
Changes to src/vtab.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | /* ** 2006 June 10 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to help implement virtual tables. ** |
︙ | |||
226 227 228 229 230 231 232 | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | - + | ); sqliteFree(zStmt); v = sqlite3GetVdbe(pParse); sqlite3ChangeCookie(db, v, iDb); sqlite3VdbeAddOp(v, OP_Expire, 0, 0); zWhere = sqlite3MPrintf("name='%q'", pTab->zName); |
︙ |
Changes to test/vtab1.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | # 2006 June 10 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is creating and dropping virtual tables. # |
︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 103 104 | 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 126 127 | + + + + + + + + + + + + + + + + + + + + + + + | } } {1 {vtable constructor failed: t1}} do_test vtab1-1.6 { execsql { SELECT name FROM sqlite_master ORDER BY 1 } } {} # Ticket #2156. Using the sqlite3_prepare_v2() API, make sure that # a CREATE VIRTUAL TABLE statement can be used multiple times. # do_test vtab1-1.2152.1 { set DB [sqlite3_connection_pointer db] set sql {CREATE VIRTUAL TABLE t2152a USING echo(t2152b)} set STMT [sqlite3_prepare_v2 $DB $sql -1 TAIL] sqlite3_step $STMT } SQLITE_ERROR do_test vtab-1.2152.2 { sqlite3_reset $STMT sqlite3_step $STMT } SQLITE_ERROR do_test vtab-1.2152.3 { sqlite3_reset $STMT db eval {CREATE TABLE t2152b(x,y)} sqlite3_step $STMT } SQLITE_DONE do_test vtab-1.2152.4 { sqlite3_finalize $STMT db eval {DROP TABLE t2152a; DROP TABLE t2152b} } {} # Test to make sure nothing goes wrong and no memory is leaked if we # select an illegal table-name (i.e a reserved name or the name of a # table that already exists). # do_test vtab1-1.7 { catchsql { |
︙ |