Public Member Functions | |
isConnected () | |
closeConnection () | |
prepare ($sql) | |
_getExecuteMode () | |
_setExecuteMode ($mode) | |
getQuoteIdentifierSymbol () | |
listTables ($schema=null) | |
describeTable ($tableName, $schemaName=null) | |
lastSequenceId ($sequenceName) | |
nextSequenceId ($sequenceName) | |
lastInsertId ($tableName=null, $primaryKey=null, $idType=null) | |
setFetchMode ($mode) | |
limit ($sql, $count, $offset=0) | |
supportsParameters ($type) | |
getServerVersion () | |
isI5 () | |
Protected Member Functions | |
_connect () | |
_quote ($value) | |
_beginTransaction () | |
_commit () | |
_rollBack () | |
_determineI5 () | |
_i5listTables ($schema=null) | |
_i5LastInsertId ($objectName=null, $idType=null) | |
Protected Attributes | |
$_config | |
$_execute_mode = DB2_AUTOCOMMIT_ON | |
$_defaultStmtClass = 'Zend_Db_Statement_Db2' | |
$_isI5 = false | |
$_numericDataTypes |
Definition at line 46 of file Db2.php.
_beginTransaction | ( | ) | [protected] |
_commit | ( | ) | [protected] |
Commit a transaction.
Reimplemented from Zend_Db_Adapter_Abstract.
_connect | ( | ) | [protected] |
_determineI5 | ( | ) | [protected] |
_getExecuteMode | ( | ) |
_i5listTables | ( | $ | schema = null ) |
[protected] |
_quote | ( | $ | value ) | [protected] |
Quote a raw string.
string | $value | Raw string |
Use db2_escape_string() if it is present in the IBM DB2 extension. But some supported versions of PHP do not include this function, so fall back to default quoting in the parent class.
Reimplemented from Zend_Db_Adapter_Abstract.
_rollBack | ( | ) | [protected] |
Rollback a transaction.
Reimplemented from Zend_Db_Adapter_Abstract.
_setExecuteMode | ( | $ | mode ) |
closeConnection | ( | ) |
describeTable | ( | $ | tableName, |
$ | schemaName = null |
||
) |
Returns the column descriptions for a table.
The return value is an associative array keyed by the column name, as returned by the RDBMS.
The value of each array element is an associative array with the following keys:
SCHEMA_NAME => string; name of database or schema TABLE_NAME => string; COLUMN_NAME => string; column name COLUMN_POSITION => number; ordinal position of column in table DATA_TYPE => string; SQL datatype name of column DEFAULT => string; default expression of column, null if none NULLABLE => boolean; true if column can have nulls LENGTH => number; length of CHAR/VARCHAR SCALE => number; scale of NUMERIC/DECIMAL PRECISION => number; precision of NUMERIC/DECIMAL UNSIGNED => boolean; unsigned property of an integer type DB2 not supports UNSIGNED integer. PRIMARY => boolean; true if column is part of the primary key PRIMARY_POSITION => integer; position of column in primary key IDENTITY => integer; true if column is auto-generated with unique values
string | $tableName | |
string | $schemaName | OPTIONAL |
To avoid case issues, fetch using FETCH_NUM
The ordering of columns is defined by the query so we can map to variables to improve readability
In IBM DB2, an column can be IDENTITY even if it is not part of the PRIMARY KEY.
Reimplemented from Zend_Db_Adapter_Abstract.
getQuoteIdentifierSymbol | ( | ) |
getServerVersion | ( | ) |
isConnected | ( | ) |
isI5 | ( | ) |
lastInsertId | ( | $ | tableName = null , |
$ | primaryKey = null , |
||
$ | idType = null |
||
) |
Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.
As a convention, on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence from the arguments and returns the last id generated by that sequence. On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method returns the last value generated for such a column, and the table name argument is disregarded.
The IDENTITY_VAL_LOCAL() function gives the last generated identity value in the current process, even if it was for a GENERATED column.
string | $tableName | OPTIONAL |
string | $primaryKey | OPTIONAL |
string | $idType | OPTIONAL used for i5 platform to define sequence/idenity unique value |
lastSequenceId | ( | $ | sequenceName ) |
Return the most recent value from the specified sequence in the database. This is supported only on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2). Other RDBMS brands return null.
string | $sequenceName |
Reimplemented from Zend_Db_Adapter_Abstract.
limit | ( | $ | sql, |
$ | count, | ||
$ | offset = 0 |
||
) |
Adds an adapter-specific LIMIT clause to the SELECT statement.
string | $sql | |
integer | $count | |
integer | $offset | OPTIONAL |
DB2 does not implement the LIMIT clause as some RDBMS do. We have to simulate it with subqueries and ROWNUM. Unfortunately because we use the column wildcard "*", this puts an extra column into the query result set.
Reimplemented from Zend_Db_Adapter_Abstract.
listTables | ( | $ | schema = null ) |
nextSequenceId | ( | $ | sequenceName ) |
Generate a new value from the specified sequence in the database, and return it. This is supported only on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2). Other RDBMS brands return null.
string | $sequenceName |
Reimplemented from Zend_Db_Adapter_Abstract.
prepare | ( | $ | sql ) |
Returns an SQL statement for preparation.
string | $sql | The SQL statement with placeholders. |
Reimplemented from Zend_Db_Adapter_Abstract.
setFetchMode | ( | $ | mode ) |
Set the fetch mode.
integer | $mode |
Zend_Db_Adapter_Db2_Exception |
Reimplemented from Zend_Db_Adapter_Abstract.
supportsParameters | ( | $ | type ) |
Check if the adapter supports real SQL parameters.
string | $type | 'positional' or 'named' |
Reimplemented from Zend_Db_Adapter_Abstract.
$_config [protected] |
array( 'dbname' => null, 'username' => null, 'password' => null, 'host' => 'localhost', 'port' => '50000', 'protocol' => 'TCPIP', 'persistent' => false, 'os' => null, 'schema' => null )
Reimplemented from Zend_Db_Adapter_Abstract.
$_numericDataTypes [protected] |
array( Zend_Db::INT_TYPE => Zend_Db::INT_TYPE, Zend_Db::BIGINT_TYPE => Zend_Db::BIGINT_TYPE, Zend_Db::FLOAT_TYPE => Zend_Db::FLOAT_TYPE, 'INTEGER' => Zend_Db::INT_TYPE, 'SMALLINT' => Zend_Db::INT_TYPE, 'BIGINT' => Zend_Db::BIGINT_TYPE, 'DECIMAL' => Zend_Db::FLOAT_TYPE, 'NUMERIC' => Zend_Db::FLOAT_TYPE )
Reimplemented from Zend_Db_Adapter_Abstract.