PHP Class Horde_Db_Adapter_Oci8, horde

Author: Jan Schneider ([email protected])
Inheritance: extends Horde_Db_Adapter_Base
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_schemaClass string Schema class to use.

Public Methods

Method Description
_oracleCharsetName ( string $charset ) : string Returns the Oracle name of a character set.
adapterName ( ) : string Returns the human-readable name of the adapter. Use mixed case - one can always use downcase if needed.
addLimitOffset ( string $sql, array $options ) : string Appends LIMIT and OFFSET options to a SQL statement.
beginDbTransaction ( ) Begins the transaction (and turns off auto-committing).
commitDbTransaction ( ) Commits the transaction (and turns on auto-committing).
connect ( ) Connect to the db
disconnect ( ) Disconnect from db
execute ( string $sql, mixed $arg1 = null, string $arg2 = null, $lobs = [] ) : resource Executes the SQL statement in the context of this connection.
insert ( string $sql, array | string $arg1 = null, string $arg2 = null, string $pk = null, integer $idValue = null, string $sequenceName = null ) : integer Inserts a row into a table.
insertBlob ( string $table, array $fields, string $pk = null, integer $idValue = null ) : integer Inserts a row including BLOBs into a table.
quoteString ( string $string ) : string Quotes a string, escaping any special characters.
rollbackDbTransaction ( ) Rolls back the transaction (and turns on auto-committing). Must be done if the transaction block raises an exception or returns false.
select ( string $sql, mixed $arg1 = null, string $arg2 = null ) : Horde_Db_Adapter_Oracle_Result Returns an array of records with the column names as keys, and column values as values.
selectAll ( string $sql, mixed $arg1 = null, string $arg2 = null ) : array Returns an array of record hashes with the column names as keys and column values as values.
selectOne ( string $sql, mixed $arg1 = null, string $arg2 = null ) : array Returns a record hash with the column names as keys and column values as values.
selectValue ( string $sql, mixed $arg1 = null, string $arg2 = null ) : string Returns a single value from a record
selectValues ( string $sql, mixed $arg1 = null, string $arg2 = null ) : array Returns an array of the values of the first column in a select: selectValues("SELECT id FROM companies LIMIT 3") => [1,2,3]
supportsMigrations ( ) : boolean Does this adapter support migrations?
updateBlob ( string $table, array $fields, string | array $where = null ) Updates rows including BLOBs into a table.

Protected Methods

Method Description
_errorMessage ( array $error ) : string Creates a formatted error message from a oci_error() result hash.
_handleError ( resource $resource, string $method ) Log and throws an exception for the last error.
_prepareBlobs ( array $fields ) : array Prepares a list of field values to be consumed by insertBlob() or updateBlob().

Method Details

_errorMessage() protected method

Creates a formatted error message from a oci_error() result hash.
protected _errorMessage ( array $error ) : string
$error array Hash returned from oci_error().
return string The formatted error message.

_handleError() protected method

Log and throws an exception for the last error.
protected _handleError ( resource $resource, string $method )
$resource resource The resource (connection or statement) to call oci_error() upon.
$method string The calling method.

_oracleCharsetName() public method

Returns the Oracle name of a character set.
public _oracleCharsetName ( string $charset ) : string
$charset string A charset name.
return string Oracle-normalized charset.

_prepareBlobs() protected method

Prepares a list of field values to be consumed by insertBlob() or updateBlob().
protected _prepareBlobs ( array $fields ) : array
$fields array A hash of column names and values. BLOB columns must be provided as Horde_Db_Value_Binary objects.
return array A list of fields, blobs, and locators.

adapterName() public method

Returns the human-readable name of the adapter. Use mixed case - one can always use downcase if needed.
public adapterName ( ) : string
return string

addLimitOffset() public method

Appends LIMIT and OFFSET options to a SQL statement.
public addLimitOffset ( string $sql, array $options ) : string
$sql string SQL statement.
$options array Hash with 'limit' and (optional) 'offset' values.
return string

beginDbTransaction() public method

Begins the transaction (and turns off auto-committing).
public beginDbTransaction ( )

commitDbTransaction() public method

Commits the transaction (and turns on auto-committing).
public commitDbTransaction ( )

connect() public method

Connect to the db
public connect ( )

disconnect() public method

Disconnect from db
public disconnect ( )

execute() public method

Executes the SQL statement in the context of this connection.
public execute ( string $sql, mixed $arg1 = null, string $arg2 = null, $lobs = [] ) : resource
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
return resource

insert() public method

Inserts a row into a table.
public insert ( string $sql, array | string $arg1 = null, string $arg2 = null, string $pk = null, integer $idValue = null, string $sequenceName = null ) : integer
$sql string SQL statement.
$arg1 array | string Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
$pk string The primary key column.
$idValue integer The primary key value. This parameter is required if the primary key is inserted manually.
$sequenceName string The sequence name.
return integer Last inserted ID.

insertBlob() public method

Inserts a row including BLOBs into a table.
public insertBlob ( string $table, array $fields, string $pk = null, integer $idValue = null ) : integer
$table string The table name.
$fields array A hash of column names and values. BLOB columns must be provided as Horde_Db_Value_Binary objects.
$pk string The primary key column.
$idValue integer The primary key value. This parameter is required if the primary key is inserted manually.
return integer Last inserted ID.

quoteString() public method

Quotes a string, escaping any special characters.
public quoteString ( string $string ) : string
$string string
return string

rollbackDbTransaction() public method

Rolls back the transaction (and turns on auto-committing). Must be done if the transaction block raises an exception or returns false.

select() public method

Returns an array of records with the column names as keys, and column values as values.
public select ( string $sql, mixed $arg1 = null, string $arg2 = null ) : Horde_Db_Adapter_Oracle_Result
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
return Horde_Db_Adapter_Oracle_Result

selectAll() public method

Returns an array of record hashes with the column names as keys and column values as values.
public selectAll ( string $sql, mixed $arg1 = null, string $arg2 = null ) : array
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
return array

selectOne() public method

Returns a record hash with the column names as keys and column values as values.
public selectOne ( string $sql, mixed $arg1 = null, string $arg2 = null ) : array
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
return array

selectValue() public method

Returns a single value from a record
public selectValue ( string $sql, mixed $arg1 = null, string $arg2 = null ) : string
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
return string

selectValues() public method

Returns an array of the values of the first column in a select: selectValues("SELECT id FROM companies LIMIT 3") => [1,2,3]
public selectValues ( string $sql, mixed $arg1 = null, string $arg2 = null ) : array
$sql string SQL statement.
$arg1 mixed Either an array of bound parameters or a query name.
$arg2 string If $arg1 contains bound parameters, the query name.
return array

supportsMigrations() public method

Does this adapter support migrations?
public supportsMigrations ( ) : boolean
return boolean

updateBlob() public method

Updates rows including BLOBs into a table.
public updateBlob ( string $table, array $fields, string | array $where = null )
$table string The table name.
$fields array A hash of column names and values. BLOB columns must be provided as Horde_Db_Value_Binary objects.
$where string | array A WHERE clause. Either a complete clause or an array containing a clause with placeholders and a list of values.

Property Details

$_schemaClass protected property

Schema class to use.
protected string $_schemaClass
return string