sessionIsDoomed function

bool sessionIsDoomed(
  1. MssqlSession session
)

Whether session can still run a statement.

A doomed transaction throws on the next command; reading the winner after a unique collision would replace a useful 2627 with that StateError.

Implementation

bool sessionIsDoomed(MssqlSession session) {
  var current = session;
  while (current is MssqlObservedSession) {
    current = current.inner;
  }
  return current is MssqlTransaction && current.isDoomed;
}