Howdy,
postgres 8.4.16, mod_perl 2.0.7, DBI, DBD::Pg
I have looked over several examples and the DBI documentation and gone
through several iterations of the following code and I'm stuck.
What I'm experiencing, is that regardless of which example I use, DBI
always treats the whole row as a single column. So I get an array, with 1
value that is the whole row. Or in hash context I get a hash with a key
named 'row' which has the entire row as one value.
$DBI->installed_drivers()
Returns "Pg"
#### Perl
my $sth = $dbh->prepare('SELECT (formid, fid, forder, ftype, fsize,
fmaxlength, fdesc, flink) FROM fdesc WHERE (formid = ?) ORDER BY forder') ;
$sth->execute($formid) ;
my $foo ;
while($foo = $sth->fetchrow_arrayref()) {
warn scalar(@$foo) ; # line 58
warn $foo->[0] ; # line 59
}
###### Warnings
1 at /Web/usr/local/lib/perl5/local/Query/Form.pm line 58.
(Login,sellerid,10,textfield,20,256,"Seller ID:",/Manual?page=Login) at
/Web/usr/local/lib/perl5/local/Query/Form.pm line 59.
######
Note that query isn't returning an array of values, but an array containing
a single string.
I have tried:
bind_columns(\$_formid, \$fid, \$forder, \$ftype, \$fsize, \$fmaxlength,
\$fdesc, \$flink) with fetchall_hashref,
I get the error:
fetchall_hashref failed: Field 'formid' does not exist (not one of row).
What I do get back from it is: {'row' => '(Login etc etc. )}
Just one key, with all columns in a string.
Any help appreciated!
Thanks!
JMA