Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: DBI 1.3.7->1.4.5

by pingo (Hermit)
on Nov 12, 2004 at 16:23 UTC ( #407407=note: print w/replies, xml ) Need Help??


in reply to DBI 1.3.7->1.4.5

I'm not too sure about what version it changed in, but in newer versions the number of params to selectall_hashref has changed:

Old:
$ary_ref = $dbh->selectall_hashref($statement);

New:
$hash_ref = $dbh->selectall_hashref($statement, $key_field);

To quote the man page:
This utility method combines the prepare, execute, and fetchall_hashref entries elsewhere in this document into a single call. It returns a reference to a hash containing one entry for each row. The key for each row entry is specified by $key_field. The value is a reference to a hash returned by "fetchrow_hashref".

Replies are listed 'Best First'.
Re^2: DBI 1.3.7->1.4.5
by Anonymous Monk on Nov 12, 2004 at 16:28 UTC
    This is my relevant code:

    my $key_field = "ACCOUNT_ID";

    my $stmt = "SELECT ea_id AS $key_field, " .
    " ea_account_name AS ACCOUNT_NAME, " .
    " ea_password AS PASSWORD, " .
    " ea_inbox_server AS INBOX_SERVER, " .
    " ea_email_address AS EMAIL_ADDRESS, " .
    " ea_accept_requests AS ACCEPT_REQUESTS " .
    "FROM email_account " .
    " where ea_accept_requests = 'Y'";

    $email_accounts = $dbh->selectall_hashref( $stmt, $key_field );

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://407407]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-11-28 22:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?