DBIO-MySQL-EV
view release on metacpan or search on metacpan
lib/DBIO/MySQL/EV/Storage.pm view on Meta::CPAN
(L</_run_crud_pinned>) reads C<SELECT LAST_INSERT_ID()> on the pinned connection
instead of appending a RETURNING suffix, so core's generic
C<_run_crud> insert branch (which consumes this seam) is never reached for this
transport; the seam is defined only to satisfy the base contract.
=head2 future_class
Returns C<'Future'> -- uses L<Future.pm|Future> from CPAN. Plain L<Future>
C<< ->then >> callbacks auto-wrap a non-Future return value into a resolved
Future (ADR 0031 §4), so ResultSet/Row C<< *_async >> callbacks that return
plain values resolve without an explicit C<< Future->done(...) >> wrap.
=head2 transport_capabilities
my @caps = DBIO::MySQL::EV::Storage->transport_capabilities;
Class method (see L<DBIO::Storage::Async/transport_capabilities>). Declares the
wire capabilities this transport really provides, so
L<DBIO::Storage::DBI/_async_storage> lets an async extension layer that requires
any of them compose onto it (and croaks naming the gap otherwise, rather than
silently dropping a feature). This transport provides B<only>:
=over 4
=item * C<on_connect_replay> -- its pool (L<DBIO::MySQL::EV::Pool>, a
L<DBIO::Storage::PoolBase>) drives core's
L<DBIO::Storage::Async/_setup_pool_connection> on every freshly-spawned
connection, and L</_run_pool_connect_statement> replays the owning sync
storage's C<on_connect_do>/C<on_connect_call> against it (karr #68 / #18).
=back
It does B<not> declare C<listen>, C<notify> or C<copy> (MySQL has neither
LISTEN/NOTIFY nor COPY), nor C<pipeline> (EV::MariaDB pipelines automatically
at the wire level; there is no explicit pipeline-mode API for the core seam to
bracket).
=head2 connect_info
$storage->connect_info([ \%conninfo, \%opts ]);
Set connection parameters. C<%conninfo> is passed to L<EV::MariaDB> as named
connection parameters (host, user, password, database, ...). When the embedding
sync storage feeds its own DBI-form connect info
(C<< ['dbi:MariaDB:...', $user, $pass, \%attrs] >>) it is translated into the
async C<< [ \%conninfo, \%opts ] >> shape first (EV::MariaDB cannot parse a DSN
string). AccessBroker connect info (C<< [ $broker ] >>) is detected and wired to
the per-spawn credential provider (the inherited broker seam), exactly as the
sync path does.
This override (rather than the inherited base C<connect_info>) is retained
because the EV transport folds the DBI-form DSN into EV::MariaDB named params
inline via L<DBIO::MySQL::EV::ConnectInfo/dbi_to_conninfo>.
=head2 _async_broker_conninfo
my $conninfo = $storage->_async_broker_conninfo($mode);
AccessBroker seam (see L<DBIO::Storage::Async/ACCESSBROKER CONSUMPTION>): return
one fresh, storage-native EV::MariaDB conninfo hash for a single new pool
connection, built from the current broker credentials via the inherited
normalisation.
=head2 _normalize_async_connect_info
my ($conninfo, $pool_size, $opts) = $storage->_normalize_async_connect_info($info);
MySQL-specific override of the base normaliser: besides stripping C<pool_size>
out of the conninfo, it maps C<dbname> to C<database> (EV::MariaDB's spelling)
so a hash-form connect that used the DBI-style C<dbname> key still reaches the
native client correctly. Works on copies so the caller's structures are never
mutated.
=head2 _conninfo_hash
my $conninfo = $storage->_conninfo_hash;
Returns the already-normalised stored EV::MariaDB conninfo hashref (or a passed
override). Normalisation (C<dbname>-E<gt>C<database>, C<pool_size> extraction)
is done once in L</_normalize_async_connect_info>, so this returns it as-is.
=head2 pool
Returns the L<DBIO::MySQL::EV::Pool> connection pool, created lazily on first
access. The pool is wired with C<< storage => $self >> so its core-shared spawn
path (L<DBIO::Storage::PoolBase/_spawn_connection>) replays the owning sync
storage's connect actions on each new connection via
L</_run_pool_connect_statement> (karr #68 / #18). Fed the per-spawn
C<conninfo_provider> when an AccessBroker is attached, otherwise the static
conninfo hash.
=head2 _txn_context_class
The pinned-connection transaction context the inherited
L<DBIO::Storage::Async/txn_do_async> hands to its coderef:
L<DBIO::MySQL::EV::TransactionContext>.
=head2 _txn_conn_accessor
The constructor key the pinned connection is passed under -- C<mdb>, matching
L<DBIO::MySQL::EV::TransactionContext>.
=head2 _transform_sql
Transport-internal SQL shaping (core #70 / ADR 0032). B<Identity> for MySQL:
MySQL/DBD speaks the C<?> placeholder dialect natively, so the C<sql_maker>
output needs no rewrite. The seam is retained (and applied first by
L</_query_async> / L</_query_async_pinned>) purely to keep the transport seam
contract uniform across drivers -- do B<not> reintroduce a dialect rewrite here.
=head2 _query_async
Transport seam. Execute a query on a freshly-acquired pooled connection,
releasing it once the Future is ready. Returns a L<Future> of the raw result
rows (list of column arrayrefs for a result set, or the affected-row count for
plain DML -- ADR 0031 §3), exactly what the inherited C<_run_crud> expects.
Receives SQL in the C<sql_maker> C<?>-placeholder dialect and shapes it via
L</_transform_sql> (identity for MySQL) before it reaches the executor -- the
core #70 / ADR 0032 seam contract.
( run in 2.142 seconds using v1.01-cache-2.11-cpan-007c89162af )