[Dbix-class] Controlling column order
Matt S Trout
dbix-class at trout.me.uk
Fri Jan 13 21:38:48 CET 2006
On Thu, Jan 12, 2006 at 09:12:07PM +0000, Will Hawes wrote:
> Matt S Trout wrote:
> >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've run svn update and I'm no longer able to reproduce the failed tests
> - looks like you've released some more pre-emptive fixes :)
>
> Attached are patches to ResultSource.pm to add the ordered_columns()
> accessor, this time using mk_group_accessors(), and 01core.tl to add a
> test for said accessor.
Had to change sub ordered_columns to return @{shift->{_ordered_columns}||[]};
Other than that, works beautifully. Thanks, applied.
--
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