<div dir="ltr"><div><div>I tried ->delete and ->delete_all both operation was deleting one by one. The version of DBIx::Class is 0.08250<br><br></div>You guessed right :) I had changed the table name but the code is no different, here is the code and schema definition of $rs<br>
<br>$schema->resultset('AlertParameterValue')->search({ProfileId => 712})->delete;<br><br></div><div>Schema Class is below and I don't have cascade relationship or is_deferable<br><br>use utf8;<br>
<br>package PAMS::WWW::Schema::Result::AlertParameterValue;<br><br>use strict;<br>use warnings;<br><br>use Moose;<br>use MooseX::NonMoose;<br>use MooseX::MarkAsMethods autoclean => 1;<br>extends 'DBIx::Class::Core';<br>
<br>__PACKAGE__->table("AlertParameterValue");<br><br>__PACKAGE__->add_columns(<br> "Id",<br> {<br> data_type => "integer",<br> is_auto_increment => 1,<br>
is_nullable => 0,<br> sequence => "\"AlertParameterValue_Id_seq\"",<br> },<br> "ProfileId",<br> {data_type => "integer", is_nullable => 1},<br>
"Value",<br> {data_type => "varchar", is_nullable => 0, size => 255},<br>);<br><br>__PACKAGE__->set_primary_key("Id");<br><br># Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-06-19 16:08:39<br>
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ykWXuRi/+hlXQIwEwVakfQ<br><br>__PACKAGE__->belongs_to(<br> Profile => 'PAMS::WWW::Schema::Result::AlertProfile',<br> {'foreign.Id' => 'self.ProfileId'}<br>
);<br><br># PgLog Settings goes here<br>__PACKAGE__->load_components(qw/PgLog/);<br><br># You can replace this text with custom code or comments, and it will be preserved on regeneration<br>__PACKAGE__->meta->make_immutable;<br>
<br>1;<br></div><br><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><div><br></div>Best Regards, <br>Sheeju Alex<br>
<div style="display:inline"></div></div></div>
<br><br><div class="gmail_quote">On Fri, Aug 29, 2014 at 12:04 PM, Peter Rabbitson <span dir="ltr"><<a href="mailto:rabbit+dbic@rabbit.us" target="_blank">rabbit+dbic@rabbit.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 08/28/2014 02:01 PM, Sheeju Alex wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>
<br>
Is there any way in DBIx to delete all rows from resultset in a<br>
single query, it looks like delete and delete_all will delete the<br>
resultset row by row.<br>
<br>
my $rs = $schema->resultset('User')-><u></u>search({GroupId => 712});<br>
$rs->delete_all;<br>
<br>
If there are 100 Users in User table then the above statement will<br>
delete in 100 query instead is there a way to delete in single query.<br>
<br>
DELETE FROM User WHERE GroupId = 712;<br>
</blockquote>
<br></div></div>
This is exactly how ->delete_all is supposed to work (one by one, so that the business logic is invoked on per-object basis).<br>
<br>
This is not supposed to happen with $rs->delete however. Please provide your version of DBIx::Class, and the true definition of the $rs (I have a strong suspicion you did *not* give us the actual code).<div class="HOEnZb">
<div class="h5"><br>
<br>
<br>
______________________________<u></u>_________________<br>
List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-<u></u>bin/mailman/listinfo/dbix-<u></u>class</a><br>
IRC: <a href="http://irc.perl.org#dbix-class" target="_blank">irc.perl.org#dbix-class</a><br>
SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" target="_blank">http://dev.catalyst.perl.org/<u></u>repos/bast/DBIx-Class/</a><br>
Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/<u></u>dbix-class@lists.scsys.co.uk</a><br>
</div></div></blockquote></div><br></div>