mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-30 15:14:17 +00:00
add sqlite 3.3.8 to in tree libs
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3735 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
3b35430557
commit
165f180162
387 files changed
+234653
No files matched your search
@@ -0,0 +1,91 @@
|
||||
# 2005 October 3
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# This file implements tests the ability of the library to open
|
||||
# many different databases at the same time without leaking memory.
|
||||
#
|
||||
# $Id: manydb.test,v 1.3 2006/01/11 01:08:34 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
set N 300
|
||||
|
||||
# First test how many file descriptors are available for use. To open a
|
||||
# database for writing SQLite requires 3 file descriptors (the database, the
|
||||
# journal and the directory).
|
||||
set filehandles {}
|
||||
catch {
|
||||
for {set i 0} {$i<($N * 3)} {incr i} {
|
||||
lappend filehandles [open testfile.1 w]
|
||||
}
|
||||
}
|
||||
foreach fd $filehandles {
|
||||
close $fd
|
||||
}
|
||||
catch {
|
||||
file delete -force testfile.1
|
||||
}
|
||||
set N [expr $i / 3]
|
||||
|
||||
# Create a bunch of random database names
|
||||
#
|
||||
unset -nocomplain dbname
|
||||
unset -nocomplain used
|
||||
for {set i 0} {$i<$N} {incr i} {
|
||||
while 1 {
|
||||
set name test-[format %08x [expr {int(rand()*0x7fffffff)}]].db
|
||||
if {[info exists used($name)]} continue
|
||||
set dbname($i) $name
|
||||
set used($name) $i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
# Create a bunch of databases
|
||||
#
|
||||
for {set i 0} {$i<$N} {incr i} {
|
||||
do_test manydb-1.$i {
|
||||
sqlite3 db$i $dbname($i)
|
||||
execsql {
|
||||
CREATE TABLE t1(a,b);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(1,2);
|
||||
} db$i
|
||||
} {}
|
||||
}
|
||||
|
||||
# Finish the transactions
|
||||
#
|
||||
for {set i 0} {$i<$N} {incr i} {
|
||||
do_test manydb-2.$i {
|
||||
execsql {
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
} db$i
|
||||
} {1 2}
|
||||
}
|
||||
|
||||
|
||||
# Close the databases and erase the files.
|
||||
#
|
||||
for {set i 0} {$i<$N} {incr i} {
|
||||
do_test manydb-3.$i {
|
||||
db$i close
|
||||
file delete -force $dbname($i)
|
||||
} {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
Reference in new issue
Block a user