Re: Re: dataObject multiple links from a column
| From: | Didier Galland | Date: | Sun, 11 Jan 2004 13:24:09 +0000 |
| Subject: | Re: Re: dataObject multiple links from a column | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10110@lists.php.net to get a copy of this message | ||
mysql says that 'marker_category_xref.marker_id' = unknow table in clause
on. Same thing by following your advice. I think the problem is more related
to multiple links in dbname.links.ini.
Example given in doc :
; for a sales example with multiple links of a single
column
[sales]
; for autoloading the car object into $sales->_car_id
car_id = car:id
; for autoloading the part number object into
$sales->_car_id_partnum
car_id.partnum = part_numbers:car_id
The last line doesn't works for me : It seems that the full stop in
dbname.links.ini is not correctly parsed and sent as it to mysql
(marker_id.smc = marker_commercial_smc:marker_id in [marker_category_xref]
section), so mysql complains because of the
"marker_category_xref.marker_id.smc" reference in on clause (the table
doesn't exists).
If I change my dbname.links.ini and add marker_id =
marker_commercial_smc:marker_id in [marker_category_xref] section (in last
place), all goes right for this query BUT I need two links and only the last
one can be taken :
[marker_category_xref]
marker_id = marker:marker_id
;this line make my query working, but override the above... and break other
queries
;if I comment it, of course debug says me : ERROR: joinAdd:
marker_category_xref hasno link with marker_commercial_smc
marker_id = marker_commercial_smc:marker_id
Thanks for your help.
Regards,
Didier
----- Original Message -----
From: "Alan Knowles" <alan@akbkhome.com>
To: "Didier Galland" <listsdg@appli-box.com>
Cc: "PEAR general list" <pear-general@lists.php.net>
Sent: Sunday, January 11, 2004 1:06 PM
Subject: [PEAR] Re: dataObject multiple links from a column
> > __find:
> > SENT: SELECT * FROM marker_commercial_smc INNER JOIN
marker_category_xref ON
> > marker_category_xref.marker_id.smc=marker_commercial_smc.marker_id WHERE
> > marker_category_xref.category_id = '2f8edc5e7dc6a65839672545d7ff3a43'
> > ERROR: DB Error: unknown error
>
> This is pretty common when using joins...
> use the mysql command prompt and paste the query into it.. (to see the
> real error)
> - I suspect it will say ambiguos result.. - eg. two columns the same..
>
> In which case it may be worth using
> $mcx->category_id = $category_id;
> $mcs->joinAdd($mcx);
>
> // select as the same name..
> $mcs->selectAs();
>
> // select all the mcx fields as mcx_*
> $mcs->selectAs($mcs,'mcx_%s');