RE: [PEAR] Dataobject : complex jointures
| From: | David Alia | Date: | Tue, 26 Jul 2005 17:49:50 +0000 |
| Subject: | RE: [PEAR] Dataobject : complex jointures | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20148@lists.php.net to get a copy of this message | ||
-----Message d'origine-----
De : Justin Patrin [mailto:papercrane@gmail.com]
Envoyé : mardi 26 juillet 2005 19:32
À : David Alia
Cc : pear-general@lists.php.net
Objet : Re: [PEAR] Dataobject : complex jointures
On 7/26/05, David Alia <david.alia@gmail.com> wrote:
>
> Hi. Thanks a lot for your -so quick- help.
>
> [cut]
>
> >
> > $D->selectAdd();
> > $D->selectAdd('A1, A2, A3'); // fields from A table
> >
> > $B->joinAdd($E);
> >
> > $D->joinAdd($B);
> > $D->selectAs();
>
> >>Likely the above call is killing the A selectAdds from above. Try
> >>removing
> the above line and see what you get.
>
> --> this solved the problem : A fields are now available.
>
> >
> > - SQL statement does not include A fields, nor E fields
>
> >> The A fields are missing likely due to the first selectAs call. The
> >> E
> fields aren't showing up because you didn't ask for them. Perhaps try
> a selectAs call for A, B, *and* E.
>
> --> Ok, I thought I had already selected E fields using $B->joinAdd($E) ?
> Since, E has no link with D, I canno't write $D->joinAdd($E)...
>
>>> Joining is not the same as setting up selected fields. joinAdd simply
adds a join clause to your SQL. You empty out the SELECT part when you do
selectAdd(), so no fields except the ones you specify will be shown. Try a
selectAs for all 3 and see if that works.
I must be an idiot but I can't get to do it :
when I write :
$D->selectAdd('A1, A2, A3, E1');
I get an error (unknown column E1)
when I write :
$D->selectAs($E, 'E_%s');
I get an error (D has no link with E)
I've tried lots of possibilities but nothing comes...
Sorry to bother you.
David