CUBRID Functions (PDO_CUBRID)IntroductionPDO_CUBRID is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to CUBRID databases.
InstallationTo build the PDO_CUBRID extension, the CUBRID DBMS must be installed on the same system as PHP. PDO_CUBRID is a » PECL extension, so follow the instructions in Installation of PECL extensions to install the PDO_CUBRID extension. Issue the configure command to point to the location of the CUBRID base dir as follows: $ ./configure --with-pdo-cubrid=/path/to/CUBRID[,shared] A DLL for this PECL extension is currently unavailable. See also the building on Windows section. Detailed information about installation on Linux and Windows manually, please read build-guide.html in PECL package CUBRID for reference. PDO_CUBRID FeaturesScrollable cursorsPDO_CUBRID supports scrollable cursors. The default cursor type is forward only, and you can use parameter driver_options in PDO::prepare to change cursor type. TimeoutPDO_CUBRID supports sql statement execution timeout setting; You can use PDO::setAttribute to set timeout value. Autocommit_mode and TransactionPDO_CUBRID supports both autocommit_mode and transaction, and autocommit_mode is enabled by default. You can use PDO::setAttribute to change its state. If you use PDO::beginTransaction to begin a transaction, it will disable autocommit_mode automatically and restore it after PDO::commit or PDO::rollBack.
Multiple SQL Statements
PDO_CUBRID supports Multiple SQL statements.
Multiple SQL statements are separated by semicolons ( Schema InformationPDO_CUBRID implements PDO::cubrid_schema to get schema information. LOBsPDO_CUBRID supports BLOB/CLOB data type. The LOB in PDO is represented as a stream, so you can insert LOBs by binding a stream, and get LOBs by reading a stream returned by CUBRID PDO. For example: Example #1 Insert LOBs in CUBRID PDO
Example #2 Fetch LOBs in CUBRID PDO
Column metaThe PDOStatement::getColumnMeta in CUBRID PDO will return an associative array containing the following values:
Collection Data TypePDO_CUBRID supports SET/MULTISET/SEQUENCE data type. If you don't specify data type, the default data type is char. For example: Example #3 Insert set in CUBRID PDO with default data type.
Example #4 Specify data type when insert set in CUBRID PDO
CUBRID Bind Data Types for the fifth parameter of PDOStatement::bindParam:
Predefined ConstantsThe constants below are defined by
this driver, and will only be available when the extension has been either
compiled into PHP or dynamically loaded at runtime. In addition, these
driver-specific constants should only be used if you are using this driver.
Using driver-specific attributes with another driver may result in
unexpected behaviour. PDO::getAttribute may be used to
obtain the The following constants can be used when setting the database attribute. They can be passed to PDO::getAttribute or PDO::setAttribute.
The following constants can be used when setting the transaction isolation level. They can be passed to PDO::getAttribute or returned by PDO::setAttribute.
The following constants can be used when getting schema information. They can be passed to PDO::cubrid_schema.
|