DBIx::Transaction::st - Statement handle when running under DBIx::Transaction


DBIx-Transaction documentation Contained in the DBIx-Transaction distribution.

Index


Code Index:

NAME

Top

DBIx::Transaction::st - Statement handle when running under DBIx::Transaction

DESCRIPTION

Top

When you connect to a database using DBIx::Transaction, your statement handles will be DBIx::Transaction::st objects. When these statement handles are executed, DBIx::Transaction::st will notice when query errors occur, and let the database handle know. See the commit() method in DBIx::Transaction::db for more information.

METHODS

Top

DBIx::Transaction::st only overrides one standard DBI::st method:

execute

Calls execute on the underlying database layer. If an error occurs, this is recorded and you will not be able to issue a commit for the current transaction.

SEE ALSO

Top

DBI, DBIx::Transaction


DBIx-Transaction documentation Contained in the DBIx-Transaction distribution.

package DBIx::Transaction::st;

use DBI;
use base q(DBI::st);
use strict;
use warnings (FATAL => 'all');
use Carp qw(croak);

return 1;

sub execute {
    my $self = shift;
    my $rv = eval { DBI::st::execute($self, @_); };
    if($@) {
        $self->{Database}->inc_transaction_error(caller, $self->errstr);
        croak "$@\n";
    }
    if(!$rv) {
        $self->{Database}->inc_transaction_error(caller, $self->errstr);
    }
    return $rv;
}