From: Mikael Nordfeldth Date: Thu, 12 Feb 2015 21:17:02 +0000 (+0100) Subject: DB_DataObject updated to 1.11.3 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a66973e158ba3b38c468005fed1a3eef94fba42f;p=quix0rs-gnu-social.git DB_DataObject updated to 1.11.3 --- diff --git a/extlib/DB/DataObject.php b/extlib/DB/DataObject.php index 1232d184df..684a98c92a 100755 --- a/extlib/DB/DataObject.php +++ b/extlib/DB/DataObject.php @@ -15,7 +15,7 @@ * @author Alan Knowles * @copyright 1997-2006 The PHP Group * @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 */ @@ -219,7 +219,7 @@ class DB_DataObject extends DB_DataObject_Overload * @access private * @var string */ - var $_DB_DataObject_version = "1.11.0"; + var $_DB_DataObject_version = "1.11.3"; /** * 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 - if ( !isset($this->$k) && $ignore_null) { + if ( (!isset($this->$k) || ($v == 1 && $this->$k == '')) + && $ignore_null + ) { continue; } // 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 the key set, and argument to update is not DB_DATAOBJECT_WHEREADD_ONLY - ", DB_DATAOBJECT_ERROR_INVALIDARGS); + ". print_r(array('seq' => $seq , 'keys'=>$keys), true), DB_DATAOBJECT_ERROR_INVALIDARGS); return false; } } else { @@ -1337,11 +1339,13 @@ class DB_DataObject extends DB_DataObject_Overload || !is_string($options['disable_null_strings']) || strtolower($options['disable_null_strings']) !== 'full' ; - + foreach($items as $k => $v) { - if (!isset($this->$k) && $ignore_null) { - continue; + if ((!isset($this->$k) || ($v == 1 && $this->$k == '')) + && $ignore_null + ) { + continue; } // ignore stuff thats @@ -1412,7 +1416,7 @@ class DB_DataObject extends DB_DataObject_Overload // - V2 may store additional data about float/int $settings .= "$kSql = " . intval($this->$k) . ' '; } - + if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { $this->debug("got keys as ".serialize($keys),3); @@ -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') { $DB->autoCommit(false); $DB->simpleQuery('BEGIN'); @@ -2535,6 +2542,7 @@ class DB_DataObject extends DB_DataObject_Overload } return true; } + if (strtoupper($string) == 'COMMIT') { $res = $DB->commit(); if ($_DB_driver == 'DB') { @@ -3808,7 +3816,7 @@ class DB_DataObject extends DB_DataObject_Overload } // 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)) ; @@ -3908,9 +3916,8 @@ class DB_DataObject extends DB_DataObject_Overload if ($has_distinct) { $this->selectAdd($has_distinct); } - - foreach($selectAs as $ar) { - + + foreach($selectAs as $ar) { $this->selectAs($ar[0], $ar[1], $ar[2]); } // restore links.. @@ -4309,7 +4316,6 @@ class DB_DataObject extends DB_DataObject_Overload $case[strtolower($k)] = $k; } 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); $element = strtolower($element); } @@ -4603,7 +4609,7 @@ class DB_DataObject extends DB_DataObject_Overload /** * Last Error that has occured * - use $this->_lastError or - * $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError'); + * $last_error = PEAR::getStaticProperty('DB_DataObject','lastError'); * * @access public * @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'])) { $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. @@ -4700,7 +4707,13 @@ class DB_DataObject extends DB_DataObject_Overload if (is_array($this->_link_loaded)) { foreach ($this->_link_loaded as $do) { - $do->free(); + if ( + !empty($this->{$do}) && + is_object($this->{$do}) && + method_exists($this->{$do}, 'free') + ) { + $this->{$do}->free(); + } } } diff --git a/extlib/DB/DataObject/Cast.php b/extlib/DB/DataObject/Cast.php index 59cc0af279..a31f536cd5 100755 --- a/extlib/DB/DataObject/Cast.php +++ b/extlib/DB/DataObject/Cast.php @@ -17,7 +17,7 @@ * @author Alan Knowles * @copyright 1997-2008 The PHP Group * @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 */ diff --git a/extlib/DB/DataObject/Generator.php b/extlib/DB/DataObject/Generator.php index c06d6ed610..a712e6d9eb 100755 --- a/extlib/DB/DataObject/Generator.php +++ b/extlib/DB/DataObject/Generator.php @@ -15,7 +15,7 @@ * @author Alan Knowles * @copyright 1997-2006 The PHP Group * @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 */ @@ -1349,6 +1349,9 @@ class DB_DataObject_Generator extends DB_DataObject $defs = $__DB->tableInfo($quotedTable); } else { $defs = $__DB->reverse->tableInfo($quotedTable); + if (PEAR::isError($defs)) { + return $defs; + } foreach ($defs as $k => $v) { if (!isset($defs[$k]['length'])) { continue; @@ -1357,12 +1360,12 @@ class DB_DataObject_Generator extends DB_DataObject } } - - - if (PEAR::isError($defs)) { return $defs; - } + } + + + if (@$_DB_DATAOBJECT['CONFIG']['debug'] > 2) { $this->debug("getting def for $database/$table",'fillTable'); $this->debug(print_r($defs,true),'defs'); diff --git a/extlib/DB/DataObject/createTables.php b/extlib/DB/DataObject/createTables.php index ed2e738b78..1295d252b8 100755 --- a/extlib/DB/DataObject/createTables.php +++ b/extlib/DB/DataObject/createTables.php @@ -16,7 +16,7 @@ // | Author: Alan Knowles // +----------------------------------------------------------------------+ // -// $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,