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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.