RE: dbi selectall_hashref drops results

"Kyle A. Hamilton" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <0EFAB002B483574E8C3A2329A324AF0E11FDFE2F@dtnmailbox.iowanetworkservices.net>
There's the issue. I was using a primary key from the database as the hash key so I assumed there were no duplicates. Just did a manual query and there are duplicate ids, must be my query or the database.

Thank you!

-----Original Message-----
From: Martin J. Evans [mailto:[email protected]] 
Sent: Friday, May 15, 2015 10:13 AM
To: Kyle A. Hamilton; '[email protected]'
Subject: Re: dbi selectall_hashref drops results

On 15/05/15 15:56, Kyle A. Hamilton wrote:
> I ran into an issue where dbi’s selectall_hashref will drop results 
> returned from the database. If I change the query to count the number 
> of results returned, it returns 96, but I am missing some records that 
> I get when I manually query the database. If I use selectall_array ref 
> and loop through the results, I get the same data as I get from 
> manually querying the database. I can provide the proprietary code as 
> an example, just want to make sure this is the correct place to submit 
> this.

For selectall_hashref you have to give it a key field. If that field is not a unique key you will lose rows.

Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.