NAME

DBIO::Storage::Async::TransactionContext - Generic pinned-connection context for async transactions

VERSION

version 0.900001

DESCRIPTION

The transaction context handed to the coderef of "txn_do_async" in DBIO::Storage::Async. It pins every CRUD operation to the single connection that BEGIN/COMMIT/ROLLBACK ran on, routing them through the storage's shared _run_crud_pinned builder so SQL generation (INSERT post-processing, select_single first-row) is never duplicated.

This is the loop-agnostic default returned by "_txn_context_class" in DBIO::Storage::Async; a transport backend that needs a different pinned-connection accessor overrides "_txn_conn_accessor" in DBIO::Storage::Async (and, if needed, _txn_context_class).

ATTRIBUTES

storage

The parent DBIO::Storage::Async instance.

txn_conn

The pinned connection handle for the duration of this transaction.

pool

Shortcut to $self->storage->pool.

in_txn

Always true -- indicates we are inside a transaction.

METHODS

new

my $ctx = DBIO::Storage::Async::TransactionContext->new(
    storage  => $storage,
    txn_conn => $conn,
);

Creates a new transaction context. Requires storage and a connection under the key returned by the storage's "_txn_conn_accessor" in DBIO::Storage::Async (default txn_conn).

_query_async

Executes a query on the pinned transaction connection without releasing it back to the pool. Uses "_query_async_pinned" in DBIO::Storage::Async.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.