<div dir="ltr">Thanks William.. I checked everywhere else completely forgot about PgLog :) I will debug and try to fix at PgLog module, my expectation of PgLog was to use it only if the query is wrapped around with txn_do.<br>
</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 Sat, Aug 30, 2014 at 6:02 AM, William Cox <span dir="ltr"><<a href="mailto:mydimension@gmail.com" target="_blank">mydimension@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Read the documentation for PgLog:<br>
<a href="https://metacpan.org/pod/DBIx::Class::ResultSet::PgLog#delete" target="_blank">https://metacpan.org/pod/DBIx::Class::ResultSet::PgLog#delete</a> - it<br>
forces ->delete_all behavior<br>
<div><div class="h5"><br>
On Fri, Aug 29, 2014 at 2:41 PM, Sheeju Alex <<a href="mailto:sheejuec7@gmail.com">sheejuec7@gmail.com</a>> wrote:<br>
> I tried ->delete and ->delete_all both operation was deleting one by one.<br>
> The version of DBIx::Class is 0.08250<br>
><br>
> You guessed right :) I had changed the table name but the code is no<br>
> different, here is the code and schema definition of $rs<br>
><br>
> $schema->resultset('AlertParameterValue')->search({ProfileId =><br>
> 712})->delete;<br>
><br>
> 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<br>
> preserved on regeneration<br>
> __PACKAGE__->meta->make_immutable;<br>
><br>
> 1;<br>
><br>
><br>
><br>
><br>
> Best Regards,<br>
> Sheeju Alex<br>
><br>
><br>
> On Fri, Aug 29, 2014 at 12:04 PM, Peter Rabbitson <<a href="mailto:rabbit%2Bdbic@rabbit.us">rabbit+dbic@rabbit.us</a>><br>
> wrote:<br>
>><br>
>> On 08/28/2014 02:01 PM, Sheeju Alex wrote:<br>
>>><br>
>>> 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')->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>
>><br>
>><br>
>> This is exactly how ->delete_all is supposed to work (one by one, so that<br>
>> the business logic is invoked on per-object basis).<br>
>><br>
>> This is not supposed to happen with $rs->delete however. Please provide<br>
>> your version of DBIx::Class, and the true definition of the $rs (I have a<br>
>> strong suspicion you did *not* give us the actual code).<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-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/repos/bast/DBIx-Class/</a><br>
>> Searchable Archive:<br>
>> <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-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/repos/bast/DBIx-Class/</a><br>
> Searchable Archive:<br>
> <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a><br>
<br>
<br>
<br>
</div></div>--<br>
William Cox<br>
<br>
e: <a href="mailto:mydimension@gmail.com">mydimension@gmail.com</a><br>
<a href="http://www.google.com/+WilliamCoxx" target="_blank">www.google.com/+WilliamCoxx</a><br>
<br>
-----BEGIN GEEK CODE BLOCK-----<br>
Version: 3.1<br>
GCS d- s+:+() a C++(++++)$ UBLC(++)$<br>
P+++(++++)$ L++(+++)$ !E--- W++(+++)$<br>
!N !o? K--? !w--- !O M++ !V- PS-(--)@ PE+()<br>
Y+ !PGP t++ !5 X+++ !R tv(+) b+>++<br>
DI+(++) D+() G e h--- r+++ y+++>++++<br>
------END GEEK CODE BLOCK------<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-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/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/dbix-class@lists.scsys.co.uk</a><br>
</div></div></blockquote></div><br></div>