On 2007-08-20 16:21:47 +1000, Ron Savage wrote:
> Under the write-up for fetchall_hashref is some sample code:
>   $dbh->{FetchHashKeyName} = 'NAME_lc';
>   $sth = $dbh->prepare("SELECT FOO, BAR, ID, NAME, BAZ FROM TABLE");
>   $sth->execute;
>   $hash_ref = $sth->fetchall_hashref('id');
>   print "Name for id 42 is $hash_ref->{42}->{name}\n";
> 
> However, after a call to $dbh -> primary_key_info(...), it seems the only
> acceptable values for the parameter in the call to fetchall_hashref() are
> TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and KEY_SEQ. Is that right?

The example assumes that there is a table called "TABLE" with at least
the fields FOO, BAR, ID, NAME, and BAZ. If you don't have such a table
(and at least Oracle thinks "TABLE" is an invalid table name), it won't
work of course. You are supposed to replace the table name and field
names with the name and fields of a table which actually exists.

I don't understand how primary_key_info() gets into the picture. Do you
mean column_info?

        hp


-- 
   _  | Peter J. Holzer    | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR       | I'd be programming in Java.
| |   | [EMAIL PROTECTED]      | I don't, and I'm not.
__/   | http://www.hjp.at/ |   -- Jesse Erlbaum on dbi-users

Attachment: pgpSFuVrD5XfU.pgp
Description: PGP signature

Reply via email to