Re: Why are my col names lowercased?
[prev]
[thread]
[next]
[Date index for 2004/10/13]
This does the trick :
my $Object = YourObject->retrieve(id);
my %data = map { $_->name , $Object->get($_->name)} $Object->columns;
Kind regards daniel
On Wed, 2004-10-13 at 20:56, Sean Quinlan wrote:
> The column names in my database contain capitol letters, generally the
> first letter. No, there is nothing requiring that - I just think they
> look better.
>
> In an application I'm working on, I'm copying all the values for a
> particular objects attributes into an aggregate data structure, which
> will be used elsewhere to populate a form. Everything seemed to be
> working fine - but for some reason none of the values appeared in the
> form. Eventually I dumped the data structure, and discovered lower cased
> keys for the column names which had the expected values.
>
> WTF!?!?!
>
> My only guess is that for some reason someone thought it was desirable
> to have capitalization typos in accessing data be ignored, or something
> equivalent? Personally, I'd rather have my typo's cause warnings or
> errors. Whatever. Even so, WHY would you want to return lower cased
> versions of my column names?!? I expect to get back column names in
> _exactly_ the same format I defined my class with. Now I have hundreds
> of lines of code using data structures, forms, etc that use the column
> names as defined.
>
> I really don't want to have to hand code the column names inside the
> app. Is there any way to get the column names back from the object as
> is?!?
>
> Sorry for ranting, but this cost me some time, for something that seems
> to me very unintuitive and annoying.
>
> Thanks!!!
|
|
Re: Why are my col names lowercased?
Daniel Wijnands 19:29 on 13 Oct 2004
|