I'm stuck with (at the moment) version 0.08011 of DBIC, so please let me know if a newer version addresses this issue.

I'm creating a resultset of source 'Foo', joining against one or more other sources, and then trying to update, assuming that the update would work against 'Foo' and not the joined-in tables. Here's what I've got:

package My::Schema::ResultSet::Foo
...
sub mark_as_exported {
  ...
  $self->search(
    {me.exported = 0, bar.state = 'WA'},
    {join => 'bar'}
  )->update({exported = 1});
  ...
}

This DBIC tracefile is produced:
$ less /tmp/trace.out
UPDATE foo SET exported = ? WHERE ( ( exported = ? AND state = ? AND ) ): '1', '0', 'WA'

Whereas I was expecting SQL like:
UPDATE foo me JOIN ( bars bar ON bars.id = me.bar_id ) SET me.exported = 1 WHERE ( me.exported = 0 AND bar.state = 'WA' )

Thanks,
--Trevor

_______________________________________________
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/[email protected]

Reply via email to