|All reviews||Comprehensive PHP PEAR::DB||Latest reviews||Best sellers ranking|
Comprehensive PHP PEAR::DB
Week: 26 All time: 128
manuellemos.netPEAR::DB is an object oriented package of the PEAR project that provides a unified interface for accessing many SQL based databases using PHP. "Comprehensive PHP PEAR::DB" is a book written by Blake Schwendiman that focuses exclusively on this package.
However, despite the author's claims in the book, PEAR::DB does not enable application portability across different databases, even when you use standard SQL statements.
One important portability feature that is missing from PEAR::DB is data type mapping between the database field types and PHP data types, unless the applications that use PEAR::DB just use integers and string types.
For instance, if an application works with dates and times, since each database uses different representations for these types, applications using PEAR::DB will still have to deal with the different formats that each supported database uses.
A greater level of portability is the goal of another PEAR package named MDB. This package is a fork of the Metabase database abstraction project, aimed at providing it with a PEAR::DB compatible API. So, the main purpose is to enable users to write PHP database applications that are more portable, without the need to change their applications too much, if they have been started using PEAR::DB.
PEAR::MDB uses the original Metabase data type abstraction system to convert data that is stored to and retrieved from the databases. Thus applications do not have to deal with data type representation differences between each database.
Another important portability feature taken from Metabase to PEAR::MDB is the schema management system. It allows a developer to describe the schema of database tables, fields, indexes and sequences in a database independent XML format that is very easy to understand for developers.
The schema manager is capable of processing an XML schema definition and installing all the database schema objects. If a developer changes the XML schema definition, the schema manager can upgrade the installed schema without affecting the data added to the database since it was installed for the first time or since it was last upgraded.
The need to perform schema changes is often a reason why developers without good tools avoid adding or changing certain features in their applications. This is because schema changes when done wrongly by mistake may destroy vital information stored in the database.
Therefore, the schema manager provided by Metabase, and thus PEAR::MDB, is a valuable feature that not only provides portability but also reduces the risk of serious mistakes that developers,
being human, may make.
The project goal of PEAR::MDB is to become a replacement for PEAR::DB. That will only happen, however, when PEAR::MDB provides at least all the drivers to work with all the databases supported by PEAR::DB.
This book does not cover PEAR::MDB. However, the author indicated his intention to cover MDB in a future edition. Meanwhile, since PEAR::MDB provides an API that is compatible with PEAR::DB, the book can still be very useful for developers who are using PEAR::MDB.
The book itself is relatively small. It covers the installation of the PEAR base system and PEAR::DB. Then it follows with a longer chapter that covers the public functions of the PEAR::DB classes, including some that are not documented but which the author found useful. This chapter includes many illustrative example scripts, as well as samples of the output of such scripts. Finally it gives an overview of the different databases that PEAR::DB supports and the author could test.
Overall, this is maybe a good and very helpful book if you are using, or plan to use, the PEAR::DB package. Although it does not cover the features that the PEAR::MDB package adds over PEAR::DB, the book may also be helpful if you are interested in PEAR::MDB as this package provides a compatible superset of the PEAR::DB features.
No comments were submitted yet.