Mixed Case Column Names

[prev] [thread] [next] [Date index for 2005/04/14]

From: Jay Hargreaves
Subject: Mixed Case Column Names
Date: 14:26 on 14 Apr 2005
Hi everyone!

I have the following table module:

--- TPG_Staging.pm ---
package TPG_Staging;
use base TPG_DBI;

__PACKAGE__->table("Staging");
__PACKAGE__->columns(Primary => qw(ClientID));
__PACKAGE__->columns(Others => qw(JobReference SSC PostcodeArea Format 
LT_60g Machinable BagWeight BagItems Sortation AccessSiteCode 
AccessPoint BagID CollectionDate HandoverDate ServiceRegister 
MailingHouseID));
---

When I query the columns that are contained in the table:

my @columns = TPG_Staging->columns;

I receive a list of the columns as expected but with all the the names 
in lower case. It is important that the column names are presented AS IS 
since they are used directly in my user interface.

Is this lower-casing always the case with Class::DBI? I have not 
experienced this problem before as I tend to use lower-case column names 
as standard. Is there a way around this problem other than providing 
explicit mappings from the lower-case name to the uppercase name:

---
# accessor is simple enough
sub accessor_name
{ my ($class, $column) = @_;
   return lc $column;
}

# mutator requires explicit mapping
sub mutator_name
{ my ($class, $column) = @_;
   my %mutator = ( clientid => 'ClientID',
                   jobreference => 'JobReference',
                   ...
                 );
   return $mutator($column);
}
---

I am using Class::DBI 0.96 on Windows XP with MySQL ver 4.0.15.

Thanks
Jay

        -- 
        a: 89 hodge lane, hartford, northwich, cw8 3ag
m: 07899 872 306
e: jay@xxxxxxx.xxx

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Mixed Case Column Names
Jay Hargreaves 14:26 on 14 Apr 2005

Re: Mixed Case Column Names
Jay Hargreaves 14:40 on 14 Apr 2005

Re: Mixed Case Column Names
Dana Hudes 14:50 on 14 Apr 2005

Re: Mixed Case Column Names
Kingsley Kerce 14:54 on 14 Apr 2005

Re: Mixed Case Column Names
Jay Hargreaves 15:45 on 14 Apr 2005

Re: Mixed Case Column Names
Daniel Wijnands 14:51 on 14 Apr 2005

Re: Mixed Case Column Names
Tony Bowden 17:34 on 14 Apr 2005

Generated at 12:49 on 16 Apr 2005 by mariachi v0.52