Web hosting domains - CHAPTER 23 INTRODUCING PDO perhaps too focused

CHAPTER 23 INTRODUCING PDO perhaps too focused on PDO s database abstraction features rather than the entire array of capabilities it offers. Indeed, PDO serves as an ideal replacement for the DB package and similar solutions. However, PDO is actually much more than just a database abstraction layer, providing the following: Coding consistency: Because the various database extensions available to PHP are written by a host of different contributors, there is no coding consistency despite the fact that all of these extensions offer basically the same features. PDO removes this inconsistency by offering a singular interface that is used no matter the database. Furthermore, the extension is broken into two distinct components: the PDO core contains most of the PHP-specific code, leaving the various drivers to focus solely on the data. Also, the PDO developers took advantage of considerable knowledge and experience while building the database extensions over the past few years, capitalizing upon what was successful and being careful to omit what was not. Flexibility: Because PDO loads the necessary database driver at run time, there s no need to reconfigure and recompile PHP every time a different database is used. For instance, if your database needs suddenly switch from Oracle to PostgreSQL, just load the PDO_PGSQL driver and go (more about how to do this later). Object-oriented features: PDO takes advantage of PHP 5 s object-oriented features, resulting in more powerful and efficient database communication. Performance: PDO is written in C and compiled into PHP, which, all other things being equal, provides a considerable performance increase over solutions written in PHP. Given such advantages, what s not to like? This chapter serves to fully acquaint you with PDO and the myriad of features it has to offer. Using PDO PDO bears a striking resemblance to all of the database extensions long supported by PHP; therefore, if you have used PHP in conjunction with a database, the material presented in this section should be quite familiar. As mentioned, PDO was built with the best features of the preceding database extensions in mind, so it makes sense that you ll see a marked similarity in its methods. This section commences with a quick overview of the PDO installation process, and follows with a summary of its presently supported database servers. For the purposes of the examples found throughout the remainder of this chapter, we ll use the following PostgreSQL table: CREATE TABLE product ( rowid SERIAL, sku CHAR(8) NOT NULL, name VARCHAR(35) NOT NULL, PRIMARY KEY(rowid) ); The table has been populated with the following products:
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Leave a Reply