Open Kagu-chan opened 4 years ago
If you do not call startSync or start explicitly it is called implicitly when you do the query. So until you call commit or rollback or make new connection you are in the same transaction and it has snapshot of data at the momment of start.
Just as a follow-up question: After commiting / rolling back the transaction, is it necessary to do something specific with the default transaction? Or is the transaction result automatically cleared?
@xdenser If i try to commit or rollback afterwards, i get an error about an unset cursor.
I got it working by calling fetchSync
before commitSync
, so basically
prepareSync
execSync
fetchSync
commitSync
With this order, the latest data is fetched, the transaction is properly closed and there is no Cursor is not open
crash.
@xdenser Can you confirm this order being the intended way of usage? Is it maybe possible to update the documentation cases?
Yes correct. Default transaction is the transaction associated with connection object. If you call 'commit' on connection object - you are commiting default transaction. Check 'inTransaction' property to see if the transaction is started.
Hi,
we're using the lib with TypeScript 3.8 and node12. We've written a simple connection class which executes queries for us.
Using this code, we have the following problem:
SELECT * FROM TABLE WHERE ID = ?
Little hack to try things out:
This way, it works, but i havent found a function to close connections
SELECT * FROM TABLE WHERE ID = ?
SELECT * FROM MON$ATTACHMENTS
shows a shitload of open connections - i didnt find a close connection function...Thanks in advance for any help you can provide (: