asfernandes / node-firebird-drivers

Node.js Firebird Drivers
MIT License
53 stars 17 forks source link

Implementation of isValid property #119

Closed gsbelarus closed 2 years ago

gsbelarus commented 2 years ago

IsValid() function implemented for objects Client, Attachment, Transaction, Statement, ResultSet, BlobStream. So, we can test the object's validity after commit(), rollback(), dispose(), close() etc. methods have been invoked.

The newly added method is covered through the tests. In two places the tests have been adapted to be able to run on FB3.

Example of usage:

const transaction = await attachment.startTransaction();
try {
  ...
  // some code where the transaction could be committed or rolled back
  // but there are also conditions for the transaction to stay alive
  // until the code ends
  ...
} finally {
  if (transaction.isValid()) await transaction.commit();
}
asfernandes commented 2 years ago

Please add it to Blob and Events.

asfernandes commented 2 years ago

Please replace isValid to be a readonly property instead of a method. It looks more friendly.

gsbelarus commented 2 years ago

resolved all issues mentioned above.

asfernandes commented 2 years ago

Please set option "allow edits from maintainers" in this PR so I can send small edits before merge.

gsbelarus commented 2 years ago

It is set.

asfernandes commented 2 years ago

It is set.

I still cannot push to it.

asfernandes commented 2 years ago

I have manually rebased your changes with mine and pushed to master, so closing this.