summaryrefslogtreecommitdiff
path: root/program/lib/MDB2/Driver/pgsql.php
diff options
context:
space:
mode:
Diffstat (limited to 'program/lib/MDB2/Driver/pgsql.php')
-rw-r--r--program/lib/MDB2/Driver/pgsql.php53
1 files changed, 27 insertions, 26 deletions
diff --git a/program/lib/MDB2/Driver/pgsql.php b/program/lib/MDB2/Driver/pgsql.php
index ca2874d5a..73f6a0dd2 100644
--- a/program/lib/MDB2/Driver/pgsql.php
+++ b/program/lib/MDB2/Driver/pgsql.php
@@ -43,7 +43,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
//
-// $Id: pgsql.php 292715 2009-12-28 14:06:34Z quipo $
+// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $
/**
* MDB2 PostGreSQL driver
@@ -251,7 +251,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$this->destructor_registered = true;
register_shutdown_function('MDB2_closeOpenTransactions');
}
- $result =& $this->_doQuery('BEGIN', true);
+ $result = $this->_doQuery('BEGIN', true);
if (PEAR::isError($result)) {
return $result;
}
@@ -285,7 +285,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
return $this->_doQuery($query, true);
}
- $result =& $this->_doQuery('COMMIT', true);
+ $result = $this->_doQuery('COMMIT', true);
if (PEAR::isError($result)) {
return $result;
}
@@ -320,7 +320,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
}
$query = 'ROLLBACK';
- $result =& $this->_doQuery($query, true);
+ $result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@@ -339,12 +339,16 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
* READ COMMITTED (prevents dirty reads)
* REPEATABLE READ (prevents nonrepeatable reads)
* SERIALIZABLE (prevents phantom reads)
+ * @param array some transaction options:
+ * 'wait' => 'WAIT' | 'NO WAIT'
+ * 'rw' => 'READ WRITE' | 'READ ONLY'
+ *
* @return mixed MDB2_OK on success, a MDB2 error on failure
*
* @access public
* @since 2.1.1
*/
- function setTransactionIsolation($isolation)
+ function setTransactionIsolation($isolation, $options = array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
switch ($isolation) {
@@ -619,7 +623,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
// }}}
// {{{ standaloneQuery()
- /**
+ /**
* execute a query as DBA
*
* @param string $query the SQL query
@@ -629,7 +633,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
* @return mixed MDB2_OK on success, a MDB2 error on failure
* @access public
*/
- function &standaloneQuery($query, $types = null, $is_manip = false)
+ function standaloneQuery($query, $types = null, $is_manip = false)
{
$user = $this->options['DBA_username']? $this->options['DBA_username'] : $this->dsn['username'];
$pass = $this->options['DBA_password']? $this->options['DBA_password'] : $this->dsn['password'];
@@ -643,7 +647,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$this->offset = $this->limit = 0;
$query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
- $result =& $this->_doQuery($query, $is_manip, $connection, $this->database_name);
+ $result = $this->_doQuery($query, $is_manip, $connection, $this->database_name);
if (!PEAR::isError($result)) {
if ($is_manip) {
$result = $this->_affectedRows($connection, $result);
@@ -668,7 +672,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
* @return result or error object
* @access protected
*/
- function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
+ function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
@@ -693,12 +697,12 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$function = $this->options['multi_query'] ? 'pg_send_query' : 'pg_query';
$result = @$function($connection, $query);
if (!$result) {
- $err =& $this->raiseError(null, null, null,
+ $err = $this->raiseError(null, null, null,
'Could not execute statement', __FUNCTION__);
return $err;
} elseif ($this->options['multi_query']) {
if (!($result = @pg_get_result($connection))) {
- $err =& $this->raiseError(null, null, null,
+ $err = $this->raiseError(null, null, null,
'Could not get the first result from a multi query', __FUNCTION__);
return $err;
}
@@ -865,11 +869,10 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
* @access public
* @see bindParam, execute
*/
- function &prepare($query, $types = null, $result_types = null, $lobs = array())
+ function prepare($query, $types = null, $result_types = null, $lobs = array())
{
if ($this->options['emulate_prepared']) {
- $obj =& parent::prepare($query, $types, $result_types, $lobs);
- return $obj;
+ return parent::prepare($query, $types, $result_types, $lobs);
}
$is_manip = ($result_types === MDB2_PREPARE_MANIP);
$offset = $this->offset;
@@ -940,7 +943,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
$param = preg_replace($regexp, '\\1', $query);
if ($param === '') {
- $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
+ $err = $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
'named parameter name must match "bindname_format" option', __FUNCTION__);
return $err;
}
@@ -985,7 +988,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
if (false === $pgtypes) {
$result = @pg_prepare($connection, $statement_name, $query);
if (!$result) {
- $err =& $this->raiseError(null, null, null,
+ $err = $this->raiseError(null, null, null,
'Unable to create prepared statement handle', __FUNCTION__);
return $err;
}
@@ -995,7 +998,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$types_string = ' ('.implode(', ', $pgtypes).') ';
}
$query = 'PREPARE '.$statement_name.$types_string.' AS '.$query;
- $statement =& $this->_doQuery($query, true, $connection);
+ $statement = $this->_doQuery($query, true, $connection);
if (PEAR::isError($statement)) {
return $statement;
}
@@ -1164,7 +1167,7 @@ class MDB2_Result_pgsql extends MDB2_Result_Common
* @return int data array on success, a MDB2 error on failure
* @access public
*/
- function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
+ function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
{
if (null !== $rownum) {
$seek = $this->seek($rownum);
@@ -1187,12 +1190,11 @@ class MDB2_Result_pgsql extends MDB2_Result_Common
}
if (!$row) {
if (false === $this->result) {
- $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
+ $err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
'resultset has already been freed', __FUNCTION__);
return $err;
}
- $null = null;
- return $null;
+ return null;
}
$mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
$rtrim = false;
@@ -1427,11 +1429,10 @@ class MDB2_Statement_pgsql extends MDB2_Statement_Common
* a MDB2 error on failure
* @access private
*/
- function &_execute($result_class = true, $result_wrap_class = false)
+ function _execute($result_class = true, $result_wrap_class = false)
{
if (null === $this->statement) {
- $result =& parent::_execute($result_class, $result_wrap_class);
- return $result;
+ return parent::_execute($result_class, $result_wrap_class);
}
$this->db->last_query = $this->query;
$this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
@@ -1492,7 +1493,7 @@ class MDB2_Statement_pgsql extends MDB2_Statement_Common
if (!$query) {
$result = @pg_execute($connection, $this->statement, $parameters);
if (!$result) {
- $err =& $this->db->raiseError(null, null, null,
+ $err = $this->db->raiseError(null, null, null,
'Unable to execute statement', __FUNCTION__);
return $err;
}
@@ -1508,7 +1509,7 @@ class MDB2_Statement_pgsql extends MDB2_Statement_Common
return $affected_rows;
}
- $result =& $this->db->_wrapResult($result, $this->result_types,
+ $result = $this->db->_wrapResult($result, $this->result_types,
$result_class, $result_wrap_class, $this->limit, $this->offset);
$this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
return $result;