Db/Adapter/Db2.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Db
- Subpackage
- Adapter
- Version
- $Id$
Package: Zend_Db\AdapterClass for connecting to SQL databases and performing common operations.
- Parent(s)
- \Zend_Db_Adapter_Abstract
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties
array $_config = array('dbname' => null, 'username' => null, 'password' => null, 'host' => 'localhost', 'port' => '50000', 'protocol' => 'TCPIP', 'persistent' => false, 'os' => null, 'schema' => null)
User-provided configuration.
Basic keys are:
username => (string) Connect to the database as this username.
password => (string) Password associated with the username.
host => (string) What host to connect to (default 127.0.0.1)
dbname => (string) The name of the database to user
protocol => (string) Protocol to use, defaults to "TCPIP"
port => (integer) Port number to use for TCP/IP if protocol is "TCPIP"
persistent => (boolean) Set TRUE to use a persistent connection (db2_pconnect)
os => (string) This should be set to 'i5' if the db is on an os400/i5
schema => (string) The default schema the connection should use
Default valuearray('dbname' => null, 'username' => null, 'password' => null, 'host' => 'localhost', 'port' => '50000', 'protocol' => 'TCPIP', 'persistent' => false, 'os' => null, 'schema' => null)
Details- Type
- array
string $_defaultStmtClass = 'Zend_Db_Statement_Db2'
Default class name for a DB statement.
Default value'Zend_Db_Statement_Db2'
Details- Type
- string
$_isI5 = false
Default valuefalse
Details- Type
- n/a
array $_numericDataTypes = 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)
Keys are UPPERCASE SQL datatypes or the constants
Zend_Db::INT_TYPE, Zend_Db::BIGINT_TYPE, or Zend_Db::FLOAT_TYPE.
Values are:
0 = 32-bit integer
1 = 64-bit integer
2 = float or decimal
Default valuearray(\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)
Details- Type
- array
Methods
_i5listTables( $schema = null) : array
Db2 On I5 specific method
Returns a list of the tables in the database .
Used only for DB2/400.
ParametersName | Type | Description |
---|
$schema | | |
---|
Returns_quote(string $value) : string
ParametersName | Type | Description |
---|
$value | string | Raw string |
---|
ReturnsType | Description |
---|
string | Quoted string |
describeTable(string $tableName, string $schemaName = null) : array
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
ParametersName | Type | Description |
---|
$tableName | string | |
---|
$schemaName | string | OPTIONAL |
---|
ReturnslastInsertId(string $tableName = null, string $primaryKey = null, string $idType = null) : string
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.
ParametersName | Type | Description |
---|
$tableName | string | OPTIONAL |
---|
$primaryKey | string | OPTIONAL |
---|
$idType | string | OPTIONAL used for i5 platform to define sequence/idenity unique value |
---|
ReturnslastSequenceId(string $sequenceName) : string
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.
ParametersName | Type | Description |
---|
$sequenceName | string | |
---|
Returnslimit(string $sql, integer $count, integer $offset = 0) : string
Adds an adapter-specific LIMIT clause to the SELECT statement.
ParametersName | Type | Description |
---|
$sql | string | |
---|
$count | integer | |
---|
$offset | integer | OPTIONAL |
---|
Returns listTables(string $schema = null) : array
Returns a list of the tables in the database.
ParametersName | Type | Description |
---|
$schema | string | OPTIONAL |
---|
Returns nextSequenceId(string $sequenceName) : string
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.
ParametersName | Type | Description |
---|
$sequenceName | string | |
---|
Returnsprepare(string $sql) : \Zend_Db_Statement_Db2
Returns an SQL statement for preparation.
ParametersName | Type | Description |
---|
$sql | string | The SQL statement with placeholders. |
---|
Returns supportsParameters(string $type) : bool
Check if the adapter supports real SQL parameters.
ParametersName | Type | Description |
---|
$type | string | 'positional' or 'named' |
---|
Returns