4 |
use warnings; |
use warnings; |
5 |
|
|
6 |
use base qw(Jifty::Object Class::Accessor::Fast); |
use base qw(Jifty::Object Class::Accessor::Fast); |
7 |
__PACKAGE__->mk_accessors( qw(query arguments dbh encoding) ); |
__PACKAGE__->mk_accessors( qw(query arguments dbh encoding duration) ); |
8 |
|
|
9 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
10 |
|
use Time::HiRes qw/time/; |
11 |
|
|
12 |
=head1 NAME |
=head1 NAME |
13 |
|
|
45 |
if ( ! $self->{_sth} ) { |
if ( ! $self->{_sth} ) { |
46 |
my $dbh = $self->dbh || Jifty->handle->dbh; |
my $dbh = $self->dbh || Jifty->handle->dbh; |
47 |
my $sth = $dbh->prepare( $self->query ) or $dbh->errstr; |
my $sth = $dbh->prepare( $self->query ) or $dbh->errstr; |
48 |
|
my $t = time(); |
49 |
if ( $self->arguments ) { |
if ( $self->arguments ) { |
50 |
Jifty->log->debug( $self->sql . ' arguments: ' . dump( $self->arguments ) ); |
Jifty->log->debug( $self->sql . ' arguments: ' . dump( $self->arguments ) ); |
51 |
$sth->execute( $self->arguments ) or die $dbh->errstr; |
$sth->execute( $self->arguments ) or die $dbh->errstr; |
52 |
} else { |
} else { |
53 |
$sth->execute or die $dbh->errstr; |
$sth->execute or die $dbh->errstr; |
54 |
} |
} |
55 |
|
$self->duration( time() - $t ); |
56 |
$self->{_sth} = $sth; |
$self->{_sth} = $sth; |
57 |
} |
} |
58 |
|
|