[Dbix-class] RFC: DBIx-Class-Tree

Aran Deltac aran at arandeltac.com
Mon Apr 3 21:24:01 CEST 2006


On 4/3/2006, "Nilson Santos Figueiredo Junior" <acid06 at gmail.com> wrote:

>On 4/3/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
>> If nobody's massively offended by the idea I think I'd like to roll the
>> ::Ordered component into 0.06001 along with the SQLT deploy improvements in
>> -current.
>>
>> What do people think of this idea?
>
>I think it's a nice idea.
>But while reading its source code something seemed odd to me:
>
>sub insert {
>    my $self = shift;
>    my $position_column = $self->position_column;
>    $self->set_column( $position_column =>
>$self->result_source->resultset->search( {$self->_grouping_clause()}
>)->count()+1 )
>        if (!$self->get_column($position_column));
>    return $self->next::method( @_ );
>}
>
>There really isn't a better (i.e. more efficient) way of doing this?
>Or is this preferred as it's probably the most "portable" solution
>accross the various database backends?

I'm not seeing how this is inneficient - the only query that is actually
run against the DB is a COUNT(*).  All the rest of this code is
detecting whether that query needs to be run.

>I also couldn't figure out from the docs how that "grouping" stuff
>really works, but this is probably just my slow brain. ;-)

The docs cover all the methods, but are not verbose by any means.  I bet
you are right that the grouping stuff needs a little more TLC.  If you
can tell me what about it didn't make sense then I will have a better
time making the docs for grouping easier to read.

Thanks,

Aran

>-Nilson Santos F. Jr.
>
>_______________________________________________
>List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
>Wiki: http://dbix-class.shadowcatsystems.co.uk/
>IRC: irc.perl.org#dbix-class
>SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/



More information about the Dbix-class mailing list