PHPPDO learning notes-PHP source code

Source: Internet
Author: User
Ec (2); ■ what is PDO? The POD (PHPDataObject) extension is added to PHP5. By default, PDO is identified in PHP6 to connect to the database. All non-PDO extensions will be removed from the extension in PHP6. This extension provides PHP built-in PDO class for accessing the database. Different databases use the same method name to solve the problem of inconsistent database connections. I configured it for development in windows. ■ The goal of PDO is to provide a lightweight, clear, and convenient API unified script ec (2); script


■ What is PDO?
The POD (PHP Data Object) extension is added to PHP5. By default, PDO is identified in PHP6 to connect to the database. All non-PDO extensions will be removed from the extension in PHP6. This extension provides PHP built-in PDO class for accessing the database. Different databases use the same method name to solve the problem of inconsistent database connections.
I configured it for development in windows.
■ PDO goals
  • 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.
  • ■ Features of PDO:
  • 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.

    ■ Install PDO
    I am using the PDO extension developed in WINDOWS. If you want to install the configuration in Linux, go to other places to find it.
    Version requirements:
    Php5.1 and later versions are included in the program package;
    Php5.0.x is downloaded to pecl.php.net and put it in your extension library, which is the ext folder of the PHP folder;
    In the manual, versions earlier than 5.0 cannot run PDO extensions.

    Configuration:
    Modify Your php. ini configuration file to support pdo. (php. if you do not understand ini, first make it clear that you need to modify the php code displayed by calling your phpinfo () function. ini)
    Set
    Remove the semicolon before extension = php_pdo.dll, which is the annotation symbol of the php configuration file. This extension is required.
    Down
    ; Extension = php_pdo.dll
    ; Extension = php_pdo_firebird.dll
    ; Extension = php_pdo_informix.dll
    ; Extension = php_pdo_mssql.dll
    ; Extension = php_pdo_mysql.dll
    ; Extension = php_pdo_oci.dll
    ; Extension = php_pdo_oci8.dll
    ; Extension = php_pdo_odbc.dll
    ; Extension = php_pdo_pgsql.dll
    ; Extension = php_pdo_sqlite.dll
    The databases corresponding to each extension are:

    Driver name Supported databases
    PDO_DBLIB FreeTDS/Microsoft SQL Server/Sybase
    PDO_FIREBIRD Firebird/Interbase 6
    PDO_INFOR
  • 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.