| 1 | package DBIx::Transaction::st; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use DBI; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use base q(DBI::st); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use warnings (FATAL => 'all'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 2 | return 1; | |||||||||
| 10 | |||||||||||
| 11 | 98 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 12 | 98 | my $self = shift; | |||||||||
| 13 | 98 | my $rv = eval { DBI::st::execute($self, @_); }; | |||||||||
| 14 | 98 | ▶ | if($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 2 | $self->{Database}->inc_transaction_error(caller, $self->errstr); | |||||||||
| 16 | 2 | croak "$@\n"; | |||||||||
| 17 | } | ||||||||||
| 18 | 96 | ▶ | if(!$rv) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 6 | $self->{Database}->inc_transaction_error(caller, $self->errstr); | |||||||||
| 20 | } | ||||||||||
| 21 | 96 | return $rv; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | =pod | ||||||||||
| 25 | |||||||||||
| 26 | =head1 NAME | ||||||||||
| 27 | |||||||||||
| 28 | DBIx::Transaction::st - Statement handle when running under DBIx::Transaction | ||||||||||
| 29 | |||||||||||
| 30 | =head1 DESCRIPTION | ||||||||||
| 31 | |||||||||||
| 32 | When you connect to a database using DBIx::Transaction, your statement handles | ||||||||||
| 33 | will be C<DBIx::Transaction::st> objects. When these statement handles are | ||||||||||
| 34 | executed, C<DBIx::Transaction::st> will notice when query errors occur, and | ||||||||||
| 35 | let the database handle know. See | ||||||||||
| 36 | L<the commit() method in DBIx::Transaction::db|DBIx::Transaction::db/item_commit> | ||||||||||
| 37 | for more information. | ||||||||||
| 38 | |||||||||||
| 39 | =head1 METHODS | ||||||||||
| 40 | |||||||||||
| 41 | C<DBIx::Transaction::st> only overrides one standard L<DBI::st|DBI> method: | ||||||||||
| 42 | |||||||||||
| 43 | =over | ||||||||||
| 44 | |||||||||||
| 45 | =item execute | ||||||||||
| 46 | |||||||||||
| 47 | Calls C<execute> on the underlying database layer. If an error | ||||||||||
| 48 | occurs, this is recorded and you will not be able to issue a C<commit> | ||||||||||
| 49 | for the current transaction. | ||||||||||
| 50 | |||||||||||
| 51 | =back | ||||||||||
| 52 | |||||||||||
| 53 | =head1 SEE ALSO | ||||||||||
| 54 | |||||||||||
| 55 | L<DBI>, L<DBIx::Transaction> | ||||||||||
| 56 | |||||||||||
| 57 | =cut | ||||||||||