Common Interfaces


One subject that deserves further attention is that of common interfaces, or abstraction layers. These are software libraries that expose a single programming interface to many of the available database servers, thus helping to reduce some of the difficulties you might encounter when using a number of different systems.

The key examples of this are PEAR DB in PHP and ODBC (Open Database Connectivity). PEAR (the PHP Extensions and Application Repository) is a facility by which open source code extensions for PHP can be contributed and distributed (see Chapter 28, "Using PEAR"). PEAR DB is a set of classes that provide an object-oriented abstraction for accessing databases.

ODBC also provides database APIs designed for maximum interoperability. These are a broader set of APIs written in a lower-level language (such as C/C++) that are available to a number of platforms and systems.

While the ability to abstract data access to a common denominator is very useful and helpful in an environment where you are working with different database systems, a number of trade-offs are made. Performance can sometimes suffer since there is now an additional layer of code between you and your database server, and feature access can be restrictedto support all systems, some server-specific features become unavailable or more difficult to use.

Thus, while we will not discourage you from investigating the various abstraction layers for yourself, we will not make great use of them throughout this book, and instead opt to show the basic data access to the individual servers (MySQL). As stated before, all of the APIs for accessing databases from within PHP (even the abstraction layers) are similar, and it is reasonably easy to make the transition from one system to another.




Core Web Application Development With PHP And MYSQL
Core Web Application Development with PHP and MySQL
ISBN: 0131867164
EAN: 2147483647
Year: 2005
Pages: 255

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net