Subject: | Patch: Small bug in Class::DBI::mysql with regards to column_type and column names with capital letters |
From: | Scotty Allen <scotty [...] scottyallen.com> |
To: | bug-Class-DBI-mysql [...] rt.cpan.org |
Date: | Mon, 26 Dec 2005 10:23:51 -0700 |
Hi Tony,
I found a small bug in Class::DBI::mysql. If you iterate across all of
the columns in a class, and print out their column types, you'll get
null for those columns with capital letters in their names in the db. I
believe this is because the capital letters are stripped in Class::DBI,
but _column_info returns the information with capital letters.
The fix I came up with is to change the line in _column_info from:
return { map { $_->{field} => $_ } $sth->fetchall_hash };
to:
return { map { lc($_->{field}) => $_ } $sth->fetchall_hash };
Thanks,
Scotty
--
Scotty Allen Consulting
303-546-0251
scotty@scottyallen.com