Subject: | _find_syntax() can throw a die due to the eval() |
I noticed a couple problems. First, using Class::DBI it didn't seem to auto-pickup that I was using MySQL and instead was trying to use GenericQ. Secondly, when I manually set limit_dialect=>'LimitXY' it would croak. The reason is that we overload the die, so the eval was attempting:
if ( eval { $syntax->{Driver}->{Name} } )
when $syntax was the string "LimitXY". Not sure this patch is a great solution, but swapping the order allowed it to run the string test BEFORE trying the eval. This error may not be obvious to those who do not override die.
Thanks!
288c288,295
< if ( UNIVERSAL::isa( $syntax, 'Class::DBI' ) )
---
> # if ( UNIVERSAL::isa( $syntax, 'DBI::db' ) ) should work too
> if ( eval { $syntax->{Driver}->{Name} } )
> { # DBI database handle
> my $db = $self->_find_database_from_dbh( $syntax );
> return $self->_find_syntax_from_database( $db );
> }
>
> if ( UNIVERSAL::isa( $syntax, 'Class::DBI' ) )
305,312d311
< # if ( UNIVERSAL::isa( $syntax, 'DBI::db' ) ) should work too
< if ( eval { $syntax->{Driver}->{Name} } )
< { # DBI database handle
< my $db = $self->_find_database_from_dbh( $syntax );
< return $self->_find_syntax_from_database( $db );
< }
<
<