X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSet.pm;h=42dade5f166c1165a4d98bd372516ff2494df721;hb=3cf3fa9f2da5cf64411e375427742616af32e7d3;hp=e240c64a27d798cfe048e3be23d0e6cc322fe28b;hpb=131534017afe3163a53a030248cf29cd4a045005;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index e240c64..42dade5 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1293,12 +1293,26 @@ Deletes the contents of the resultset from its result source. Note that this will not run DBIC cascade triggers. See L if you need triggers to run. See also L. +delete may not generate correct SQL for a query with joins or a resultset +chained from a related resultset. In this case it will generate a warning:- + + WARNING! Currently $rs->delete() does not generate proper SQL on + joined resultsets, and may delete rows well outside of the contents + of $rs. Use at your own risk + +In these cases you may find that delete_all is more appropriate, or you +need to respecify your query in a way that can be expressed without a join. + =cut sub delete { my ($self) = @_; $self->throw_exception("Delete should not be passed any arguments") if $_[1]; + carp( 'WARNING! Currently $rs->delete() does not generate proper SQL' + . ' on joined resultsets, and may delete rows well outside of the' + . ' contents of $rs. Use at your own risk' ) + if ( $self->{attrs}{seen_join} ); my $cond = $self->_cond_for_update_delete; $self->result_source->storage->delete($self->result_source, $cond);