Subject: | Resultset update with -or |
Updating a resulset that contains an -or query does not work. See
attached test case for details.
Cheers
Maroš
Subject: | update_or.t |
use strict;
use warnings;
use Test::More;
use Test::Exception;
use lib qw(t/lib);
use DBIC::SqlMakerTest;
use DBICTest;
my $schema = DBICTest->init_schema();
my $cd_rs = $schema->resultset ('CD');
my $cd = $cd_rs->create({
title => 'Songs from the future',
year => 2050,
artist => $schema->resultset('Artist')->first,
});
# make sure order + distinct do not double-inject group criteria
my $year_rs = $cd_rs->search ({
-or => [
year => { '>=', 2020 },
year => { '<=', 1940 },
]
});
$year_rs->update({
year => 2010
});
$cd->discard_changes();
is($cd->year,2010);
$cd->delete;
done_testing;