/// <summary> /// Commit all the operations of a transaction into the database. /// All cursors opened within the transaction will be closed by this call. /// The cursors and transaction handle will be freed and must not be used again after this call. /// </summary> public void Commit() { try { try { this.OnClosing(false); } finally { try { NativeMethods.Execute(lib => lib.mdb_txn_commit(_handle)); } catch (LightningException) { this.Abort(false); throw; } this.State = LightningTransactionState.Commited; } } finally { this.DetachClosingHandler(); } }
/// <summary> /// Reset current transaction. /// </summary> public void Reset() { if (!IsReadOnly) { throw new InvalidOperationException("Can't reset non-readonly transaction"); } Lmdb.mdb_txn_reset(_handle); State = LightningTransactionState.Reseted; }
/// <summary> /// Reset current transaction. /// </summary> public void Reset() { if (!this.IsReadOnly) { throw new InvalidOperationException("Can't reset non-readonly transaction"); } NativeMethods.Library.mdb_txn_reset(_handle); this.State = LightningTransactionState.Reseted; }
private void OnParentStateChanging(LightningTransactionState state) { switch (state) { case LightningTransactionState.Aborted: case LightningTransactionState.Commited: Abort(); break; default: break; } }
/// <summary> /// Renew current transaction. /// </summary> public void Renew() { if (!IsReadOnly) { throw new InvalidOperationException("Can't renew non-readonly transaction"); } if (State != LightningTransactionState.Reseted) { throw new InvalidOperationException("Transaction should be reseted first"); } Lmdb.mdb_txn_renew(_handle); State = LightningTransactionState.Active; }
/// <summary> /// Renew current transaction. /// </summary> public void Renew() { if (!this.IsReadOnly) { throw new InvalidOperationException("Can't renew non-readonly transaction"); } if (this.State != LightningTransactionState.Reseted) { throw new InvalidOperationException("Transaction should be reseted first"); } NativeMethods.Library.mdb_txn_renew(_handle); this.State = LightningTransactionState.Active; }
/// <summary> /// Renew current transaction. /// </summary> public MDBResultCode Renew() { if (!IsReadOnly) { throw new InvalidOperationException("Can't renew non-readonly transaction"); } if (State != LightningTransactionState.Reseted) { throw new InvalidOperationException("Transaction should be reset first"); } var result = mdb_txn_renew(_handle); State = LightningTransactionState.Active; return(result); }
private void Abort(bool environmentClosing) { try { try { this.OnClosing(environmentClosing); } finally { NativeMethods.Library.mdb_txn_abort(_handle); } } finally { this.DetachClosingHandler(); this.State = LightningTransactionState.Aborted; } }
/// <summary> /// Commit all the operations of a transaction into the database. /// All cursors opened within the transaction will be closed by this call. /// The cursors and transaction handle will be freed and must not be used again after this call. /// </summary> public void Commit() { State = LightningTransactionState.Commited; StateChanging?.Invoke(State); Lmdb.mdb_txn_commit(_handle); }
/// <summary> /// Commit all the operations of a transaction into the database. /// All cursors opened within the transaction will be closed by this call. /// The cursors and transaction handle will be freed and must not be used again after this call. /// </summary> public void Commit() { Discard(() => { try { NativeMethods.Execute(lib => lib.mdb_txn_commit(_handle)); this.State = LightningTransactionState.Commited; NotifyDiscarded(); } catch (LightningException) { this.Abort(); throw; } }); }
/// <summary> /// Reset current transaction. /// </summary> public void Reset() { if (!this.IsReadOnly) throw new InvalidOperationException("Can't reset non-readonly transaction"); NativeMethods.Library.mdb_txn_reset(_handle); this.State = LightningTransactionState.Reseted; }
/// <summary> /// Commit all the operations of a transaction into the database. /// All cursors opened within the transaction will be closed by this call. /// The cursors and transaction handle will be freed and must not be used again after this call. /// </summary> public void Commit() { State = LightningTransactionState.Commited; StateChanging?.Invoke(State); mdb_txn_commit(_handle); }
/// <summary> /// Abandon all the operations of the transaction instead of saving them. /// All cursors opened within the transaction will be closed by this call. /// The cursors and transaction handle will be freed and must not be used again after this call. /// </summary> public void Abort() { State = LightningTransactionState.Aborted; StateChanging?.Invoke(State); mdb_txn_abort(_handle); }
/// <summary> /// Renew current transaction. /// </summary> public void Renew() { if (!IsReadOnly) throw new InvalidOperationException("Can't renew non-readonly transaction"); if (State != LightningTransactionState.Reseted) throw new InvalidOperationException("Transaction should be reseted first"); mdb_txn_renew(_handle); State = LightningTransactionState.Active; }
/// <summary> /// Reset current transaction. /// </summary> public void Reset() { if (!IsReadOnly) throw new InvalidOperationException("Can't reset non-readonly transaction"); mdb_txn_reset(_handle); State = LightningTransactionState.Reseted; }
/// <summary> /// Abandon all the operations of the transaction instead of saving them. /// All cursors opened within the transaction will be closed by this call. /// The cursors and transaction handle will be freed and must not be used again after this call. /// </summary> public void Abort() { State = LightningTransactionState.Aborted; StateChanging?.Invoke(State); Lmdb.mdb_txn_abort(_handle); }
/// <summary> /// Abandon all the operations of the transaction instead of saving them. /// All cursors opened within the transaction will be closed by this call. /// The cursors and transaction handle will be freed and must not be used again after this call. /// </summary> public void Abort() { Discard(() => { this.State = LightningTransactionState.Aborted; NativeMethods.Library.mdb_txn_abort(_handle); }); }
/// <summary> /// Commit all the operations of a transaction into the database. /// All cursors opened within the transaction will be closed by this call. /// The cursors and transaction handle will be freed and must not be used again after this call. /// </summary> public MDBResultCode Commit() { State = LightningTransactionState.Commited; StateChanging?.Invoke(State); return(mdb_txn_commit(_handle)); }