Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^3: Result set into array

by shenme (Priest)
on Nov 19, 2006 at 02:05 UTC ( #584911=note: print w/replies, xml ) Need Help??

in reply to Re^2: Result set into array
in thread Result set into array

Guessing from reading the docs (!) but it looks like selectall_hashref() is executed using the DB handle, so your code might better be:
my $hash = $dbconn->selectall_hashref($sql_statement);
You may have been led astray by the talk of preparing a statement ahead of time, but even then you still use the DB handle.
my $sth = $dbconn->prepare($sql_statement); . . . . . . . my $hash = $dbconn->selectall_hashref($sth);
As for setting the valuable RaiseError flag, it looks like you'll have to do that on the DB handle when using selectall_hashref, perhaps something like:
{ local $dbconn->{RaiseError} = 1; my $hash = $dbconn->selectall_hashref($sql_statement); . . . . . . . }
Go back and read the DBI docs whenever something goes 'wrong' - sometimes it takes me a couple "read again"s before it sinks in to my flat file head.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2021-01-27 21:50 GMT
Find Nodes?
    Voting Booth?