Re: PEAR development
| From: | Stig S. Bakken | Date: | Tue, 25 Feb 2003 08:18:32 +0000 |
| Subject: | Re: PEAR development | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-13822@lists.php.net to get a copy of this message | ||
On Tue, 2003-02-25 at 02:34, Alan Knowles wrote:
> >
> >
> >>Hi, this question is concerning the addition of a particular php/mysql
> >>
> >>function. The function is mysql_insert_id(). As far as I can tell,
> >>PEAR does not offer any function that is compatible with this
> >>particular function. I'm wondering if there are any plans to add this
> >>to PEAR? Personally, I think this function is very useful and it
> >>would be a shame to not include it.
> >>
> >>
> >
> >I do not think there is be an addition for this function. This is a
> >mysql-mysql specific function, and, not portable, imho, even to avoid
> >its use (except in rare specific cases).
> >
> >You may try to look at sequences, which are available in PEAR::DB as
> >well as in PEAR::MDB, sequences do exactly the same and are safely
> >portable.
> >
> >
> That said - the other reason for using PEAR:DB is the api is simpler
> than the php one :) - and one one api for all DB's - this is time saving
> for the programmer. - So if you only ever intend to use MySQL one
> technique would be
> a) create a file mysqlNonCompat.php in the DB folder, write a class that
> extends mysql.php and have one function getInsertID() or something..
> b) then just use mysqlNonCompat://xys@....../ as your dsn..
>
> Note however that you cant use auto_increment well with replication, so
> PEAR's sequences should be quite good for that..
...except that PEAR's sequences for mysql use separate one-column tables
with - guess what - auto_increment :-)
- Stig