[Dbix-class] trouble with using 'select' in a search clause
Toby Corkindale
tjc at wintrmute.net
Thu May 18 17:48:53 CEST 2006
On Thu, May 18, 2006 at 02:56:00PM +0100, Matt S Trout wrote:
> my $rs = $schema->resultset('Example')->search({ id => { '<', 1000 });
> # remember this doesn't actually run a query
>
> $schema->txn_do(
> sub { $rs->update({ foo => \"foo + 1" }); }
> );
OK, I'm just playing with more complex versions of this, and wondered - does
->update() support complex resultsets built through search()s with
attributes/joined tables?
ie.
(Assume table Extra is setup and related to Example)
my $rs = $schema->resultset('Example')->search(
{
'me.id' => { '<', 1000 },
'extra.bar' => 'qux'
},
{
join => 'extra'
}
);
$rs->update({ foo => "foo + 1" });
I just ask, because it wasn't working on my little test - the update() was
dieing with "Column foo not found". (It wasn't joining anything)
tjc
--
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --keyserver www.co.uk.pgp.net --recv-key B1CCF88E)
More information about the Dbix-class
mailing list