run<R> method
Runs action exclusively; the next lease starts after its future settles.
Implementation
@override
Future<R> run<R>(Future<R> Function(SqlConnection) action) {
if (_closed) {
throw const OrmException('DRIVER.CLOSED', 'SQLite driver is closed.');
}
// Queue the whole lease: no caller can enter another caller's transaction.
final result = _tail.then((_) => action(_connection));
_tail = result.then<void>((_) {}, onError: (Object _, StackTrace _) {});
return result;
}