DboDb2 Class Reference

Public Member Functions | |
| _execute ($sql) | |
| begin (&$model) | |
| boolean ($data) | |
| column ($real) | |
| commit (&$model) | |
| connect () | |
| & | describe (&$model) |
| disconnect () | |
| fetchResult () | |
| lastAffected () | |
| lastError () | |
| lastInsertId ($source=null) | |
| lastNumRows () | |
| limit ($limit, $offset=null) | |
| listSources () | |
| name ($data) | |
| resultSet (&$results, $sql=null) | |
| rollback (&$model) | |
| update (&$model, $fields=array(), $values=array()) | |
| value ($data, $column=null, $safe=false) | |
Public Attributes | |
| $_baseConfig | |
| $_resultMap = array() | |
| $columns | |
| $description = 'IBM DB2 DBO Driver' | |
| $endQuote = '' | |
| $startQuote = '' | |
Detailed Description
Definition at line 41 of file dbo_db2.php.
Member Function Documentation
| DboDb2::_execute | ( | $ | sql | ) |
Executes given SQL statement. We should use prepare / execute to allow the database server to reuse its access plan and increase the efficiency of your database access
- Parameters:
-
string $sql SQL statement
- Returns:
- resource Result resource identifier protected
Definition at line 160 of file dbo_db2.php.
References DboSource::$index.
Referenced by connect().
| DboDb2::begin | ( | &$ | model | ) |
Begins a transaction. Returns true if the transaction was started successfully, otherwise false.
- Parameters:
-
unknown_type $model
- Returns:
- boolean True on success, false on fail (i.e. if the database/model does not support transactions).
Reimplemented from DboSource.
Definition at line 317 of file dbo_db2.php.
| DboDb2::boolean | ( | $ | data | ) |
Not sure about this one, MySQL needs it but does ODBC? Safer just to leave it Translates between PHP boolean values and MySQL (faked) boolean values
- Parameters:
-
mixed $data Value to be translated
- Returns:
- mixed Converted boolean value
Reimplemented from DboSource.
Definition at line 296 of file dbo_db2.php.
Referenced by value().
| DboDb2::column | ( | $ | real | ) |
Converts database-layer column types to basic types
- Parameters:
-
string $real Real database-layer column type (i.e. "varchar(255)")
- Returns:
- string Abstract column type (i.e. "string")
Reimplemented from DataSource.
Definition at line 476 of file dbo_db2.php.
References limit(), and name().
Referenced by describe().
| DboDb2::commit | ( | &$ | model | ) |
Commit a transaction
- Parameters:
-
unknown_type $model
- Returns:
- boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).
Reimplemented from DboSource.
Definition at line 334 of file dbo_db2.php.
| DboDb2::connect | ( | ) |
Connects to the database using options in the given configuration array.
- Returns:
- boolean True if the database could be connected, else false
Definition at line 110 of file dbo_db2.php.
References DataSource::$config, _execute(), and config().
| & DboDb2::describe | ( | &$ | model | ) |
Returns an array of the fields in given table name.
- Returns:
- array Fields in table. Keys are name and type
Definition at line 216 of file dbo_db2.php.
References column(), DboSource::fullTableName(), and DboSource::length().
| DboDb2::disconnect | ( | ) |
Disconnects from database.
- Returns:
- boolean True if the database could be disconnected, else false
Definition at line 146 of file dbo_db2.php.
| DboDb2::fetchResult | ( | ) |
Fetches the next row from the current result set Maps the records in the $result property to the map created in resultSet().
2. Gets the actual values.
- Returns:
- unknown
Definition at line 554 of file dbo_db2.php.
References DboSource::$index.
| DboDb2::lastAffected | ( | ) |
Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
- Returns:
- integer Number of affected rows
Definition at line 399 of file dbo_db2.php.
| DboDb2::lastError | ( | ) |
Returns a formatted error message from previous database operation. DB2 distinguishes between statement and connnection errors so we must check for both.
- Returns:
- string Error message with error number
Definition at line 385 of file dbo_db2.php.
| DboDb2::lastInsertId | ( | $ | source = null |
) |
Returns the ID generated from the previous INSERT operation.
- Parameters:
-
unknown_type $source
- Returns:
- in
Reimplemented from DataSource.
Definition at line 423 of file dbo_db2.php.
References DboSource::fetchRow().
| DboDb2::lastNumRows | ( | ) |
Returns number of rows in previous resultset. If no previous resultset exists, this returns false.
- Returns:
- integer Number of rows in resultset
Definition at line 411 of file dbo_db2.php.
| DboDb2::limit | ( | $ | limit, | |
| $ | offset = null | |||
| ) |
Returns a limit statement in the correct format for the particular database.
- Parameters:
-
integer $limit Limit of results returned integer $offset Offset from which to start results
- Returns:
- string SQL limit/offset statement
Reimplemented from DboSource.
Definition at line 438 of file dbo_db2.php.
Referenced by column().
| DboDb2::listSources | ( | ) |
Returns an array of all the tables in the database. Should call parent::listSources twice in the method: once to see if the list is cached, and once to cache the list if not.
- Returns:
- array Array of tablenames in the database
Definition at line 195 of file dbo_db2.php.
| DboDb2::name | ( | $ | data | ) |
Returns a quoted name of $data for use in an SQL statement.
- Parameters:
-
string $data Name (table.field) to be prepared for use in an SQL statement
- Returns:
- string Quoted for MySQL
Reimplemented from DboSource.
Definition at line 242 of file dbo_db2.php.
Referenced by column().
| DboDb2::resultSet | ( | &$ | results, | |
| $ | sql = null | |||
| ) |
Maps a result set to an array so that returned fields are grouped by model. Any calculated fields, or fields that do not correspond to a particular model belong under array key 0.
1. Gets the column headers
Post.id Post.title
[0] => Array ( [0] => Post [1] => id )
[1] => Array ( [0] => Post [1] => title )
- Parameters:
-
unknown_type $results
Definition at line 541 of file dbo_db2.php.
| DboDb2::rollback | ( | &$ | model | ) |
Rollback a transaction
- Parameters:
-
unknown_type $model
- Returns:
- boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).
Reimplemented from DboSource.
Definition at line 352 of file dbo_db2.php.
| DboDb2::update | ( | &$ | model, | |
| $ | fields = array(), |
|||
| $ | values = array() | |||
| ) |
Removes Identity (primary key) column from update data before returning to parent
- Parameters:
-
Model $model array $fields array $values
- Returns:
- array
Reimplemented from DataSource.
Definition at line 368 of file dbo_db2.php.
| DboDb2::value | ( | $ | data, | |
| $ | column = null, |
|||
| $ | safe = false | |||
| ) |
Returns a quoted and escaped string of $data for use in an SQL statement.
- Parameters:
-
string $data String to be prepared for use in an SQL statement string $column The column into which this data will be inserted
- Returns:
- string Quoted and escaped
- Todo:
- Add logic that formats/escapes data based on column type
Definition at line 254 of file dbo_db2.php.
References boolean().
Member Data Documentation
| DboDb2::$_baseConfig |
Initial value:
array(
'persistent' => true,
'login' => 'db2inst1',
'password' => '',
'database' => 'cake',
'schema' => '',
'hostname' => '127.0.0.1',
'port' => '50001',
'encoding' => 'UTF-8',
'cataloged' => true,
'autocommit' => true
)
Reimplemented from DataSource.
Definition at line 66 of file dbo_db2.php.
| DboDb2::$_resultMap = array() |
Definition at line 104 of file dbo_db2.php.
| DboDb2::$columns |
Initial value:
array(
'primary_key' => array('name' => 'not null generated by default as identity (start with 1, increment by 1)'),
'string' => array('name' => 'varchar', 'limit' => '255'),
'text' => array('name' => 'clob'),
'integer' => array('name' => 'integer', 'limit' => '10', 'formatter' => 'intval'),
'float' => array('name' => 'double', 'formatter' => 'floatval'),
'datetime' => array('name' => 'timestamp', 'format' => 'Y-m-d-H.i.s', 'formatter' => 'date'),
'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d-H.i.s', 'formatter' => 'date'),
'time' => array('name' => 'time', 'format' => 'H.i.s', 'formatter' => 'date'),
'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'),
'binary' => array('name' => 'blob'),
'boolean' => array('name' => 'smallint', 'limit' => '1')
)
Definition at line 86 of file dbo_db2.php.
| DboDb2::$description = 'IBM DB2 DBO Driver' |
| DboDb2::$endQuote = '' |
| DboDb2::$startQuote = '' |
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/model/datasources/dbo/dbo_db2.php