# Copyright (c) 1999, 2000 D. Richard Hipp # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Author contact information: # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is database locks. # # $Id: lock.test,v 1.5 2001/01/04 14:20:18 drh Exp $ if {$dbprefix=="gdbm:"} { set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a largish table # do_test lock-1.0 { execsql {CREATE TABLE big(f1 int, f2 int, f3 int)} set f [open ./testdata1.txt w] for {set i 1} {$i<=500} {incr i} { puts $f "$i\t[expr {$i*2}]\t[expr {$i*3}]" } close $f execsql {COPY big FROM './testdata1.txt'} file delete -force ./testdata1.txt } {} do_test lock-1.1 { # Create a background query that gives us a read lock on the big table # set f [open slow.sql w] puts $f "SELECT a.f1, b.f1 FROM big AS a, big AS B" puts $f "WHERE a.f1+b.f1==0.5;" close $f set ::lock_pid [exec ./sqlite testdb