15
use GenTest::Constants;
16
17
use constant EXECUTOR_DSN => 0;
17
18
use constant EXECUTOR_DBH => 1;
18
19
use constant EXECUTOR_ID => 2;
19
use constant EXECUTOR_DEBUG => 3;
20
use constant EXECUTOR_ROW_COUNTS => 4;
21
use constant EXECUTOR_EXPLAIN_COUNTS => 5;
22
use constant EXECUTOR_EXPLAIN_QUERIES => 6;
23
use constant EXECUTOR_ERROR_COUNTS => 7;
20
use constant EXECUTOR_ROW_COUNTS => 3;
21
use constant EXECUTOR_EXPLAIN_COUNTS => 4;
22
use constant EXECUTOR_EXPLAIN_QUERIES => 5;
23
use constant EXECUTOR_ERROR_COUNTS => 6;
30
30
my $executor = $class->SUPER::new({
31
31
'dsn' => EXECUTOR_DSN,
32
32
'dbh' => EXECUTOR_DBH,
33
'debug' => EXECUTOR_DEBUG
64
59
$_[0]->[EXECUTOR_ID] = $_[1];
64
if ($self =~ m/GenTest::Executor::JavaDB/) {
66
}elsif ($self =~/^GenTest::Executor::MySQL/) {
68
}elsif ($self =~ m/GenTest::Executor::Postgres/) {
76
my @dbid = ("Unknown","MySQL","Postgres","JavaDB");
80
return $dbid[$self->type()];
84
my ($self, $query) = @_;
86
my $id = $dbid[$self->type()];
91
# print "... $id before: $query \n";
93
$query =~ s/\/\*\+[a-z:]*$id[a-z:]*:([^*]*)\*\//\1/gi;
95
# print "... after: $query \n";
100
## This array maps SQL State class (2 first letters) to a status. This
101
## list needs to be extended
103
"07" => STATUS_SEMANTIC_ERROR, # dynamic SQL error
104
"08" => STATUS_SEMANTIC_ERROR, # connection exception
105
"22" => STATUS_SEMANTIC_ERROR, # data exception
106
"23" => STATUS_SEMANTIC_ERROR, # integrity constraint violation
107
"25" => STATUS_TRANSACTION_ERROR, # invalid transaction state
108
"42" => STATUS_SYNTAX_ERROR # syntax error or access rule
114
my ($self, $state) = @_;
116
my $class = substr($state, 0, 2);
117
if (defined $class2status{$class}) {
118
return $class2status{$class};
120
return STATUS_UNKNOWN_ERROR;