Re: Getting columns in DB order

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

From: David Baird
Subject: Re: Getting columns in DB order
Date: 20:03 on 14 Jun 2005
Sam Tregar wrote:

>On Tue, 14 Jun 2005, Randal L. Schwartz wrote:
>
>  
>
>>Sam> Do you carry that philosophy into your UI as well?  This CSV data will
>>Sam> end up in Excel for analysis outside my app.  Do you really think
>>Sam> column order doesn't matter there?
>>
>>The order of the columns in the *database* shouldn't matter.  Yes, you
>>should have some sort of out-of-band description about the particular
>>columns your reports will have.  That's not the job of the database.
>>The job of the database is to give you the data.  The job of your
>>report is to format that in a manner necessary for the next step.
>>    
>>
>
>Yeah, I can dig it.  I was hoping to avoid putting the same
>information (the list of fields in the "person" table) in two places.
>It's already in person.sql and now it has to be in Person.pm too.  If
>I remove a field from one I'll have to remember to update the other.
>Suck.
>  
>
Seems to me that if the information exists, it's nice to be able to use it:

# Get deep into CDBI to extract the columns in the same order as defined 
in the database.
# In fact, this returns the columns in the order they were originally 
supplied to
# $proto->columns( All => [ col list ] ) Defaults
# to the order returned from the database query in CDBI::Loader, which 
for MySQL,
# is the same as the order in the database.
sub db_order_columns
{
    my ( $proto ) = @_;
   
    return @{ $proto->__grouper->{_groups}->{All} };
}


d.

(message missing)

Getting columns in DB order
Sam Tregar 17:06 on 14 Jun 2005

Re: Getting columns in DB order
merlyn (Randal L. Schwartz) 17:35 on 14 Jun 2005

Re: Getting columns in DB order
Sam Tregar 17:40 on 14 Jun 2005

Re: Getting columns in DB order
merlyn (Randal L. Schwartz) 17:46 on 14 Jun 2005

Re: Getting columns in DB order
Sam Tregar 17:49 on 14 Jun 2005

Re: Getting columns in DB order
David Baird 20:03 on 14 Jun 2005

Re: Getting columns in DB order
merlyn (Randal L. Schwartz) 17:47 on 14 Jun 2005

Re: Getting columns in DB order
merlyn (Randal L. Schwartz) 17:48 on 14 Jun 2005

Re: Getting columns in DB order
Charles Bailey 18:02 on 14 Jun 2005

Re: Getting columns in DB order
Sam Tregar 20:10 on 14 Jun 2005

Generated at 16:35 on 28 Jul 2005 by mariachi v0.52