RE: [PEAR] NextID and DB_DataObjects (me too;)

From: Date: Fri, 22 Nov 2002 10:20:12 +0000
Subject: RE: [PEAR] NextID and DB_DataObjects (me too;)
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-2810@lists.php.net to get a copy of this message
DATE-SEQUENCE-INCREMENT is not the name of the sequence in my case though. It is the form of the id i generate. Si i use a sequence to get the increment then i build the full id using the date and the increment. I used the method i described in an arlier post and it works well. That is i override insert, generate my id then use the $this->mytableid = mygeneratedid; and call Parent::insert. When using only a sequence an option to set the sequence name for the table would be a good addition imho. Arnaud. > this was the idea of adding a configuration option: > seq_tablename = DATE-SEQUENCE-INCREMENT > or perhaps > > seq_tablename = __IGNORE__ // to tell it not to autocreate > sequences... > > do you think that would work? > Regards > Alan > > LIMBOURG Arnaud wrote: > > > The only problem with that is when you want to have your > own id, like > > DATE-SEQUENCE-INCREMENT. > > > > You then have no choice but to override insert or do your > own piece of > > code and tell dataobject the id ;) > > > > > try changing the line in insert as below.. > > > I guess it should be user defined somehow.. if you can > come up with a > > > patch that does that feel free to commit it. > > > > > > > > > > > > if (($key = @$keys[0]) && ($dbtype != 'mysql')) { > > > > > > $this->$key = $__DB->nextId($this->__table.'_seq'); > > > } > > > > > > > > > Of the top of my head > > > [DB_DataObject] > > > > > > seq_tablename = sequencename > > > > > > may be a good format.. - if it exists use the value, > > > otherwise use tablename_seq > > > > > > Regards > > > Alan > > > > > > > > > > > > > > > -- > > > PEAR General Mailing List (http://pear.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > >

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