PHP5 data object (PDO) abstraction layer and Oracle

Source: Internet
Author: User
Tags odbc connection php error
The original developer at the data abstraction layer of a new PHP Data Object (PDO) briefly introduces this abstraction layer, focusing on running with Oracle. Required PHP: 5.0 needed additional: Oracle8 or later client library download for Oracle PDO (Win... "> <LINKhref =" http://www.php100.com//s

 

The original developer at the data abstraction layer of a new PHP Data Object (PDO) 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 expansion 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.

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.

Unix/Linux installation

If you have not tried PHP 5 before, take a moment to read the "news" and various statements. On UNIX computers, you may need to install or upgrade libxml2. without libxml2, the "pear" package management tool cannot run, and you may encounter many difficulties when installing PDO. Obtain PHP 5 and compile and install it. Make sure that the specified prefix is not/usr/local/, so that it will not conflict with PHP 4 installation:

%./Configure -- prefix =/usr/local/php5 -- with-zlib [specify other options here] % make install

Now you can use the pear tool to obtain and install PDO and the Oracle driver for PDO. Because PDO is currently marked as alpha, the pear tool does not download the package by default. Add the suffix "-alpha" after the package name to notify the pear tool to install alpha:

% PATH="/usr/local/php5/bin:$PATH"% pear install PDO-alpha

You need to inform PHP to load the PDO driver from the PHP. ini file dedicated to php 5. If you use the same prefix as I used, PHP will search for the php. ini file in/usr/local/php5/lib/php. ini. Add the following lines to the file:
Extension = pdo. so
Now you need to obtain a specific database driver. for Oracle, this specific program is called PDO_OCI. In shell, type:
% Pear install PDO_OCI-alpha
This driver also needs to be loaded from the php. ini file; add the downstream to the row added above:
Extension = pdo_oci.so
Check now to make sure it can run:
% Php-m
In the module list, you should see PDO and PDO_OCI.

What's wrong with the firewall?

If you are behind the firewall, you may encounter some problems when using the pear installer to obtain the package. In this case, you can follow the instructions below to manually download and install these packages:

% wget http://pecl.php.net/get/PDO% pear install PDO-0.1.1.tgz

[Add extension = pdo. so to php. ini]

% wget http://pecl.php.net/get/PDO_OCI% pear install PDO_OCI-0.1.tgz

[Add extension = pdo_oci.so to php. ini]
In both cases, you must first call "pear install" (followed by the downloaded real package). the version number in the preceding example is the latest in this article, but it will change as development continues.

Windows installation

If you are running Windows, follow the instructions below:
• Get PHP 5 from the http://www.php.net/downloads.php#v5 and decompress it to C: \ php5.
• Obtain PDO and PDO_OCI from the http://snaps.php.net/win32/PECL_5_0/php_pdo.dll and http://snaps.php.net/win32/PECL_5_0/php_pdo_oci.dll, respectively, and place them into C: \ php5 \ ext. Alternatively, you can find all these PDO drivers and all Windows versions of PECL packages in the "PECL module set for PHP 5.0.0" zip file listed on the PHP 5 download page.
• Edit the C: \ php5 \ php. ini file and add the following content:
Extension = php_pdo.dll
Extension = php_pdo_oci.dll
When editing the php. ini file, it is important to load the PDO extension before any other PDO driver. Otherwise, the initialization fails (in this case, an error occurs ).
If the Windows directory contains a Global PHP. ini file of php 4, you may encounter problems. The best solution is to move the php. ini file so that it is in the same folder as PHP 4 SAPI to isolate PHP 4 installation; for example, move it to the same folder as php4apache. dll in the same folder. Note that not all documents in PHP 5 are up-to-date. the recommended installation process is described above, as stated in the install.txt file, do not copy any DLL to the windows folder or system folder-any content is self-contained. If you are running apache and encounter an error where DLL cannot be loaded, check whether C: \ php5 is added to PATH. Also, note that the CGI version of PHP 5 is now named php-cgi.exe.

Connect to PDO

First, create an instance of the PDO class and use it as a database handle. It doesn't matter which basic driver to use; you always need to use the PDO class name. The first parameter of the constructor is the data source name (DSN), the second parameter is the user name, and the third parameter is the password of the user name. The PDO naming convention of DSN is the name of the PDO driver, followed by a colon, followed by optional driver-specific information. In our example, the OCI driver is loaded without specifying any other information. This will use the default database. For other drivers, such as ODBC drivers, all content after the first Colon will be used as odbc dsn. The MySQL driver will also explain its DSN in different ways.
If the driver cannot be loaded or the connection fails, a PDOException is thrown so that you can decide how to handle the fault best.

getMessage();    }?>

You can specify two optional parameters in the connection string. The first parameter is the database name and the second parameter is the character set. these parameters correspond to the third and fourth optional parameters, you may have used the last two parameters in the oci8 extension function ociconnect () or ociplogon. To connect to a specific database using a specific character set, you can perform the following operations:

getMessage();    }?>

It is not helpful to omit the try... catch control structure. If no exception handling is defined at a higher level of the application, the script will be terminated if a database connection cannot be established.

Connection Management

Currently, PDO does not perform any connection management. Therefore, each "new PDO" call creates a new database connection. This connection will be released when the $ dbh variable is out of bounds or when you specify a NULL value for it.

GetMessage (); exit;} // perform some operations on the database here //... // now, the connection is released. $ dbh = null;?>

We plan to add the connection cache function for PDO in the near future. in terms of the current oci8 extension, the connection to the existing server will be reused and idle logins will be reused in these connections. When running in cache connection mode, when $ dbh is released as shown in the code snippet above, the login will be marked as reusable by other connections.
If you use an ODBC driver to access Oracle, you may be happy to note that the PDO_ODBC driver supports the ODBC Connection pool by default.

Use PDO

The best way to understand a programming API is to use it, so let's take a look at the demo that comes with it to learn how to perform batch update (the code is as follows ).

exec("CREATE TABLE CREDITS (extension varchar(255),name varchar(255))");// start a transaction$dbh->beginTransaction();// prepare to insert a large quantitiy of data$stmt = $dbh->prepare("INSERT INTO CREDITS (extension, name) VALUES (:extension, :name)");// bind the inputs to php variables; specify that the data will be strings// with a maximum length of 64 characters$stmt->bindParam(':extension',$extension,PDO_PARAM_STR, 64);$stmt->bindParam(':name', $name,PDO_PARAM_STR, 64);// Open the .csv file for import$fp = fopen('credits.csv', 'r');while (!feof($fp)) {list($extension, $name) = fgetcsv($fp, 1024);$stmt->execute();}fclose($fp);// Commit the changes$dbh->commit();?>

Since we have successfully connected to Oracle, now we can create a table to save some data. For this example, we use some PHP extensions and their authors, and input the content into a database. The exec () method of the database handle object can be used to issue a quick one-time query that does not return the result set. Therefore, we use this method to issue a create table query here.
To make the example more natural, I extracted the extension and its author information from the PHP source code and stored it in a CSV file (see "related attachment: credits.csv "). This represents a common situation: importing data in batches from CSV files. In our example, we fully utilize the Oracle pre-processing statement and bind parameters to obtain an efficient data import script. Before describing this example, it is necessary to understand how PDO processes transactions.

Transaction processing in PDO

Oracle has a sensitive default operation mode: When you connect, it will be in an implicit transaction, and the changes will not take effect until the transaction is committed. In addition to the standard advantages of transaction processing (atomicity, consistency, isolation, and durability-ACID), the database server does not need to re-build indexes and other internal structures after each update; it can be delayed after submission. This will accelerate code execution. Oracle is really good.
Unfortunately, not every database vendor supports transaction processing, and because PDO is designed to support these transactions in a relatively portable manner, therefore, it runs in auto-submit mode by default. When the automatic submission mode is enabled, the database driver implicitly submits each successful update. When you call $ dbh-> beginTransaction (), the automatic submission is closed until $ dbh-> commit () or $ dbh-> rollBack () is called () it will be re-enabled, depending on how your code is written. If the underlying driver does not support transaction processing, a PDOException is thrown.
If a problem occurs and a PHP error occurs, your script exits and the transaction is waiting for approval. or when you close the database handle, PDO automatically calls $ dbh-> rollBack () for any pending transactions (). This behavior reduces the possibility of submitting undefined or corrupted data to the database, which is the standard semantics used to process abandoned transactions.

Pre-processing statements and stored procedures

PDO supports using the placeholder syntax for Oracle style naming to help set variables to preprocessing statements in SQL (similar to ocibindbyname () in the oci8 extension ). PDO also provides name placeholder simulation for other databases (such as ODBC). It can even simulate preprocessing statements and bind parameters for databases (such as MySQL) that are not born to support this concept. This is a positive step forward for PHP, because it enables developers to write "enterprise-level" database applications using PHP without having to pay special attention to the capabilities of the database platform.
The PDO preprocessing statement is very simple. you can call the prepare () method of the database handle. It returns a statement handle object, and you can use this object to bind parameters and execute statements. In this example, we will define two placeholder names: ": extension" and ": name. the PHP extension name in the CSV file corresponds to the name of one of the authors.

$stmt = $dbh->prepare("INSERT INTO CREDITS (extension, name) VALUES (:extension, :name)");

After the statement is preprocessed, we use the bindParam () method to associate these naming parameters with the PHP variable names "$ extension" and "$ name" (which are associated with ocibindbyname () ). We will also notify Oracle that the data will be formatted as a string with a maximum length of 64 characters.

$stmt->bindParam(':extension', $extension, PDO_PARAM_STR, 64);$stmt->bindParam(':name',      $name,      PDO_PARAM_STR, 64);

Now we are ready to insert data-we only need to open the CSV file and obtain data from it. You can perform this operation quite simply by using the fopen () and fgetcsv () functions. Then, we can use the PHP list () constructor to directly specify the CSV columns to the variables "$ extension" and "$ name ". Because these variables have been bound to the statement, all we need to do now is call the execute () method of the statement object to execute the insert. This method is convenient and fast-there are only two rows in each iteration loop during transaction processing. At the end of the file, we can use the commit () method of the database handle to submit these changes immediately.
If you only want to pass the input parameters and many of them need to be passed, you will find the shortcut syntax shown below very helpful; this syntax allows you to save calls to $ stmt-> bindParam.

$stmt = $dbh->prepare("INSERT INTO CREDITS (extension, name) VALUES (:extension, :name)");$stmt->execute(array(':extension' => $extension, ':name' => $name));

You can also use bindParam to set input/output parameters for stored procedures. The syntax is identical, but the query is different. The following code demonstrates how to call a stored procedure named "sp_add_item" to set $ item_name for the input, and then update $ error_code when the stored procedure returns.

$stmt = $dbh->prepare("begin sp_add_item(:item_name, :error_code); end");$stmt->bindParam(':item_name', $item_name, PDO_PARAM_STR,  12);$stmt->bindParam(':error_code', $error_code, PDO_PARAM_STR, 12);$stmt->execute();
Capture data

Using PDO to capture data is similar to inserting or updating data, but after you execute the query, you will repeatedly call the fetch () method to obtain the next row of the result set. The simplest case is as follows. it is worth noting that you can also bind parameters to queries to control content such as the WHERE clause; the syntax for executing this operation is exactly the same as the bindParam () code we have seen.

$stmt = $dbh->prepare("SELECT extension, name from CREDITS");if ($stmt->execute()) {while ($row = stmt->fetch()) {print_r($row);    }}

PDO supports different crawling policies that differ in convenience and performance. by specifying one of the following options as a parameter of the fetch () method, you can change the return value to adapt to your syntax:
• PDO_FETCH_NUM-each row is crawled and returns an array indexed by column position, which is based on 0 (the first column is 0th elements ).

while ($row = $stmt->fetch(PDO_FETCH_NUM)) {printf("Extension %s, by %s", $row[0], $row[1]);}

• PDO_FETCH_ASSOC-each row is crawled based on the column name in the row set and an array indexed by column name is returned.

while ($row = $stmt->fetch(PDO_FETCH_ASSOC)) {echo "Extension $row[EXTENSION] by $row[NAME]";}

• PDO_FETCH_BOTH-an array indexed by column position and by column name is returned for each row capture. That is, the direct combination of the above two cases. If the capture mode is not specified, this mode is the default mode.
• PDO_FETCH_OBJ-an anonymous object is returned for each row capture. Its attribute name corresponds to the column name.

while ($row = $stmt->fetch(PDO_FETCH_ASSOC)) {echo "Extension {$row->EXTENSION} by {$row->NAME}";}

• PDO_FETCH_LAZY-each row captures and returns an overloaded object of the referenced statement object. This "looks" like a combination of PDO_FETCH_OBJ and PDO_FETCH_BOTH. these variables are created only when you access PHP variables in the script.
• PDO_FETCH_BOUND-captures each row and returns TRUE. This method is very useful when you bind an output column. it can avoid creating any unnecessary arrays or objects. (See the following example ).
No matter which crawling policy you use, when no other row can be crawled, the fetch () method returns FALSE.
Now I want to talk about some tips. if you need to adjust the script performance at last, these skills may be helpful to you. But let's give you one piece of advice: avoid immature optimization like avoiding plague. You should always choose the most clear and maintainable solution. Remember, in a typical Web application, you cannot measure the differences between different capture modes unless the script processes many lines. I will repeat it again: the performance difference between capture modes is very small-please use the mode that best suits your code.
Remember that using PDO_FETCH_NUM is the least expensive, because accessing column data is only a simple numerical query. PDO_FETCH_OBJ enables you to use the OO syntax to access the dataset columns as object attributes. However, each attribute access involves an additional hash query, the cost of using it is basically the same as that of PDO_FETCH_ASSOC. In each of these modes, the entire row is copied to occupy a little more memory.
Many database drivers capture and cache a certain number of rows in advance. Every time PHP accesses a column in such a row, it needs to copy it to its own dedicated memory area. If your query involves many rows and you only need to access specific columns of a given row based on some complicated logic, you will find that PDO_FETCH_LAZY is a useful method to avoid using a lot of memory, because it only copies a given column when you access it. When using this method, note that each fetch () the crawled "inert object" is the same object used during each iteration (to reduce the overhead of each creation/destruction ). This implies that you cannot simply store the object for future comparison, because it will still reference the current row of the statement-the part you need to manually copy.
The last mode is PDO_FETCH_BOUND, which tells PDO that you have bound all columns to the PHP variable, in addition, you do not need to perform any operations except to notify you when it reaches the end of the row set. The bound output column is similar to the bound input parameter in concept, but the bound output column can be used for all database drivers. You can bind the PHP variable to the name column. PDO updates the variable every time execute () is called. This technology can be used to shave off some virtual machine operation codes for each column and line in the result set (this code is slower than the native code ). The disadvantage of this technology is that it may make your code difficult to trace (also known as the WTF coefficient is high), you need to be careful when using variable names. The following code illustrates how to bind an output column. Note that you do not need to specify PDO_FETCH_BOUND to use $ stmt-> bindColumn (); PDO_FETCH_BOUND is only an optimization for your understanding that only bound values can be used.

$stmt = $dbh->prepare("SELECT extension, name from CREDITS");if ($stmt->execute()) {$stmt->bindColumn('EXTENSION', $extension);$stmt->bindColumn('NAME',      $name);while ($stmt->fetch(PDO_FETCH_BOUND)) {echo "Extension:$extension, Author:$name\n";    }}
Portability

Case-sensitive columns
PDO is designed to make scripts that use portable SQL run well and can be transplanted. All queries mentioned in this article (except for calling stored procedures) have the same running performance when using any PDO driver-including all bound input variables and bound output columns.
But there is a conversion problem-when you use PDO_FETCH_ASSOC to capture data, different drivers will return different column names in different ways-some will convert the column names to uppercase, and some to lowercase, some will make it show the style specified in the query. This is a potential problem for PHP scripts because the array keys are case sensitive. PDO provides a compatibility attribute to help standardize the script results. The following small code snippet is the portable version of the above PDO_FETCH_BOUND example, because the setAttribute () method call instructs PDO to convert all the retrieved column names to uppercase:

$dbh = new PDO('OCI:', 'scott', 'tiger');$dbh->setAttribute(PDO_ATTR_CASE, PDO_CASE_UPPER);stmt = $dbh->prepare("SELECT extension, name from CREDITS");if ($stmt->execute()) {$stmt->bindColumn('EXTENSION', $extension);$stmt->bindColumn('NAME',      $name);while ($stmt->fetch(PDO_FETCH_BOUND)) {echo "Extension:$extension, Author:$name\n";    }}

In addition to PDO_CASE_UPPER, PDO_CASE_LOWER (which converts the column name to lowercase) and PDO_CASE_NATURAL (which is the default option to keep the column in the form returned by the database driver ).
Handle errors and errors
Another challenge for porting scripts is to handle different types of error messages returned from various database processors. some databases have poor support for programmatic error handling, other databases have rich error codes. As long as it works, PDO will provide a unified error code for your script, so that you do not have to worry about portability. Of course, PDO also provides the driver with native error code and error messages, in case you need to use it for diagnosis or the error code ING is incomplete.
Another consistency problem that troubles PHP database extensions is the consistency of error handling policies: some extensions return error code that requires you to manually capture error strings, while some other extensions only issue PHP warnings. PDO allows you to select one of the following three different error handling policies:
• PDO_ERRMODE_SILENT
This is the default mode. it only uses the statement and the errorCode () and errorInfo () methods of the database handle object to set the error code to be checked.

If (! $ Dbh-> exec ($ SQL) {echo $ dbh-> errorCode (). ""; $ info = $ dbh-> errorInfo (); // $ info [0] = $ dbh-> errorCode () the unified error code // $ info [1] is the driver-specific error code // $ info [2] is the driver-specific error string}


PDO_ERRMODE_WARNING
In addition to setting error codes, PDO also issues a PHP warning. you can use a common PHP error handler to capture this warning, and centrally apply any error handling/record policies you have prepared for the application, or simply display the error in the browser (useful during internal testing ).

PDO_ERRMODE_EXCEPTION
In addition to setting the error code, PDO throws a PDOException and sets its attribute to include the error code and information. Then, you can capture the exception at a higher level of the code and use the global exception handler to capture the exception, or terminate the script without processing it (at this time, any pending transactions will be rolled back ).

Try {$ dbh-> exec ($ SQL);} catch (PDOException $ e) {// display the warning message print $ e-> getMessage (); $ info = $ e-> errorInfo; // $ info [0] = $ e-> code; uniied error code // $ info [1] is the driver-specific error code // $ info [2] is the driver-specific error string}

Note that, compared to warnings or exceptions, silent mode has the least resources for running errors, but to get this speed, you sacrifice some simplicity and become a little complicated.
The unified error code table currently contains the following constants: PDO_ERR_NONE, PDO_ERR_CANT_MAP, PDO_ERR_SYNTAX, PDO_ERR_CONSTRAINT, begin, primary, primary, PDO_ERR_MISMATCH, primary, PDO_ERR_DISCONNECTED.
The meaning represented by these constants can be understood literally, except for the PDO_ERR_CANT_MAP code. this is a PDO-specific code, that is, it cannot map the driver-specific code to the unified error code, therefore, you should query the specific driver code returned by the errorInfo () method to obtain more information.
Data type
PDO is of unknown type to some extent, so it prefers to represent data as a string rather than converting it to an integer or double-precision type. At this point, you may be confused about this, but the reason is very simple: the string type is the most accurate type, which has the widest application scope in PHP; premature data conversion to integers or double precision may result in truncation or rounding errors. By extracting data as strings, PDO provides some script control for you. you can use common PHP conversion tools (such as conversions and implicit conversions during mathematical operations) to control how to perform conversion and when to perform conversion.
NULL
If a column in the result set contains a NULL value, PDO maps it to a PHP null value. Oracle converts NULL strings to NULL when returning data to PDO, but no other database supported by PHP does. This causes portability problems. PDO provides a driver-level property PDO_ATTR_ORACLE_NULLS that simulates this behavior for other data drivers:

$ Dbh = new PDO ('oci: ', 'Scott', 'Tiger '); $ dbh-> setAttribute (PDO_ATTR_ORACLE_NULLS, true ); // now, the // NULL string in any statement opened by $ dbh will be converted to NULL.
POD status quo and future

PDO is still quite immature, but it will become mature quickly. At the time of writing this article, everything I mentioned in this article can be applied to Oracle 8 or later (tested on Oracle 8.0 and 9.2) through the PDO_OCI driver ).
The following features are planned to be available soon:
1. use LOB support for PHP stream. By binding parameters, you can pass any stream resources (such as files, sockets, HTTP resources, compressed/filtered streams) as input or output parameters to the query running on LOB. Similarly, output parameters of the LOB type are expressed as PHP streams, so you can use fread (), fwrite (), fseek (), and other stream functions to access these parameters. In this case, there is no LOB support in PDO.
2. persistent connections and cache preprocessing statements. Persistent connections prevent you from enabling or disabling database server connections when each page hits. The cache pre-processing statement is another step forward, which enables you to persistently maintain the pre-processing version and database handle of the query.
3. cursor. Currently, PDO only provides forward Read-only cursors, but in the future it will provide scroll cursors (supported by the basic driver), REF-CURSOR, and CURSOR-based location update, and updatable scroll cursors.
We want to enable PHP extensions by default in PHP 5.1 (far from this target), but before that, we want to make PDO run stably at PHP 5.0 release, however, the pressure in our daily work is a little too long. At the same time, the release of PDO through PECL enables us to respond when we receive the Problem Report and release the fix version according to the schedule different from the PHP 5.0 release schedule, therefore, you can use PDO before PHP 5.1 is released.
We need your feedback
If you have tried PDO and found any problems, please use our error tracking software to report it to us. If you are using an Oracle driver, use this page:
Http://pecl.php.net/bugs/report.php? Package = PDO_OCI
If you are using another driver, replace PDO_OCI in the URL with its name.
If you encounter problems when using PDO, have questions about certain features, or have feature requests, contact the pecl-dev@lists.php.net. If you want to, of course, you can also directly contact me (wez@php.net), but please note that I receive a lot of emails about PHP every day; you may find that you will receive a response faster if you contact the previous email list first.

About the Author

Wez Furlong is the technical director of Brain Room Ltd., where he not only uses PHP for Web development, but also uses it as an embedded script engine for Linux and Windows applications and systems. Wez is the core developer of PHP. it often contributes to SQLite, COM/. Net, ActivePHP, mailparse, and Streams APIs. it is the "head" of the PHP extended community library ". His consulting company's webpage is http://www.thebrainroom.net.

Resources
1. More information about the PDO package
2. report new errors? -Provide any information that may help to fix the error.
3. PHP extension for Oracle JDeveloper-This PHP extension simplifies the creation, editing, and running of PHP scripts in Oracle JDeveloper 10 GB
4. PHP roaming Guide-learn everything about PHP, from starting your first application to what future the language will have.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.