Re: DB, DB_DO and sequences
| From: | Justin Patrin | Date: | Mon, 25 Apr 2005 16:36:53 +0000 |
| Subject: | Re: DB, DB_DO and sequences | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18949@lists.php.net to get a copy of this message | ||
On 4/25/05, Matt Craig <mcraig@leadehealth.com> wrote:
> (my only experience is through DO so maybe this is more a question of DataObject)
>
> Could someone give an explanation of the reasoning behind DB defaulting to using it's own
> sequences even when a database has native sequences?
>
> For instance,
>
> CREATE TABLE tab1 (
> id SERIAL, AUTONUMBER, etc.
> ...
> );
>
> DB creates the sequence, tab1_seq, if not explicitly told not to. Now, not everyone in my
> company accesses the database with PHP using DB. Some use the command line, some use MS
> Access, etc. and all those other methods use native sequences. The non-PHP people don't
> want
> to use some other non-native sequence such as the one created by DB, because that is extra
> hassle.
>
> So why does DB do this with sequences? It seems like it would be very common that DB is not
> the only access method to a database.
>
Although the sequences are form DB, DB_DataObject is the one creating
them. You need to look at the sequenceKey() method. Search the
archives for lots of discussion on it. Basically you can quite easily
override it in your DOs to have the native sequence used.
--
Justin Patrin