[TYPO3-dev] ADOdb vc PDO

Jigal van Hemert jigal at xs4all.nl
Sat May 9 09:22:33 CEST 2009


Hi Ries and others,

Ries van Twisk schreef:
> AdoDB tries to solve some cross database access issues in a generic way,
> much like what PDO tries to solve. Both are not trying to solve  
> changing yout queries to something generic.

At the level at which PDO and AdoDB work, they shouldn't change queries
at all.
It would be nice to have a db independent abstraction layer in TYPO3,
but I'm afraid that it's a bit too late for that in 4.x. Thousands of
extension use their own queries with the low level t3lib_DB functions
and many may use MySQL specific functions.

To be really db independent the db layer should translate table and
column definitions from a generic set to db specific definitions. The db
layer should also have to take care of building the actual queries based
on how a specific DBMS stores which type of data.

Trying to interpret a query and rebuild it for another DBMS seems to be
a very ambitious project.

> 1) AdoDB was there way before PDO, keep that in mind.
Historic reasons were also mentioned by others; good point!

> 2) PDO is not fully stable yet and not well field tested!
Hmm... it's been around for many years. With the fact in mind that many 
'standard' extensions of TYPO3 are still in beta after so many years, I 
can understand this ;-)

> 3) AdoDB does have some utils to store schema's in XML, so they can be  
> transparently
A DBMS independent way to store schema information would be nice. Way 
better than the ext_tables.sql stuff...

> 4) PDO cannot be found on a lot of PHP installations yet
I think it's there on most PHP5 installations. The PHP manual says about 
installing PDO: "If you're running a PHP 5.1 release, PDO and PDO_SQLITE 
is included in the distribution; it will be automatically enabled when 
you run configure."
So any hoster who runs a standard PHP5 installation seems to have PDO 
enabled.

> 5) PDO will properly be a bit fatser then AdoDB because AdoDB is  
> written in PHP itself, I think PDO can send prepared statements to the  
> server and AdoDB does that work 'in house' (as far as I know, may be  
> that is changed).

PDO uses the specific drivers for this. If the DBMS doesn't support 
certain features of PDO they will be emulated.

Regarding security in TYPO3, it would be great to use the parameter 
binding options in PDO (which may also be present in AdoDB). No more SQL 
injections :-)

> 6) Note for 5) AdoDB is also available as a PHP extension.... I never  
> tried it

It will probably be faster than the PHP version. Then again, it will not 
be present in most PHP installations by default.

> 7) AdoDB also has Active Record... PDO has none of that

PDO only has a very rudimentary PDOStatement->fetchObject to retrieve 
the next record as an object. Indeed it doesn't have a whole mapping of 
the data to a series of object with the possibility to change the data 
in the database using those objects.
I've never felt the need for this however.

Thanks to all who replied! It really gave me a good impression of why 
AdoDB is being used.

Regards,

-- 
Jigal van Hemert.


More information about the TYPO3-dev mailing list