DBIx-Class
view release on metacpan or search on metacpan
lib/DBIx/Class/Manual/Cookbook.pod view on Meta::CPAN
While you can get more fine-grained control using C<svp_begin>, C<svp_release>
and C<svp_rollback>, it is strongly recommended to use C<txn_do> with coderefs.
=head2 Simple Transactions with DBIx::Class::Storage::TxnScopeGuard
An easy way to use transactions is with
L<DBIx::Class::Storage::TxnScopeGuard>. See L</Automatically creating
related objects> for an example.
Note that unlike txn_do, TxnScopeGuard will only make sure the connection is
alive when issuing the C<BEGIN> statement. It will not (and really can not)
retry if the server goes away mid-operations, unlike C<txn_do>.
=head1 SQL
=head2 Creating Schemas From An Existing Database
L<DBIx::Class::Schema::Loader> will connect to a database and create a
L<DBIx::Class::Schema> and associated sources by examining the database.
The recommend way of achieving this is to use the L<dbicdump> utility or the
t/52leaks.t view on Meta::CPAN
if ($names =~ /^Test::Builder/m) {
# T::B 2.0 has result objects and other fancyness
delete $weak_registry->{$addr};
}
elsif ($names =~ /^Hash::Merge/m) {
# only clear one object of a specific behavior - more would indicate trouble
delete $weak_registry->{$addr}
unless $cleared->{hash_merge_singleton}{$weak_registry->{$addr}{weakref}{behavior}}++;
}
elsif ($names =~ /^B::Hooks::EndOfScope::PP::_TieHintHashFieldHash/m) {
# there is one tied lexical which stays alive until GC time
# https://metacpan.org/source/ETHER/B-Hooks-EndOfScope-0.15/lib/B/Hooks/EndOfScope/PP/FieldHash.pm#L24
# simply ignore it here, instead of teaching the leaktracer to examine ties
# the latter is possible yet terrible: https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.082840/t/lib/DBICTest/Util/LeakTracer.pm#L113-117
delete $weak_registry->{$addr}
unless $cleared->{bheos_pptiehinthashfieldhash}++;
}
elsif ($names =~ /^B::Hooks::EndOfScope::PP::HintHash::__GraveyardTransport/m) {
# a workaround for perl-level double free: these "leak" by design
delete $weak_registry->{$addr};
}
( run in 1.891 second using v1.01-cache-2.11-cpan-39bf76dae61 )