Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-20 Thread Paul M Foster
On Fri, Mar 19, 2010 at 02:01:03PM -0700, Michael A. Peters wrote:



>
> 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?

Maybe nothing. But PDO is built-in and MDB2 isn't.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Fwd: Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Nilesh Govindarajan

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Fwd: Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Michael A. Peters

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.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Fwd: Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Nilesh Govindarajan

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.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Michael A. Peters

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?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Robert P. J. Day
On Fri, 19 Mar 2010, 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, ...

  you're right and, in fact, i knew that, i just forgot.  i'm also
taking seriously the recommendations for PDO and adodb.

rday
--



Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Lester Caine

la...@garfieldtech.com wrote:

Add me to the list of people recommending PDO.  It's much nicer to work
with than the ext/mysql API, and frankly more secure since you get
prepared statements. It won't get you complete database independence for
a number of reasons (mostly due to databases being too unstandardized
because they all suck in different ways; I say this as someone who has
written an abstraction layer atop PDO and it wasn't easy), but it will
get you part way there and even if you only ever use MySQL is a nicer
API to work with.


Of cause ADODB will actually use PDO for those databases that are currently 
available in it, and the generic drivers for those which are not currently 
supported by PDO ;) One can also check performance by switching between PDO 
driver and generic if you want to ...


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Mattias Thorslund

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.


Cheers,

Mattias

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread la...@garfieldtech.com
Add me to the list of people recommending PDO.  It's much nicer to work 
with than the ext/mysql API, and frankly more secure since you get 
prepared statements.  It won't get you complete database independence 
for a number of reasons (mostly due to databases being too 
unstandardized because they all suck in different ways; I say this as 
someone who has written an abstraction layer atop PDO and it wasn't 
easy), but it will get you part way there and even if you only ever use 
MySQL is a nicer API to work with.


--Larry Garfield

On 3/19/10 9:17 AM, 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
--



Robert P. J. Day   Waterloo, Ontario, CANADA

 Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Nilesh Govindarajan

On 03/19/2010 08:51 PM, Rene Veerman wrote:

another option: adodb.sf.net.

and yep, i'm fully for using a db abstraction layer.


On Fri, Mar 19, 2010 at 3:17 PM, 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
--



Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






Adodb is the same one that is available in Visual Basic.

I suggest PDO. Easy to use and portable.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Rene Veerman
another option: adodb.sf.net.

and yep, i'm fully for using a db abstraction layer.


On Fri, Mar 19, 2010 at 3:17 PM, 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
> --
>
>
> 
> Robert P. J. Day                               Waterloo, Ontario, CANADA
>
>            Linux Consulting, Training and Kernel Pedantry.
>
> Web page:                                          http://crashcourse.ca
> Twitter:                                       http://twitter.com/rpjday
> 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Adam Richardson
On Fri, Mar 19, 2010 at 10:23 AM, Ashley Sheridan
wrote:

> On Fri, 2010-03-19 at 10:17 -0400, 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
> > --
> >
> >
> > 
> > Robert P. J. Day   Waterloo, Ontario, CANADA
> >
> > Linux Consulting, Training and Kernel Pedantry.
> >
> > Web page:  http://crashcourse.ca
> > Twitter:   http://twitter.com/rpjday
> > 
> >
>
>
> The only problem I can foresee is if the system you're looking to
> replace the mysql calls in uses any specific mysql-only features and
> functions. So, for example, not all database types support grabbing the
> last inserted id (and grabbing the MAX(id) is just asking for trouble)
>
> Have a look through the code to see if there any database calls that you
> think might throw up any issues. I believe the Pear module supports all
> the mysql functions, but there might be issues if you want to change the
> back end at some point in the future.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
You also might prefer the level of abstraction and simplicity provided by
PDO (note that it's a data access abstraction layer, not a database
abstraction layer, http://www.php.net/manual/en/intro.pdo.php.)

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Paul M Foster
On Fri, Mar 19, 2010 at 02:23:30PM +, Ashley Sheridan wrote:

> On Fri, 2010-03-19 at 10:17 -0400, 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
> 
> 
> The only problem I can foresee is if the system you're looking to
> replace the mysql calls in uses any specific mysql-only features and
> functions. So, for example, not all database types support grabbing the
> last inserted id (and grabbing the MAX(id) is just asking for trouble)
> 
> Have a look through the code to see if there any database calls that you
> think might throw up any issues. I believe the Pear module supports all
> the mysql functions, but there might be issues if you want to change the
> back end at some point in the future.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 

I would suggest instead the built-in PDO module for PHP. This is
generic, and suitable for several DBMS back-ends. But any direct queries
using features unique to a specific DBMS (like Ash's "last inserted id")
will have to be coded specifically for your back-end.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Ashley Sheridan
On Fri, 2010-03-19 at 10:17 -0400, 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
> --
> 
> 
> 
> Robert P. J. Day   Waterloo, Ontario, CANADA
> 
> Linux Consulting, Training and Kernel Pedantry.
> 
> Web page:  http://crashcourse.ca
> Twitter:   http://twitter.com/rpjday
> 
> 


The only problem I can foresee is if the system you're looking to
replace the mysql calls in uses any specific mysql-only features and
functions. So, for example, not all database types support grabbing the
last inserted id (and grabbing the MAX(id) is just asking for trouble)

Have a look through the code to see if there any database calls that you
think might throw up any issues. I believe the Pear module supports all
the mysql functions, but there might be issues if you want to change the
back end at some point in the future.

Thanks,
Ash
http://www.ashleysheridan.co.uk