Skip to content

Commit

Permalink
Check whether this Transaction is active or not
Browse files Browse the repository at this point in the history
  • Loading branch information
QSmally committed Sep 30, 2020
1 parent 38d3cda commit 0292a77
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Utility/Transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ class Transaction {
* @returns {Boolean} Whether the changed were committed.
*/
Commit () {
if (!this._Connection._Ready) return false;
if (!this.Active) return false;
if (!this._Connection.API.inTransaction) return false;
if (!this._Connection._Ready) return false;

this._Connection.API.exec("COMMIT");
this.Active = false;
Expand All @@ -56,8 +57,9 @@ class Transaction {
* @returns {Boolean} Whether the changed were reset.
*/
Rollback () {
if (!this._Connection._Ready) return false;
if (!this.Active) return false;
if (!this._Connection.API.inTransaction) return false;
if (!this._Connection._Ready) return false;

this._Connection.Cache.clear();
this._Connection.API.exec("ROLLBACK");
Expand Down

0 comments on commit 0292a77

Please sign in to comment.