PHP5 Data Object (PDO) abstraction layer and Oracle-PHP source code

Source: Internet
Author: User
Tags pear php database
Ec (2); PDO introduction PHP is mainly a project completed by volunteers; although there are a few fixed & ldquo; core & rdquo; developers, however, no one of us is developing PHP with a full-time salary. 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 personal short-term needs of sudden whimsy. There are also a variety of reasons for office buildings in Beijing. Some are experimental, while others are due to & ldquo; script ec (2) will be active tomorrow; script




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 personal short-term needs of sudden whimsy. There are also a variety of reasons for office buildings in Beijing, some of which are experimental, and some are because "there will be work to hand over tomorrow ". Although PHP is usually improved at every step, integrity is lacking in the long run-database expansion is an important example of HKRFP.

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
? The common features of different RDBMS databases are unified, but more advanced features are not excluded.
? PHP scripts provide optional abstract/compatibility.

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 to achieve better performance of this API Beijing cleaning.

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. Our summer camp does not want to make all content 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.
? It can be expanded during runtime. 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.

Where can I obtain PDO?



PDO is provided through the PECL (pronounced "pee-kle", European language style), that is, the PHP extension library. If you are running a Linux computer, follow the instructions below to set it. Later, the installation details are provided on Windows.

Note that the PDO and its drivers are currently in the "alpha" State; this means we will reasonably ensure there are no major defects, but this package is not fully functional-we need to add a lot of functionality. Although we encourage you to test this package, it is not recommended to use it for production at this stage.

<

Related Article

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.