ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
MDB2_Driver_oci8 Class Reference
+ Inheritance diagram for MDB2_Driver_oci8:
+ Collaboration diagram for MDB2_Driver_oci8:

Public Member Functions

 __construct ()
 Constructor. More...
 
 errorInfo ($error=null)
 This method is used to collect information about an error. More...
 
 beginTransaction ($savepoint=null)
 Start a transaction or set a savepoint. More...
 
 commit ($savepoint=null)
 Commit the database changes done during a transaction that is in progress or release a savepoint. More...
 
 rollback ($savepoint=null)
 Cancel any database changes done during a transaction or since a specific savepoint that is in progress. More...
 
 setTransactionIsolation ($isolation)
 Set the transacton isolation level. More...
 
 _doConnect ($username, $password, $persistent=false)
 do the grunt work of the connect More...
 
 connect ()
 Connect to the database. More...
 
 disconnect ($force=true)
 Log out and disconnect from the database. More...
 
standaloneExec ($query)
 execute a query as database administrator More...
 
standaloneQuery ($query, $types=null, $is_manip=false)
 execute a query as DBA More...
 
 _modifyQuery ($query, $is_manip, $limit, $offset)
 Changes a query string for various DBMS specific reasons. More...
 
_doQuery ($query, $is_manip=false, $connection=null, $database_name=null)
 Execute a query. More...
 
 _affectedRows ($connection, $result=null)
 Returns the number of rows affected. More...
 
 getServerVersion ($native=false)
 return version information about the server More...
 
prepare ($query, $types=null, $result_types=null, $lobs=array())
 Prepares a query for multiple execution with execute(). More...
 
 nextID ($seq_name, $ondemand=true)
 Returns the next free id of a sequence. More...
 
 lastInsertID ($table=null, $field=null)
 Returns the autoincrement ID if supported or $id or fetches the current ID in a sequence called: $table. More...
 
 currId ($seq_name)
 Returns the current id of a sequence. More...
 
- Public Member Functions inherited from MDB2_Driver_Common
 __construct ()
 Constructor. More...
 
 MDB2_Driver_Common ()
 PHP 4 Constructor. More...
 
 __destruct ()
 Destructor. More...
 
 free ()
 Free the internal references so that the instance can be destroyed. More...
 
 __toString ()
 String conversation. More...
 
 errorInfo ($error=null)
 This method is used to collect information about an error. More...
 
raiseError ($code=null, $mode=null, $options=null, $userinfo=null, $method=null)
 This method is used to communicate an error and invoke error callbacks etc. More...
 
 resetWarnings ()
 reset the warning array More...
 
 getWarnings ()
 Get all warnings in reverse order. More...
 
 setFetchMode ($fetchmode, $object_class='stdClass')
 Sets which fetch mode should be used by default on queries on this connection. More...
 
 setOption ($option, $value)
 set the option for the db class More...
 
 getOption ($option)
 Returns the value of an option. More...
 
 debug ($message, $scope='', $context=array())
 set a debug message More...
 
 getDebugOutput ()
 output debug info More...
 
 escape ($text, $escape_wildcards=false)
 Quotes a string so it can be safely used in a query. More...
 
 escapePattern ($text)
 Quotes pattern (% and _) characters in a string) More...
 
 quoteIdentifier ($str, $check_option=false)
 Quote a string so it can be safely used as a table or column name. More...
 
 getAsKeyword ()
 Gets the string to alias column. More...
 
 getConnection ()
 Returns a native connection. More...
 
 _fixResultArrayValues (&$row, $mode)
 Do all necessary conversions on result arrays to fix DBMS quirks. More...
 
loadModule ($module, $property=null, $phptype_specific=null)
 loads a module More...
 
 __call ($method, $params)
 Calls a module method using the __call magic method. More...
 
 beginTransaction ($savepoint=null)
 Start a transaction or set a savepoint. More...
 
 commit ($savepoint=null)
 Commit the database changes done during a transaction that is in progress or release a savepoint. More...
 
 rollback ($savepoint=null)
 Cancel any database changes done during a transaction or since a specific savepoint that is in progress. More...
 
 inTransaction ($ignore_nested=false)
 If a transaction is currently open. More...
 
 setTransactionIsolation ($isolation, $options=array())
 Set the transacton isolation level. More...
 
 beginNestedTransaction ()
 Start a nested transaction. More...
 
 completeNestedTransaction ($force_rollback=false)
 Finish a nested transaction by rolling back if an error occured or committing otherwise. More...
 
 failNestedTransaction ($error=null, $immediately=false)
 Force setting nested transaction to failed. More...
 
 getNestedTransactionError ()
 The first error that occured since the transaction start. More...
 
 connect ()
 Connect to the database. More...
 
 setCharset ($charset, $connection=null)
 Set the charset on the current connection. More...
 
 disconnect ($force=true)
 Log out and disconnect from the database. More...
 
 setDatabase ($name)
 Select a different database. More...
 
 getDatabase ()
 Get the current database. More...
 
 setDSN ($dsn)
 set the DSN More...
 
 getDSN ($type='string', $hidepw=false)
 return the DSN as a string More...
 
standaloneQuery ($query, $types=null, $is_manip=false)
 execute a query as database administrator More...
 
 _modifyQuery ($query, $is_manip, $limit, $offset)
 Changes a query string for various DBMS specific reasons. More...
 
_doQuery ($query, $is_manip=false, $connection=null, $database_name=null)
 Execute a query. More...
 
 _affectedRows ($connection, $result=null)
 Returns the number of rows affected. More...
 
exec ($query)
 Execute a manipulation query to the database and return the number of affected rows. More...
 
query ($query, $types=null, $result_class=true, $result_wrap_class=false)
 Send a query to the database and return any results. More...
 
_wrapResult ($result, $types=array(), $result_class=true, $result_wrap_class=false, $limit=null, $offset=null)
 wrap a result set into the correct class More...
 
 getServerVersion ($native=false)
 return version information about the server More...
 
 setLimit ($limit, $offset=null)
 set the range of the next query More...
 
 subSelect ($query, $type=false)
 simple subselect emulation: leaves the query untouched for all RDBMS that support subselects More...
 
 replace ($table, $fields)
 Execute a SQL REPLACE query. More...
 
prepare ($query, $types=null, $result_types=null, $lobs=array())
 Prepares a query for multiple execution with execute(). More...
 
 _skipDelimitedStrings ($query, $position, $p_position)
 Utility method, used by prepare() to avoid replacing placeholders within delimited strings. More...
 
 quote ($value, $type=null, $quote=true, $escape_wildcards=false)
 Convert a text value into a DBMS specific format that is suitable to compose query statements. More...
 
 getDeclaration ($type, $name, $field)
 Obtain DBMS specific SQL code portion needed to declare of the given type. More...
 
 compareDefinition ($current, $previous)
 Obtain an array of changes that may need to applied. More...
 
 supports ($feature)
 Tell whether a DB implementation or its backend extension supports a given feature. More...
 
 getSequenceName ($sqn)
 adds sequence name formatting to a sequence name More...
 
 getIndexName ($idx)
 adds index name formatting to a index name More...
 
 nextID ($seq_name, $ondemand=true)
 Returns the next free id of a sequence. More...
 
 lastInsertID ($table=null, $field=null)
 Returns the autoincrement ID if supported or $id or fetches the current ID in a sequence called: $table. More...
 
 currID ($seq_name)
 Returns the current id of a sequence. More...
 
 queryOne ($query, $type=null, $colnum=0)
 Execute the specified query, fetch the value from the first column of the first row of the result set and then frees the result set. More...
 
 queryRow ($query, $types=null, $fetchmode=MDB2_FETCHMODE_DEFAULT)
 Execute the specified query, fetch the values from the first row of the result set into an array and then frees the result set. More...
 
 queryCol ($query, $type=null, $colnum=0)
 Execute the specified query, fetch the value from the first column of each row of the result set into an array and then frees the result set. More...
 
 queryAll ($query, $types=null, $fetchmode=MDB2_FETCHMODE_DEFAULT, $rekey=false, $force_array=false, $group=false)
 Execute the specified query, fetch all the rows of the result set into a two dimensional array and then frees the result set. More...
 
- Public Member Functions inherited from PEAR
 __construct ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

 $string_quoting = array('start' => "'", 'end' => "'", 'escape' => "'", 'escape_pattern' => '@')
 
 $identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"')
 
 $uncommitedqueries = 0
 
- Data Fields inherited from MDB2_Driver_Common
 $db_index = 0
 
 $dsn = array()
 
 $connected_dsn = array()
 
 $connection = 0
 
 $opened_persistent
 
 $database_name = ''
 
 $connected_database_name = ''
 
 $connected_server_info = ''
 
 $supported
 
 $options
 
 $string_quoting = array('start' => "'", 'end' => "'", 'escape' => false, 'escape_pattern' => false)
 
 $identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"')
 
 $sql_comments
 
 $wildcards = array('%', '_')
 
 $as_keyword = ' AS '
 
 $warnings = array()
 
 $debug_output = ''
 
 $in_transaction = false
 
 $nested_transaction_counter = null
 
 $has_transaction_error = false
 
 $offset = 0
 
 $limit = 0
 
 $phptype
 
 $dbsyntax
 
 $last_query
 
 $fetchmode = MDB2_FETCHMODE_ORDERED
 
 $modules = array()
 
 $destructor_registered = true
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Additional Inherited Members

- Static Public Member Functions inherited from PEAR
static & getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
static setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 

Detailed Description

Definition at line 55 of file oci8.php.

Constructor & Destructor Documentation

◆ __construct()

MDB2_Driver_oci8::__construct ( )

Constructor.

Definition at line 69 of file oci8.php.

70  {
71  parent::__construct();
72 
73  $this->phptype = 'oci8';
74  $this->dbsyntax = 'oci8';
75 
76  $this->supported['sequences'] = true;
77  $this->supported['indexes'] = true;
78  $this->supported['summary_functions'] = true;
79  $this->supported['order_by_text'] = true;
80  $this->supported['current_id'] = true;
81  $this->supported['affected_rows'] = true;
82  $this->supported['transactions'] = true;
83  $this->supported['savepoints'] = true;
84  $this->supported['limit_queries'] = true;
85  $this->supported['LOBs'] = true;
86  $this->supported['replace'] = 'emulated';
87  $this->supported['sub_selects'] = true;
88  $this->supported['auto_increment'] = false; // implementation is broken
89  $this->supported['primary_key'] = true;
90  $this->supported['result_introspection'] = true;
91  $this->supported['prepared_statements'] = true;
92  $this->supported['identifier_quoting'] = true;
93  $this->supported['pattern_escaping'] = true;
94  $this->supported['new_link'] = true;
95 
96  $this->options['DBA_username'] = false;
97  $this->options['DBA_password'] = false;
98  $this->options['database_name_prefix'] = false;
99  $this->options['emulate_database'] = true;
100  $this->options['default_tablespace'] = false;
101  $this->options['default_text_field_length'] = 2000;
102  $this->options['result_prefetching'] = false;
103  }

Member Function Documentation

◆ _affectedRows()

MDB2_Driver_oci8::_affectedRows (   $connection,
  $result = null 
)

Returns the number of rows affected.

Parameters
resource$result
resource$connection
Returns
mixed MDB2 Error Object or the number of rows affected private

Definition at line 684 of file oci8.php.

References MDB2_Driver_Common\$connection, $result, MDB2_Driver_Common\getConnection(), and PEAR\isError().

Referenced by standaloneExec(), and standaloneQuery().

685  {
686  if (is_null($connection)) {
687  $connection = $this->getConnection();
688  if (PEAR::isError($connection)) {
689  return $connection;
690  }
691  }
692  return @OCIRowCount($result);
693  }
$result
getConnection()
Returns a native connection.
Definition: MDB2.php:1738
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _doConnect()

MDB2_Driver_oci8::_doConnect (   $username,
  $password,
  $persistent = false 
)

do the grunt work of the connect

Returns
connection on success or MDB2 Error Object on failure protected

Definition at line 319 of file oci8.php.

References MDB2_Driver_Common\$connection, MDB2_Driver_Common\$database_name, $error, $query, $result, _doQuery(), disconnect(), PEAR\isError(), PEAR\loadExtension(), MDB2_ERROR_CONNECT_FAILED, MDB2_ERROR_NOT_FOUND, MDB2_Driver_Common\raiseError(), and MDB2_Driver_Common\setCharset().

Referenced by connect(), standaloneExec(), and standaloneQuery().

320  {
321  if (!PEAR::loadExtension($this->phptype)) {
322  return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
323  'extension '.$this->phptype.' is not compiled into PHP', __FUNCTION__);
324  }
325 
326  $sid = '';
327 
328  if (!empty($this->dsn['service']) && $this->dsn['hostspec']) {
329  //oci8://username:password@foo.example.com[:port]/?service=service
330  // service name is given, it is assumed that hostspec is really a
331  // hostname, we try to construct an oracle connection string from this
332  $port = $this->dsn['port'] ? $this->dsn['port'] : 1521;
333  $sid = sprintf("(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
334  (HOST=%s) (PORT=%s)))
335  (CONNECT_DATA=(SERVICE_NAME=%s)))",
336  $this->dsn['hostspec'],
337  $port,
338  $this->dsn['service']
339  );
340  } elseif ($this->dsn['hostspec']) {
341  // we are given something like 'oci8://username:password@foo/'
342  // we have hostspec but not a service name, now we assume that
343  // hostspec is a tnsname defined in tnsnames.ora
344  $sid = $this->dsn['hostspec'];
345  } else {
346  // oci://username:password@
347  // if everything fails, we have to rely on environment variables
348  // not before a check to 'emulate_database'
349  if (!$this->options['emulate_database'] && $this->database_name) {
350  $sid = $this->database_name;
351  } elseif (getenv('ORACLE_SID')) {
352  $sid = getenv('ORACLE_SID');
353  } elseif ($sid = getenv('TWO_TASK')) {
354  $sid = getenv('TWO_TASK');
355  } else {
356  return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
357  'not a valid connection string or environment variable [ORACLE_SID|TWO_TASK] not set',
358  __FUNCTION__);
359  }
360  }
361 
362  if (function_exists('oci_connect')) {
363  if (isset($this->dsn['new_link'])
364  && ($this->dsn['new_link'] == 'true' || $this->dsn['new_link'] === true)
365  ) {
366  $connect_function = 'oci_new_connect';
367  } else {
368  $connect_function = $persistent ? 'oci_pconnect' : 'oci_connect';
369  }
370 
371  $charset = empty($this->dsn['charset']) ? null : $this->dsn['charset'];
372  $connection = @$connect_function($username, $password, $sid, $charset);
373  $error = @OCIError();
374  if (isset($error['code']) && $error['code'] == 12541) {
375  // Couldn't find TNS listener. Try direct connection.
376  $connection = @$connect_function($username, $password, null, $charset);
377  }
378  } else {
379  $connect_function = $persistent ? 'OCIPLogon' : 'OCILogon';
380  $connection = @$connect_function($username, $password, $sid);
381 
382  if (!empty($this->dsn['charset'])) {
383  $result = $this->setCharset($this->dsn['charset'], $connection);
384  if (PEAR::isError($result)) {
385  return $result;
386  }
387  }
388  }
389 
390  if (!$connection) {
391  return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
392  'unable to establish a connection', __FUNCTION__);
393  }
394 
395  if (empty($this->dsn['disable_iso_date'])) {
396  $query = "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'";
397  $err =& $this->_doQuery($query, true, $connection);
398  if (PEAR::isError($err)) {
399  $this->disconnect(false);
400  return $err;
401  }
402  }
403 
404  $query = "ALTER SESSION SET NLS_NUMERIC_CHARACTERS='. '";
405  $err =& $this->_doQuery($query, true, $connection);
406  if (PEAR::isError($err)) {
407  $this->disconnect(false);
408  return $err;
409  }
410 
411  return $connection;
412  }
$error
Definition: Error.php:17
loadExtension($ext)
OS independant PHP extension load.
Definition: PEAR.php:749
$result
& _doQuery($query, $is_manip=false, $connection=null, $database_name=null)
Execute a query.
Definition: oci8.php:627
const MDB2_ERROR_NOT_FOUND
Definition: MDB2.php:76
& raiseError($code=null, $mode=null, $options=null, $userinfo=null, $method=null)
This method is used to communicate an error and invoke error callbacks etc.
Definition: MDB2.php:1412
const MDB2_ERROR_CONNECT_FAILED
Definition: MDB2.php:96
setCharset($charset, $connection=null)
Set the charset on the current connection.
Definition: MDB2.php:2221
disconnect($force=true)
Log out and disconnect from the database.
Definition: oci8.php:474
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _doQuery()

& MDB2_Driver_oci8::_doQuery (   $query,
  $is_manip = false,
  $connection = null,
  $database_name = null 
)

Execute a query.

Parameters
string$queryquery
boolean$is_manipif the query is a manipulation query
resource$connection
string$database_name
Returns
result or error object protected

Definition at line 627 of file oci8.php.

References MDB2_Driver_Common\$connection, $query, $result, array, MDB2_Driver_Common\debug(), MDB2_Driver_Common\getConnection(), MDB2_Driver_Common\getOption(), PEAR\isError(), and MDB2_Driver_Common\raiseError().

Referenced by _doConnect(), beginTransaction(), rollback(), setTransactionIsolation(), standaloneExec(), and standaloneQuery().

628  {
629  $this->last_query = $query;
630  $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
631  if ($result) {
632  if (PEAR::isError($result)) {
633  return $result;
634  }
635  $query = $result;
636  }
637  if ($this->getOption('disable_query')) {
638  if ($is_manip) {
639  return 0;
640  }
641  return null;
642  }
643 
644  if (is_null($connection)) {
645  $connection = $this->getConnection();
646  if (PEAR::isError($connection)) {
647  return $connection;
648  }
649  }
650 
651  $result = @OCIParse($connection, $query);
652  if (!$result) {
653  $err = $this->raiseError(null, null, null,
654  'Could not create statement', __FUNCTION__);
655  return $err;
656  }
657 
658  $mode = $this->in_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS;
659  if (!@OCIExecute($result, $mode)) {
660  $err =& $this->raiseError($result, null, null,
661  'Could not execute statement', __FUNCTION__);
662  return $err;
663  }
664 
665  if (is_numeric($this->options['result_prefetching'])) {
666  @ocisetprefetch($result, $this->options['result_prefetching']);
667  }
668 
669  $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'post', 'result' => $result));
670  return $result;
671  }
getOption($option)
Returns the value of an option.
Definition: MDB2.php:1561
$result
debug($message, $scope='', $context=array())
set a debug message
Definition: MDB2.php:1587
& raiseError($code=null, $mode=null, $options=null, $userinfo=null, $method=null)
This method is used to communicate an error and invoke error callbacks etc.
Definition: MDB2.php:1412
Create styles array
The data for the language used.
getConnection()
Returns a native connection.
Definition: MDB2.php:1738
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _modifyQuery()

MDB2_Driver_oci8::_modifyQuery (   $query,
  $is_manip,
  $limit,
  $offset 
)

Changes a query string for various DBMS specific reasons.

Parameters
string$queryquery to modify
boolean$is_manipif it is a DML query
integer$limitlimit the number of rows
integer$offsetstart reading from given offset
Returns
string modified query protected

Definition at line 595 of file oci8.php.

References MDB2_Driver_Common\$limit, MDB2_Driver_Common\$offset, and $query.

Referenced by prepare(), standaloneExec(), and standaloneQuery().

596  {
597  if (preg_match('/^\s*SELECT/i', $query)) {
598  if (!preg_match('/\sFROM\s/i', $query)) {
599  $query.= " FROM dual";
600  }
601  if ($limit > 0) {
602  // taken from http://svn.ez.no/svn/ezcomponents/packages/Database
603  $max = $offset + $limit;
604  if ($offset > 0) {
605  $min = $offset + 1;
606  $query = "SELECT * FROM (SELECT a.*, ROWNUM mdb2rn FROM ($query) a WHERE ROWNUM <= $max) WHERE mdb2rn >= $min";
607  } else {
608  $query = "SELECT a.* FROM ($query) a WHERE ROWNUM <= $max";
609  }
610  }
611  }
612  return $query;
613  }
+ Here is the caller graph for this function:

◆ beginTransaction()

MDB2_Driver_oci8::beginTransaction (   $savepoint = null)

Start a transaction or set a savepoint.

Parameters
stringname of a savepoint to set
Returns
mixed MDB2_OK on success, a MDB2 error on failure

public

Definition at line 171 of file oci8.php.

References $query, $uncommitedqueries, _doQuery(), array, MDB2_Driver_Common\debug(), MDB2_ERROR_INVALID, MDB2_OK, and MDB2_Driver_Common\raiseError().

172  {
173  $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
174  if (!is_null($savepoint)) {
175  if (!$this->in_transaction) {
176  return $this->raiseError(MDB2_ERROR_INVALID, null, null,
177  'savepoint cannot be released when changes are auto committed', __FUNCTION__);
178  }
179  $query = 'SAVEPOINT '.$savepoint;
180  return $this->_doQuery($query, true);
181  } elseif ($this->in_transaction) {
182  return MDB2_OK; //nothing to do
183  }
184  if (!$this->destructor_registered && $this->opened_persistent) {
185  $this->destructor_registered = true;
186  register_shutdown_function('MDB2_closeOpenTransactions');
187  }
188  $this->in_transaction = true;
190  return MDB2_OK;
191  }
const MDB2_OK(!class_exists('PEAR'))
The method mapErrorCode in each MDB2_dbtype implementation maps native error codes to one of these...
Definition: MDB2.php:72
const MDB2_ERROR_INVALID
Definition: MDB2.php:80
debug($message, $scope='', $context=array())
set a debug message
Definition: MDB2.php:1587
& _doQuery($query, $is_manip=false, $connection=null, $database_name=null)
Execute a query.
Definition: oci8.php:627
& raiseError($code=null, $mode=null, $options=null, $userinfo=null, $method=null)
This method is used to communicate an error and invoke error callbacks etc.
Definition: MDB2.php:1412
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ commit()

MDB2_Driver_oci8::commit (   $savepoint = null)

Commit the database changes done during a transaction that is in progress or release a savepoint.

This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after committing the pending changes.

Parameters
stringname of a savepoint to release
Returns
mixed MDB2_OK on success, a MDB2 error on failure

public

Definition at line 207 of file oci8.php.

References MDB2_Driver_Common\$connection, array, MDB2_Driver_Common\debug(), MDB2_Driver_Common\getConnection(), PEAR\isError(), MDB2_ERROR_INVALID, MDB2_OK, and MDB2_Driver_Common\raiseError().

208  {
209  $this->debug('Committing transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
210  if (!$this->in_transaction) {
211  return $this->raiseError(MDB2_ERROR_INVALID, null, null,
212  'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__);
213  }
214  if (!is_null($savepoint)) {
215  return MDB2_OK;
216  }
217 
218  if ($this->uncommitedqueries) {
219  $connection = $this->getConnection();
220  if (PEAR::isError($connection)) {
221  return $connection;
222  }
223  if (!@OCICommit($connection)) {
224  return $this->raiseError(null, null, null,
225  'Unable to commit transaction', __FUNCTION__);
226  }
227  $this->uncommitedqueries = 0;
228  }
229  $this->in_transaction = false;
230  return MDB2_OK;
231  }
const MDB2_OK(!class_exists('PEAR'))
The method mapErrorCode in each MDB2_dbtype implementation maps native error codes to one of these...
Definition: MDB2.php:72
const MDB2_ERROR_INVALID
Definition: MDB2.php:80
debug($message, $scope='', $context=array())
set a debug message
Definition: MDB2.php:1587
& raiseError($code=null, $mode=null, $options=null, $userinfo=null, $method=null)
This method is used to communicate an error and invoke error callbacks etc.
Definition: MDB2.php:1412
Create styles array
The data for the language used.
getConnection()
Returns a native connection.
Definition: MDB2.php:1738
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:

◆ connect()

MDB2_Driver_oci8::connect ( )

Connect to the database.

Returns
MDB2_OK on success, MDB2 Error Object on failure public

Definition at line 423 of file oci8.php.

References MDB2_Driver_Common\$connection, MDB2_Driver_Common\$database_name, MDB2_Driver_Common\$dsn, MDB2_Driver_Common\$phptype, _doConnect(), disconnect(), getServerVersion(), PEAR\isError(), and MDB2_OK.

424  {
425  if ($this->database_name && $this->options['emulate_database']) {
426  $this->dsn['username'] = $this->options['database_name_prefix'].$this->database_name;
427  }
428  if (is_resource($this->connection)) {
429  if (count(array_diff($this->connected_dsn, $this->dsn)) == 0
430  && $this->connected_database_name == $this->database_name
431  && $this->opened_persistent == $this->options['persistent']
432  ) {
433  return MDB2_OK;
434  }
435  $this->disconnect(false);
436  }
437 
438  $connection = $this->_doConnect(
439  $this->dsn['username'],
440  $this->dsn['password'],
441  $this->options['persistent']
442  );
443  if (PEAR::isError($connection)) {
444  return $connection;
445  }
446  $this->connection = $connection;
447  $this->connected_dsn = $this->dsn;
448  $this->connected_database_name = $this->database_name;
449  $this->opened_persistent = $this->options['persistent'];
450  $this->dbsyntax = $this->dsn['dbsyntax'] ? $this->dsn['dbsyntax'] : $this->phptype;
451 
452  $this->as_keyword = ' ';
453  $server_info = $this->getServerVersion();
454  if (is_array($server_info)) {
455  if ($server_info['major'] >= '10') {
456  $this->as_keyword = ' AS ';
457  }
458  }
459  return MDB2_OK;
460  }
const MDB2_OK(!class_exists('PEAR'))
The method mapErrorCode in each MDB2_dbtype implementation maps native error codes to one of these...
Definition: MDB2.php:72
getServerVersion($native=false)
return version information about the server
Definition: oci8.php:705
_doConnect($username, $password, $persistent=false)
do the grunt work of the connect
Definition: oci8.php:319
disconnect($force=true)
Log out and disconnect from the database.
Definition: oci8.php:474
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:

◆ currId()

MDB2_Driver_oci8::currId (   $seq_name)

Returns the current id of a sequence.

Parameters
string$seq_namename of the sequence
Returns
mixed MDB2_Error or id public

Definition at line 951 of file oci8.php.

References $query, MDB2_Driver_Common\getSequenceName(), and MDB2_Driver_Common\queryOne().

952  {
953  $sequence_name = $this->getSequenceName($seq_name);
954  $query = 'SELECT (last_number-1) FROM user_sequences';
955  $query.= ' WHERE sequence_name='.$this->quote($sequence_name, 'text');
956  $query.= ' OR sequence_name='.$this->quote(strtoupper($sequence_name), 'text');
957  return $this->queryOne($query, 'integer');
958  }
getSequenceName($sqn)
adds sequence name formatting to a sequence name
Definition: MDB2.php:3107
queryOne($query, $type=null, $colnum=0)
Execute the specified query, fetch the value from the first column of the first row of the result set...
Definition: MDB2.php:3208
+ Here is the call graph for this function:

◆ disconnect()

MDB2_Driver_oci8::disconnect (   $force = true)

Log out and disconnect from the database.

Parameters
boolean$forceif the disconnect should be forced even if the connection is opened persistently
Returns
mixed true on success, false if not connected and error object on error public

Definition at line 474 of file oci8.php.

References MDB2_Driver_Common\$connected_database_name, MDB2_Driver_Common\$connected_dsn, MDB2_Driver_Common\$database_name, MDB2_Driver_Common\$dsn, MDB2_Driver_Common\$opened_persistent, and rollback().

Referenced by _doConnect(), and connect().

475  {
476  if (is_resource($this->connection)) {
477  if ($this->in_transaction) {
478  $dsn = $this->dsn;
480  $persistent = $this->options['persistent'];
481  $this->dsn = $this->connected_dsn;
482  $this->database_name = $this->connected_database_name;
483  $this->options['persistent'] = $this->opened_persistent;
484  $this->rollback();
485  $this->dsn = $dsn;
486  $this->database_name = $database_name;
487  $this->options['persistent'] = $persistent;
488  }
489 
490  if (!$this->opened_persistent || $force) {
491  if (function_exists('oci_close')) {
492  @oci_close($this->connection);
493  } else {
494  @OCILogOff($this->connection);
495  }
496  }
497  $this->uncommitedqueries = 0;
498  }
499  return parent::disconnect($force);
500  }
rollback($savepoint=null)
Cancel any database changes done during a transaction or since a specific savepoint that is in progre...
Definition: oci8.php:247
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ errorInfo()

MDB2_Driver_oci8::errorInfo (   $error = null)

This method is used to collect information about an error.

Parameters
integer$error
Returns
array public

Definition at line 115 of file oci8.php.

References $error, array, MDB2_ERROR_ALREADY_EXISTS, MDB2_ERROR_CONSTRAINT, MDB2_ERROR_CONSTRAINT_NOT_NULL, MDB2_ERROR_DIVZERO, MDB2_ERROR_INVALID, MDB2_ERROR_INVALID_NUMBER, MDB2_ERROR_NOSUCHFIELD, MDB2_ERROR_NOSUCHTABLE, MDB2_ERROR_NOT_FOUND, MDB2_ERROR_SYNTAX, and MDB2_ERROR_VALUE_COUNT_ON_ROW.

116  {
117  if (is_resource($error)) {
118  $error_data = @OCIError($error);
119  $error = null;
120  } elseif ($this->connection) {
121  $error_data = @OCIError($this->connection);
122  } else {
123  $error_data = @OCIError();
124  }
125  $native_code = $error_data['code'];
126  $native_msg = $error_data['message'];
127  if (is_null($error)) {
128  static $ecode_map;
129  if (empty($ecode_map)) {
130  $ecode_map = array(
132  900 => MDB2_ERROR_SYNTAX,
133  904 => MDB2_ERROR_NOSUCHFIELD,
134  911 => MDB2_ERROR_SYNTAX, //invalid character
136  921 => MDB2_ERROR_SYNTAX,
137  923 => MDB2_ERROR_SYNTAX,
138  942 => MDB2_ERROR_NOSUCHTABLE,
141  1401 => MDB2_ERROR_INVALID,
143  1418 => MDB2_ERROR_NOT_FOUND,
144  1476 => MDB2_ERROR_DIVZERO,
146  2289 => MDB2_ERROR_NOSUCHTABLE,
147  2291 => MDB2_ERROR_CONSTRAINT,
148  2292 => MDB2_ERROR_CONSTRAINT,
149  2449 => MDB2_ERROR_CONSTRAINT,
150  24344 => MDB2_ERROR_SYNTAX, //success with compilation error
151  );
152  }
153  if (isset($ecode_map[$native_code])) {
154  $error = $ecode_map[$native_code];
155  }
156  }
157  return array($error, $native_code, $native_msg);
158  }
$error
Definition: Error.php:17
const MDB2_ERROR_INVALID
Definition: MDB2.php:80
const MDB2_ERROR_SYNTAX
Definition: MDB2.php:74
const MDB2_ERROR_CONSTRAINT
Definition: MDB2.php:75
const MDB2_ERROR_NOSUCHFIELD
Definition: MDB2.php:91
const MDB2_ERROR_NOT_FOUND
Definition: MDB2.php:76
const MDB2_ERROR_CONSTRAINT_NOT_NULL
Definition: MDB2.php:101
Create styles array
The data for the language used.
const MDB2_ERROR_VALUE_COUNT_ON_ROW
Definition: MDB2.php:94
const MDB2_ERROR_INVALID_NUMBER
Definition: MDB2.php:83
const MDB2_ERROR_DIVZERO
Definition: MDB2.php:85
const MDB2_ERROR_ALREADY_EXISTS
Definition: MDB2.php:77
const MDB2_ERROR_NOSUCHTABLE
Definition: MDB2.php:90

◆ getServerVersion()

MDB2_Driver_oci8::getServerVersion (   $native = false)

return version information about the server

Parameters
bool$nativedetermines if the raw version string should be returned
Returns
mixed array/string with version information or MDB2 error object public

Definition at line 705 of file oci8.php.

References MDB2_Driver_Common\$connected_server_info, MDB2_Driver_Common\$connection, array, MDB2_Driver_Common\getConnection(), PEAR\isError(), MDB2_ERROR_INVALID, and MDB2_Driver_Common\raiseError().

Referenced by connect().

706  {
707  $connection = $this->getConnection();
708  if (PEAR::isError($connection)) {
709  return $connection;
710  }
711  if ($this->connected_server_info) {
712  $server_info = $this->connected_server_info;
713  } else {
714  $server_info = @ociserverversion($connection);
715  }
716  if (!$server_info) {
717  return $this->raiseError(null, null, null,
718  'Could not get server information', __FUNCTION__);
719  }
720  // cache server_info
721  $this->connected_server_info = $server_info;
722  if (!$native) {
723  if (!preg_match('/ (\d+)\.(\d+)\.(\d+)\.([\d\.]+) /', $server_info, $tmp)) {
724  return $this->raiseError(MDB2_ERROR_INVALID, null, null,
725  'Could not parse version information:'.$server_info, __FUNCTION__);
726  }
727  $server_info = array(
728  'major' => $tmp[1],
729  'minor' => $tmp[2],
730  'patch' => $tmp[3],
731  'extra' => $tmp[4],
732  'native' => $server_info,
733  );
734  }
735  return $server_info;
736  }
const MDB2_ERROR_INVALID
Definition: MDB2.php:80
& raiseError($code=null, $mode=null, $options=null, $userinfo=null, $method=null)
This method is used to communicate an error and invoke error callbacks etc.
Definition: MDB2.php:1412
Create styles array
The data for the language used.
getConnection()
Returns a native connection.
Definition: MDB2.php:1738
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lastInsertID()

MDB2_Driver_oci8::lastInsertID (   $table = null,
  $field = null 
)

Returns the autoincrement ID if supported or $id or fetches the current ID in a sequence called: $table.

(empty($field) ? '' : '_'.$field)

Parameters
string$tablename of the table into which a new row was inserted
string$fieldname of the field into which a new row was inserted
Returns
mixed MDB2 Error Object or id public

Definition at line 934 of file oci8.php.

References MDB2_Driver_Common\getSequenceName(), MDB2_Driver_Common\queryOne(), and MDB2_Driver_Common\quoteIdentifier().

935  {
936  $seq = $table.(empty($field) ? '' : '_'.$field);
937  $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq), true);
938  return $this->queryOne("SELECT $sequence_name.currval", 'integer');
939  }
quoteIdentifier($str, $check_option=false)
Quote a string so it can be safely used as a table or column name.
Definition: MDB2.php:1705
getSequenceName($sqn)
adds sequence name formatting to a sequence name
Definition: MDB2.php:3107
queryOne($query, $type=null, $colnum=0)
Execute the specified query, fetch the value from the first column of the first row of the result set...
Definition: MDB2.php:3208
+ Here is the call graph for this function:

◆ nextID()

MDB2_Driver_oci8::nextID (   $seq_name,
  $ondemand = true 
)

Returns the next free id of a sequence.

Parameters
string$seq_namename of the sequence
boolean$ondemandwhen true the sequence is automatic created, if it not exists
Returns
mixed MDB2 Error Object or id public

Definition at line 902 of file oci8.php.

References $query, $result, PEAR\expectError(), MDB2_Driver_Common\getSequenceName(), PEAR\isError(), MDB2_Driver_Common\loadModule(), MDB2_ERROR_NOSUCHTABLE, PEAR\popExpect(), MDB2_Driver_Common\queryOne(), and MDB2_Driver_Common\quoteIdentifier().

903  {
904  $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
905  $query = "SELECT $sequence_name.nextval FROM DUAL";
907  $result = $this->queryOne($query, 'integer');
908  $this->popExpect();
909  if (PEAR::isError($result)) {
910  if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) {
911  $this->loadModule('Manager', null, true);
912  $result = $this->manager->createSequence($seq_name);
913  if (PEAR::isError($result)) {
914  return $result;
915  }
916  return $this->nextId($seq_name, false);
917  }
918  }
919  return $result;
920  }
$result
quoteIdentifier($str, $check_option=false)
Quote a string so it can be safely used as a table or column name.
Definition: MDB2.php:1705
getSequenceName($sqn)
adds sequence name formatting to a sequence name
Definition: MDB2.php:3107
popExpect()
This method pops one element off the expected error codes stack.
Definition: PEAR.php:407
expectError($code=' *')
This method is used to tell which errors you expect to get.
Definition: PEAR.php:388
queryOne($query, $type=null, $colnum=0)
Execute the specified query, fetch the value from the first column of the first row of the result set...
Definition: MDB2.php:3208
& loadModule($module, $property=null, $phptype_specific=null)
loads a module
Definition: MDB2.php:1845
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
const MDB2_ERROR_NOSUCHTABLE
Definition: MDB2.php:90
+ Here is the call graph for this function:

◆ prepare()

& MDB2_Driver_oci8::prepare (   $query,
  $types = null,
  $result_types = null,
  $lobs = array() 
)

Prepares a query for multiple execution with execute().

With some database backends, this is emulated. prepare() requires a generic query as string like 'INSERT INTO numbers VALUES(?,?)' or 'INSERT INTO numbers VALUES(:foo,:bar)'. The ? and :[a-zA-Z] and are placeholders which can be set using bindParam() and the query can be send off using the execute() method.

Parameters
string$querythe query to prepare
mixed$typesarray that contains the types of the placeholders
mixed$result_typesarray that contains the types of the columns in the result set or MDB2_PREPARE_RESULT, if set to MDB2_PREPARE_MANIP the query is handled as a manipulation query
mixed$lobskey (field) value (parameter) pair for all lob placeholders
Returns
mixed resource handle for the prepared query on success, a MDB2 error on failure public
See also
bindParam, execute

Definition at line 761 of file oci8.php.

References $columns, MDB2_Driver_Common\$connection, MDB2_Driver_Common\$limit, MDB2_Driver_Common\$offset, $query, $result, _modifyQuery(), MDB2_Driver_Common\_skipDelimitedStrings(), array, MDB2_Driver_Common\debug(), MDB2_Driver_Common\getConnection(), PEAR\isError(), MDB2_ERROR_SYNTAX, MDB2_PREPARE_MANIP, MDB2_Driver_Common\quote(), and MDB2_Driver_Common\raiseError().

762  {
763  if ($this->options['emulate_prepared']) {
764  $obj =& parent::prepare($query, $types, $result_types, $lobs);
765  return $obj;
766  }
767  $is_manip = ($result_types === MDB2_PREPARE_MANIP);
770  $this->offset = $this->limit = 0;
771  $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
772  if ($result) {
773  if (PEAR::isError($result)) {
774  return $result;
775  }
776  $query = $result;
777  }
778  $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
779  $placeholder_type_guess = $placeholder_type = null;
780  $question = '?';
781  $colon = ':';
782  $positions = array();
783  $position = 0;
784  $parameter = -1;
785  while ($position < strlen($query)) {
786  $q_position = strpos($query, $question, $position);
787  $c_position = strpos($query, $colon, $position);
788  if ($q_position && $c_position) {
789  $p_position = min($q_position, $c_position);
790  } elseif ($q_position) {
791  $p_position = $q_position;
792  } elseif ($c_position) {
793  $p_position = $c_position;
794  } else {
795  break;
796  }
797  if (is_null($placeholder_type)) {
798  $placeholder_type_guess = $query[$p_position];
799  }
800 
801  $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
802  if (PEAR::isError($new_pos)) {
803  return $new_pos;
804  }
805  if ($new_pos != $position) {
806  $position = $new_pos;
807  continue; //evaluate again starting from the new position
808  }
809 
810  if ($query[$position] == $placeholder_type_guess) {
811  if (is_null($placeholder_type)) {
812  $placeholder_type = $query[$p_position];
813  $question = $colon = $placeholder_type;
814  if (!empty($types) && is_array($types)) {
815  if ($placeholder_type == ':') {
816  if (is_int(key($types))) {
817  $types_tmp = $types;
818  $types = array();
819  $count = -1;
820  }
821  } else {
822  $types = array_values($types);
823  }
824  }
825  }
826  if ($placeholder_type == ':') {
827  $parameter = preg_replace('/^.{'.($position+1).'}([a-z0-9_]+).*$/si', '\\1', $query);
828  if ($parameter === '') {
829  $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
830  'named parameter with an empty name', __FUNCTION__);
831  return $err;
832  }
833  // use parameter name in type array
834  if (isset($count) && isset($types_tmp[++$count])) {
835  $types[$parameter] = $types_tmp[$count];
836  }
837  $length = strlen($parameter) + 1;
838  } else {
839  ++$parameter;
840  $length = strlen($parameter);
841  }
842  if (!in_array($parameter, $positions)) {
843  $positions[] = $parameter;
844  }
845  if (isset($types[$parameter])
846  && ($types[$parameter] == 'clob' || $types[$parameter] == 'blob')
847  ) {
848  if (!isset($lobs[$parameter])) {
849  $lobs[$parameter] = $parameter;
850  }
851  $value = $this->quote(true, $types[$parameter]);
852  $query = substr_replace($query, $value, $p_position, $length);
853  $position = $p_position + strlen($value) - 1;
854  } elseif ($placeholder_type == '?') {
855  $query = substr_replace($query, ':'.$parameter, $p_position, 1);
856  $position = $p_position + $length;
857  } else {
858  $position = $p_position + 1;
859  }
860  } else {
861  $position = $p_position;
862  }
863  }
864  if (is_array($lobs)) {
865  $columns = $variables = '';
866  foreach ($lobs as $parameter => $field) {
867  $columns.= ($columns ? ', ' : ' RETURNING ').$field;
868  $variables.= ($variables ? ', ' : ' INTO ').':'.$parameter;
869  }
870  $query.= $columns.$variables;
871  }
872  $connection = $this->getConnection();
873  if (PEAR::isError($connection)) {
874  return $connection;
875  }
876  $statement = @OCIParse($connection, $query);
877  if (!$statement) {
878  $err =& $this->raiseError(null, null, null,
879  'Could not create statement', __FUNCTION__);
880  return $err;
881  }
882 
883  $class_name = 'MDB2_Statement_'.$this->phptype;
884  $obj = new $class_name($this, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
885  $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'post', 'result' => $obj));
886  return $obj;
887  }
$result
const MDB2_ERROR_SYNTAX
Definition: MDB2.php:74
debug($message, $scope='', $context=array())
set a debug message
Definition: MDB2.php:1587
_skipDelimitedStrings($query, $position, $p_position)
Utility method, used by prepare() to avoid replacing placeholders within delimited strings...
Definition: MDB2.php:2968
const MDB2_PREPARE_MANIP
These are just helper constants to more verbosely express parameters to prepare() ...
Definition: MDB2.php:114
& raiseError($code=null, $mode=null, $options=null, $userinfo=null, $method=null)
This method is used to communicate an error and invoke error callbacks etc.
Definition: MDB2.php:1412
_modifyQuery($query, $is_manip, $limit, $offset)
Changes a query string for various DBMS specific reasons.
Definition: oci8.php:595
Create styles array
The data for the language used.
getConnection()
Returns a native connection.
Definition: MDB2.php:1738
quote($value, $type=null, $quote=true, $escape_wildcards=false)
Convert a text value into a DBMS specific format that is suitable to compose query statements...
Definition: MDB2.php:3014
if(! $in) $columns
Definition: Utf8Test.php:45
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:

◆ rollback()

MDB2_Driver_oci8::rollback (   $savepoint = null)

Cancel any database changes done during a transaction or since a specific savepoint that is in progress.

This function may only be called when auto-committing is disabled, otherwise it will fail. Therefore, a new transaction is implicitly started after canceling the pending changes.

Parameters
stringname of a savepoint to rollback to
Returns
mixed MDB2_OK on success, a MDB2 error on failure

public

Definition at line 247 of file oci8.php.

References MDB2_Driver_Common\$connection, $query, _doQuery(), array, MDB2_Driver_Common\debug(), MDB2_Driver_Common\getConnection(), PEAR\isError(), MDB2_ERROR_INVALID, MDB2_OK, and MDB2_Driver_Common\raiseError().

Referenced by disconnect().

248  {
249  $this->debug('Rolling back transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
250  if (!$this->in_transaction) {
251  return $this->raiseError(MDB2_ERROR_INVALID, null, null,
252  'rollback cannot be done changes are auto committed', __FUNCTION__);
253  }
254  if (!is_null($savepoint)) {
255  $query = 'ROLLBACK TO SAVEPOINT '.$savepoint;
256  return $this->_doQuery($query, true);
257  }
258 
259  if ($this->uncommitedqueries) {
260  $connection = $this->getConnection();
261  if (PEAR::isError($connection)) {
262  return $connection;
263  }
264  if (!@OCIRollback($connection)) {
265  return $this->raiseError(null, null, null,
266  'Unable to rollback transaction', __FUNCTION__);
267  }
268  $this->uncommitedqueries = 0;
269  }
270  $this->in_transaction = false;
271  return MDB2_OK;
272  }
const MDB2_OK(!class_exists('PEAR'))
The method mapErrorCode in each MDB2_dbtype implementation maps native error codes to one of these...
Definition: MDB2.php:72
const MDB2_ERROR_INVALID
Definition: MDB2.php:80
debug($message, $scope='', $context=array())
set a debug message
Definition: MDB2.php:1587
& _doQuery($query, $is_manip=false, $connection=null, $database_name=null)
Execute a query.
Definition: oci8.php:627
& raiseError($code=null, $mode=null, $options=null, $userinfo=null, $method=null)
This method is used to communicate an error and invoke error callbacks etc.
Definition: MDB2.php:1412
Create styles array
The data for the language used.
getConnection()
Returns a native connection.
Definition: MDB2.php:1738
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTransactionIsolation()

MDB2_Driver_oci8::setTransactionIsolation (   $isolation)

Set the transacton isolation level.

Parameters
stringstandard isolation level READ UNCOMMITTED (allows dirty reads) READ COMMITTED (prevents dirty reads) REPEATABLE READ (prevents nonrepeatable reads) SERIALIZABLE (prevents phantom reads)
Returns
mixed MDB2_OK on success, a MDB2 error on failure

public

Since
2.1.1

Definition at line 290 of file oci8.php.

References $query, _doQuery(), array, MDB2_Driver_Common\debug(), MDB2_ERROR_UNSUPPORTED, and MDB2_Driver_Common\raiseError().

291  {
292  $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
293  switch ($isolation) {
294  case 'READ UNCOMMITTED':
295  $isolation = 'READ COMMITTED';
296  case 'READ COMMITTED':
297  case 'REPEATABLE READ':
298  $isolation = 'SERIALIZABLE';
299  case 'SERIALIZABLE':
300  break;
301  default:
302  return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
303  'isolation level is not supported: '.$isolation, __FUNCTION__);
304  }
305 
306  $query = "ALTER SESSION ISOLATION LEVEL $isolation";
307  return $this->_doQuery($query, true);
308  }
const MDB2_ERROR_UNSUPPORTED
Definition: MDB2.php:78
debug($message, $scope='', $context=array())
set a debug message
Definition: MDB2.php:1587
& _doQuery($query, $is_manip=false, $connection=null, $database_name=null)
Execute a query.
Definition: oci8.php:627
& raiseError($code=null, $mode=null, $options=null, $userinfo=null, $method=null)
This method is used to communicate an error and invoke error callbacks etc.
Definition: MDB2.php:1412
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ standaloneExec()

& MDB2_Driver_oci8::standaloneExec (   $query)

execute a query as database administrator

Parameters
string$querythe SQL query
Returns
mixed MDB2_OK on success, a MDB2 error on failure public

Definition at line 512 of file oci8.php.

References MDB2_Driver_Common\$connection, MDB2_Driver_Common\$limit, MDB2_Driver_Common\$offset, $query, $result, $ret, _affectedRows(), _doConnect(), _doQuery(), _modifyQuery(), and PEAR\isError().

513  {
514  $connection = $this->_doConnect(
515  $this->options['DBA_username'],
516  $this->options['DBA_password'],
517  $this->options['persistent']
518  );
519  if (PEAR::isError($connection)) {
520  return $connection;
521  }
522 
525  $this->offset = $this->limit = 0;
526  $query = $this->_modifyQuery($query, false, $limit, $offset);
527 
528  $result =& $this->_doQuery($query, false, $connection, false);
529  if (PEAR::isError($result)) {
530  @OCILogOff($connection);
531  return $result;
532  }
533 
535  @OCILogOff($connection);
536  return $ret;
537  }
$result
_affectedRows($connection, $result=null)
Returns the number of rows affected.
Definition: oci8.php:684
& _doQuery($query, $is_manip=false, $connection=null, $database_name=null)
Execute a query.
Definition: oci8.php:627
_modifyQuery($query, $is_manip, $limit, $offset)
Changes a query string for various DBMS specific reasons.
Definition: oci8.php:595
_doConnect($username, $password, $persistent=false)
do the grunt work of the connect
Definition: oci8.php:319
$ret
Definition: parser.php:6
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:

◆ standaloneQuery()

& MDB2_Driver_oci8::standaloneQuery (   $query,
  $types = null,
  $is_manip = false 
)

execute a query as DBA

Parameters
string$querythe SQL query
mixed$typesarray that contains the types of the columns in the result set
boolean$is_manipif the query is a manipulation query
Returns
mixed MDB2_OK on success, a MDB2 error on failure public

Definition at line 552 of file oci8.php.

References MDB2_Driver_Common\$connection, MDB2_Driver_Common\$limit, MDB2_Driver_Common\$offset, $query, $result, _affectedRows(), _doConnect(), _doQuery(), _modifyQuery(), MDB2_Driver_Common\_wrapResult(), and PEAR\isError().

553  {
554  $connection = $this->_doConnect(
555  $this->options['DBA_username'],
556  $this->options['DBA_password'],
557  $this->options['persistent']
558  );
559  if (PEAR::isError($connection)) {
560  return $connection;
561  }
562 
565  $this->offset = $this->limit = 0;
566  $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
567 
568  $result =& $this->_doQuery($query, $is_manip, $connection, false);
569  @OCILogOff($connection);
570  if (PEAR::isError($result)) {
571  return $result;
572  }
573 
574  if ($is_manip) {
575  $affected_rows = $this->_affectedRows($connection, $result);
576  return $affected_rows;
577  }
578  $return =& $this->_wrapResult($result, $types, true, false, $limit, $offset);
579  return $return;
580  }
$result
_affectedRows($connection, $result=null)
Returns the number of rows affected.
Definition: oci8.php:684
& _wrapResult($result, $types=array(), $result_class=true, $result_wrap_class=false, $limit=null, $offset=null)
wrap a result set into the correct class
Definition: MDB2.php:2546
& _doQuery($query, $is_manip=false, $connection=null, $database_name=null)
Execute a query.
Definition: oci8.php:627
_modifyQuery($query, $is_manip, $limit, $offset)
Changes a query string for various DBMS specific reasons.
Definition: oci8.php:595
_doConnect($username, $password, $persistent=false)
do the grunt work of the connect
Definition: oci8.php:319
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:

Field Documentation

◆ $identifier_quoting

MDB2_Driver_oci8::$identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"')

Definition at line 60 of file oci8.php.

◆ $string_quoting

MDB2_Driver_oci8::$string_quoting = array('start' => "'", 'end' => "'", 'escape' => "'", 'escape_pattern' => '@')

Definition at line 58 of file oci8.php.

◆ $uncommitedqueries

MDB2_Driver_oci8::$uncommitedqueries = 0

Definition at line 62 of file oci8.php.

Referenced by beginTransaction().


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