Subject: | table_info not defined (returns undef) |
DBD::Mock::db::table_info is not defined.
Code that calls it throws this error:
qq[Can't call method "fetchall_arrayref" on an undefined value].
defining a simple sub that calls $_[0]->prepare seems to do the trick.
I don't know a lot about DBI internals and what should be defined...
There's likely a more appropriate way to make a fake statement handle
but the attached patch works for me.
For now I'm defining the method dynamically in my test code
which also works:
local *DBD::Mock::db::table_info = sub { $_[0]->prepare('SELECT
table_info()'); };
Subject: | table_info.patch |
--- release/DBD/Mock.pm 2010-12-01 15:14:12.000000000 -0700
+++ table_info/DBD/Mock.pm 2011-05-10 14:57:39.000000000 -0700
@@ -398,6 +398,11 @@
return [ map { @$_[@cols] } @{$a_ref} ]
}
+sub table_info {
+ my ( $dbh, $cat, $sch, $tab, $typ ) = @_;
+ $dbh->prepare('SELECT * FROM "table_info"');
+}
+
sub FETCH {
my ( $dbh, $attrib, $value ) = @_;
$dbh->trace_msg( "Fetching DB attrib '$attrib'\n" );