close method

Future<void> close()

Closes the owned resource, if any.

A borrowed database does nothing here. An owned database closes what it opened — the connection, or the pool — once; calling again is a no-op. After close, the database and every query derived from it are unusable.

Implementation

Future<void> close() async {
  if (!owned || _closed) return;
  _closed = true;
  final borrowed = pool;
  if (borrowed != null) {
    await borrowed.close();
    return;
  }
  final s = _session;
  if (s is MssqlConnection) {
    await s.close();
  }
}