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 | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
78a0229a7e5e33fe642847381f5514e6 |
User & Date: | drh 2002-08-29 23:59:48 |
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: c5e0c6a7 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: 78a0229a 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: 723362e7 user: drh tags: trunk | |
Changes
Changes to src/main.c.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ... 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 ... 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
** ************************************************************************* ** 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.98 2002/08/24 18:24:54 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** A pointer to this structure is used to communicate information ................................................................................ } /* 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]; ................................................................................ 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 = sqliteInit(db, pzErrMsg); if( rc!=SQLITE_OK ){ sqliteStrRealloc(pzErrMsg); sqliteSafetyOff(db); return rc; } } if( db->file_format<3 ){ |
| > > > | > |
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ... 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 ... 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
** ************************************************************************* ** 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 ................................................................................ } /* 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]; ................................................................................ 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.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
239
240
241
242
243
244
245
246
247
248
249
250
251
|
# 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.16 2002/08/18 20:28:07 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create an alternative connection to the database # ................................................................................ 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 |
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
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
|
# 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 # ................................................................................ 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
15
16
17
18
19
20
21
22
...
185
186
187
188
189
190
191
192
193
194
195
|
# 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.6 2002/08/13 23:02:59 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Current file format version set VX 4 ................................................................................ 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 {}} finish_test |
|
|
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
185
186
187
188
189
190
191
192
193
194
195
|
# 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 ................................................................................ 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 |