On Wed Aug 27 04:46:56 2014, chrmet@web.de wrote:
Show quoted text> Dear Ladies and Gentleman, we are using DBD-Multi 0.18 with Perl
> 5.12.3 on Linux (Rhel 5.5).It fits our requirements very well.We are
> able to write to every cluster node with
> MariaDB-Galera-server-5.5.37-1 for MySQL.
Hello! I'm glad to hear it is working well for you.
Show quoted text> A) Should behave like other DBD drivers if a connection could not be
> establishedReturn "undef" (or a false value)Set $DBI::errSet
> $DBI::errstr
The DBD::Multi object is just a container. Creation of that container
never fails. Until that changes, Multi should not return undef.
Multi is an object that holds multiple database handles for you. Those
database handles may exist when you create the Mutli object, or they
might not even be created until they are needed.
For example, if I specify a connection like this:
DBI->connect( 'dbi:Multi:', undef, undef, {
dsns => [ 10 => [ ... ] # first db
20 => [ ... ] # second db ] } );
The Multi object will not attempt to connect to the first DB until it
has been sent its first query. Additionally, as long as the first DB
continues to work, the Multi object will never connect to second DB.
So, it would be impossible to always know at the time the Multi object
is constructed if the inner database handle connections will be
successful.
Show quoted text> B) The module dies if a connction could not be establishedI tried to
> catch this in my application with eval { ->connect() }, but
> unfortunatelythis does not work for me (script gets terminated).So the
> module should work like A) and not "die". Kind regards, Christian
> Metzger
The code does call die():
367 die("All data sources failed!");
You should be able to trap that with an eval {}. Can you provide
sample code that demonstrates the problem?
I think a valid argument could be made here that Multi should only call
die in the case where RaiseError is turned on. I would be willing to
look into making this change, if it would be helpful to you?
Regards,
-Dan