Support for lower casing column names in returned hashes - Feature Request

5 views
Skip to first unread message

Ross Attrill

unread,
Jan 10, 2013, 6:13:50 PM1/10/13
to dbix-da...@googlegroups.com
Hello Laurent,

My database has upper case table and column names, which means that for me DBIDM hash results have upper case keys. Following the recent change to pluralization in schema generation, which standardizes Perl style lower_case for relation names etc an ability to lower case the column names in returned hashes would provide a greater level of consistency in the overall application interface in situations where column names are coming back from DBI in upper case.

The module DBIx::Simple  (https://metacpan.org/module/DBIx::Simple) has an 'lc_columns' attribute that can be added to the database handle which will ensure that all hash keys in returned results are lower case.

I am suggesting something similar for DBIDM - basically a lc_columns attribute that could be added to the schema object to indicate to lower case hash keys.

Would you be supportive of such an enhancement for DBIDM?  (If so, I would be willing to try and work out how to do it if I can.)

Your thoughts on this would be much appreciated.

Thank you,

Ross.




laurent dami

unread,
Jan 10, 2013, 11:56:04 PM1/10/13
to dbix-da...@googlegroups.com
Le 11.01.2013 00:13, Ross Attrill a �crit :
Hi Ross,

There is no need to to this in DBIDM because it's already a feature of
DBI, through the FetchHashKeyName attribute (and DBIDM::Statement
already uses this attribute).

So the way to go is :

my $dbh = DBI->connect(..., {FetchHashKeyName => 'NAME_lc'});

Cheers, Laurent D.


Ross Attrill

unread,
Jan 11, 2013, 7:04:08 PM1/11/13
to dbix-da...@googlegroups.com
Brilliant!

Thank you Laurent.


On Fri, Jan 11, 2013 at 3:56 PM, laurent dami <lauren...@free.fr> wrote:
Reply all
Reply to author
Forward
0 new messages