Re: DB_DataObject: how do I query composite primary keys?
| From: | Alan Knowles | Date: | Sun, 30 Mar 2003 16:04:01 +0000 |
| Subject: | Re: DB_DataObject: how do I query composite primary keys? | ||
| References: | 1 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-4518@lists.php.net to get a copy of this message | ||
I'd create a specific method for it in the extended class.
function getbyPrimary($contact,$user) {
$this->contactId = $contact;
$this->userId = $user;
$this->fetch(true);
return $this->N;
}
I'm not sure if the generator will pick up the 2 key values (it should).. - since they may not form unique values individually..
Regards
Alan
Pj Taylor wrote:
Hello, Does anyone know if it's possible to use DB_DataObjects if your database structure has composite primary keys? Eg I have a table CONTACT contactID userID contactName contactDetails contactID and userID form a composite primary key How do I reflect this when I'm setting up the tables? Also, how do I then query it? Any help much appreciated PJ _________________________________________________________________