Replies: 1 comment 2 replies
-
The current approach already accomplishes this, albeit with a little more steps if (client.session.current_transaction !== null) {
await client.createTransaction(transaction_name).rollback();
} I don't recommend ending the connection altogether, since that also removes whatever temporal data was created in the current session |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A more cautious approach to securing transactions
safe
private property on theQueryClient
.safe
tofalse
every timebegin()
is executed on a connection.commit()
orrollback()
is executed on a connection changesafe
totrue
.What the user has to do:
end()
to end the connection and reconnect. You can also executerollback()
to roll back. Or selectbegin()
to commit.更谨慎的 确保事务安全的 办法
safe
私有属性.begin()
都将safe
改为false
.commit()
或者rollback()
都将safe
改为true
.使用者要做的:
end()
结束这个连接, 重新进行连接. 也可以执行rollback()
进行回滚. 或者选择begin()
进行提交.Beta Was this translation helpful? Give feedback.
All reactions