diff options
author | alecpl <alec@alec.pl> | 2010-03-12 08:13:59 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-03-12 08:13:59 +0000 |
commit | 7244b4500e2b685cee5e9c4746a87f12acb56297 (patch) | |
tree | 7649eb06e5ae60b8de741256add44cd74443d47b /program/lib/MDB2/Driver | |
parent | bc404ffd41c3411510a022ae5b0c9f2bfe8f5db1 (diff) |
- Merge changes from MDB2's trunk
Diffstat (limited to 'program/lib/MDB2/Driver')
31 files changed, 464 insertions, 416 deletions
diff --git a/program/lib/MDB2/Driver/Datatype/mssql.php b/program/lib/MDB2/Driver/Datatype/mssql.php index dcabed2d2..b0db7051a 100644 --- a/program/lib/MDB2/Driver/Datatype/mssql.php +++ b/program/lib/MDB2/Driver/Datatype/mssql.php @@ -44,7 +44,7 @@ // | Daniel Convissor <danielc@php.net> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -136,7 +136,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -215,7 +215,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common */ function _getIntegerDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -269,7 +269,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common */ function _getCLOBDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -305,7 +305,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common */ function _getBLOBDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -355,7 +355,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common */ function matchPattern($pattern, $operator = null, $field = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -476,7 +476,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common $length = null; break; default: - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Datatype/mysql.php b/program/lib/MDB2/Driver/Datatype/mysql.php index ac7bcd316..055e01067 100644 --- a/program/lib/MDB2/Driver/Datatype/mysql.php +++ b/program/lib/MDB2/Driver/Datatype/mysql.php @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -116,7 +116,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -219,7 +219,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common */ function _getIntegerDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -236,6 +236,9 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common $notnull = empty($field['notnull']) ? '' : ' NOT NULL'; $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED'; + if (empty($default) && empty($notnull)) { + $default = ' DEFAULT NULL'; + } $name = $db->quoteIdentifier($name, true); return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc; } @@ -308,7 +311,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common */ function _getDecimalDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -346,7 +349,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common */ function matchPattern($pattern, $operator = null, $field = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -537,7 +540,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common $length = null; break; default: - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Datatype/mysqli.php b/program/lib/MDB2/Driver/Datatype/mysqli.php index 9ccd1b443..9db4fa446 100644 --- a/program/lib/MDB2/Driver/Datatype/mysqli.php +++ b/program/lib/MDB2/Driver/Datatype/mysqli.php @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysqli.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -116,7 +116,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -219,7 +219,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common */ function _getIntegerDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -236,6 +236,9 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common $notnull = empty($field['notnull']) ? '' : ' NOT NULL'; $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED'; + if (empty($default) && empty($notnull)) { + $default = ' DEFAULT NULL'; + } $name = $db->quoteIdentifier($name, true); return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc; } @@ -308,7 +311,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common */ function _getDecimalDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -346,7 +349,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common */ function matchPattern($pattern, $operator = null, $field = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -537,7 +540,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common $length = null; break; default: - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -565,7 +568,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common */ function mapPrepareDatatype($type) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Datatype/pgsql.php b/program/lib/MDB2/Driver/Datatype/pgsql.php index 2a0bbb717..f036886e3 100644 --- a/program/lib/MDB2/Driver/Datatype/pgsql.php +++ b/program/lib/MDB2/Driver/Datatype/pgsql.php @@ -42,7 +42,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 $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -117,7 +117,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -198,7 +198,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function _getIntegerDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -219,6 +219,9 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common } $notnull = empty($field['notnull']) ? '' : ' NOT NULL'; + if (empty($default) && empty($notnull)) { + $default = ' DEFAULT NULL'; + } $name = $db->quoteIdentifier($name, true); return $name.' '.$this->getTypeDeclaration($field).$default.$notnull; } @@ -239,7 +242,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function _quoteCLOB($value, $quote, $escape_wildcards) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -271,7 +274,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common if (!$quote) { return $value; } - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -333,7 +336,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function matchPattern($pattern, $operator = null, $field = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -388,7 +391,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function patternEscapeString() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -514,7 +517,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common $length = null; break; default: - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -541,7 +544,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function mapPrepareDatatype($type) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Datatype/sqlite.php b/program/lib/MDB2/Driver/Datatype/sqlite.php index 4b68b8c40..3afa78a7e 100644 --- a/program/lib/MDB2/Driver/Datatype/sqlite.php +++ b/program/lib/MDB2/Driver/Datatype/sqlite.php @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -101,7 +101,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -199,7 +199,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common */ function _getIntegerDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -216,6 +216,9 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common $notnull = empty($field['notnull']) ? '' : ' NOT NULL'; $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED'; + if (empty($default) && empty($notnull)) { + $default = ' DEFAULT NULL'; + } $name = $db->quoteIdentifier($name, true); return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc; } @@ -237,7 +240,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common */ function matchPattern($pattern, $operator = null, $field = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -394,7 +397,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common $length = null; break; default: - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Datatype/sqlsrv.php b/program/lib/MDB2/Driver/Datatype/sqlsrv.php index 078c2a9b2..53a7c09ad 100644 --- a/program/lib/MDB2/Driver/Datatype/sqlsrv.php +++ b/program/lib/MDB2/Driver/Datatype/sqlsrv.php @@ -132,7 +132,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -211,7 +211,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common */ function _getIntegerDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -265,7 +265,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common */ function _getCLOBDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -301,7 +301,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common */ function _getBLOBDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -431,7 +431,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common $length = null; break; default: - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Function/mssql.php b/program/lib/MDB2/Driver/Function/mssql.php index 972c5adfe..69a002f9a 100644 --- a/program/lib/MDB2/Driver/Function/mssql.php +++ b/program/lib/MDB2/Driver/Function/mssql.php @@ -42,7 +42,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Function/Common.php'; @@ -71,9 +71,9 @@ class MDB2_Driver_Function_mssql extends MDB2_Driver_Function_Common * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure * @access public */ - function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) + function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Function/mysql.php b/program/lib/MDB2/Driver/Function/mysql.php index 81d9911f3..f34bed651 100644 --- a/program/lib/MDB2/Driver/Function/mysql.php +++ b/program/lib/MDB2/Driver/Function/mysql.php @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php 253106 2008-02-17 18:54:08Z quipo $ +// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Function/Common.php'; @@ -71,9 +71,9 @@ class MDB2_Driver_Function_mysql extends MDB2_Driver_Function_Common * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure * @access public */ - function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) + function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Function/mysqli.php b/program/lib/MDB2/Driver/Function/mysqli.php index b5adc2ae8..86a693259 100644 --- a/program/lib/MDB2/Driver/Function/mysqli.php +++ b/program/lib/MDB2/Driver/Function/mysqli.php @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysqli.php 253106 2008-02-17 18:54:08Z quipo $ +// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Function/Common.php'; @@ -71,9 +71,9 @@ class MDB2_Driver_Function_mysqli extends MDB2_Driver_Function_Common * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure * @access public */ - function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) + function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -84,7 +84,7 @@ class MDB2_Driver_Function_mysqli extends MDB2_Driver_Function_Common } $query = 'CALL '.$name; $query .= $params ? '('.implode(', ', $params).')' : '()'; - $result =& $db->query($query, $types, $result_class, $result_wrap_class); + $result = $db->query($query, $types, $result_class, $result_wrap_class); if (!$multi_query) { $db->setOption('multi_query', false); } diff --git a/program/lib/MDB2/Driver/Function/pgsql.php b/program/lib/MDB2/Driver/Function/pgsql.php index 75cad08eb..ae9519075 100644 --- a/program/lib/MDB2/Driver/Function/pgsql.php +++ b/program/lib/MDB2/Driver/Function/pgsql.php @@ -42,7 +42,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php 268669 2008-11-09 19:46:50Z quipo $ +// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $ require_once 'MDB2/Driver/Function/Common.php'; @@ -69,9 +69,9 @@ class MDB2_Driver_Function_pgsql extends MDB2_Driver_Function_Common * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure * @access public */ - function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) + function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Function/sqlite.php b/program/lib/MDB2/Driver/Function/sqlite.php index 307a5c834..34e4fcb48 100644 --- a/program/lib/MDB2/Driver/Function/sqlite.php +++ b/program/lib/MDB2/Driver/Function/sqlite.php @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Function/Common.php'; @@ -147,12 +147,12 @@ class MDB2_Driver_Function_sqlite extends MDB2_Driver_Function_Common */ function replace($str, $from_str, $to_str) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } - $error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + $error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'method not implemented', __FUNCTION__); return $error; } diff --git a/program/lib/MDB2/Driver/Function/sqlsrv.php b/program/lib/MDB2/Driver/Function/sqlsrv.php index 4b1f35a40..055dc9d37 100644 --- a/program/lib/MDB2/Driver/Function/sqlsrv.php +++ b/program/lib/MDB2/Driver/Function/sqlsrv.php @@ -67,9 +67,9 @@ class MDB2_Driver_Function_sqlsrv extends MDB2_Driver_Function_Common * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure * @access public */ - function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) + function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Manager/mssql.php b/program/lib/MDB2/Driver/Manager/mssql.php index 16e1bbe38..22a40543a 100644 --- a/program/lib/MDB2/Driver/Manager/mssql.php +++ b/program/lib/MDB2/Driver/Manager/mssql.php @@ -44,7 +44,7 @@ // | Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -74,7 +74,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function createDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -106,7 +106,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function alterDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -138,7 +138,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function dropDatabase($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -245,7 +245,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function truncateTable($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -275,7 +275,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function vacuum($table = null, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -385,7 +385,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function alterTable($name, $changes, $check) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -546,7 +546,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function _dropConflictingIndices($table, $fields) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -592,7 +592,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function _dropConflictingConstraints($table, $fields) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -647,7 +647,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function _getTableFieldDefaultConstraint($table, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -673,7 +673,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listTables() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; @@ -710,7 +710,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listTableFields($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -742,7 +742,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listTableIndexes($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -790,7 +790,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listDatabases() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -816,7 +816,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listUsers() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -842,7 +842,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listFunctions() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -883,7 +883,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listTableTriggers($table = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -924,7 +924,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listViews() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -967,7 +967,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function dropIndex($table, $name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -990,7 +990,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listTableConstraints($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1033,7 +1033,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function createSequence($seq_name, $start = 1) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1079,7 +1079,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function dropSequence($seq_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1099,7 +1099,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common */ function listSequences() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Manager/mysql.php b/program/lib/MDB2/Driver/Manager/mysql.php index 2fb15aac1..a7afa76e1 100644 --- a/program/lib/MDB2/Driver/Manager/mysql.php +++ b/program/lib/MDB2/Driver/Manager/mysql.php @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -71,7 +71,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -101,7 +101,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function alterDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -128,7 +128,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropDatabase($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -204,7 +204,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createTable($name, $fields, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -285,7 +285,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropTable($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -321,7 +321,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function truncateTable($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -349,7 +349,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function vacuum($table = null, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -474,7 +474,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function alterTable($name, $changes, $check) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -575,7 +575,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listDatabases() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -601,7 +601,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listUsers() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -620,7 +620,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listFunctions() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -653,7 +653,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTableTriggers($table = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -685,7 +685,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTables($database = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -725,7 +725,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listViews($database = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -759,7 +759,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTableFields($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -815,7 +815,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createIndex($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -848,7 +848,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropIndex($table, $name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -870,7 +870,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTableIndexes($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -934,7 +934,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createConstraint($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1008,7 +1008,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropConstraint($table, $name, $primary = false) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1058,7 +1058,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function _createFKTriggers($table, $foreign_keys) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1204,7 +1204,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function _dropFKTriggers($table, $fkname, $referenced_table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1238,7 +1238,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTableConstraints($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1313,7 +1313,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createSequence($seq_name, $start = 1, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1386,7 +1386,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropSequence($seq_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1407,7 +1407,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listSequences($database = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Manager/mysqli.php b/program/lib/MDB2/Driver/Manager/mysqli.php index d08544988..f01747aa7 100644 --- a/program/lib/MDB2/Driver/Manager/mysqli.php +++ b/program/lib/MDB2/Driver/Manager/mysqli.php @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysqli.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -71,7 +71,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function createDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -101,7 +101,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function alterDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -128,7 +128,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function dropDatabase($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -204,7 +204,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function createTable($name, $fields, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -285,7 +285,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function dropTable($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -321,7 +321,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function truncateTable($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -349,7 +349,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function vacuum($table = null, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -474,7 +474,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function alterTable($name, $changes, $check) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -575,7 +575,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listDatabases() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -601,7 +601,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listUsers() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -620,7 +620,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listFunctions() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -653,7 +653,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listTableTriggers($table = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -685,7 +685,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listTables($database = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -725,7 +725,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listViews($database = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -759,7 +759,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listTableFields($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -815,7 +815,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function createIndex($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -848,7 +848,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function dropIndex($table, $name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -870,7 +870,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listTableIndexes($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -934,7 +934,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function createConstraint($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1008,7 +1008,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function dropConstraint($table, $name, $primary = false) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1058,7 +1058,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function _createFKTriggers($table, $foreign_keys) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1204,7 +1204,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function _dropFKTriggers($table, $fkname, $referenced_table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1238,7 +1238,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listTableConstraints($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1313,7 +1313,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function createSequence($seq_name, $start = 1, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1386,7 +1386,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function dropSequence($seq_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1407,7 +1407,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common */ function listSequences($database = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Manager/pgsql.php b/program/lib/MDB2/Driver/Manager/pgsql.php index 913a58db0..7d356277b 100644 --- a/program/lib/MDB2/Driver/Manager/pgsql.php +++ b/program/lib/MDB2/Driver/Manager/pgsql.php @@ -42,7 +42,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 $ require_once 'MDB2/Driver/Manager/Common.php'; @@ -68,7 +68,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function createDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -95,7 +95,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function alterDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -122,7 +122,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function dropDatabase($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -181,7 +181,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function truncateTable($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -209,7 +209,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function vacuum($table = null, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -326,7 +326,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function alterTable($name, $changes, $check) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -441,7 +441,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listDatabases() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -474,7 +474,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listUsers() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -501,7 +501,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listViews() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -532,7 +532,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listTableViews($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -560,7 +560,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listFunctions() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -599,7 +599,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listTableTriggers($table = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -633,7 +633,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listTables() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -680,7 +680,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listTableFields($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -716,7 +716,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listTableIndexes($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -769,7 +769,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function dropConstraint($table, $name, $primary = false) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -817,7 +817,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listTableConstraints($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -882,7 +882,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function createSequence($seq_name, $start = 1) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -904,7 +904,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function dropSequence($seq_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -924,7 +924,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common */ function listSequences() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Manager/sqlite.php b/program/lib/MDB2/Driver/Manager/sqlite.php index ba0d162c5..aa01caf32 100644 --- a/program/lib/MDB2/Driver/Manager/sqlite.php +++ b/program/lib/MDB2/Driver/Manager/sqlite.php @@ -43,7 +43,7 @@ // | Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -71,7 +71,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function createDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -107,7 +107,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function dropDatabase($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -174,7 +174,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function _getCreateTableQuery($name, $fields, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -236,7 +236,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common } // create triggers to enforce FOREIGN KEY constraints if (!empty($options['foreign_keys'])) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -384,7 +384,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function dropTable($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -427,7 +427,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function vacuum($table = null, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -534,7 +534,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function alterTable($name, $changes, $check, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -687,7 +687,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common $query = 'INSERT INTO '.$db->quoteIdentifier($name_new, true); $query.= '('.implode(', ', array_slice(array_keys($fields), 0, count($select_fields))).')'; $query.=' VALUES (?'.str_repeat(', ?', (count($select_fields) - 1)).')'; - $stmt =& $db->prepare($query, null, MDB2_PREPARE_MANIP); + $stmt = $db->prepare($query, null, MDB2_PREPARE_MANIP); if (PEAR::isError($stmt)) { return $stmt; } @@ -712,7 +712,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listDatabases() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -732,7 +732,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listUsers() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -752,7 +752,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listViews() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -780,7 +780,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableViews($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -816,7 +816,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTables() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -850,7 +850,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableFields($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -898,7 +898,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableTriggers($table = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -958,7 +958,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function createIndex($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -998,7 +998,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function dropIndex($table, $name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1019,7 +1019,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableIndexes($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1080,7 +1080,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function createConstraint($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1133,7 +1133,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common return $this->alterTable($table, array(), false, array('primary' => null)); } - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1170,7 +1170,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function _dropFKTriggers($table, $fkname, $referenced_table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1204,7 +1204,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableConstraints($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1274,7 +1274,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function createSequence($seq_name, $start = 1) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1315,7 +1315,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function dropSequence($seq_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1335,7 +1335,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listSequences() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Manager/sqlsrv.php b/program/lib/MDB2/Driver/Manager/sqlsrv.php index d0cac98c7..256e000af 100644 --- a/program/lib/MDB2/Driver/Manager/sqlsrv.php +++ b/program/lib/MDB2/Driver/Manager/sqlsrv.php @@ -71,7 +71,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function createDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -103,7 +103,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function alterDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -135,7 +135,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function dropDatabase($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -156,7 +156,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function dropTable($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -262,7 +262,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function truncateTable($name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -292,7 +292,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function vacuum($table = null, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -402,7 +402,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function alterTable($name, $changes, $check) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -563,7 +563,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function _dropConflictingIndices($table, $fields) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -609,7 +609,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function _dropConflictingConstraints($table, $fields) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -664,7 +664,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function _getTableFieldDefaultConstraint($table, $field) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -690,7 +690,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listTables() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; @@ -727,7 +727,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listTableFields($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -759,7 +759,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listTableIndexes($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -807,7 +807,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listDatabases() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -833,7 +833,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listUsers() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -859,7 +859,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listFunctions() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -900,7 +900,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listTableTriggers($table = null) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -941,7 +941,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listViews() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -984,7 +984,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function dropIndex($table, $name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1007,7 +1007,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listTableConstraints($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1052,7 +1052,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function _getCreateTableQuery($name, $fields, $options = array()) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1097,7 +1097,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function createSequence($seq_name, $start = 1) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1143,7 +1143,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function dropSequence($seq_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1163,7 +1163,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function listSequences() { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1217,7 +1217,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function getTableStatus($table) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1239,7 +1239,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common function checkTable($tableName) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1345,7 +1345,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common */ function createConstraint($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Native/pgsql.php b/program/lib/MDB2/Driver/Native/pgsql.php index 9b2a4f21e..80495c57c 100644 --- a/program/lib/MDB2/Driver/Native/pgsql.php +++ b/program/lib/MDB2/Driver/Native/pgsql.php @@ -42,7 +42,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php 216444 2006-07-15 13:07:15Z lsmith $ +// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $ require_once 'MDB2/Driver/Native/Common.php'; @@ -67,7 +67,7 @@ class MDB2_Driver_Native_pgsql extends MDB2_Driver_Native_Common */ function deleteOID($OID) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Reverse/mssql.php b/program/lib/MDB2/Driver/Reverse/mssql.php index 96bc09515..e83ab6f60 100644 --- a/program/lib/MDB2/Driver/Reverse/mssql.php +++ b/program/lib/MDB2/Driver/Reverse/mssql.php @@ -43,7 +43,7 @@ // | Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Reverse/Common.php'; @@ -70,7 +70,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common */ function getTableFieldDefinition($table_name, $field_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -187,7 +187,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common */ function getTableIndexDefinition($table_name, $index_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -271,7 +271,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common */ function getTableConstraintDefinition($table_name, $constraint_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -406,7 +406,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common */ function getTriggerDefinition($trigger) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -486,7 +486,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common return parent::tableInfo($result, $mode); } - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -564,7 +564,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common */ function _mssql_field_flags($table, $column) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Reverse/mysql.php b/program/lib/MDB2/Driver/Reverse/mysql.php index 2ac9fc0f5..1cd2ad9c0 100644 --- a/program/lib/MDB2/Driver/Reverse/mysql.php +++ b/program/lib/MDB2/Driver/Reverse/mysql.php @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Reverse/Common.php'; @@ -69,7 +69,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function getTableFieldDefinition($table_name, $field_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -117,9 +117,17 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common $default = ''; } } + $definition[0] = array( + 'notnull' => $notnull, + 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type']) + ); $autoincrement = false; - if (!empty($column['extra']) && $column['extra'] == 'auto_increment') { - $autoincrement = true; + if (!empty($column['extra'])) { + if ($column['extra'] == 'auto_increment') { + $autoincrement = true; + } else { + $definition[0]['extra'] = $column['extra']; + } } $collate = null; if (!empty($column['collation'])) { @@ -127,10 +135,6 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common $charset = preg_replace('/(.+?)(_.+)?/', '$1', $collate); } - $definition[0] = array( - 'notnull' => $notnull, - 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type']) - ); if (null !== $length) { $definition[0]['length'] = $length; } @@ -181,7 +185,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function getTableIndexDefinition($table_name, $index_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -256,7 +260,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function getTableConstraintDefinition($table_name, $constraint_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -356,10 +360,16 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function _getTableFKConstraintDefinition($table, $constraint_name, $definition) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } + //Use INFORMATION_SCHEMA instead? + //SELECT * + // FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS + // WHERE CONSTRAINT_SCHEMA = '$dbname' + // AND TABLE_NAME = '$table' + // AND CONSTRAINT_NAME = '$constraint_name'; $query = 'SHOW CREATE TABLE '. $db->escape($table); $constraint = $db->queryOne($query, 'text', 1); if (!PEAR::isError($constraint) && !empty($constraint)) { @@ -372,10 +382,10 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common } $constraint_name_original = $constraint_name; $constraint_name = $db->getIndexName($constraint_name); - $pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i'; + $pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i'; if (!preg_match($pattern, str_replace('`', '', $constraint), $matches)) { //fallback to original constraint name - $pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i'; + $pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i'; } if (preg_match($pattern, str_replace('`', '', $constraint), $matches)) { $definition['foreign'] = true; @@ -397,8 +407,8 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common 'position' => $colpos++ ); } - $definition['onupdate'] = 'NO ACTION'; - $definition['ondelete'] = 'NO ACTION'; + $definition['ondelete'] = empty($matches[4]) ? 'RESTRICT' : strtoupper($matches[4]); + $definition['onupdate'] = empty($matches[5]) ? 'RESTRICT' : strtoupper($matches[5]); $definition['match'] = 'SIMPLE'; return $definition; } @@ -424,7 +434,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function getTriggerDefinition($trigger) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -476,7 +486,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common return parent::tableInfo($result, $mode); } - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -506,11 +516,11 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common $db->loadModule('Datatype', null, true); for ($i = 0; $i < $count; $i++) { $res[$i] = array( - 'table' => $case_func(@mysql_field_table($resource, $i)), - 'name' => $case_func(@mysql_field_name($resource, $i)), - 'type' => @mysql_field_type($resource, $i), - 'length' => @mysql_field_len($resource, $i), - 'flags' => @mysql_field_flags($resource, $i), + 'table' => $case_func(@mysql_field_table($resource, $i)), + 'name' => $case_func(@mysql_field_name($resource, $i)), + 'type' => @mysql_field_type($resource, $i), + 'length' => @mysql_field_len($resource, $i), + 'flags' => @mysql_field_flags($resource, $i), ); if ($res[$i]['type'] == 'string') { $res[$i]['type'] = 'char'; diff --git a/program/lib/MDB2/Driver/Reverse/mysqli.php b/program/lib/MDB2/Driver/Reverse/mysqli.php index 4ad52b16c..10e918338 100644 --- a/program/lib/MDB2/Driver/Reverse/mysqli.php +++ b/program/lib/MDB2/Driver/Reverse/mysqli.php @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysqli.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Reverse/Common.php'; @@ -123,7 +123,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common */ function getTableFieldDefinition($table_name, $field_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -171,9 +171,17 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common $default = ''; } } + $definition[0] = array( + 'notnull' => $notnull, + 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type']) + ); $autoincrement = false; - if (!empty($column['extra']) && $column['extra'] == 'auto_increment') { - $autoincrement = true; + if (!empty($column['extra'])) { + if ($column['extra'] == 'auto_increment') { + $autoincrement = true; + } else { + $definition[0]['extra'] = $column['extra']; + } } $collate = null; if (!empty($column['collation'])) { @@ -181,10 +189,6 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common $charset = preg_replace('/(.+?)(_.+)?/', '$1', $collate); } - $definition[0] = array( - 'notnull' => $notnull, - 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type']) - ); if (null !== $length) { $definition[0]['length'] = $length; } @@ -235,7 +239,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common */ function getTableIndexDefinition($table_name, $index_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -310,7 +314,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common */ function getTableConstraintDefinition($table_name, $constraint_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -410,10 +414,16 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common */ function _getTableFKConstraintDefinition($table, $constraint_name, $definition) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } + //Use INFORMATION_SCHEMA instead? + //SELECT * + // FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS + // WHERE CONSTRAINT_SCHEMA = '$dbname' + // AND TABLE_NAME = '$table' + // AND CONSTRAINT_NAME = '$constraint_name'; $query = 'SHOW CREATE TABLE '. $db->escape($table); $constraint = $db->queryOne($query, 'text', 1); if (!PEAR::isError($constraint) && !empty($constraint)) { @@ -426,10 +436,10 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common } $constraint_name_original = $constraint_name; $constraint_name = $db->getIndexName($constraint_name); - $pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i'; + $pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i'; if (!preg_match($pattern, str_replace('`', '', $constraint), $matches)) { //fallback to original constraint name - $pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i'; + $pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i'; } if (preg_match($pattern, str_replace('`', '', $constraint), $matches)) { $definition['foreign'] = true; @@ -451,8 +461,8 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common 'position' => $colpos++ ); } - $definition['onupdate'] = 'NO ACTION'; - $definition['ondelete'] = 'NO ACTION'; + $definition['ondelete'] = empty($matches[4]) ? 'RESTRICT' : strtoupper($matches[4]); + $definition['onupdate'] = empty($matches[5]) ? 'RESTRICT' : strtoupper($matches[5]); $definition['match'] = 'SIMPLE'; return $definition; } @@ -478,7 +488,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common */ function getTriggerDefinition($trigger) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -530,7 +540,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common return parent::tableInfo($result, $mode); } - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Reverse/pgsql.php b/program/lib/MDB2/Driver/Reverse/pgsql.php index 47ae38ec1..a630f306c 100644 --- a/program/lib/MDB2/Driver/Reverse/pgsql.php +++ b/program/lib/MDB2/Driver/Reverse/pgsql.php @@ -43,7 +43,7 @@ // | Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $ require_once 'MDB2/Driver/Reverse/Common.php'; @@ -69,7 +69,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common */ function getTableFieldDefinition($table_name, $field_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -199,7 +199,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common */ function getTableIndexDefinition($table_name, $index_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -257,7 +257,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common */ function getTableConstraintDefinition($table_name, $constraint_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -444,7 +444,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common */ function getTriggerDefinition($trigger) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -518,7 +518,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common return parent::tableInfo($result, $mode); } - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Reverse/sqlite.php b/program/lib/MDB2/Driver/Reverse/sqlite.php index 6fb638298..c88ad0ddb 100644 --- a/program/lib/MDB2/Driver/Reverse/sqlite.php +++ b/program/lib/MDB2/Driver/Reverse/sqlite.php @@ -43,7 +43,7 @@ // | Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $ // require_once 'MDB2/Driver/Reverse/Common.php'; @@ -78,7 +78,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function _getTableColumns($sql) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -156,7 +156,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function getTableFieldDefinition($table_name, $field_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -258,7 +258,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function getTableIndexDefinition($table_name, $index_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -341,7 +341,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function getTableConstraintDefinition($table_name, $constraint_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -532,7 +532,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function getTriggerDefinition($trigger) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -596,7 +596,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common return parent::tableInfo($result, $mode); } - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/Reverse/sqlsrv.php b/program/lib/MDB2/Driver/Reverse/sqlsrv.php index 3835ceb85..d913594e9 100644 --- a/program/lib/MDB2/Driver/Reverse/sqlsrv.php +++ b/program/lib/MDB2/Driver/Reverse/sqlsrv.php @@ -67,7 +67,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common */ function getTableFieldDefinition($table_name, $field_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -184,7 +184,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common */ function getTableIndexDefinition($table_name, $index_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -268,7 +268,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common */ function getTableConstraintDefinition($table_name, $constraint_name) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -403,7 +403,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common */ function getTriggerDefinition($trigger) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -483,7 +483,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common return parent::tableInfo($result, $mode); } - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -564,7 +564,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common */ function _mssql_field_flags($table, $column) { - $db =& $this->getDBInstance(); + $db = $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/program/lib/MDB2/Driver/mssql.php b/program/lib/MDB2/Driver/mssql.php index 3e45fef8c..88d326b7a 100644 --- a/program/lib/MDB2/Driver/mssql.php +++ b/program/lib/MDB2/Driver/mssql.php @@ -43,7 +43,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $ // // {{{ Class MDB2_Driver_mssql /** @@ -531,7 +531,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common // }}} // {{{ standaloneQuery() - /** + /** * execute a query as DBA * * @param string $query the SQL query @@ -541,7 +541,7 @@ class MDB2_Driver_mssql 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']; @@ -555,7 +555,7 @@ class MDB2_Driver_mssql 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)) { $result = $this->_affectedRows($connection, $result); } @@ -576,7 +576,7 @@ class MDB2_Driver_mssql 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')); @@ -614,7 +614,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common $result = @mssql_query($query, $connection); if (!$result) { - $err =& $this->raiseError(null, null, null, + $err = $this->raiseError(null, null, null, 'Could not execute statement', __FUNCTION__); return $err; } @@ -728,7 +728,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common function _checkSequence($seq_name) { $query = "SELECT * FROM $seq_name"; - $tableExists =& $this->_doQuery($query, true); + $tableExists = $this->_doQuery($query, true); if (PEAR::isError($tableExists)) { if ($tableExists->getCode() == MDB2_ERROR_NOSUCHTABLE) { return false; @@ -768,7 +768,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common } else { $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (0)"; } - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); $this->popExpect(); $this->popErrorHandling(); if (PEAR::isError($result)) { @@ -802,7 +802,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common $value = $this->lastInsertID($sequence_name); if (is_numeric($value)) { $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value"; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } @@ -895,11 +895,10 @@ class MDB2_Result_mssql 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 (!$this->_skipLimitOffset()) { - $null = null; - return $null; + return null; } if (null !== $rownum) { $seek = $this->seek($rownum); @@ -922,12 +921,11 @@ class MDB2_Result_mssql 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; diff --git a/program/lib/MDB2/Driver/mysql.php b/program/lib/MDB2/Driver/mysql.php index c9324ec14..790bb6faa 100644 --- a/program/lib/MDB2/Driver/mysql.php +++ b/program/lib/MDB2/Driver/mysql.php @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php 292659 2009-12-26 17:31:01Z quipo $ +// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $ // /** @@ -338,7 +338,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common register_shutdown_function('MDB2_closeOpenTransactions'); } $query = $this->start_transaction ? 'START TRANSACTION' : 'SET AUTOCOMMIT = 0'; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -385,13 +385,13 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common 'transactions are not supported', __FUNCTION__); } - $result =& $this->_doQuery('COMMIT', true); + $result = $this->_doQuery('COMMIT', true); if (PEAR::isError($result)) { return $result; } if (!$this->start_transaction) { $query = 'SET AUTOCOMMIT = 1'; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -431,13 +431,13 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common } $query = 'ROLLBACK'; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } if (!$this->start_transaction) { $query = 'SET AUTOCOMMIT = 1'; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -457,12 +457,16 @@ class MDB2_Driver_mysql 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)); if (!$this->supports('transactions')) { @@ -626,7 +630,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common $client_info = mysql_get_client_info(); if (function_exists('mysql_set_charset') && version_compare($client_info, '5.0.6')) { if (!$result = mysql_set_charset($charset, $connection)) { - $err =& $this->raiseError(null, null, null, + $err = $this->raiseError(null, null, null, 'Could not set client character set', __FUNCTION__); return $err; } @@ -709,7 +713,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common // }}} // {{{ standaloneQuery() - /** + /** * execute a query as DBA * * @param string $query the SQL query @@ -719,7 +723,7 @@ class MDB2_Driver_mysql 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']; @@ -733,7 +737,7 @@ class MDB2_Driver_mysql 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)) { $result = $this->_affectedRows($connection, $result); } @@ -754,7 +758,7 @@ class MDB2_Driver_mysql 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')); @@ -794,7 +798,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common ? 'mysql_query' : 'mysql_unbuffered_query'; $result = @$function($query, $connection); if (!$result && 0 !== mysql_errno($connection)) { - $err =& $this->raiseError(null, null, null, + $err = $this->raiseError(null, null, null, 'Could not execute statement', __FUNCTION__); return $err; } @@ -1032,7 +1036,7 @@ class MDB2_Driver_mysql 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()) { // connect to get server capabilities (http://pear.php.net/bugs/16147) $connection = $this->getConnection(); @@ -1043,8 +1047,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common if ($this->options['emulate_prepared'] || $this->supported['prepared_statements'] !== true ) { - $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; @@ -1104,7 +1107,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s'; $parameter = preg_replace($regexp, '\\1', $query); if ($parameter === '') { - $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; } @@ -1123,7 +1126,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common $statement_name = sprintf($this->options['statement_format'], $this->phptype, $prep_statement_counter++ . sha1(microtime() + mt_rand())); $statement_name = substr(strtolower($statement_name), 0, $this->options['max_identifiers_length']); $query = "PREPARE $statement_name FROM ".$this->quote($query, 'text'); - $statement =& $this->_doQuery($query, true, $connection); + $statement = $this->_doQuery($query, true, $connection); if (PEAR::isError($statement)) { return $statement; } @@ -1243,7 +1246,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common $table = $this->quoteIdentifier($table, true); $query = "REPLACE INTO $table ($query) VALUES ($values)"; - $result =& $this->_doQuery($query, true, $connection); + $result = $this->_doQuery($query, true, $connection); if (PEAR::isError($result)) { return $result; } @@ -1271,7 +1274,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)"; $this->pushErrorHandling(PEAR_ERROR_RETURN); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); $this->popExpect(); $this->popErrorHandling(); if (PEAR::isError($result)) { @@ -1290,7 +1293,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common $value = $this->lastInsertID(); if (is_numeric($value)) { $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value"; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } @@ -1355,7 +1358,7 @@ class MDB2_Result_mysql 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 (!is_null($rownum)) { $seek = $this->seek($rownum); @@ -1379,12 +1382,11 @@ class MDB2_Result_mysql extends MDB2_Result_Common if (!$row) { if ($this->result === false) { - $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; @@ -1597,10 +1599,10 @@ class MDB2_Statement_mysql 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 (is_null($this->statement)) { - $result =& parent::_execute($result_class, $result_wrap_class); + $result = parent::_execute($result_class, $result_wrap_class); return $result; } $this->db->last_query = $this->query; @@ -1668,7 +1670,7 @@ class MDB2_Statement_mysql 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; diff --git a/program/lib/MDB2/Driver/mysqli.php b/program/lib/MDB2/Driver/mysqli.php index 4543f5fe1..c74c4d2f7 100644 --- a/program/lib/MDB2/Driver/mysqli.php +++ b/program/lib/MDB2/Driver/mysqli.php @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysqli.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $ // /** @@ -336,7 +336,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common return MDB2_OK; //nothing to do } $query = $this->start_transaction ? 'START TRANSACTION' : 'SET AUTOCOMMIT = 0'; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -383,13 +383,13 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common 'transactions are not supported', __FUNCTION__); } - $result =& $this->_doQuery('COMMIT', true); + $result = $this->_doQuery('COMMIT', true); if (PEAR::isError($result)) { return $result; } if (!$this->start_transaction) { $query = 'SET AUTOCOMMIT = 1'; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -429,13 +429,13 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common } $query = 'ROLLBACK'; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } if (!$this->start_transaction) { $query = 'SET AUTOCOMMIT = 1'; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -455,12 +455,16 @@ class MDB2_Driver_mysqli 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)); if (!$this->supports('transactions')) { @@ -613,7 +617,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common return $this->_doQuery($query, true, $connection); } if (!$result = mysqli_set_charset($connection, $charset)) { - $err =& $this->raiseError(null, null, null, + $err = $this->raiseError(null, null, null, 'Could not set client character set', __FUNCTION__); return $err; } @@ -699,7 +703,7 @@ class MDB2_Driver_mysqli 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']; @@ -713,7 +717,7 @@ class MDB2_Driver_mysqli 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)) { $result = $this->_affectedRows($connection, $result); } @@ -734,7 +738,7 @@ class MDB2_Driver_mysqli 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')); @@ -778,7 +782,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common } if (!$result && 0 !== mysqli_errno($connection)) { - $err =& $this->raiseError(null, null, null, + $err = $this->raiseError(null, null, null, 'Could not execute statement', __FUNCTION__); return $err; } @@ -786,12 +790,12 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common if ($this->options['multi_query']) { if ($this->options['result_buffering']) { if (!($result = @mysqli_store_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; } } elseif (!($result = @mysqli_use_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; } @@ -1030,7 +1034,7 @@ class MDB2_Driver_mysqli 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()) { // connect to get server capabilities (http://pear.php.net/bugs/16147) $connection = $this->getConnection(); @@ -1041,8 +1045,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common if ($this->options['emulate_prepared'] || $this->supported['prepared_statements'] !== true ) { - $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; @@ -1102,7 +1105,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s'; $parameter = preg_replace($regexp, '\\1', $query); if ($parameter === '') { - $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; } @@ -1123,7 +1126,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common $statement_name = substr(strtolower($statement_name), 0, $this->options['max_identifiers_length']); $query = "PREPARE $statement_name FROM ".$this->quote($query, 'text'); - $statement =& $this->_doQuery($query, true, $connection); + $statement = $this->_doQuery($query, true, $connection); if (PEAR::isError($statement)) { return $statement; } @@ -1131,7 +1134,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common } else { $statement = @mysqli_prepare($connection, $query); if (!$statement) { - $err =& $this->raiseError(null, null, null, + $err = $this->raiseError(null, null, null, 'Unable to create prepared statement handle', __FUNCTION__); return $err; } @@ -1252,7 +1255,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common $table = $this->quoteIdentifier($table, true); $query = "REPLACE INTO $table ($query) VALUES ($values)"; - $result =& $this->_doQuery($query, true, $connection); + $result = $this->_doQuery($query, true, $connection); if (PEAR::isError($result)) { return $result; } @@ -1280,7 +1283,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)"; $this->pushErrorHandling(PEAR_ERROR_RETURN); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); $this->popExpect(); $this->popErrorHandling(); if (PEAR::isError($result)) { @@ -1299,7 +1302,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common $value = $this->lastInsertID(); if (is_numeric($value)) { $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value"; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } @@ -1364,7 +1367,7 @@ class MDB2_Result_mysqli 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); @@ -1392,8 +1395,7 @@ class MDB2_Result_mysqli extends MDB2_Result_Common '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; @@ -1667,10 +1669,10 @@ class MDB2_Statement_mysqli 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); + $result = parent::_execute($result_class, $result_wrap_class); return $result; } $this->db->last_query = $this->query; @@ -1689,6 +1691,7 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common $query = 'EXECUTE '.$this->statement; } if (!empty($this->positions)) { + $paramReferences = array(); $parameters = array(0 => $this->statement, 1 => ''); $lobs = array(); $i = 0; @@ -1730,15 +1733,18 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common } } else { if (is_resource($value) || $type == 'clob' || $type == 'blob') { - $parameters[] = null; + $paramReferences[$i] = null; + // mysqli_stmt_bind_param() requires parameters to be passed by reference + $parameters[] =& $paramReferences[$i]; $parameters[1].= 'b'; $lobs[$i] = $parameter; } else { - $quoted = $this->db->quote($value, $type, false); - if (PEAR::isError($quoted)) { - return $quoted; + $paramReferences[$i] = $this->db->quote($value, $type, false); + if (PEAR::isError($paramReferences[$i])) { + return $paramReferences[$i]; } - $parameters[] = $quoted; + // mysqli_stmt_bind_param() requires parameters to be passed by reference + $parameters[] =& $paramReferences[$i]; $parameters[1].= $this->db->datatype->mapPrepareDatatype($type); } ++$i; @@ -1748,9 +1754,9 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common if (!is_object($this->statement)) { $query.= ' USING @'.implode(', @', array_values($this->positions)); } else { - $result = @call_user_func_array('mysqli_stmt_bind_param', $parameters); + $result = call_user_func_array('mysqli_stmt_bind_param', $parameters); if (false === $result) { - $err =& $this->db->raiseError(null, null, null, + $err = $this->db->raiseError(null, null, null, 'Unable to bind parameters', __FUNCTION__); return $err; } @@ -1794,11 +1800,14 @@ class MDB2_Statement_mysqli 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); } else { - if (!@mysqli_stmt_execute($this->statement)) { - $err =& $this->db->raiseError(null, null, null, +//echo '<pre>'; var_dump($this->statement, mysqli_stmt_error($this->statement));exit; + + if (!mysqli_stmt_execute($this->statement)) { +echo '<pre>'; var_dump($this->statement, mysqli_stmt_error($this->statement));exit; + $err = $this->db->raiseError(null, null, null, 'Unable to execute statement', __FUNCTION__); return $err; } @@ -1812,7 +1821,7 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common @mysqli_stmt_store_result($this->statement); } - $result =& $this->db->_wrapResult($this->statement, $this->result_types, + $result = $this->db->_wrapResult($this->statement, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset); } 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; diff --git a/program/lib/MDB2/Driver/sqlite.php b/program/lib/MDB2/Driver/sqlite.php index 282b8eca3..e1726b04b 100644 --- a/program/lib/MDB2/Driver/sqlite.php +++ b/program/lib/MDB2/Driver/sqlite.php @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $ +// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $ // /** @@ -206,7 +206,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common register_shutdown_function('MDB2_closeOpenTransactions'); } $query = 'BEGIN TRANSACTION '.$this->options['base_transaction_name']; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -241,7 +241,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common } $query = 'COMMIT TRANSACTION '.$this->options['base_transaction_name']; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -276,7 +276,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common } $query = 'ROLLBACK TRANSACTION '.$this->options['base_transaction_name']; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -295,12 +295,16 @@ class MDB2_Driver_sqlite 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) { @@ -500,7 +504,7 @@ class MDB2_Driver_sqlite 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')); @@ -539,7 +543,11 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common $this->_lasterror = $php_errormsg; if (!$result) { - $err =& $this->raiseError(null, null, null, + $code = null; + if (0 === strpos($this->_lasterror, 'no such table')) { + $code = MDB2_ERROR_NOSUCHTABLE; + } + $err = $this->raiseError($code, null, null, 'Could not execute statement', __FUNCTION__); return $err; } @@ -754,7 +762,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common $table = $this->quoteIdentifier($table, true); $query = "REPLACE INTO $table ($query) VALUES ($values)"; - $result =& $this->_doQuery($query, true, $connection); + $result = $this->_doQuery($query, true, $connection); if (PEAR::isError($result)) { return $result; } @@ -782,7 +790,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)"; $this->pushErrorHandling(PEAR_ERROR_RETURN); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); $this->popExpect(); $this->popErrorHandling(); if (PEAR::isError($result)) { @@ -801,7 +809,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common $value = $this->lastInsertID(); if (is_numeric($value)) { $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value"; - $result =& $this->_doQuery($query, true); + $result = $this->_doQuery($query, true); if (PEAR::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } @@ -874,7 +882,7 @@ class MDB2_Result_sqlite 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); @@ -897,12 +905,11 @@ class MDB2_Result_sqlite 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; diff --git a/program/lib/MDB2/Driver/sqlsrv.php b/program/lib/MDB2/Driver/sqlsrv.php index 7f1017a6e..50205b7f4 100644 --- a/program/lib/MDB2/Driver/sqlsrv.php +++ b/program/lib/MDB2/Driver/sqlsrv.php @@ -479,7 +479,7 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common $query = $this->_modifyQuery($query, $is_manip, $this->limit, $this->offset);
$this->offset = $this->limit = 0;
- $result =& $this->_doQuery($query, $is_manip, $connection);
+ $result = $this->_doQuery($query, $is_manip, $connection);
if (!PEAR::isError($result)) {
$result = $this->_affectedRows($connection, $result);
}
@@ -500,7 +500,7 @@ class MDB2_Driver_sqlsrv 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'));
@@ -539,7 +539,7 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common $query = preg_replace('/DATE_FORMAT\(([\w|.]*)\, \'\%Y\-\%m\-\%d %H\:00\:00\'\)/i','CONVERT(varchar(13),$1,120)+\':00:00\'',$query);
$result = @sqlsrv_query($connection,$query);
if (!$result) {
- $err =& $this->raiseError(null, null, null,
+ $err = $this->raiseError(null, null, null,
'Could not execute statement', __FUNCTION__);
return $err;
}
@@ -689,7 +689,7 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common } else {
$query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (0)";
}
- $result =& $this->_doQuery($query, true);
+ $result = $this->_doQuery($query, true);
$this->popExpect();
$this->popErrorHandling();
if (PEAR::isError($result)) {
@@ -723,7 +723,7 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common $value = $this->lastInsertID($sequence_name);
if (is_numeric($value)) {
$query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
- $result =& $this->_doQuery($query, true);
+ $result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
$this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
}
@@ -764,15 +764,15 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common */
class MDB2_Result_sqlsrv extends MDB2_Result_Common
{
- // {{{ constructor: function __construct(&$db, &$result, $limit = 0, $offset = 0)
+ // {{{ constructor: function __construct($db, $result, $limit = 0, $offset = 0)
/**
* Constructor
*/
- function __construct(&$db, &$result, $limit = 0, $offset = 0)
+ function __construct($db, $result, $limit = 0, $offset = 0)
{
- $this->db =& $db;
- $this->result =& $result;
+ $this->db = $db;
+ $this->result = $result;
$this->offset = $offset;
$this->limit = max(0, $limit - 1);
$this->cursor = 0;
@@ -787,11 +787,12 @@ class MDB2_Result_sqlsrv extends MDB2_Result_Common continue;
}
foreach ($row as $k => $v) {
- if (is_object($v) && method_exists($v, 'format')) {//DateTime Object
- $row[$k] = $v->format("Y-m-d H:i:s");
+ if (is_object($v) && method_exists($v, 'format')) {
+ //DateTime Object
+ $row[$k] = $v->format('Y-m-d H:i:s');
}
}
- $this->rows[] = $row;//read results into memory, cursors are not supported
+ $this->rows[] = $row; //read results into memory, cursors are not supported
}
}
$this->rowcnt = count($this->rows);
@@ -848,14 +849,13 @@ class MDB2_Result_sqlsrv 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 (!$this->result) {
return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'no valid statement given', __FUNCTION__);
}
if (($this->limit && $this->rownum >= $this->limit) || ($this->cursor >= $this->rowcnt || $this->rowcnt == 0)) {
- $null = null;
- return $null;
+ return null;
}
if (null !== $rownum) {
$seek = $this->seek($rownum);
@@ -911,12 +911,11 @@ class MDB2_Result_sqlsrv 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;
@@ -1162,4 +1161,4 @@ class MDB2_Statement_sqlsrv extends MDB2_Statement_Common // }}}
-?>
\ No newline at end of file +?>
|