Re: DB_DataObject: how do I query composite primary keys?

From: Date: Sun, 30 Mar 2003 17:20:01 +0000
Subject: Re: DB_DataObject: how do I query composite primary keys?
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-4523@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; > } Thanks for the tip! > I'm not sure if the generator will pick up the 2 key values (it > should).. - since they may not form unique values individually.. As I said in my other post, I still haven't been able to get the generator to work and it finally reached that stage where trying to get the simple thing to work had taken longer than doing it the long way round the first time, so I've written the extended classes myself now. Part of the problem is that in this particular database, each of the composite primary keys contains an autoincrement value (obviously primary) as well. The situation is that we wanted to use composite primary keys to link users to events, tasks, etc that "belonged" to them, so ideally would have to have the user's id as well as the record id in order to identify particular records. We have a work-around of sorts, though, so no worries Thanks again for all your help PJ

« previous php.pear.general (#4523) next »