Re: Alternative MySQL PEAR DB sequence behavior
| From: | Tomas V.V.Cox | Date: | Wed, 25 Jul 2001 01:24:27 +0000 |
| Subject: | Re: Alternative MySQL PEAR DB sequence behavior | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1034@lists.php.net to get a copy of this message | ||
Jim Winstead wrote:
>
> On Wed, Jul 25, 2001 at 01:05:42AM +0200, Stig S. Bakken wrote:
> > jimw@php.net wrote:
> > > and while i'm dipping into the thread, am i the only one who wishes
> > > that PEAR::DB had an (additional?) interface that mapped more directly
> > > to how mysql can handle sequences, and perhaps something that would
> > > provide a generic interface for the functionality you get with mysql's
> > > LIMIT?
> >
> > If you're doing database specific stuff anyway, why not use
> > $dbh->connection (we can add a method for retrieving it, for future
> > compatibility) and mysql_insert_id()?
>
> i wasn't talking about doing database-specific stuff (but do use
> $result->result in one application :). i was just suggesting we might
> want to provide an interface for sequences that looks more like how
> mysql handles them, which could then be emulated on other databases.
I have only see in mysql the ability to get the last inserted ID, so I
can not imagine how to do that in other backends (without a lot of
work). Also it sounds for me a little ackward to change all extensions
to work like MySQL when MySQL is the only very different extension.
> the model that was chosen (nextId, createSequence, etc) is obviously
> more tailored to other databases, and doing it that way with mysql
> just screams 'hack' to me.
>
> it isn't a big deal, obviously, and i'm sure there would be lots of
> people opposed to supporting both models.
I'm one of them :-) Isn't so diferent and "dificult" to instead of doing
the query and get the id, get the id and do the query. I don't know your
personal situation, but perhaps some day you meet with the need of
replacing the backend and sure you thank not to have the need to change
anything.
> > As for LIMIT, I think we should add that. It can be emulated in
> > "compatible mode" for others, too.
>
> right, that was my intention.
>
What is the performance difference between mysql_data_seek and LIMIT? We
have yet implemented the fetchrow by number feature.
Tomas V.V.Cox