I have a DBIC class made up using a UNION, something like this
simplified example:

 __PACKAGE__->table('nodes');
 __PACKAGE__->result_source_instance->is_virtual(1);
 __PACKAGE__->result_source_instance->view_definition(
   "SELECT
        sp_id AS id,
        sp_status  COLLATE latin1_general_ci AS status,
        FROM sp
    UNION
    SELECT
        pr_id AS id,
        pr_status  COLLATE latin1_general_ci AS status,
        FROM pr");

It works fine but I now find I need to delete all records from the
database where status = 'obsolete'.

I've discovered that this doesn't work:

 $node_rs->search({status => 'obsolete' })->delete;

and neither does this:

 my $obs_node_rs = $node_rs->search({status => 'obsolete' });
 while (my $node = $obs_node_rs->next) {
     $node->delete;
 }

Is there some idiom that does work, or am I going to need to operate on
the individual tables separately (there are more than two, sadly)?

Cheers, Dave

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to