Getting columns in DB order

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

From: Sam Tregar
Subject: Getting columns in DB order
Date: 17:06 on 14 Jun 2005
Hello all.  I'm using Class::DBI::mysql to automatically create
Class::DBI classes for my tables.  Now I'm working on writing routines
to output my objects into CSV files and I'm having trouble getting the
column ordering right.  Here's what I'm doing:

  @COLUMNS = __PACKAGE__->columns();

That results in a random ordering of columns.  You might wonder why I
can't just:

  @COLUMNS = sort __PACKAGE__->columns();

The problem is that this is demographic data, so the correct ordering
isn't alphabetical - it's the order of the columns in the DB
(firstname, lastname, address1, address2, city, state, country, ...).
Is there any way I can get this ordering without resorting to
hard-coding the columns in my table?

-sam

(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