1# See the file LICENSE for redistribution information. 2# 3# Copyright (c) 1999-2009 Oracle. All rights reserved. 4# 5# $Id$ 6# 7# TEST test064 8# TEST Test of DB->get_type 9# TEST Create a database of type specified by method. 10# TEST Make sure DB->get_type returns the right thing with both a normal 11# TEST and DB_UNKNOWN open. 12proc test064 { method args } { 13 source ./include.tcl 14 15 set args [convert_args $method $args] 16 set omethod [convert_method $method] 17 set tnum "064" 18 19 set txnenv 0 20 set eindex [lsearch -exact $args "-env"] 21 # 22 # If we are using an env, then testfile should just be the db name. 23 # Otherwise it is the test directory and the name. 24 if { $eindex == -1 } { 25 set testfile $testdir/test$tnum.db 26 set env NULL 27 } else { 28 set testfile test$tnum.db 29 incr eindex 30 set env [lindex $args $eindex] 31 set txnenv [is_txnenv $env] 32 if { $txnenv == 1 } { 33 append args " -auto_commit " 34 } 35 set testdir [get_home $env] 36 } 37 cleanup $testdir $env 38 39 puts "Test$tnum: $method ($args) DB->get_type test." 40 41 # Create a test database. 42 puts "\tTest$tnum.a: Creating test database of type $method." 43 set db [eval {berkdb_open -create -mode 0644} \ 44 $omethod $args $testfile] 45 error_check_good db_create [is_valid_db $db] TRUE 46 47 error_check_good db_close [$db close] 0 48 49 puts "\tTest$tnum.b: get_type after method specifier." 50 51 set db [eval {berkdb_open} $omethod $args {$testfile}] 52 error_check_good db_open [is_valid_db $db] TRUE 53 54 set type [$db get_type] 55 error_check_good get_type $type [string range $omethod 1 end] 56 57 error_check_good db_close [$db close] 0 58 59 puts "\tTest$tnum.c: get_type after DB_UNKNOWN." 60 61 set db [eval {berkdb_open} $args $testfile] 62 error_check_good db_open [is_valid_db $db] TRUE 63 64 set type [$db get_type] 65 error_check_good get_type $type [string range $omethod 1 end] 66 67 error_check_good db_close [$db close] 0 68} 69