Re: Fwd: Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?
[email protected] (Nilesh Govindarajan)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On 03/20/2010 07:50 AM, Michael A. Peters wrote: > Nilesh Govindarajan wrote: >> On 03/20/2010 02:31 AM, Michael A. Peters wrote: >>> Mattias Thorslund wrote: >>>> Robert P. J. Day wrote: >>>>> (just a warning -- as a relative newbie to PHP, i'll probably have >>>>> the occasional dumb question. just humour me.) >>>>> >>>>> i'm looking at some existing PHP code that accesses a mysql 5.0 db, >>>>> and it's coded using the mysql-specific calls: mysql_connect, >>>>> mysql_select_db, etc, etc. >>>>> >>>>> is there any reason i *wouldn't* want to rewrite that code using the >>>>> more general PEAR DB module, and use mysqli? certainly, as i read it, >>>>> using the PEAR DB module would make it easier down the road if i >>>>> suddenly decide to change the DB backend. >>>>> >>>>> anyway, any compelling arguments for or against? >>>>> >>>>> rday >>>>> -- >>>> >>>> Well, the reason you shouldn't use PEAR DB in a new project is that >>>> it's being deprecated. MDB2 is the PEAR successor, and does provide >>>> emulation for some features that don't exist on all database >>>> platforms, such as LastInsertID. It can also help you convert your >>>> database from one platform to another, since it also provides methods >>>> for detecting and managing the database structure itself (the Manager >>>> and Reverse modules). >>>> >>>> That said, if I were to start a new project at this time, I would look >>>> closer at whether PDO fits my needs. >>> >>> I use MDB2. >>> I hear PDO hyped a lot, what does it really give me that MDB2 does not, >>> other than making the application dependent upon a binary module? >>> >> >> binary module makes a lot of difference. If you use MDB2, the >> interpreter has to compile MDB2's code along with your program logic. >> Whereas PDO is already compiled one, so it will do the job much much >> faster. >> > > So since I already cash my db requests via APC the benefits to me would > be small. Yeah the use of APC or Xcache, etc. would not make any difference between PDO and MDB2 in terms of performance. -- Nilesh Govindarajan Site & Server Administrator www.itech7.com