Re: Mixed Case Column Names
[prev]
[thread]
[next]
[Date index for 2005/04/14]
I've been through this and explored the issue. Ima::DBI is part of the
problem so is Class::Accessor. You have a few places where names are
forced to lower case. Its a big mess. I gave up and went with the flow
despite that it screws up my XML-compliant column names.
On Thu, 14 Apr 2005, Jay Hargreaves wrote:
> In fact the workaround I provided doesn't appear to work either - I
> guess columns() does not use the mutator_name() method as I had expected.
>
> I've also just noticed that columns() does not provide the columns in
> the order I listed them - which is also the order they appear in the
> table. Is there anyway they can be returned in the correct order?
>
> Thanks
> Jay
>
> 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
> >
>
> --
> 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
> ______________________________________________________________________
>