Re: [PHP] PDO: good, popular?

2010-12-15 Thread Nicholas Kell

On Dec 14, 2010, at 5:45 PM, Govinda wrote:

 In previous experience with questions such as these, you will get
 several types of individual responses to usages of the software. Some
 good, some bad, depending on the experience level of the commenter
 with both the language and the code in question.
 
 It's a combination of your current understanding of php and the
 associated usages of other languages, and what you want to know.
 
 Don't trust what people say, trust what feels right at the current
 time of your usage of the php library available/your experience level,
 and what you currently know how to use.
 
 From my experience with several languages, once you know the basics,
 even if you do re-invent the 'wheel', so did firestone,michelin, and
 goodyear, and they're not complaining. And you'll feel better for
 reinventing, than using someone elses.
 
 
 I think this ^^^ advice is brilliant, understated; nothing replaces 
 integration of one's own thorough understanding.
 
 
 Govinda
 govinda(DOT)webdnatalk(AT)gmail(DOT)com

@the OP

I absolutely agree.

One-thousand people will miraculously come up with two-thousand opinions on PDO 
and similar tools. PDO is only one of many, many tools in your toolbox.

At the end of the day - get ahold of PDO, mess around with it a bit, read some 
docs, etc.. See what you can do with it, then see if it was worth the learning 
curve and how you can leverage your newly found knowledge on your next project. 
Then, drop it like it's hot when you don't need it. No need to jam a square peg 
in a round hole. Whip out your pocket knife and make a round peg for a nice 
snug fit. After all, that's why you carry a pocket knife - right?


If it feels good - do it.

Re: [PHP] PDO: good, popular?

2010-12-14 Thread David Hutto
On Tue, Dec 14, 2010 at 6:10 AM, Sam Smith a...@itab.com wrote:
 Searching for PHP CRUD in hopes of learning the best way to access
 databases and to use PEAR or what I came across PDO.

 I want to know the communities opinion of PDO: everyone uses it or no one
 uses it or it's great or what?

In previous experience with questions such as these, you will get
several types of individual responses to usages of the software. Some
good, some bad, depending on the experience level of the commenter
with both the language and the code in question.

It's a combination of your current understanding of php and the
associated usages of other languages, and what you want to know.

Don't trust what people say, trust what feels right at the current
time of your usage of the php library available/your experience level,
and what you currently know how to use.

From my experience with several languages, once you know the basics,
even if you do re-invent the 'wheel', so did firestone,michelin, and
goodyear, and they're not complaining. And you'll feel better for
reinventing, than using someone elses.



 Thanks


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



Re: [PHP] PDO: good, popular?

2010-12-14 Thread Richard Quadling
On 14 December 2010 11:10, Sam Smith a...@itab.com wrote:
 Searching for PHP CRUD in hopes of learning the best way to access
 databases and to use PEAR or what I came across PDO.

 I want to know the communities opinion of PDO: everyone uses it or no one
 uses it or it's great or what?

 Thanks


If you are developing code for a single database and you are really,
really sure you're not going to ever use another DB, then maybe PDO is
an unnecessary layer.

If you are developing code which has to remain compatible across
multiple DBs, then PDO would, on the surface, seem like a good idea.
The downside though is that PDO still requires DB specific drivers.

I only work on 1 DB (MS SQL). So, I don't use PDO.

From http://docs.php.net/manual/en/intro.pdo.php :

PDO provides a data-access abstraction layer, which means that,
regardless of which database you're using, you use the same functions
to issue queries and fetch data. PDO does not provide a database
abstraction; it doesn't rewrite SQL or emulate missing features. You
should use a full-blown abstraction layer if you need that facility.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] PDO: good, popular?

2010-12-14 Thread David Hutto
In other words, in ten years from now, even the advisors you get today
will rethink their answers with 20/20/hindsight, and not think about
your ignorance of technology, but their own.

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



Re: [PHP] PDO: good, popular?

2010-12-14 Thread Richard Quadling
On 14 December 2010 15:45, David Hutto smokefl...@gmail.com wrote:
 From my experience with several languages, once you know the basics,
 even if you do re-invent the 'wheel', so did firestone,michelin, and
 goodyear, and they're not complaining. And you'll feel better for
 reinventing, than using someone elses.

Strange that you should mention those tyre manufacturers. I work for a
tyre remoulder. We take their dead tyres and remake them into high
quality remoulds. The majority of all food delivered in the UK run on
our tyres!

Essentially, we are recycling. Looking to the future and all that.

If you can recycle others code into new and interesting ways, then go for it.

Richard.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] PDO: good, popular?

2010-12-14 Thread la...@garfieldtech.com
I'm the DB maintainer for Drupal 7, and we rebuilt our entire DB layer 
on top of PDO.  It's a rather nice API, although as others have noted it 
does not abstract away SQL entirely; it abstracts the API calls you need 
to use to get to SQL.


We then built a layer on top of that which does abstract away most 
database weirdness using fluent query builders.  It's much 
lighter-weight than an ORM.  I'm in the process of spinning it off as a 
stand-alone library because we think it's that cool, but it's not 
completely divorced from Drupal yet.  Stay tuned. :-)


But yes, PDO is nice.

--Larry Garfield

On 12/14/10 5:10 AM, Sam Smith wrote:

Searching for PHP CRUD in hopes of learning the best way to access
databases and to use PEAR or what I came across PDO.

I want to know the communities opinion of PDO: everyone uses it or no one
uses it or it's great or what?

Thanks



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



Re: [PHP] PDO: good, popular?

2010-12-14 Thread Adam Richardson
On Tue, Dec 14, 2010 at 6:10 AM, Sam Smith a...@itab.com wrote:

 Searching for PHP CRUD in hopes of learning the best way to access
 databases and to use PEAR or what I came across PDO.

 I want to know the communities opinion of PDO: everyone uses it or no one
 uses it or it's great or what?

 Thanks


I like working with PDO.  I use a very thin set of wrapper functions to
automatically grab the connection information from a config file, cause
errors to be thrown as exceptions, and make sure the results are formatted
as arrays.  It works very well and relatively fast.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] PDO: good, popular?

2010-12-14 Thread Lester Caine

la...@garfieldtech.com wrote:

I'm the DB maintainer for Drupal 7, and we rebuilt our entire DB layer
on top of PDO.  It's a rather nice API, although as others have noted it
does not abstract away SQL entirely; it abstracts the API calls you need
to use to get to SQL.

We then built a layer on top of that which does abstract away most
database weirdness using fluent query builders.  It's much
lighter-weight than an ORM.  I'm in the process of spinning it off as a
stand-alone library because we think it's that cool, but it's not
completely divorced from Drupal yet.  Stay tuned. :-)


Larry - how many databases does it actually work with? Having rebuilt the DB 
layer using PDO did you actually gain anything?


Sam - The situation on database abstraction is not clear cut and a lot of 
tangents have been generated while the traditional approaches are still the best 
in many cases.


As has been said ... if you only intend to use on database, then use the 
matching driver and work the SQL in a manor that works for you with that database.


If you need a full range of databases supported, then ADOdb is STILL the best 
option, and will quite happily use a PDO or generic driver internally depending 
on your choice, but which ever you use ( and the generic ones still tend to be 
faster especially with the accelerator package ) the abstraction of the SQL is 
much more important then simply managing a few data conversions. ADOdb will 
build tables across the whole range of databases it supports from a single 
'profile', while PDO needs a lot of help to do the same, preferring instead to 
have separate 'profiles' for each database each hand coded.


PDO still needs a number of areas finishing before it can become a total 
replacement for the legacy stuff that is available such as the PEAR libraries 
and the likes of Drupal writing their own abstraction layer on top of it ... 
along with a number of other projects who are now doing the same thing ... shows 
that PDO is not creating the common platform it was supposed 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] PDO: good, popular?

2010-12-14 Thread Govinda

In previous experience with questions such as these, you will get
several types of individual responses to usages of the software. Some
good, some bad, depending on the experience level of the commenter
with both the language and the code in question.

It's a combination of your current understanding of php and the
associated usages of other languages, and what you want to know.

Don't trust what people say, trust what feels right at the current
time of your usage of the php library available/your experience level,
and what you currently know how to use.

From my experience with several languages, once you know the basics,
even if you do re-invent the 'wheel', so did firestone,michelin, and
goodyear, and they're not complaining. And you'll feel better for
reinventing, than using someone elses.



I think this ^^^ advice is brilliant, understated; nothing replaces  
integration of one's own thorough understanding.



Govinda
govinda(DOT)webdnatalk(AT)gmail(DOT)com


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



Re: [PHP] PDO: good, popular?

2010-12-14 Thread Paul M Foster
On Tue, Dec 14, 2010 at 03:10:56AM -0800, Sam Smith wrote:

 Searching for PHP CRUD in hopes of learning the best way to access
 databases and to use PEAR or what I came across PDO.
 
 I want to know the communities opinion of PDO: everyone uses it or no one
 uses it or it's great or what?

I use PDO within a class which handles various housekeeping (error
handling etc.) for everything. PDO handles all the popular RDBMSes (as
far as I know). It can also sanitize queries to avoid SQL injection.
Simple interface. It's also part of PHP, meaning it's well tested and
solid.

Paul

-- 
Paul M. Foster

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



Re: [PHP] PDO: good, popular?

2010-12-14 Thread Larry Garfield
On Tuesday, December 14, 2010 1:02:33 pm Lester Caine wrote:
 la...@garfieldtech.com wrote:
  I'm the DB maintainer for Drupal 7, and we rebuilt our entire DB layer
  on top of PDO.  It's a rather nice API, although as others have noted it
  does not abstract away SQL entirely; it abstracts the API calls you need
  to use to get to SQL.
  
  We then built a layer on top of that which does abstract away most
  database weirdness using fluent query builders.  It's much
  lighter-weight than an ORM.  I'm in the process of spinning it off as a
  stand-alone library because we think it's that cool, but it's not
  completely divorced from Drupal yet.  Stay tuned. :-)
 
 Larry - how many databases does it actually work with? Having rebuilt the
 DB layer using PDO did you actually gain anything?

Drupal 6 and earlier supported MySQL and, kinda sorta, Postgres, maybe.

Drupal 7 ships with support for MySQL, Postgres, and SQLite out of the box and 
add-on modules provide support for Oracle and MS SQL, within reason.  So we 
increased our DB support from 1.5 to 5, essentially.

We also gained, as part of the rewrite, untyped prepared statements, 
transactions, and master/slave support (although that's nothing to do with PDO 
per se, just our layer on top of it).  And that allowed us, in turn, to build 
type-safe query builders, support for MERGE queries, and all kinds of other 
fun stuff on top of that.

 PDO still needs a number of areas finishing before it can become a total
 replacement for the legacy stuff that is available such as the PEAR
 libraries and the likes of Drupal writing their own abstraction layer on
 top of it ... along with a number of other projects who are now doing the
 same thing ... shows that PDO is not creating the common platform it was
 supposed to :(

That is, sadly, true.  PDO is not a complete and perfect DB library, in part 
because there are few people who work on it, and fewer still who understand 
all of the vendor-specific issues at hand and the vendors have been very slow 
to lend a hand, preferring to work on proprietary APIs.  It's quite 
unfortunate, but I still consider PDO an overall win.

If anyone knows C and wants to make a name for themselves in the PHP world, 
PDO is looking for some heroes. :-)

--Larry Garfield

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