* Commit more often to prevent out-of-memory errors.
This commit is contained in:
parent
98df735b51
commit
3a99616968
3 changed files with 22 additions and 4 deletions
|
|
@ -33,11 +33,9 @@ Transaction::Transaction()
|
|||
|
||||
|
||||
Transaction::Transaction(Database & db)
|
||||
: txn(0)
|
||||
{
|
||||
db.requireEnv();
|
||||
try {
|
||||
db.env->txn_begin(0, &txn, 0);
|
||||
} catch (DbException e) { rethrow(e); }
|
||||
begin(db);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -47,6 +45,16 @@ Transaction::~Transaction()
|
|||
}
|
||||
|
||||
|
||||
void Transaction::begin(Database & db)
|
||||
{
|
||||
assert(txn == 0);
|
||||
db.requireEnv();
|
||||
try {
|
||||
db.env->txn_begin(0, &txn, 0);
|
||||
} catch (DbException e) { rethrow(e); }
|
||||
}
|
||||
|
||||
|
||||
void Transaction::commit()
|
||||
{
|
||||
if (!txn) throw Error("commit called on null transaction");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue