FWD: Strange selectall_hashref/fetchall_hashref problem with DBD::mysql

"Martin J. Evans" <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Organization Easysoft Ltd
Message-ID <[email protected]>
Hi,

I posted the following email to dbi-users list but have so far received no
responses. I hoped I might have more luck here. I'd appreciate any ideas on how
to persue this.

Thanks

-----FW: <[email protected]>-----

Date: Fri, 10 Feb 2006 12:04:33 -0000 (GMT)
From: "Martin J. Evans" <[email protected]>
To: [email protected]
Subject: Strange selectall_hashref/fetchall_hashref problem with DBD::mysql

Hi,

selectall_hashref and fetchall_hashref work fine for me most of the time but
I've hit a scenario where I get a result I just cannot fathom.

I'm using DBI 1.50 and DBD::mysql 3.0002_4 (with a few minor patches I posted
on this list to make it compile and get rid of the FREE UNBIND problem I had).

I have tables:

race
race_id               primary key auto increment
meeting_id            foreign key to meeting_id in meeting

meeting
meeting_id            primary key auto increment
created_date_time_utc datetime

(there are other columns but they are not referenced).

I do:

SELECT m.meeting_id,r.race_id FROM meeting m, race r where
r.meeting_id = m.meeting_id and
DATEDIFF('2006-02-10', DATE(m.created_date_time_utc)) <= 100

and dump the reference returned by selectall_hashref(race_id) or
fetchall_hashref(race_id) and get:

$VAR1 = {
          '' => {
                  'race_id' => undef,
                  'meeting_id' => undef
                }
        };

The query does return rows. I know because:
1) if I change to use prepare/execute/fetchrow_array I can the rows
   back
2) if I leave it as fetchall_hashref/selectall_hashref and set
   DBI_TRACE to 20 I can see my data in the trace.

I can also change nothing other than switch to DBD::ODBC (and the myodbc
driver) and it works fine.

The interesting bit is if all I do is take the
"DATEDIFF('2006-02-10', DATE(m.created_date_time_utc)) <= 100" out of
the where clause it works, even though this makes no difference
I can see to either the number of rows returned, the column names or
result-set content. Unfortunatly the trace at level 20 is 120K.

I've tried reproducing with other tables which are more simple but
failed - the above is as simple as I can get it and fail.

Any ideas?

Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com

--------------End of forwarded message-------------------------

--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com


-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
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.