forked from GNUsocial/gnu-social
DB_DataObject updated to 1.11.3
This commit is contained in:
parent
10f2cde0b1
commit
a66973e158
@ -15,7 +15,7 @@
|
||||
* @author Alan Knowles <alan@akbkhome.com>
|
||||
* @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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @author Alan Knowles <alan@akbkhome.com>
|
||||
* @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
|
||||
*/
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* @author Alan Knowles <alan@akbkhome.com>
|
||||
* @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');
|
||||
|
@ -16,7 +16,7 @@
|
||||
// | 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,
|
||||
|
Loading…
Reference in New Issue
Block a user