|
Posted by Manuel Lemos on 09/17/05 00:49
Hello,
on 09/15/2005 07:10 AM Oliver Grätz said the following:
>> NEWSFLASH: PDO already exists for PHP 4:
>>
>> http://www.phpclasses.org/pdo
>
> One can't implement overloading of the Zend Engine 2 in PHP4 so this is
Who is going to miss that? Anyway, I don't think that is the point of
PDO for PHP 4. It is rather that what you do with PDO for PHP 4, it will
work with PDO for PHP 5.
> not "the full package". And then, the most important feature of PDO is
> that it's NOT WRITTEN IN PHP like any other database abstraction layer.
> It's written in C for speed.
In theory, that would be a a good advantage. In practice you will hard
notice any difference in real world applications because most of the
time PHP code will be waiting for the server to execute queries and
exchange data.
Furthermore, keep in mind that PHP code is just glue code that already
calls native C extensions that take care of the heavy part of database
clients, which is marshalling and unmarshalling the data that is
exchanged between the client and the server.
This is a big difference between PHP database APIs and for instance JDBC
drivers which are mostly written in pure Java code and introduce
inefficiencies that PHP APIs do not have because they interface with
native client APIs in C provided by the respective database vendors.
Anyway, if you are not convinced and you are obcessed with speed, you
may just as well use the native API for accessing the database instead
of dealing with PDO overhead and API limitations.
>> Despite of that, I do not think PDO is a compelling reason to use PHP 5.
>> Basically it is yet another attempt to do the same where other
>> abstraction layers extensions have failed like ODBC and DBX.
>
> It will not fail because it will be the de-facto-standard for new
> programmers. PHP tutorials will start containing PDO examples instead of
> mysql_* examples. That's even more true because the mysql extension is
> not included by default anymore.
I think that is purely wishful thinking on your part.
If hosts want to keep their business with PHP clients, they make mysql
available to everybody as in PHP 4.
>> The matter is that PDO does not offer real database independence, so
>> application developers that want to not have to deal with the important
>> aspects that are different among databases will still have to deal them
>> in their applications making their applications non-portable.
>
> This is true for the 10 percent of PHP programmers doing complicated
> database stuff. PDO still is good for them because PDO explicitly makes
> stuff unique to a particular DBMS available through its interface (the
> doc is full of "this will only work for some engines"). The other 90
> percent will be fine with what PDO has to offer.
10% doing complicated stuff? Man, you are so biased towards PDO/PHP 5
that you are missing the obvious. I am almost certain that you never
tried to do any database indenpendent programming with PDO or whatever
that, or else you would not be saying the above.
You see, Wez Furlong, the author of PDO is a well known capable
developer, however IMO he made a strategic mistake, probably because he
did not consult the PHP database programming community, in copying ODBC
as base of PDO API. What happens is that ODBC is a stone-age API that
comes from the pre-Web era.
Web programming pushes certain needs that database API must provide
somehow, but ODBC did not handle these because they were not so
important in the pre-Web era.
Here are just a few examples of non-complicated stuff that 99.9999% of
the developers need, for which ODBC/PDO do not provide in an appropriate
way:
- Auto-increment field access
- LIMIT (FYI Rasmus Lerdorf, creator of the PHP invented LIMIT)
- Database independent type mapping (actually ODBC provides this but PDO
doesn't)
So you understand how do I know this stuff is important for database
independent programming, that is because in 1998 I started creating a
database independent API for PHP that provides all the above and also
several other non-trivial features such as schema management, which
AFAIK no other database API provides, not for PHP, nor for any other
language.
http://www.phpclasses.org/metabase
When I say above that unfortunately Wez Furlong did not consult the PHP
database programming community, I meant that if could have at least
checked what the existing PHP database abstraction API like Metabase and
others that followed and copied some of its features, instead of
departing of a pre-Web API which is ODBC and maybe PDO could have been a
much more database independent API, which currently it isn't. This way I
am afraid that PDO destiny won't be different from others like PHP ODBC
and DBX.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
[Back to original message]
|