[CDBI] Class::DBI and DBD::Mock problem
"Aaron Trevena" <[email protected]> Tue, 20 Mar 2007 15:14:53 +0000
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
Hey you crazy kids,
I'm trying to unit test some hairy query autogeneration using Traits
and Class::DBI - the obvious thing to do is to use DBD::Mock and
populate some fake results, and check the params and statement
provided.
Unfortunately I get the following error when using DBD::Mock in place
of a real driver :
DBI bind_columns: invalid number of arguments: got handle + 0,
expected handle + between 1 and -1
Usage: $h->bind_columns(\$var1 [, \$var2, ...]) at
/usr/lib/perl5/site_perl/5.8.5/Class/DBI.pm line 1140.
when calling sth_to_objects, which I've over-ridden to do :
sub sth_to_objects {
my ($self,$sth) = (shift,@_);
# get mockdbi info
warn "over-ridden sth_to_objects called with...\n";
warn Dumper(@_);
$self->{__test}{mock_params} = $sth->{mock_params};
$self->{__test}{mock_statement} = $sth->{mock_statement};
warn "params : ", @{$sth->{mock_params}}, "\n";
warn "statement : ", $sth->{mock_statement}, "\n";
return $self->SUPER::sth_to_objects(@_);
}
Any suggestions of how to make this work or how to bug fix either CDBI
or DBD::Mock much appreciated.
ta muchly,
A.
--
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Hosting