[ic] Column-names part II

Mike Heins interchange-users@icdevgroup.org
Fri Aug 16 12:54:01 2002


Quoting Rene Hertell (interchange-users@hertell.com):
> > This is basic programming -- you always use arrays. We could build our
> > own array with pointers, but you can even get help from DBI and IC with
> > a hash query type...
> > 
> > [perl]
> > 	my $db = $Db{query};
> > 	my $q = 'select * from address';
> > 	my $ary = $db->query( { sql => $q, hashref => 1 });
> > 	defined $ary
> > 		or die errmsg("query error for %s!", $q);
> > 
> > 	my @out;
> > 	foreach my $row (@$ary) {
> > 	    push @out, "Address for $row->{code} is $row->{address}";
> > 	}
> > 	return join "<br>", @out;
> > [/perl]
> 
> Sorry to bother you again, but I get an error in the catalogs error.log: 
> Safe: Can't call method "query" on an undefined value at (eval 181) line 4
> 
> I tried to add query to SafeUntrap, but then I couldn't get IC to start...
> 

I think you need to read some.

I made a typo, i.e. $Db{query} instead of $Db{address}. You should
have picked that up.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

When the only tool you have is a hammer, all your problems tend to look
like nails.  -- Abraham Maslow