Update PEAR DB_DataObject to 1.11.5
Source: https://pear.php.net/package/DB_DataObject Release date: 2015-11-10
This commit is contained in:
parent
61876ed232
commit
a223273544
|
@ -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 320069 2011-11-28 04:34:08Z alan_k $
|
* @version CVS: $Id: DataObject.php 336751 2015-05-12 04:39:50Z alan_k $
|
||||||
* @link http://pear.php.net/package/DB_DataObject
|
* @link http://pear.php.net/package/DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||||
if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
|
if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
|
||||||
$this->debug($n, "find",1);
|
$this->debug($n, "find",1);
|
||||||
}
|
}
|
||||||
if (!$this->__table) {
|
if (!strlen($this->tableName())) {
|
||||||
// xdebug can backtrace this!
|
// xdebug can backtrace this!
|
||||||
trigger_error("NO \$__table SPECIFIED in class definition",E_USER_ERROR);
|
trigger_error("NO \$__table SPECIFIED in class definition",E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -2073,6 +2073,9 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||||
if (count($args)) {
|
if (count($args)) {
|
||||||
$this->__table = $args[0];
|
$this->__table = $args[0];
|
||||||
}
|
}
|
||||||
|
if (empty($this->__table)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
if (!empty($_DB_DATAOBJECT['CONFIG']['portability']) && $_DB_DATAOBJECT['CONFIG']['portability'] & 1) {
|
if (!empty($_DB_DATAOBJECT['CONFIG']['portability']) && $_DB_DATAOBJECT['CONFIG']['portability'] & 1) {
|
||||||
return strtolower($this->__table);
|
return strtolower($this->__table);
|
||||||
}
|
}
|
||||||
|
@ -2421,7 +2424,7 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||||
$dsn = isset($this->_database_dsn) ? $this->_database_dsn : null;
|
$dsn = isset($this->_database_dsn) ? $this->_database_dsn : null;
|
||||||
|
|
||||||
if (!$dsn) {
|
if (!$dsn) {
|
||||||
if (!$this->_database && !empty($this->__table)) {
|
if (!$this->_database && !strlen($this->tableName())) {
|
||||||
$this->_database = isset($options["table_{$this->tableName()}"]) ? $options["table_{$this->tableName()}"] : null;
|
$this->_database = isset($options["table_{$this->tableName()}"]) ? $options["table_{$this->tableName()}"] : null;
|
||||||
}
|
}
|
||||||
if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
|
if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
|
||||||
|
@ -3522,7 +3525,7 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||||
if ($joinCol !== false) {
|
if ($joinCol !== false) {
|
||||||
$this->raiseError(
|
$this->raiseError(
|
||||||
"joinAdd: You cannot target a join column in the " .
|
"joinAdd: You cannot target a join column in the " .
|
||||||
"'link from' table ({$obj->__table}). " .
|
"'link from' table ({$obj->tableName()}). " .
|
||||||
"Either remove the fourth argument to joinAdd() ".
|
"Either remove the fourth argument to joinAdd() ".
|
||||||
"({$joinCol}), or alter your links.ini file.",
|
"({$joinCol}), or alter your links.ini file.",
|
||||||
DB_DATAOBJECT_ERROR_NODATA);
|
DB_DATAOBJECT_ERROR_NODATA);
|
||||||
|
@ -3605,7 +3608,7 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||||
|
|
||||||
if (!$items) {
|
if (!$items) {
|
||||||
$this->raiseError(
|
$this->raiseError(
|
||||||
"joinAdd: No table definition for {$obj->__table}",
|
"joinAdd: No table definition for {$obj->tableName()}",
|
||||||
DB_DATAOBJECT_ERROR_INVALIDCONFIG);
|
DB_DATAOBJECT_ERROR_INVALIDCONFIG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3800,6 +3803,7 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||||
*/
|
*/
|
||||||
function autoJoin($cfg = array())
|
function autoJoin($cfg = array())
|
||||||
{
|
{
|
||||||
|
global $_DB_DATAOBJECT;
|
||||||
//var_Dump($cfg);exit;
|
//var_Dump($cfg);exit;
|
||||||
$pre_links = $this->links();
|
$pre_links = $this->links();
|
||||||
if (!empty($cfg['links'])) {
|
if (!empty($cfg['links'])) {
|
||||||
|
@ -3807,7 +3811,8 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||||
}
|
}
|
||||||
$map = $this->links( );
|
$map = $this->links( );
|
||||||
|
|
||||||
|
$this->databaseStructure();
|
||||||
|
$dbstructure = $_DB_DATAOBJECT['INI'][$this->_database];
|
||||||
//print_r($map);
|
//print_r($map);
|
||||||
$tabdef = $this->table();
|
$tabdef = $this->table();
|
||||||
|
|
||||||
|
@ -3874,6 +3879,12 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||||
|
|
||||||
list($tab,$col) = explode(':', $info);
|
list($tab,$col) = explode(':', $info);
|
||||||
// what about multiple joins on the same table!!!
|
// what about multiple joins on the same table!!!
|
||||||
|
|
||||||
|
// if links point to a table that does not exist - ignore.
|
||||||
|
if (!isset($dbstructure[$tab])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$xx = DB_DataObject::factory($tab);
|
$xx = DB_DataObject::factory($tab);
|
||||||
if (!is_object($xx) || !is_a($xx, 'DB_DataObject')) {
|
if (!is_object($xx) || !is_a($xx, 'DB_DataObject')) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -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 315531 2011-08-26 02:21:29Z alan_k $
|
* @version CVS: $Id: Generator.php 336719 2015-05-05 10:37:33Z alan_k $
|
||||||
* @link http://pear.php.net/package/DB_DataObject
|
* @link http://pear.php.net/package/DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ class DB_DataObject_Generator extends DB_DataObject
|
||||||
* Currenly only works with mysql / mysqli / posgtreas
|
* Currenly only works with mysql / mysqli / posgtreas
|
||||||
* to use, you must set option: generate_links=true
|
* to use, you must set option: generate_links=true
|
||||||
*
|
*
|
||||||
* @author Pascal Schöni
|
* @author Pascal Sch<EFBFBD>ni
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function _createForiegnKeys()
|
function _createForiegnKeys()
|
||||||
|
@ -507,7 +507,7 @@ class DB_DataObject_Generator extends DB_DataObject
|
||||||
* Currenly only works with mysql / mysqli
|
* Currenly only works with mysql / mysqli
|
||||||
* to use, you must set option: generate_links=true
|
* to use, you must set option: generate_links=true
|
||||||
*
|
*
|
||||||
* @author Pascal Schöni
|
* @author Pascal Sch<EFBFBD>ni
|
||||||
*/
|
*/
|
||||||
function generateForeignKeys()
|
function generateForeignKeys()
|
||||||
{
|
{
|
||||||
|
@ -895,7 +895,7 @@ class DB_DataObject_Generator extends DB_DataObject
|
||||||
$options = &PEAR::getStaticProperty('DB_DataObject','options');
|
$options = &PEAR::getStaticProperty('DB_DataObject','options');
|
||||||
|
|
||||||
$this->_extends = empty($options['extends']) ? $this->_extends : $options['extends'];
|
$this->_extends = empty($options['extends']) ? $this->_extends : $options['extends'];
|
||||||
$this->_extendsFile = empty($options['extends_location']) ? $this->_extendsFile : $options['extends_location'];
|
$this->_extendsFile = !isset($options['extends_location']) ? $this->_extendsFile : $options['extends_location'];
|
||||||
|
|
||||||
|
|
||||||
foreach($this->tables as $this->table) {
|
foreach($this->tables as $this->table) {
|
||||||
|
@ -976,8 +976,12 @@ class DB_DataObject_Generator extends DB_DataObject
|
||||||
$head .= $this->derivedHookExtendsDocBlock();
|
$head .= $this->derivedHookExtendsDocBlock();
|
||||||
|
|
||||||
|
|
||||||
// requires
|
// requires - if you set extends_location = (blank) then no require line will be set
|
||||||
$head .= "require_once '{$this->_extendsFile}';\n\n";
|
// this can be used if you have an autoloader
|
||||||
|
|
||||||
|
if (!empty($this->_extendsFile)) {
|
||||||
|
$head .= "require_once '{$this->_extendsFile}';\n\n";
|
||||||
|
}
|
||||||
// add dummy class header in...
|
// add dummy class header in...
|
||||||
// class
|
// class
|
||||||
$head .= $this->derivedHookClassDocBlock();
|
$head .= $this->derivedHookClassDocBlock();
|
||||||
|
@ -1039,10 +1043,11 @@ class DB_DataObject_Generator extends DB_DataObject
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = str_repeat(' ',max(2, (30 - strlen($t->name))));
|
$pad = str_repeat(' ',max(2, (30 - strlen($t->name))));
|
||||||
|
|
||||||
$length = empty($t->len) ? '' : '('.$t->len.')';
|
$length = empty($t->len) ? '' : '('.$t->len.')';
|
||||||
$body .=" {$var} \${$t->name}; {$p}// {$t->type}$length {$t->flags}\n";
|
$flags = strlen($t->flags) ? (' '. trim($t->flags)) : '';
|
||||||
|
$body .=" {$var} \${$t->name}; {$pad}// {$t->type}{$length}{$flags}\n";
|
||||||
|
|
||||||
// can not do set as PEAR::DB table info doesnt support it.
|
// can not do set as PEAR::DB table info doesnt support it.
|
||||||
//if (substr($t->Type,0,3) == "set")
|
//if (substr($t->Type,0,3) == "set")
|
||||||
|
@ -1283,7 +1288,7 @@ class DB_DataObject_Generator extends DB_DataObject
|
||||||
$class_prefix = empty($options['class_prefix']) ? '' : $options['class_prefix'];
|
$class_prefix = empty($options['class_prefix']) ? '' : $options['class_prefix'];
|
||||||
|
|
||||||
$this->_extends = empty($options['extends']) ? $this->_extends : $options['extends'];
|
$this->_extends = empty($options['extends']) ? $this->_extends : $options['extends'];
|
||||||
$this->_extendsFile = empty($options['extends_location']) ? $this->_extendsFile : $options['extends_location'];
|
$this->_extendsFile = !isset($options['extends_location']) ? $this->_extendsFile : $options['extends_location'];
|
||||||
|
|
||||||
$classname = $this->classname = $this->getClassNameFromTableName($this->table);
|
$classname = $this->classname = $this->getClassNameFromTableName($this->table);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user