1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Add the SQLITE_OPEN_NOMUTEX flag. Used for opening connections that are not protected by an internal mutex. (CVS 5387)

FossilOrigin-Name: 7e58b78712420b3bd4320192a58d89eb71eecc9c
This commit is contained in:
danielk1977
2008-07-10 17:52:49 +00:00
parent 93a960a0a8
commit 9a6284c1bb
9 changed files with 85 additions and 28 deletions

View File

@@ -9,7 +9,7 @@
#
#***********************************************************************
#
# $Id: mutex1.test,v 1.7 2008/07/08 02:12:37 drh Exp $
# $Id: mutex1.test,v 1.8 2008/07/10 17:52:49 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -130,6 +130,19 @@ ifcapable threadsafe {
}
sqlite3_enable_shared_cache $enable_shared_cache
# Open and use a connection in "nomutex" mode. Test that no recursive
# mutexes are obtained.
do_test mutex1.3.1 {
catch {db close}
clear_mutex_counters
sqlite3 db test.db -nomutex 1
execsql { SELECT * FROM abc }
} {1 2 3 1 2 3 1 2 3}
do_test mutex1.3.2 {
mutex_counters counters
set counters(recursive)
} {0}
do_test mutex1-X {
catch {db close}
sqlite3_shutdown

View File

@@ -9,7 +9,7 @@
#
#***********************************************************************
#
# $Id: permutations.test,v 1.9 2008/06/27 14:05:25 danielk1977 Exp $
# $Id: permutations.test,v 1.10 2008/07/10 17:52:49 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -194,6 +194,25 @@ run_tests "singlethread" -description {
} SQLITE_OK
}
run_tests "nomutex" -description {
Tests run with the SQLITE_OPEN_SINGLETHREADED flag passed to sqlite3_open().
} -initialize {
rename sqlite3 sqlite3_nomutex
proc sqlite3 {args} {
if {[string range [lindex $args 0] 0 0] ne "-"} {
lappend args -nomutex 1
}
uplevel [concat sqlite3_nomutex $args]
}
} -include {
delete.test delete2.test insert.test rollback.test select1.test
select2.test trans.test update.test vacuum.test types.test
types2.test types3.test
} -shutdown {
rename sqlite3 {}
rename sqlite3_nomutex sqlite3
}
# Run some tests in SQLITE_CONFIG_MULTITHREAD mode.
#
run_tests "multithread" -description {

View File

@@ -15,7 +15,7 @@
# interface is pretty well tested. This file contains some addition
# tests for fringe issues that the main test suite does not cover.
#
# $Id: tclsqlite.test,v 1.64 2008/04/28 13:02:58 drh Exp $
# $Id: tclsqlite.test,v 1.65 2008/07/10 17:52:49 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -25,7 +25,7 @@ source $testdir/tester.tcl
if {[sqlite3 -has-codec]} {
set r "sqlite_orig HANDLE FILENAME ?-key CODEC-KEY?"
} else {
set r "sqlite3 HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN?"
set r "sqlite3 HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN? ?-nomutex BOOLEAN?"
}
do_test tcl-1.1 {
set v [catch {sqlite3 bogus} msg]