File: txn006.tcl

package info (click to toggle)
evolution-data-server 1.6.3-5
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 59,384 kB
  • ctags: 43,218
  • sloc: ansic: 319,315; tcl: 30,499; xml: 19,166; sh: 18,776; perl: 11,529; cpp: 8,259; java: 7,653; makefile: 6,448; awk: 1,338; yacc: 1,103; sed: 772; cs: 505; lex: 134; asm: 14
file content (47 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# See the file LICENSE for redistribution information.
#
# Copyright (c) 1996-2002
#	Sleepycat Software.  All rights reserved.
#
# $Id: txn006.tcl,v 1.1.1.1 2003/11/20 22:14:02 toshok Exp $
#
#
#TEST	txn006
#TEST	Test dump/load in transactional environment.
proc txn006 { { iter 50 } } {
	source ./include.tcl
	set testfile txn006.db

	puts "Txn006: Test dump/load in transaction environment"
	env_cleanup $testdir

	puts "\tTxn006.a: Create environment and database"
	# Open/create the txn region
	set e [berkdb_env -create -home $testdir -txn]
	error_check_good env_open [is_valid_env $e] TRUE

	# Open/create database
	set db [berkdb_open -auto_commit -env $e \
	    -create -btree -dup $testfile]
	error_check_good db_open [is_valid_db $db] TRUE

	# Start a transaction
	set txn [$e txn]
	error_check_good txn [is_valid_txn $txn $e] TRUE

	puts "\tTxn006.b: Put data"
	# Put some data
	for { set i 1 } { $i < $iter } { incr i } {
		error_check_good put [$db put -txn $txn key$i data$i] 0
	}

	# End transaction, close db
	error_check_good txn_commit [$txn commit] 0
	error_check_good db_close [$db close] 0
	error_check_good env_close [$e close] 0

	puts "\tTxn006.c: dump/load"
	# Dump and load
	exec $util_path/db_dump -p -h $testdir $testfile | \
	    $util_path/db_load -h $testdir $testfile
}