Public Member Functions | Protected Member Functions | Protected Attributes

Zend_Db_Adapter_Db2 Class Reference

Inheritance diagram for Zend_Db_Adapter_Db2:
Zend_Db_Adapter_Abstract

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

Detailed Description

Definition at line 46 of file Db2.php.


Member Function Documentation

_beginTransaction (  ) [protected]

Begin a transaction.

Returns:
void

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 570 of file Db2.php.

_commit (  ) [protected]

Commit a transaction.

Returns:
void

See also:
Zend_Db_Adapter_Db2_Exception

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 580 of file Db2.php.

_connect (  ) [protected]

Creates a connection resource.

Returns:
void

See also:
Zend_Db_Adapter_Db2_Exception
Zend_Db_Adapter_Db2_Exception

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 119 of file Db2.php.

_determineI5 (  ) [protected]

Check the connection parameters according to verify type of used OS

Returns:
void

Definition at line 753 of file Db2.php.

_getExecuteMode (  )

Gets the execution mode

Returns:
int the execution mode (DB2_AUTOCOMMIT_ON or DB2_AUTOCOMMIT_OFF)

Definition at line 240 of file Db2.php.

_i5listTables ( schema = null ) [protected]

Db2 On I5 specific method

Returns a list of the tables in the database . Used only for DB2/400.

Returns:
array

Definition at line 778 of file Db2.php.

_quote ( value ) [protected]

Quote a raw string.

Parameters:
string$valueRaw string
Returns:
string Quoted 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.

Definition at line 273 of file Db2.php.

_rollBack (  ) [protected]

Rollback a transaction.

Returns:
void

See also:
Zend_Db_Adapter_Db2_Exception

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 600 of file Db2.php.

_setExecuteMode ( mode )
Parameters:
integer$mode
Returns:
void

See also:
Zend_Db_Adapter_Db2_Exception

Definition at line 249 of file Db2.php.

closeConnection (  )

Force the connection to close.

Returns:
void

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 208 of file Db2.php.

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

Parameters:
string$tableName
string$schemaNameOPTIONAL
Returns:
array

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.

Definition at line 368 of file Db2.php.

getQuoteIdentifierSymbol (  )
Returns:
string

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 292 of file Db2.php.

getServerVersion (  )

Retrieve server version in PHP style

Returns:
string

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 718 of file Db2.php.

isConnected (  )

Test if a connection is active

Returns:
boolean

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 197 of file Db2.php.

isI5 (  )

Return whether or not this is running on i5

Returns:
bool

Definition at line 738 of file Db2.php.

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.

Parameters:
string$tableNameOPTIONAL
string$primaryKeyOPTIONAL
string$idTypeOPTIONAL used for i5 platform to define sequence/idenity unique value
Returns:
string

Definition at line 543 of file Db2.php.

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.

Parameters:
string$sequenceName
Returns:
string

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 492 of file Db2.php.

limit ( sql,
count,
offset = 0 
)

Adds an adapter-specific LIMIT clause to the SELECT statement.

Parameters:
string$sql
integer$count
integer$offsetOPTIONAL
Returns:
string

See also:
Zend_Db_Adapter_Db2_Exception
Zend_Db_Adapter_Db2_Exception

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.

Definition at line 655 of file Db2.php.

listTables ( schema = null )

Returns a list of the tables in the database.

Parameters:
string$schemaOPTIONAL
Returns:
array

Definition at line 312 of file Db2.php.

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.

Parameters:
string$sequenceName
Returns:
string

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 516 of file Db2.php.

prepare ( sql )

Returns an SQL statement for preparation.

Parameters:
string$sqlThe SQL statement with placeholders.
Returns:
Zend_Db_Statement_Db2

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 222 of file Db2.php.

setFetchMode ( mode )

Set the fetch mode.

Parameters:
integer$mode
Returns:
void
Exceptions:
Zend_Db_Adapter_Db2_Exception

See also:
Zend_Db_Adapter_Db2_Exception
Zend_Db_Adapter_Db2_Exception

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 621 of file Db2.php.

supportsParameters ( type )

Check if the adapter supports real SQL parameters.

Parameters:
string$type'positional' or 'named'
Returns:
bool

Reimplemented from Zend_Db_Adapter_Abstract.

Definition at line 703 of file Db2.php.


Field Documentation

$_config [protected]
Initial value:
 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.

Definition at line 65 of file Db2.php.

$_numericDataTypes [protected]
Initial value:
 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.

Definition at line 103 of file Db2.php.


The documentation for this class was generated from the following file: