[ic] fetchrow_hashref?
Mike Heins
mike at perusion.com
Mon Oct 6 16:38:40 EDT 2003
Quoting Chris Wenham (cwenham at synesmedia.com):
>
> I notice that fetchrow_array works in [perl] tags that want to use the $Sql
> object. But fetchrow_hashref doesn't. It doesn't appear that Interchange
> gives you real access to the DBI object. How can I get this function and
> others?
>
> I'm using 4.9.7 and PostgreSQL as the database.
>
You don't mention error logs....but I am guessing you are seeing:
10.10.10.6 CuhQpndB:10.10.10.6 - [06/October/2003:15:20:43 -0400] pfound /cgi-bin/pfound/t1 Safe: Can't locate DBI object method "fetchrow_hashref" via package "DBD::Pg::st" at (tag 'perl') line 8.
This is because of DBD::Pg subclassing that routine from DBI::st instead of
calling it directly, a change they made a few versions ago.
I have never had a need since I don't typically use DBI in IC embedded Perl,
but I suspect you can get around it by putting in a GlobalSub somewhere:
package DBD::Pg::st;
*fetchrow_hashref = \&DBD::_::st::fetchrow_hashref;
I always do:
my $ary = $Db{foo}->query( { sql => 'select * from foo', hashref => 1 });
for my $record (@$ary) {
do_this($record->{sku});
do_that($record->{description});
}
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.513.523.7621 <mike at perusion.com>
Few blame themselves until they have exhausted all other possibilities.
-- anonymous
More information about the interchange-users
mailing list