[Sqlrelay-discussion] SQLRelay and RaiseError problem
Brought to you by:
mused
|
From: Albert V. <av...@im...> - 2006-04-28 11:17:21
|
Hello,
I'm testing the SQLRelay with the perl DBI module and I have a
problem. The connection looks like:
if ($sqlrelay{$hostKey}) {
# SQLRelay connections
$self->{CONNECTION} = DBI->connect("DBI:SQLRelay:host=$host;port=
$port;", "$usuariMysql", "$pwdMysql", { RaiseError => 1, PrintError
=> 0});
} else {
# Normal connections using the DBI module
$self->{CONNECTION} = DBI->connect("DBI:$sgMysql:$database;host=
$host", "$usuariMysql", "$pwdMysql", { RaiseError => 1, PrintError =>
0)};
}
And the code to perform an action looks like:
eval {
$result = $connection->selectall_arrayref($query);
};
# Error control
if ($@) {
my $error = $@;
if ($error =~ m/MySQL server has gone away/ || $error =~ m/Lost
connection to MySQL server during query/) {
# Reconnection
$self->doConnection($self->{DATABASE}, $self->{HOSTKEY});
$result = $connection->selectall_arrayref($query);
}
}
return $result;
However, using the normal DBI connection, the RaiseError works and I
can catch the exception. Using the SQLRelay I can't catch the
Exception. Is there a way to catch this Exceptions?
Thanks in advance.
Albert
|