Tim Bunce wrote:
I'm interested to hear stories of people who have subclassed the DBI, or used modules that subclass the DBI.
Just as a simple example, how evil is this?:
package MyDbi; use base 'DBI'; package MyDbi::db; use base 'DBI::db'; sub prepare { my($self,@connect_args) = @_; return bless $self->SUPER::prepare(@connect_args), 'MyDbi::st'; } package MyDbi::st; use base 'DBI::st'; sub execute { my($sth,@binds)[EMAIL PROTECTED]; @binds = () unless @binds; my $stmt = $sth->{Statement}; for my $b(@binds) { $b = qq{'$b'} if defined $b and !DBI::looks_like_number($b); $b = q{NULL} unless defined $b; $stmt =~ s/\?/$b/; } my $rv; eval { $rv = $sth->SUPER::execute(@binds) }; return $rv unless $@; die sprintf "Execution Error: %sReconstructed SQL = %s\n" , $sth->errstr, $stmt; } 1; __END__ -- Jeff