[Dbix-class] Controlling column order

Matt S Trout dbix-class at trout.me.uk
Thu Jan 12 20:50:45 CET 2006


On Thu, Jan 12, 2006 at 07:08:16PM +0000, Will Hawes wrote:
> Matt S Trout wrote:
> >On Thu, Jan 12, 2006 at 10:33:56AM +0000, Will Hawes wrote:
> >>Matt S Trout wrote:
> >>>On Wed, Jan 11, 2006 at 01:16:12PM -0600, Brandon Black wrote:
> >>>>On 1/11/06, Will Hawes <info at whawes.co.uk> wrote:
> >>>>>Is it possible to control the order in which columns are returned from 
> >>>>>a
> >>>>>DBIx::Class object?
> >>>>>
> >>>>You mean from DBIx::Class::Table->columns?  Perhaps this should be an
> >>>>optional column_info attribute (sort_order?) that ->columns looks at.
> >>>or maybe just make the internal hash an IxHash like primaries do. Not 
> >>>sure
> >>>what the performance impact of this would be though.
> >>>
> >>I thought something along the lines of the attached patch (to SVN 
> >>revision 462) might be useful here.
> >
> >Why the classaccessor rather than creating _ordered_columns as part of the
> >simple group along with everything else?
> 
> I did try that, but for some reason it made several of the cdbi tests 
> crap out.

Back to the drawing board and try to figure out why then :)

It's probably down to the way CDBI handles column grouping/ordering;
emulating it was "enertaining", let us say.

Making it a class-level accessor definitely isn't the answer, since
DBIx::Class::Table is no longer something any of your record classes inherit
from - instead they have an instance of it as classdata accessible via
$object->result_source. If you update your branch to latest you should also
find that most of this stuff is now in ResultSource.pm, rather than Table
- if you could add it there, please?

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Dbix-class mailing list