1# See the file LICENSE for redistribution information. 2# 3# Copyright (c) 1996,2008 Oracle. All rights reserved. 4# 5# $Id: txn006.tcl,v 12.6 2008/01/08 20:58:53 bostic Exp $ 6# 7#TEST txn006 8#TEST Test dump/load in transactional environment. 9proc txn006 { { iter 50 } } { 10 source ./include.tcl 11 set testfile txn006.db 12 13 puts "Txn006: Test dump/load in transaction environment" 14 env_cleanup $testdir 15 16 puts "\tTxn006.a: Create environment and database" 17 # Open/create the txn region 18 set e [berkdb_env -create -home $testdir -txn] 19 error_check_good env_open [is_valid_env $e] TRUE 20 21 # Open/create database 22 set db [berkdb_open -auto_commit -env $e \ 23 -create -btree -dup $testfile] 24 error_check_good db_open [is_valid_db $db] TRUE 25 26 # Start a transaction 27 set txn [$e txn] 28 error_check_good txn [is_valid_txn $txn $e] TRUE 29 30 puts "\tTxn006.b: Put data" 31 # Put some data 32 for { set i 1 } { $i < $iter } { incr i } { 33 error_check_good put [$db put -txn $txn key$i data$i] 0 34 } 35 36 # End transaction, close db 37 error_check_good txn_commit [$txn commit] 0 38 error_check_good db_close [$db close] 0 39 error_check_good env_close [$e close] 0 40 41 puts "\tTxn006.c: dump/load" 42 # Dump and load 43 exec $util_path/db_dump -p -h $testdir $testfile | \ 44 $util_path/db_load -h $testdir $testfile 45} 46