Digging a bit deeper, just to satisfy my own curiosity (as I could not remember lower-casing the headers), here's the cause of your column name folding:
From the SQL::Statement manual pages:
· Wildcards are expanded to lower cased identifiers. This mig
+ht
confuse some people, but it was easier to implement.
The warning in DBI to never trust the case of returned colu
+mn names
should be read more often. If you need to rely on identifie
+rs,
always use "sth->{NAME_lc}" or "sth->{NAME_uc}" - never rel
+y on
"sth->{NAME}":
$dbh->{FetchHashKeyName} = "NAME_lc";
$sth = $dbh->prepare ("SELECT FOO, BAR, ID, NAME, BAZ FRO
+M TABLE");
$sth->execute;
$hash_ref = $sth->fetchall_hashref ("id");
print "Name for id 42 is $hash_ref->{42}->{name}\n";
See "FetchHashKeyName" in DBI for more information.
As select * from selects on a wildcard, this situation comes into effect. I'll add an explicit note to the docs of DBD::CSV.
Note in case of DBD::CSV that you can check what the driver's view on reality is by inspecting $dbh->{csv_tables}{tablename}{col_names}. My test showed me that this still holds the original folding.
Personally, I always use NAME_lc in all my database interfaces, so I never hit this problem.
Enjoy, Have FUN! H.Merijn
|