PHP5 data object (PDO) abstraction layer and Oracle_PHP tutorial

Source: Internet
Author: User
PHP5 data object (PDO) abstraction layer and Oracle. The original developer of the new PHP Data Object (PDO) data abstraction layer briefly introduces this abstraction layer, focusing on running with Oracle. Required PHP: 5.0 required others: the original developer of the new PHP Data Object (PDO) data abstraction layer briefly introduces this abstraction layer, focusing on running with Oracle.
PHP: 5.0 required
Other required: Oracle 8 or later Client Library
Download PDO for Oracle (Windows): php_pdo.dll, php_pdo_oci.dll
Download the PDO (Unix): pdo, pdo_oci for Oracle
About PDO
PHP is mainly a project completed by volunteers. although there are a few fixed "core" developers, none of us are working full-time to develop PHP. In addition, we are located in different parts of the world. you can imagine how difficult it is to coordinate long-term development. Therefore, PHP is mainly developed based on the short-term demand of sudden whimsical individuals. There are also various reasons, some of which are experimental, and some are because "there is a job to hand in tomorrow ". Although PHP is usually improved at every step, in the long run, there is a lack of integrity-database tutorial extension is an important example.
There is no real consistency between various data extensions (such as oci, mysql, postgresql, and mssql). In some cases, there is no real consistency within these extensions. Almost all of these extensions use different codes closely linked to the basic database API to complete the same type of tasks. In addition, because we (PHP core developers and extension developers) have very limited manpower, this makes the code more difficult to maintain and brings a lot of problems to PHP.
As PHP is becoming increasingly popular and successful, maintainers of major PHP database extensions attended the LinuxTag 2003 conference in Germany. at the conference, we exchanged views on the future of PHP. When discussing the randomness of PHP development, we have determined some goals for database access in PHP:
· Provides a lightweight, clear, and convenient API
· Unify the common features of different RDBMS databases, but do not exclude more advanced features.
· Provides optional abstract/compatibility with PHP scripts.
We have proposed the concept of this PHP Data object (PDO) because we want to use Zend Engine 2 (the core of PHP 5) advanced object-oriented features provide better performance for this API.
The concept of the data abstraction layer in PHP is not new at all. querying "PHP database abstraction action" in Google will find about 83,200 matching items. It is almost the dream of many PHP developers, and its generation is partly attributed to our incomplete API. If you have tried to use a third-party abstraction layer to do anything really important, these abstraction layers are usually designed to be too powerful for the work at hand-either as they require a lot of learning before use or as slow interfaces, parameters must be called by a multi-layer script function before they can reach the database's own API. the preceding two representations usually exist.
Why are these abstract layers having such problems? These abstract layers are always trying to complete too many tasks, or even impossible tasks. We decided to take practicality as our goal, and only use some of the most common database API features as our foundation, so that the PDO driver can expose their product-specific features as regular extension functions.
Why use PDO?
Most people who have heard of rumors about database abstraction extensions immediately have doubts about PDO extensions-do we want to analyze SQL statements and convert them into corresponding back-end dialects? How do we deal with feature X or feature Y. Therefore, you may be surprised when you hear that we don't have to worry about it in PDO. we don't want to make everything completely unified, because we want to make this unified possible, you can only limit yourself to the lowest standard.
If PDO is not an abstract layer, is there any other reason why you should consider using it?
· Performance. From the very beginning, PDO learned from the success and failure of existing database expansion. Because the PDO code is brand new, we have the opportunity to design performance again to take advantage of the latest features of PHP 5.
· Capability. PDO is designed to provide common database functions as the basis and provide convenient access to the unique functions of RDBMS.
· Simple. PDO is designed to make it easy to use databases. The API does not forcibly intervene in your code and clearly shows the process of calling each function.
· Runtime scalability. The PDO extension is modular, allowing you to load drivers at the backend of your database at runtime without re-compiling or re-installing the entire PHP program. For example, the PDO_OCI extension replaces the PDO extension to implement the Oracle database API. There are also some drivers for MySQL, PostgreSQL, ODBC, and Firebird. more drivers are still under development.
You may want to know the comparison between PDO and other commonly used abstract layers, such as pear db or ADODB. In terms of API and performance, PDO is lighter than other common abstraction layers, but it is inferior to those abstraction layers to provide uniformity between the backend of each database, for example, the pear mdb 2 abstraction layer is used to handle a large number of portability problems.


The original developer of the PHP Data object (PDO) data abstraction layer briefly introduces this abstraction layer, focusing on running with Oracle. PHP: 5.0 is required :...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.