[Dbix-class] Search and Delete with Single Query

Sheeju Alex sheejuec7 at gmail.com
Thu Aug 28 12:01:24 GMT 2014


Hi All,

    Is there any way in DBIx to delete all rows from resultset in a single
query, it looks like delete and delete_all will delete the resultset row by
row.

my $rs = $schema->resultset('User')->search({GroupId => 712});
$rs->delete_all;

If there are 100 Users in User table then the above statement will delete
in 100 query instead is there a way to delete in single query.

DELETE FROM User WHERE GroupId = 712;


Best Regards,
Sheeju Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20140828/d9d1ad75/attachment.htm>


More information about the DBIx-Class mailing list