- update() on row not in_storage no longer throws an exception
if there are no dirty columns to update (fixes cascaded update
annoyances)
+ - update()/delete() on prefetching resultsets no longer results
+ in malformed SQL (some $rs attributes were erroneously left in)
- Fix dbicadmin to allow deploy() on non-versioned schema
- Fix dbicadmin to respect sql_dir on upgrade() (RT#57732)
- Update Schema::Versioned to respect hashref style of
'MRO::Compat' => '0.09',
'Module::Find' => '0.06',
'Path::Class' => '0.18',
- 'SQL::Abstract' => '1.66',
+ 'SQL::Abstract' => '1.67',
'SQL::Abstract::Limit' => '0.13',
'Sub::Name' => '0.04',
'Data::Dumper::Concise' => '1.000',
my $self = {
_source_handle => $source,
cond => $attrs->{where},
- count => undef,
pager => undef,
attrs => $attrs
};
# make a new $rs selecting only the PKs (that's all we really need)
my $attrs = $self->_resolved_attrs_copy;
- delete $attrs->{$_} for qw/collapse select as/;
+
+ delete $attrs->{$_} for qw/collapse _collapse_order_by select _prefetch_select as/;
$attrs->{columns} = [ map { "$attrs->{alias}.$_" } ($self->result_source->_pri_cols) ];
if ($needs_group_by_subq) {
}
my $subrs = (ref $self)->new($rsrc, $attrs);
-
return $self->result_source->storage->_subq_update_delete($subrs, $op, $values);
}
else {
use Test::More;
use Test::Exception;
use DBICTest;
+use DBIC::DebugObj;
+use DBIC::SqlMakerTest;
my $schema = DBICTest->init_schema();
);
$sub_rs->delete;
-
is ($tkfks->count, $tkfk_cnt -= 2, 'Only two rows deleted');
# make sure limit-only deletion works
$tkfks->search ({}, { rows => 1 })->delete;
is ($tkfks->count, $tkfk_cnt -= 1, 'Only one row deleted');
+
+# Make sure prefetch is properly stripped too
+# check with sql-equality, as sqlite will accept bad sql just fine
+my ($sql, @bind);
+my $orig_debugobj = $schema->storage->debugobj;
+my $orig_debug = $schema->storage->debug;
+
+$schema->storage->debugobj (DBIC::DebugObj->new (\$sql, \@bind) );
+$schema->storage->debug (1);
+$schema->resultset('CD')->search(
+ { year => { '!=' => 2010 } },
+ { prefetch => 'liner_notes' },
+)->delete;
+
+is_same_sql_bind (
+ $sql,
+ \@bind,
+ 'DELETE FROM cd WHERE ( cdid IN ( SELECT me.cdid FROM cd me WHERE ( year != ? ) GROUP BY me.cdid ) )',
+ ["'2010'"],
+ 'Update on prefetching resultset strips prefetch correctly'
+);
+
done_testing;