X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FOrdered.pm;h=049d9c6b71d743db8d1e96f06b831b0c9b81f425;hb=7d3139ac1ff52213e2dad35fc9c9d1057711256a;hp=7842a4059d7913e8be0c9bff3f0b5e571ec03ece;hpb=48580715af3072905f2c71dc27e7f70f21a11338;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Ordered.pm b/lib/DBIx/Class/Ordered.pm index 7842a40..049d9c6 100644 --- a/lib/DBIx/Class/Ordered.pm +++ b/lib/DBIx/Class/Ordered.pm @@ -797,15 +797,15 @@ sub _shift_siblings { if (grep { $_ eq $position_column } ( map { @$_ } (values %{{ $rsrc->unique_constraints }} ) ) ) { - my @pcols = $rsrc->primary_columns; + my @pcols = $rsrc->_pri_cols; my $cursor = $shift_rs->search ({}, { order_by => { "-$ord", $position_column }, columns => \@pcols } )->cursor; my $rs = $self->result_source->resultset; - while (my @pks = $cursor->next ) { - + my @all_pks = $cursor->all; + while (my $pks = shift @all_pks) { my $cond; for my $i (0.. $#pcols) { - $cond->{$pcols[$i]} = $pks[$i]; + $cond->{$pcols[$i]} = $pks->[$i]; } $rs->search($cond)->update ({ $position_column => \ "$position_column $op 1" } ); @@ -943,9 +943,23 @@ __END__ =head1 CAVEATS +=head2 Resultset Methods + +Note that all Insert/Create/Delete overrides are happening on +L methods only. If you use the +L versions of +L or +L, all logic present in this +module will be bypassed entirely (possibly resulting in a broken +order-tree). Instead always use the +L and +L methods, which will +invoke the corresponding L method on every +member of the given resultset. + =head2 Race Condition on Insert -If a position is not specified for an insert than a position +If a position is not specified for an insert, a position will be chosen based either on L or L, depending if there are already some items in the current group. The space of time between the