185c23c61Sdrh# 2005 September 19 285c23c61Sdrh# 385c23c61Sdrh# The author disclaims copyright to this source code. In place of 485c23c61Sdrh# a legal notice, here is a blessing: 585c23c61Sdrh# 685c23c61Sdrh# May you do good and not evil. 785c23c61Sdrh# May you find forgiveness for yourself and forgive others. 885c23c61Sdrh# May you share freely, never taking more than you give. 985c23c61Sdrh# 1085c23c61Sdrh#************************************************************************* 1185c23c61Sdrh# This file implements regression tests for SQLite library. The 1285c23c61Sdrh# focus of this script is testing the ATTACH statement and 1385c23c61Sdrh# specifically out-of-memory conditions within that command. 1485c23c61Sdrh# 15*ae72d982Sdanielk1977# $Id: attachmalloc.test,v 1.6 2007/10/03 08:46:45 danielk1977 Exp $ 1685c23c61Sdrh# 1785c23c61Sdrh 1885c23c61Sdrhset testdir [file dirname $argv0] 1985c23c61Sdrhsource $testdir/tester.tcl 2085c23c61Sdrh 21da57895fSdrhifcapable !memdebug { 22da57895fSdrh finish_test 23da57895fSdrh return 24da57895fSdrh} 25da57895fSdrh 26222a757dSdanielk1977source $testdir/malloc_common.tcl 2785c23c61Sdrh 2885c23c61Sdrhdo_malloc_test attachmalloc-1 -tclprep { 2985c23c61Sdrh db close 3085c23c61Sdrh for {set i 2} {$i<=4} {incr i} { 3185c23c61Sdrh file delete -force test$i.db 3285c23c61Sdrh file delete -force test$i.db-journal 3385c23c61Sdrh } 3485c23c61Sdrh} -tclbody { 3585c23c61Sdrh if {[catch {sqlite3 db test.db}]} { 3685c23c61Sdrh error "out of memory" 3785c23c61Sdrh } 38*ae72d982Sdanielk1977 sqlite3_extended_result_codes db 1 3985c23c61Sdrh} -sqlbody { 4085c23c61Sdrh ATTACH 'test2.db' AS two; 4185c23c61Sdrh CREATE TABLE two.t1(x); 4285c23c61Sdrh ATTACH 'test3.db' AS three; 4385c23c61Sdrh CREATE TABLE three.t1(x); 4485c23c61Sdrh ATTACH 'test4.db' AS four; 4585c23c61Sdrh CREATE TABLE four.t1(x); 4685c23c61Sdrh} 4785c23c61Sdrh 4885c23c61Sdrhfinish_test 49