DboOracle Class Reference

Inheritance diagram for DboOracle:

DboSource DataSource Object

List of all members.


Public Member Functions

 _execute ($sql)
 _scrapeSQL ($sql)
 _setError ($source=null, $clear=false)
 alterSchema ($compare, $table=null)
 begin ()
 column ($real)
 commit ()
 connect ()
 constraint ($action, $table)
 createSequence ($sequence)
 createTrigger ($table)
 describe (&$model)
 disconnect ()
 fetchRow ()
 getEncoding ()
 index ($model)
 lastAffected ()
 lastError ()
 lastInsertId ($source)
 lastNumRows ()
 limit ($limit=-1, $offset=0)
 listSources ()
 name ($name)
 queryAssociation (&$model, &$linkModel, $type, $association, $assocData, &$queryData, $external=false, &$resultSet, $recursive, $stack)
 renderStatement ($type, $data)
 rollback ()
 sequenceExists ($sequence)
 setEncoding ($lang)
 truncate ($table, $reset=0)
 value ($data, $column=null, $safe=false)

Public Attributes

 $_baseConfig
 $_currentRow
 $_error
 $_limit = -1
 $_map
 $_numRows
 $_offset = 0
 $_results
 $_sequenceMap = array()
 $_sequences = array()
 $alias = ''
 $columns
 $config
 $connection

Detailed Description

Definition at line 37 of file dbo_oracle.php.


Member Function Documentation

DboOracle::_execute ( sql  ) 

Executes given SQL statement. This is an overloaded method.

Parameters:
string $sql SQL statement
Returns:
resource Result resource identifier or null protected

Definition at line 329 of file dbo_oracle.php.

References _scrapeSQL(), _setError(), and limit().

DboOracle::_scrapeSQL ( sql  ) 

Scrape the incoming SQL to create the association map. This is an extremely experimental method that creates the association maps since Oracle will not tell us.

Parameters:
string $sql
Returns:
false if sql is nor a SELECT protected

Definition at line 259 of file dbo_oracle.php.

Referenced by _execute().

DboOracle::_setError ( source = null,
clear = false 
)

Keeps track of the most recent Oracle error

Definition at line 200 of file dbo_oracle.php.

Referenced by _execute(), and connect().

DboOracle::alterSchema ( compare,
table = null 
)

Generate a Oracle Alter Table syntax for the given Schema comparison

Parameters:
unknown_type $schema
Returns:
unknown

Reimplemented from DboSource.

Definition at line 668 of file dbo_oracle.php.

References $out, DboSource::buildColumn(), DboSource::fullTableName(), and name().

DboOracle::begin (  ) 

Begin a transaction

Parameters:
unknown_type $model
Returns:
boolean True on success, false on fail (i.e. if the database/model does not support transactions).

Definition at line 739 of file dbo_oracle.php.

DboOracle::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") public

Reimplemented from DataSource.

Definition at line 773 of file dbo_oracle.php.

References limit(), and name().

Referenced by describe(), and index().

DboOracle::commit (  ) 

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).

Definition at line 762 of file dbo_oracle.php.

DboOracle::connect (  ) 

Connects to the database using options in the given configuration array.

Returns:
boolean True if the database could be connected, else false public

Definition at line 166 of file dbo_oracle.php.

References $config, _setError(), config(), and DboSource::execute().

DboOracle::constraint ( action,
table 
)

Enables, disables, and lists table constraints

Note: This method could have been written using a subselect for each table, however the effort Oracle expends to run the constraint introspection is very high. Therefore, this method caches the result once and loops through the arrays to find what it needs. It reduced my query time by 50%. YMMV.

Parameters:
string $action
string $table
Returns:
mixed boolean true or array of constraints

Definition at line 554 of file dbo_oracle.php.

References DboSource::execute(), and fetchRow().

DboOracle::createSequence ( sequence  ) 

Creates a database sequence

Parameters:
string $sequence
Returns:
bool public

Definition at line 419 of file dbo_oracle.php.

References DboSource::execute().

DboOracle::createTrigger ( table  ) 

Enter description here...

Parameters:
unknown_type $table
Returns:
unknown public

Definition at line 430 of file dbo_oracle.php.

References DboSource::execute().

DboOracle::describe ( &$  model  ) 

Returns an array of the fields in given table name.

Parameters:
object instance of a model to inspect
Returns:
array Fields in table. Keys are name and type public

Definition at line 466 of file dbo_oracle.php.

References column(), DboSource::execute(), fetchRow(), DboSource::fullTableName(), and DboSource::length().

DboOracle::disconnect (  ) 

Disconnects from database.

Returns:
boolean True if the database could be disconnected, else false public

Definition at line 245 of file dbo_oracle.php.

DboOracle::fetchRow (  ) 

Enter description here...

Returns:
unknown public

Definition at line 375 of file dbo_oracle.php.

References DboSource::$index.

Referenced by constraint(), describe(), getEncoding(), lastInsertId(), listSources(), sequenceExists(), and truncate().

DboOracle::getEncoding (  ) 

Gets the current encoding language

Returns:
string language constant

Definition at line 228 of file dbo_oracle.php.

References DboSource::execute(), and fetchRow().

DboOracle::index ( model  ) 

Returns an array of the indexes in given table name.

Parameters:
string $model Name of model to inspect
Returns:
array Fields in table. Keys are column and unique

Reimplemented from DboSource.

Definition at line 626 of file dbo_oracle.php.

References DboSource::$index, column(), DboSource::fullTableName(), ife(), and DboSource::query().

DboOracle::lastAffected (  ) 

Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.

Returns:
int Number of affected rows public

Definition at line 891 of file dbo_oracle.php.

DboOracle::lastError (  ) 

Returns a formatted error message from previous database operation.

Returns:
string Error message with error number public

Definition at line 882 of file dbo_oracle.php.

DboOracle::lastInsertId ( source  ) 

Returns the ID generated from the previous INSERT operation.

Parameters:
string 
Returns:
integer public

Reimplemented from DataSource.

Definition at line 863 of file dbo_oracle.php.

References DboSource::execute(), and fetchRow().

DboOracle::lastNumRows (  ) 

Returns number of rows in previous resultset. If no previous resultset exists, this returns false.

Returns:
integer Number of rows in resultset public

Definition at line 319 of file dbo_oracle.php.

DboOracle::limit ( limit = -1,
offset = 0 
)

Modify a SQL query to limit (and offset) the result set

Parameters:
integer $limit Maximum number of rows to return
integer $offset Row to begin returning
Returns:
modified SQL Query public

Reimplemented from DboSource.

Definition at line 308 of file dbo_oracle.php.

Referenced by _execute(), column(), and queryAssociation().

DboOracle::listSources (  ) 

Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.

Returns:
array tablenames in the database public

Definition at line 441 of file dbo_oracle.php.

References DboSource::execute(), fetchRow(), and name().

DboOracle::name ( name  ) 

This method should quote Oracle identifiers. Well it doesn't. It would break all scaffolding and all of Cake's default assumptions.

Parameters:
unknown_type $var
Returns:
unknown public

Reimplemented from DboSource.

Definition at line 719 of file dbo_oracle.php.

Referenced by alterSchema(), column(), and listSources().

DboOracle::queryAssociation ( &$  model,
&$  linkModel,
type,
association,
assocData,
&$  queryData,
external = false,
&$  resultSet,
recursive,
stack 
)

Enter description here...

Parameters:
Model $model
unknown_type $linkModel
string $type Association type
unknown_type $association
unknown_type $assocData
unknown_type $queryData
unknown_type $external
unknown_type $resultSet
integer $recursive Number of levels of association
array $stack

Reimplemented from DboSource.

Definition at line 938 of file dbo_oracle.php.

References $res, Set::diff(), e(), DboSource::fetchAll(), DboSource::generateAssociationQuery(), ConnectionManager::getDataSource(), DataSource::insertQueryData(), limit(), and Configure::read().

DboOracle::renderStatement ( type,
data 
)

Renders a final SQL statement by putting together the component parts in the correct order

Parameters:
string $type
array $data
Returns:
string

Reimplemented from DboSource.

Definition at line 901 of file dbo_oracle.php.

References $alias, and DboSource::update().

DboOracle::rollback (  ) 

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).

Definition at line 751 of file dbo_oracle.php.

DboOracle::sequenceExists ( sequence  ) 

Checks to see if a named sequence exists

Parameters:
string $sequence
Returns:
bool public

Definition at line 405 of file dbo_oracle.php.

References DboSource::execute(), and fetchRow().

DboOracle::setEncoding ( lang  ) 

Sets the encoding language of the session

Parameters:
string $lang language constant
Returns:
bool

Definition at line 217 of file dbo_oracle.php.

References DboSource::execute().

DboOracle::truncate ( table,
reset = 0 
)

Deletes all the records in a table and drops all associated auto-increment sequences. Using DELETE instead of TRUNCATE because it causes locking problems.

Parameters:
mixed $table A string or model class representing the table to be truncated
integer $reset If -1, sequences are dropped, if 0 (default), sequences are reset, and if 1, sequences are not modified
Returns:
boolean SQL TRUNCATE TABLE statement, false if not applicable. public

Definition at line 508 of file dbo_oracle.php.

References DboSource::execute(), fetchRow(), and DboSource::fullTableName().

DboOracle::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
Returns:
string Quoted and escaped public

Definition at line 823 of file dbo_oracle.php.


Member Data Documentation

DboOracle::$_baseConfig

Initial value:

 array(
        'persistent' => true,
        'host' => 'localhost',
        'login' => 'system',
        'password' => '',
        'database' => 'cake',
        'nls_sort' => '',
        'nls_sort' => ''
    )

Reimplemented from DataSource.

Definition at line 144 of file dbo_oracle.php.

DboOracle::$_currentRow

Definition at line 116 of file dbo_oracle.php.

DboOracle::$_error

Definition at line 137 of file dbo_oracle.php.

DboOracle::$_limit = -1

Definition at line 95 of file dbo_oracle.php.

DboOracle::$_map

Definition at line 109 of file dbo_oracle.php.

DboOracle::$_numRows

Definition at line 123 of file dbo_oracle.php.

DboOracle::$_offset = 0

Definition at line 102 of file dbo_oracle.php.

DboOracle::$_results

Definition at line 130 of file dbo_oracle.php.

DboOracle::$_sequenceMap = array()

Definition at line 159 of file dbo_oracle.php.

DboOracle::$_sequences = array()

Sequence names as introspected from the database

Definition at line 54 of file dbo_oracle.php.

DboOracle::$alias = ''

Reimplemented from DboSource.

Definition at line 50 of file dbo_oracle.php.

Referenced by renderStatement().

DboOracle::$columns

Initial value:

 array(
        'primary_key' => array('name' => 'number NOT NULL'),
        'string' => array('name' => 'varchar2', 'limit' => '255'),
        'text' => array('name' => 'varchar2'),
        'integer' => array('name' => 'numeric'),
        'float' => array('name' => 'float'),
        'datetime' => array('name' => 'date', 'format' => 'Y-m-d H:i:s'),
        'timestamp' => array('name' => 'date', 'format' => 'Y-m-d H:i:s'),
        'time' => array('name' => 'date', 'format' => 'Y-m-d H:i:s'),
        'date' => array('name' => 'date', 'format' => 'Y-m-d H:i:s'),
        'binary' => array('name' => 'bytea'),
        'boolean' => array('name' => 'boolean'),
        'number' => array('name' => 'numeric'),
        'inet' => array('name' => 'inet'))

Definition at line 68 of file dbo_oracle.php.

DboOracle::$config

Reimplemented from DataSource.

Definition at line 44 of file dbo_oracle.php.

Referenced by connect().

DboOracle::$connection

Reimplemented from DataSource.

Definition at line 88 of file dbo_oracle.php.


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