[Dbix-class] update and join
Peter Rabbitson
rabbit+dbic at rabbit.us
Thu Jan 22 11:12:55 GMT 2015
On 01/22/2015 11:12 AM, RAPPAZ Francois wrote:
> I'm checking with phpMyAdmin
>
> If I do
> $s->resultset('Dduser')->search_rs({iduser => 3})->update({id_credit => 22});
>
> UPDATE ddusers SET id_credit = ? WHERE ( iduser = ? ): '22', '3'
>
> The field is updated
>
> If I do
> $s->resultset('Ddref')->search_related_rs('RefUser',{ 'RefUser.iduser' => 3 })->update({id_credit => 22});
>
> UPDATE ddusers SET id_credit = ? WHERE ( iduser IN ( SELECT * FROM ( SELECT Ref
> User.iduser FROM ddrefs me JOIN ddusers RefUser ON RefUser.iduser = me.iduser W
> HERE ( RefUser.iduser = ? ) ) `_forced_double_subquery` ) ): '22', '3'
>
> It is not
>
Wait a second, I might have assumed too much here. Can you give me the
results (the return value and the executed SQL trace) of these three
statements:
$s->resultset('Ddref')->search_related('RefUser')->count;
$s->resultset('Ddref')->search_related('RefUser', { 'RefUser.iduser' =>
3 })->count;
$s->resultset('Dduser')->count;
Cheers
More information about the DBIx-Class
mailing list