good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Having problems with DBI selectall_arrayrefby SergioQ (Beadle) |
on Dec 26, 2020 at 16:36 UTC ( [id://11125748]=perlquestion: print w/replies, xml ) | Need Help?? |
SergioQ has asked for the wisdom of the Perl Monks concerning the following question: Oh help me please Holy Monks, this one is killing me. I have an old pm module that does all the connecting and querying with MySQL, so I have faith in it. Now I am trying to retrieve multiple rows with all columns using selectall_hashref and am tripping all over myself. my $data_all = $connection->selectall_hashref($query, { 'Columns' => {} } ); And I get back: Not an ARRAY reference at /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/DBI.pm line 2106. I know all the column names, this is not a read any strange table function. Somewhere my approach has it all wrong, should I take a different approach? What I am trying to get back is an array of hash references, that's al, to my multiple row query, and yes my query works manually. Can you help me? p.s. I found this thread <a href="https://www.perlmonks.org/?node_id=1040177 "target="_blank> How does DBI return an arrayref with key/value pairs? so I tried that, switching to selectall_arrayref But when I ran
What I got back was that $columns was another hash, and that led my second "say" to output nothing. So confused
Back to
Seekers of Perl Wisdom
|
|