Re: DB class, MySQL and nextId()

From: Date: Fri, 16 Apr 2004 12:01:36 +0000
Subject: Re: DB class, MySQL and nextId()
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11908@lists.php.net to get a copy of this message
Chris Boget wrote:
If you want abstraction then I guess you will just have to trust that we know what we are doing.
Then I would be very interested in learning how, during the development of PEAR DB, you envisioned the sequence functionality working when used against a table using auto_increment and having pre-existing records? W/o the need to go back and refactor all the existing code to use PEAR DB...
Aehm, you are changing your code from the mysql native API to PEAR DB. And now you expect your code to work on all RDBMS? Sorry to say this will not work. Oracle has no auto increment etc. So I am afraid you will just have to accept the fact that you will need to adjust your RDBMS. Again if you dont care about any other RDBMS I am wondering why you ported your code. Either way the query I provided will do the trick for you then.
I am not aware that Java even bothers to abstract this sort of thing .. anyways I dont see where we are to blame for this fact.
I don't see that you are to blame either, per se. But since each RDBMS has it's own driver class, I don't see why the functionality wasn't developed to take into consideration each RDBMS' individual quirks.
Aehm that is exactly the point. Using the nextId() method we enable you to write RDBMS independant code (as in we handle all the differnt quirks). If you actually dont want to write RDBMS independant code then you also dont have a problem. YOu can send MySQL specific queries (like the one I send you) or you can even mix PEAR DB with the native interface accessing the "connection" property as the database link.
If I sound a bit miffed it might be a result of the fact that none of you have bothered to search the archives or have tried to keep a polite tone in your questions.
If I came across as impolite, I apologize. I was frustrated after trying many different work arounds that didn't really work w/o becoming really cludgy.
The problem is that alot of newbies think that all RDBMS work like MySQL. So they come to us being mad/frustrated that we are making things so hard for them. There are 2 problems with this: 1) the assumption that we are just here to be a pain and intentionally make things hard for you 2) not searching the web for one of the most asked question on PEAR DB (or any other php database abstraction layer) I guess what you can be annoyed about is the lack of a package level faq/comment system so that you dont even run a search to find the answer to your question. Suffice it to say we also want this, just someone needs to code it into pear.php.net. regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07

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