RE: [PEAR-DEV] DB::createSequence(string $seq_name [ , integer start])
| From: | Lukas Smith | Date: | Thu, 28 Nov 2002 07:43:38 +0000 |
| Subject: | RE: [PEAR-DEV] DB::createSequence(string $seq_name [ , integer start]) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-11206@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Emmanuel Chantreau [mailto:ml-tech.pear@maretmanu.org]
> Sent: Thursday, November 28, 2002 7:19 AM
> To: pear-dev@lists.php.net
> Subject: Re: [PEAR-DEV] DB::createSequence(string $seq_name [ ,
integer
> start])
>
>
> Arnaud Limbourg écrit:
> > COuld you be a bit clearer, please ?
>
> I will try, sory for my bad english, I'm french.
>
> > Do you mean mean you want to start a sequence from a certain value ?
> Yes.
>
> Imagine that you save all the content of your database in a xml file.
When
> you want to restore it (using DB) you delete all the content of your
> tables and then you store the data from your xml file in the tables.
You
> need also to restore the value of sequences. For that, you can just
drop
> and create sequences, so you need to create a sequence with a starting
> value. We could try to have a function to set the value of an existing
> sequence but it's not possible in all database (postgres for ex.).
>
> >> Hello
> >>
> >> Actually DB::createSequence can't set the starting value, but when
we
> >> restore the database (for example from an xml file) using DB we
can't
> >> restore the sequence, so we can't restore the database.
> >>
> >> I had a look in the sources for the differents backends and it
seems
> >> possible to add the optional "start" argument for all backends.
> >>
> >> I'm not registered as a developper, but I can provide a patch
> >> for this modification or I can subscribe as a developper. But I
can't
> >> test for all backends of course (just postgres and mysql).
>
MDB already has this feature.
http://pear.php.net/package-info.php?package=MDB
public mixed createSequence(string name[, string start])
create sequence
Arguments
* name
name of the sequence to be created
* start [optional, default value = 1]
start value of the sequence; default is 1
Return
MDB_OK on success, a MDB error on failure
Regards,
Lukas