Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | If the database is locked when sqlite_open() is called, sqlite_exec() should still honor the busy callback and should return an error message together with the SQLITE_BUSY result code. (CVS 733) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
78a0229a7e5e33fe642847381f5514e6 |
User & Date: | drh 2002-08-29 23:59:48.000 |
Context
2002-08-31
| ||
16:33 | Fix for ticket #145: Include the func.c source file in the build of testfixture so that the "randstr()" function will be available. (CVS 734) (check-in: c5e0c6a782 user: drh tags: trunk) | |
2002-08-29
| ||
23:59 | If the database is locked when sqlite_open() is called, sqlite_exec() should still honor the busy callback and should return an error message together with the SQLITE_BUSY result code. (CVS 733) (check-in: 78a0229a7e user: drh tags: trunk) | |
2002-08-28
| ||
03:00 | Slightly faster INSERTs from a SELECT by avoiding an intermediate table. But it didn't make nearly as much difference as I had hoped. (CVS 732) (check-in: 723362e74f user: drh tags: trunk) | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** 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. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** 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. ** ** $Id: main.c,v 1.99 2002/08/29 23:59:48 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** A pointer to this structure is used to communicate information |
︙ | ︙ | |||
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | } /* Create a cursor to hold the database open */ if( db->pBe==0 ) return SQLITE_OK; rc = sqliteBtreeCursor(db->pBe, 2, 0, &curMain); if( rc ){ sqliteResetInternalSchema(db); return rc; } /* Get the database meta information */ rc = sqliteBtreeGetMeta(db->pBe, meta); if( rc ){ sqliteResetInternalSchema(db); sqliteBtreeCloseCursor(curMain); return rc; } db->schema_cookie = meta[1]; db->next_cookie = db->schema_cookie; db->file_format = meta[2]; | > > | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | } /* Create a cursor to hold the database open */ if( db->pBe==0 ) return SQLITE_OK; rc = sqliteBtreeCursor(db->pBe, 2, 0, &curMain); if( rc ){ sqliteSetString(pzErrMsg, sqlite_error_string(rc), 0); sqliteResetInternalSchema(db); return rc; } /* Get the database meta information */ rc = sqliteBtreeGetMeta(db->pBe, meta); if( rc ){ sqliteSetString(pzErrMsg, sqlite_error_string(rc), 0); sqliteResetInternalSchema(db); sqliteBtreeCloseCursor(curMain); return rc; } db->schema_cookie = meta[1]; db->next_cookie = db->schema_cookie; db->file_format = meta[2]; |
︙ | ︙ | |||
597 598 599 600 601 602 603 | char **pzErrMsg /* Write error messages here */ ){ Parse sParse; if( pzErrMsg ) *pzErrMsg = 0; if( sqliteSafetyOn(db) ) goto exec_misuse; if( (db->flags & SQLITE_Initialized)==0 ){ | > | > | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | char **pzErrMsg /* Write error messages here */ ){ Parse sParse; if( pzErrMsg ) *pzErrMsg = 0; if( sqliteSafetyOn(db) ) goto exec_misuse; if( (db->flags & SQLITE_Initialized)==0 ){ int rc, cnt = 1; while( (rc = sqliteInit(db, pzErrMsg))==SQLITE_BUSY && db->xBusyCallback && db->xBusyCallback(db->pBusyArg, "", cnt++)!=0 ){} if( rc!=SQLITE_OK ){ sqliteStrRealloc(pzErrMsg); sqliteSafetyOff(db); return rc; } } if( db->file_format<3 ){ |
︙ | ︙ |
Changes to test/lock.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # 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 script is database locks. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # 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 script is database locks. # # $Id: lock.test,v 1.17 2002/08/29 23:59:50 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create an alternative connection to the database # |
︙ | ︙ | |||
239 240 241 242 243 244 245 246 247 248 249 250 251 | do_test lock-3.1 { execsql {BEGIN TRANSACTION} set r [catch {execsql {BEGIN TRANSACTION}} msg] execsql {ROLLBACK} lappend r $msg } {1 {cannot start a transaction within a transaction}} integrity_check lock-3.2 do_test lock-999.1 { rename db2 {} } {} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | do_test lock-3.1 { execsql {BEGIN TRANSACTION} set r [catch {execsql {BEGIN TRANSACTION}} msg] execsql {ROLLBACK} lappend r $msg } {1 {cannot start a transaction within a transaction}} integrity_check lock-3.2 # Make sure the busy handler and error messages work when # opening a new pointer to the database while another pointer # has the database locked. # do_test lock-4.1 { db2 close catch {db eval ROLLBACK} db eval BEGIN sqlite db2 ./test.db set rc [catch {db2 eval {SELECT * FROM t1}} msg] lappend rc $msg } {1 {database is locked}} do_test lock-4.2 { set ::callback_value {} set rc [catch {db2 eval {SELECT * FROM t1}} msg] lappend rc $msg $::callback_value } {1 {database is locked} {}} do_test lock-4.3 { proc callback {file count} { lappend ::callback_value $count if {$count>4} break } db2 busy callback set rc [catch {db2 eval {SELECT * FROM t1}} msg] lappend rc $msg $::callback_value } {1 {database is locked} {1 2 3 4 5}} do_test lock-999.1 { rename db2 {} } {} finish_test |
Changes to test/version.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the ability of the library to detect # past or future file format version numbers and respond appropriately. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the ability of the library to detect # past or future file format version numbers and respond appropriately. # # $Id: version.test,v 1.7 2002/08/29 23:59:50 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Current file format version set VX 4 |
︙ | ︙ | |||
185 186 187 188 189 190 191 | set fd [open test.db w] set txt "This is not a valid database file\n" while {[string length $txt]<4092} {append txt $txt} puts $fd $txt close $fd set rc [catch {sqlite db test.db} msg] lappend rc $msg | | | 185 186 187 188 189 190 191 192 193 194 195 | set fd [open test.db w] set txt "This is not a valid database file\n" while {[string length $txt]<4092} {append txt $txt} puts $fd $txt close $fd set rc [catch {sqlite db test.db} msg] lappend rc $msg } {1 {database disk image is malformed}} finish_test |