1
# See the file LICENSE for redistribution information.
3
# Copyright (c) 1996-2002
4
# Sleepycat Software. All rights reserved.
8
# Txn003 script - outstanding child prepare script
9
# Usage: txnscript envcmd dbcmd gidf key data
10
# envcmd: command to open env
11
# dbfile: name of database file
12
# gidf: name of global id file
14
# data: new data to use
17
source $test_path/test.tcl
18
source $test_path/testutils.tcl
20
set usage "txnscript envcmd dbfile gidfile key data"
24
puts stderr "FAIL:[timestamp] Usage: $usage"
28
# Initialize arguments
29
set envcmd [ lindex $argv 0 ]
30
set dbfile [ lindex $argv 1 ]
31
set gidfile [ lindex $argv 2 ]
32
set key [ lindex $argv 3 ]
33
set data [ lindex $argv 4 ]
35
set dbenv [eval $envcmd]
36
error_check_good envopen [is_valid_env $dbenv] TRUE
39
set db [berkdb_open -auto_commit -env $dbenv $dbfile]
40
error_check_good dbopen [is_valid_db $db] TRUE
42
puts "\tTxnscript.a: begin parent and child txn"
43
set parent [$dbenv txn]
44
error_check_good parent [is_valid_txn $parent $dbenv] TRUE
45
set child [$dbenv txn -parent $parent]
46
error_check_good parent [is_valid_txn $child $dbenv] TRUE
48
puts "\tTxnscript.b: Modify data"
49
error_check_good db_put [$db put -txn $child $key $data] 0
51
set gfd [open $gidfile w+]
52
set gid [make_gid txnscript:$parent]
54
puts "\tTxnscript.c: Prepare parent only"
55
error_check_good txn_prepare:$parent [$parent prepare $gid] 0
58
puts "\tTxnscript.d: Check child handle"
59
set stat [catch {$child abort} ret]
60
error_check_good child_handle $stat 1
61
error_check_good child_h2 [is_substr $ret "invalid command name"] 1
64
# We do not close the db or env, but exit with the txns outstanding.
66
puts "\tTxnscript completed successfully"