line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#********************************************************************* |
2
|
|
|
|
|
|
|
#*** lib/ResourcePool/Command/DBI/Execute.pm |
3
|
|
|
|
|
|
|
#*** Copyright (c) 2004 by Markus Winand |
4
|
|
|
|
|
|
|
#*** $Id: Execute.pm,v 1.5 2004/05/02 07:48:55 mws Exp $ |
5
|
|
|
|
|
|
|
#********************************************************************* |
6
|
|
|
|
|
|
|
package ResourcePool::Command::DBI::Execute; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
27247
|
use ResourcePool::Command; |
|
2
|
|
|
|
|
813
|
|
|
2
|
|
|
|
|
52
|
|
9
|
2
|
|
|
2
|
|
1573
|
use ResourcePool::Command::NoFailoverException; |
|
2
|
|
|
|
|
401
|
|
|
2
|
|
|
|
|
51
|
|
10
|
2
|
|
|
2
|
|
1167
|
use ResourcePool::Command::DBI::Common; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
55
|
|
11
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
53
|
|
12
|
2
|
|
|
2
|
|
8
|
use DBI; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
62
|
|
13
|
2
|
|
|
2
|
|
9
|
use vars qw(@ISA $VERSION); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
575
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = "1.0101"; |
16
|
|
|
|
|
|
|
push @ISA, qw(ResourcePool::Command::DBI::Common ResourcePool::Command); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub execute($$@) { |
19
|
0
|
|
|
0
|
1
|
|
my ($self, $dbh, @args) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $sql = $self->getSQLfromargs(\@args); |
22
|
0
|
|
|
|
|
|
my $sth = $self->prepare($dbh, $sql); |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$self->bind($sth, \@args); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $rc = 1; |
27
|
0
|
|
|
|
|
|
eval { |
28
|
0
|
|
|
|
|
|
$rc = $sth->execute(); |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
0
|
|
|
|
if ($rc && ! $@) { |
32
|
0
|
0
|
|
|
|
|
if (! $dbh->{AutoCommit}) { |
33
|
0
|
|
|
|
|
|
$rc = $dbh->commit(); |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
|
return $rc; |
36
|
|
|
|
|
|
|
} else { |
37
|
|
|
|
|
|
|
# test if failover should occure |
38
|
0
|
|
|
|
|
|
eval { |
39
|
0
|
0
|
|
|
|
|
if (! $dbh->{AutoCommit}) { |
40
|
0
|
|
|
|
|
|
$rc = $dbh->rollback(); |
41
|
|
|
|
|
|
|
} else { |
42
|
0
|
|
|
|
|
|
$rc = $dbh->ping(); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
}; |
45
|
0
|
0
|
0
|
|
|
|
if ($rc && ! @_) { |
46
|
0
|
|
|
|
|
|
die 'Execution of "' . $sql . '" failed: ' . $dbh->errstr() . "\n"; |
47
|
|
|
|
|
|
|
} else { |
48
|
0
|
|
|
|
|
|
die ResourcePool::Command::NoFailoverException->new( |
49
|
|
|
|
|
|
|
'Execution of "' . $sql . '" failed: ' . $dbh->errstr() . "\n" |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |