2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 1997, 1998
5
* Sleepycat Software. All rights reserved.
11
static const char sccsid[] = "@(#)cxx_txn.cpp 10.8 (Sleepycat) 4/10/98";
18
////////////////////////////////////////////////////////////////////////
22
////////////////////////////////////////////////////////////////////////
33
int DbTxnMgr::begin(DbTxn *pid, DbTxn **tid)
36
DB_TXNMGR *mgr = unwrap(this);
39
if ((err = txn_begin(mgr, unwrap(pid), &txn)) != 0) {
40
DB_ERROR("DbTxn::begin", err);
43
DbTxn *result = new DbTxn();
44
result->imp_ = wrap(txn);
49
int DbTxnMgr::checkpoint(u_int32_t kbyte, u_int32_t min) const
52
const DB_TXNMGR *mgr = unwrapConst(this);
53
if ((err = txn_checkpoint(mgr, kbyte, min)) != 0) {
54
DB_ERROR("DbTxnMgr::checkpoint", err);
63
DB_TXNMGR *mgr = unwrap(this);
64
if ((err = txn_close(mgr)) != 0) {
65
DB_ERROR("DbTxnMgr::close", err);
68
imp_ = 0; // extra safety
70
// This may seem weird, but is legal as long as we don't access
71
// any data before returning.
78
int DbTxnMgr::open(const char *dir, u_int32_t flags, int mode,
79
DbEnv *dbenv, DbTxnMgr **regionp)
82
DB_TXNMGR *result = 0;
84
if ((err = txn_open(dir, flags, mode, dbenv, &result)) != 0) {
85
DB_ERROR("DbTxnMgr::open", err);
89
*regionp = new DbTxnMgr();
90
(*regionp)->imp_ = wrap(result);
94
int DbTxnMgr::stat(DB_TXN_STAT **statp, void *(*db_malloc)(size_t))
97
DB_TXNMGR *mgr = unwrap(this);
98
if ((err = txn_stat(mgr, statp, db_malloc)) != 0) {
99
DB_ERROR("DbTxnMgr::stat", err);
106
int DbTxnMgr::unlink(const char *dir, int force, DbEnv *dbenv)
109
if ((err = txn_unlink(dir, force, dbenv)) != 0) {
110
DB_ERROR("DbTxnMgr::unlink", err);
116
////////////////////////////////////////////////////////////////////////
120
////////////////////////////////////////////////////////////////////////
134
DB_TXN *txn = unwrap(this);
135
if ((err = txn_abort(txn)) != 0) {
136
DB_ERROR("DbTxn::abort", err);
140
// This may seem weird, but is legal as long as we don't access
141
// any data before returning.
150
DB_TXN *txn = unwrap(this);
151
if ((err = txn_commit(txn)) != 0) {
152
DB_ERROR("DbTxn::commit", err);
156
// This may seem weird, but is legal as long as we don't access
157
// any data before returning.
163
u_int32_t DbTxn::id()
165
DB_TXN *txn = unwrap(this);
166
return txn_id(txn); // no error
172
DB_TXN *txn = unwrap(this);
173
if ((err = txn_prepare(txn)) != 0) {
174
DB_ERROR("DbTxn::prepare", err);