NAME
DBIO::MySQL::EV::TransactionContext - Pinned connection context for an async MySQL/MariaDB transaction
VERSION
version 0.900007
DESCRIPTION
The pinned-connection context DBIO::MySQL::EV::Storage hands to a txn_do_async coderef -- see "_txn_context_class" in DBIO::MySQL::EV::Storage.
Everything it does is inherited from DBIO::Storage::Async::TransactionContext, the generic context core ships since ADR 0030 §4: storage, txn_conn, pool, in_txn, the non-releasing _query_async, the five *_async CRUD methods pinned through "_run_crud_pinned" in DBIO::MySQL::EV::Storage and their blocking ->get siblings, the sql_maker / debug delegations, pipeline (runs on the pinned txn_conn in core -- here it returns a failed Future, because this transport has no pipeline seam, ADR 0009), txn_do_async (refuses a nested transaction), and _context_active / _invalidate (ADR 0045), which context-bound DBIO::ResultSet / DBIO::Row / DBIO::ResultSetColumn *_async ops consult before routing onto the context.
The blocking siblings wait through "await" in DBIO::MySQL::EV::Future. The coderef that calls them runs from the idle watcher that settles the BEGIN's Future, outside every callback of the pinned connection, so a statement it sends -- with or without bind values -- goes out at once and a blocking call waiting for it returns: $ctx->select without a WHERE works in the coderef, inside the transaction.
A blocking call on the storage in the coderef -- $storage->select where $ctx->select_async was meant -- does not run on this context's connection but on another one from the pool. When the callbacks it runs inside hold every connection of the pool, it is refused the same way and does not run ("await" in DBIO::MySQL::EV::Future).
This class adds exactly one thing: the "txn_mdb" compatibility alias below. The pinning policy this context implements is recorded in ADR 0002; the duplicated-context half of that ADR is superseded by core ADR 0030 §4.
The pinned connection is passed to new under the core constructor key txn_conn, which "_txn_conn_accessor" in DBIO::MySQL::EV::Storage names and core's txn_do_async builds the context with. The constructor dies without txn_conn.
ATTRIBUTES
txn_mdb
my $mdb = $ctx->txn_mdb;
Alias for the inherited "txn_conn" in DBIO::Storage::Async::TransactionContext: the pinned EV::MariaDB connection handle for the duration of this transaction. The name says which kind of handle is pinned. txn_conn is the name core's own code reaches for -- deploy_async's transactional branch among them -- so both answer the same handle.
AUTHOR
DBIO Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.