DB_DataObject updated to 1.11.3

This commit is contained in:
Mikael Nordfeldth 2015-02-12 22:17:02 +01:00
parent 10f2cde0b1
commit a66973e158
4 changed files with 40 additions and 24 deletions

View File

@ -15,7 +15,7 @@
* @author Alan Knowles <alan@akbkhome.com> * @author Alan Knowles <alan@akbkhome.com>
* @copyright 1997-2006 The PHP Group * @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01 * @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: DataObject.php 329992 2013-04-03 11:38:43Z alan_k $ * @version CVS: $Id: DataObject.php 320069 2011-11-28 04:34:08Z alan_k $
* @link http://pear.php.net/package/DB_DataObject * @link http://pear.php.net/package/DB_DataObject
*/ */
@ -219,7 +219,7 @@ class DB_DataObject extends DB_DataObject_Overload
* @access private * @access private
* @var string * @var string
*/ */
var $_DB_DataObject_version = "1.11.0"; var $_DB_DataObject_version = "1.11.3";
/** /**
* The Database table (used by table extends) * The Database table (used by table extends)
@ -1094,7 +1094,9 @@ class DB_DataObject extends DB_DataObject_Overload
// Ignore variables which aren't set to a value // Ignore variables which aren't set to a value
if ( !isset($this->$k) && $ignore_null) { if ( (!isset($this->$k) || ($v == 1 && $this->$k == ''))
&& $ignore_null
) {
continue; continue;
} }
// dont insert data into mysql timestamps // dont insert data into mysql timestamps
@ -1311,7 +1313,7 @@ class DB_DataObject extends DB_DataObject_Overload
$this->raiseError("update: trying to perform an update without $this->raiseError("update: trying to perform an update without
the key set, and argument to update is not the key set, and argument to update is not
DB_DATAOBJECT_WHEREADD_ONLY DB_DATAOBJECT_WHEREADD_ONLY
", DB_DATAOBJECT_ERROR_INVALIDARGS); ". print_r(array('seq' => $seq , 'keys'=>$keys), true), DB_DATAOBJECT_ERROR_INVALIDARGS);
return false; return false;
} }
} else { } else {
@ -1340,7 +1342,9 @@ class DB_DataObject extends DB_DataObject_Overload
foreach($items as $k => $v) { foreach($items as $k => $v) {
if (!isset($this->$k) && $ignore_null) { if ((!isset($this->$k) || ($v == 1 && $this->$k == ''))
&& $ignore_null
) {
continue; continue;
} }
// ignore stuff thats // ignore stuff thats
@ -2526,7 +2530,10 @@ class DB_DataObject extends DB_DataObject_Overload
} }
if (strtoupper($string) == 'BEGIN') { if (
strtoupper($string) == 'BEGIN' ||
strtoupper($string) == 'START TRANSACTION'
) {
if ($_DB_driver == 'DB') { if ($_DB_driver == 'DB') {
$DB->autoCommit(false); $DB->autoCommit(false);
$DB->simpleQuery('BEGIN'); $DB->simpleQuery('BEGIN');
@ -2535,6 +2542,7 @@ class DB_DataObject extends DB_DataObject_Overload
} }
return true; return true;
} }
if (strtoupper($string) == 'COMMIT') { if (strtoupper($string) == 'COMMIT') {
$res = $DB->commit(); $res = $DB->commit();
if ($_DB_driver == 'DB') { if ($_DB_driver == 'DB') {
@ -3808,7 +3816,7 @@ class DB_DataObject extends DB_DataObject_Overload
} }
// apply our filtered version, which excludes the distinct column. // apply our filtered version, which excludes the distinct column.
$selectAs = empty($cols) ? array() : array(array( $cols , '%s', false)) ; $selectAs = empty($cols) ? array() : array(array(array( $cols) , '%s', false)) ;
@ -3910,7 +3918,6 @@ class DB_DataObject extends DB_DataObject_Overload
} }
foreach($selectAs as $ar) { foreach($selectAs as $ar) {
$this->selectAs($ar[0], $ar[1], $ar[2]); $this->selectAs($ar[0], $ar[1], $ar[2]);
} }
// restore links.. // restore links..
@ -4309,7 +4316,6 @@ class DB_DataObject extends DB_DataObject_Overload
$case[strtolower($k)] = $k; $case[strtolower($k)] = $k;
} }
if ((substr(phpversion(),0,1) == 5) && isset($case[strtolower($element)])) { if ((substr(phpversion(),0,1) == 5) && isset($case[strtolower($element)])) {
file_put_contents('/tmp/backtrace', var_export(debug_backtrace(),true));
trigger_error("PHP5 set/get calls should match the case of the variable",E_USER_WARNING); trigger_error("PHP5 set/get calls should match the case of the variable",E_USER_WARNING);
$element = strtolower($element); $element = strtolower($element);
} }
@ -4603,7 +4609,7 @@ class DB_DataObject extends DB_DataObject_Overload
/** /**
* Last Error that has occured * Last Error that has occured
* - use $this->_lastError or * - use $this->_lastError or
* $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError'); * $last_error = PEAR::getStaticProperty('DB_DataObject','lastError');
* *
* @access public * @access public
* @var object PEAR_Error (or false) * @var object PEAR_Error (or false)
@ -4628,7 +4634,8 @@ class DB_DataObject extends DB_DataObject_Overload
if ($behaviour == PEAR_ERROR_DIE && !empty($_DB_DATAOBJECT['CONFIG']['dont_die'])) { if ($behaviour == PEAR_ERROR_DIE && !empty($_DB_DATAOBJECT['CONFIG']['dont_die'])) {
$behaviour = null; $behaviour = null;
} }
$error = PEAR::getStaticProperty('DB_DataObject','lastError');
$error = &PEAR::getStaticProperty('DB_DataObject','lastError');
// no checks for production here?....... - we log errors before we throw them. // no checks for production here?....... - we log errors before we throw them.
@ -4700,7 +4707,13 @@ class DB_DataObject extends DB_DataObject_Overload
if (is_array($this->_link_loaded)) { if (is_array($this->_link_loaded)) {
foreach ($this->_link_loaded as $do) { foreach ($this->_link_loaded as $do) {
$do->free(); if (
!empty($this->{$do}) &&
is_object($this->{$do}) &&
method_exists($this->{$do}, 'free')
) {
$this->{$do}->free();
}
} }
} }

View File

@ -17,7 +17,7 @@
* @author Alan Knowles <alan@akbkhome.com> * @author Alan Knowles <alan@akbkhome.com>
* @copyright 1997-2008 The PHP Group * @copyright 1997-2008 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01 * @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: Cast.php 326604 2012-07-12 03:02:00Z alan_k $ * @version CVS: $Id: Cast.php 287158 2009-08-12 13:58:31Z alan_k $
* @link http://pear.php.net/package/DB_DataObject * @link http://pear.php.net/package/DB_DataObject
*/ */

View File

@ -15,7 +15,7 @@
* @author Alan Knowles <alan@akbkhome.com> * @author Alan Knowles <alan@akbkhome.com>
* @copyright 1997-2006 The PHP Group * @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01 * @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: Generator.php 327926 2012-10-08 02:42:09Z alan_k $ * @version CVS: $Id: Generator.php 315531 2011-08-26 02:21:29Z alan_k $
* @link http://pear.php.net/package/DB_DataObject * @link http://pear.php.net/package/DB_DataObject
*/ */
@ -1349,6 +1349,9 @@ class DB_DataObject_Generator extends DB_DataObject
$defs = $__DB->tableInfo($quotedTable); $defs = $__DB->tableInfo($quotedTable);
} else { } else {
$defs = $__DB->reverse->tableInfo($quotedTable); $defs = $__DB->reverse->tableInfo($quotedTable);
if (PEAR::isError($defs)) {
return $defs;
}
foreach ($defs as $k => $v) { foreach ($defs as $k => $v) {
if (!isset($defs[$k]['length'])) { if (!isset($defs[$k]['length'])) {
continue; continue;
@ -1357,12 +1360,12 @@ class DB_DataObject_Generator extends DB_DataObject
} }
} }
if (PEAR::isError($defs)) { if (PEAR::isError($defs)) {
return $defs; return $defs;
} }
if (@$_DB_DATAOBJECT['CONFIG']['debug'] > 2) { if (@$_DB_DATAOBJECT['CONFIG']['debug'] > 2) {
$this->debug("getting def for $database/$table",'fillTable'); $this->debug("getting def for $database/$table",'fillTable');
$this->debug(print_r($defs,true),'defs'); $this->debug(print_r($defs,true),'defs');

View File

@ -16,7 +16,7 @@
// | Author: Alan Knowles <alan@akbkhome.com> // | Author: Alan Knowles <alan@akbkhome.com>
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// //
// $Id: createTables.php 315758 2011-08-30 08:11:59Z alan_k $ // $Id: createTables.php 277015 2009-03-12 05:51:03Z alan_k $
// //
// since this version doesnt use overload, // since this version doesnt use overload,