Re: Need help with Pear::DB_DataObjects
| From: | Justin Patrin | Date: | Wed, 19 Apr 2006 18:21:30 +0000 |
| Subject: | Re: Need help with Pear::DB_DataObjects | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23751@lists.php.net to get a copy of this message | ||
On 4/19/06, Clements, Brent M (SAIC) <brent.clements@bp.com> wrote:
> I'm having trouble figuring out the addJoin method of DB_DataObjects
>
> I have the following two tables
>
> table1: vertrans_ID, install_ID, site_ID, ntlogin
> table2: install_ID, chgcat_ID, aim_ID, app_ID, and so on
>
> (note the "install_ID" field in both tables, install_ID IS the primary key in table2)
>
> When I do:
>
> $model['versionsArray'] = array();
> DB_DataObject::debugLevel(5);
> $t1 = DB_DataObject::Factory('table1');
> $t2 = DB_DataObject::Factory('table2');
> $t2->app_ID = "1";
> $t2->joinAdd($t1, NULL, NULL , "install_ID");
I'm not sure this call is correct, but instead of using that set up
your links.ini file (see DB_DO documentation). Once this is done you
can simply:
$t2->joinAdd($t1);
>
> DB_DataObject::debugLevel();
>
> But when I run that query, the DataObjects Debugger says that table1 has no link with table2
>
> I've checked the RAW SQL and I get the expected results when I run the SQL via the
> Database command line client. Am I forming the DataObjects version of the query wrong? I'm
> trying to achieve the following RAW sql
>
> SELECT
> *
> FROM
>
table1 ,
> table2
> WHERE
> table2.app_ID = '1 AND
> table2.install_ID =
> table1.install_ID
>
>
> Can someone please indicate where my error is at?
>
> Thanks,
> BC.
>
> This message may contain confidential and/or privileged information. If you are not the
> addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take
> any action based on this message or any information herein. If you have received this message in
> error, please advise the sender immediately by reply e-mail and delete this message. Thank you for
> your cooperation.
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Justin Patrin