X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fresultset%2Fupdate_delete.t;fp=t%2Fresultset%2Fupdate_delete.t;h=7d9efa9c1d3aae13ac887d758410b38facc64042;hb=1b658919f5ff67e9ac656daf6642a3bae8cec282;hp=c3e8c2f58477a695986c4d51c5bd0d139adc8479;hpb=e6ed824bbb02cbe1dfdc18987f468791af228e63;p=dbsrgits%2FDBIx-Class.git diff --git a/t/resultset/update_delete.t b/t/resultset/update_delete.t index c3e8c2f..7d9efa9 100644 --- a/t/resultset/update_delete.t +++ b/t/resultset/update_delete.t @@ -5,6 +5,11 @@ use lib qw(t/lib); use Test::More; use Test::Exception; +# MASSIVE FIXME - there is a hole in ::RSC / as_subselect_rs +# losing the order. Needs a rework/extract of the realiaser, +# and that's a whole another bag of dicks +BEGIN { $ENV{DBIC_SHUFFLE_UNORDERED_RESULTSETS} = 0 } + use DBICTest::Schema::CD; BEGIN { # the default scalarref table name will not work well for this test @@ -31,7 +36,7 @@ my ($fa, $fb, $fc) = $tkfks->related_resultset ('fourkeys')->populate ([ # [qw/2 2 /], #]); my ($ta, $tb) = $schema->resultset ('TwoKeys') - ->search ( [ { artist => 1, cd => 1 }, { artist => 2, cd => 2 } ]) + ->search ( [ { artist => 1, cd => 1 }, { artist => 2, cd => 2 } ], { order_by => 'artist' }) ->all; my $tkfk_cnt = $tkfks->count; @@ -73,7 +78,10 @@ is ($fb->discard_changes->read_count, 21, 'Update ran only once on discard-join is ($fc->discard_changes->read_count, 30, 'Update did not touch outlier'); # make the multi-join stick -my $fks_multi = $fks->search({ 'fourkeys_to_twokeys.pilot_sequence' => { '!=' => 666 } }); +my $fks_multi = $fks->search( + { 'fourkeys_to_twokeys.pilot_sequence' => { '!=' => 666 } }, + { order_by => [ $fks->result_source->primary_columns ] }, +); $schema->is_executed_sql_bind( sub { $fks_multi->update ({ read_count => \ 'read_count + 1' }) }, [ @@ -85,6 +93,7 @@ $schema->is_executed_sql_bind( sub { ON fourkeys_to_twokeys.f_bar = me.bar AND fourkeys_to_twokeys.f_foo = me.foo AND fourkeys_to_twokeys.f_goodbye = me.goodbye AND fourkeys_to_twokeys.f_hello = me.hello WHERE ( bar = ? OR bar = ? ) AND ( foo = ? OR foo = ? ) AND fourkeys_to_twokeys.pilot_sequence != ? AND ( goodbye = ? OR goodbye = ? ) AND ( hello = ? OR hello = ? ) AND sensors != ? GROUP BY me.foo, me.bar, me.hello, me.goodbye + ORDER BY foo, bar, hello, goodbye ', (1, 2) x 2, 666, @@ -118,6 +127,7 @@ $schema->is_executed_sql_bind( sub { ON fourkeys_to_twokeys.f_bar = me.bar AND fourkeys_to_twokeys.f_foo = me.foo AND fourkeys_to_twokeys.f_goodbye = me.goodbye AND fourkeys_to_twokeys.f_hello = me.hello WHERE "blah" = "bleh" AND ( bar = ? OR bar = ? ) AND ( foo = ? OR foo = ? ) AND fourkeys_to_twokeys.pilot_sequence != ? AND ( goodbye = ? OR goodbye = ? ) AND ( hello = ? OR hello = ? ) AND sensors != ? GROUP BY me.foo, me.bar, me.hello, me.goodbye + ORDER BY foo, bar, hello, goodbye ', (1, 2) x 2, 666, @@ -147,6 +157,7 @@ $schema->is_executed_sql_bind( sub { AND fourkeys_to_twokeys.f_goodbye = me.goodbye AND fourkeys_to_twokeys.f_hello = me.hello WHERE ( bar = ? OR bar = ? ) AND ( foo = ? OR foo = ? ) AND fourkeys_to_twokeys.pilot_sequence != ? AND ( goodbye = ? OR goodbye = ? ) AND ( hello = ? OR hello = ? ) AND sensors != ? + ORDER BY foo, bar, hello, goodbye ) ) ',