Re: Mixed Case Column Names

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

From: Daniel Wijnands
Subject: Re: Mixed Case Column Names
Date: 14:51 on 14 Apr 2005
my @columns =  map { $_->name } TPG_Staging->columns;
 
Gives you the column name 


On Thursday 14 April 2005 16:26, Jay Hargreaves wrote:
> 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

        -- 
        Met vriendelijke groet, 

itXL 
Daniel Wijnands
daniel@xxxx.xx

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