cvs: pear /DB_DataObject DataObject.php
| From: | Alan Knowles | Date: | Tue, 04 Oct 2005 05:05:08 +0000 |
| Subject: | cvs: pear /DB_DataObject DataObject.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35253@lists.php.net to get a copy of this message | ||
alan_k Tue Oct 4 01:05:08 2005 EDT
Modified files:
/pear/DB_DataObject DataObject.php
Log:
fix bug #5491 - prevent autoloading of generator in some failure conditions
http://cvs.php.net/diff.php/pear/DB_DataObject/DataObject.php?r1=1.374&r2=1.375&ty=u
Index: pear/DB_DataObject/DataObject.php
diff -u pear/DB_DataObject/DataObject.php:1.374 pear/DB_DataObject/DataObject.php:1.375
--- pear/DB_DataObject/DataObject.php:1.374 Sat Sep 17 23:40:59 2005
+++ pear/DB_DataObject/DataObject.php Tue Oct 4 01:05:02 2005
@@ -15,7 +15,7 @@
* @author Alan Knowles <alan@akbkhome.com>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: DataObject.php,v 1.374 2005/09/18 03:40:59 alan_k Exp $
+ * @version CVS: $Id: DataObject.php,v 1.375 2005/10/04 05:05:02 alan_k Exp $
* @link http://pear.php.net/package/DB_DataObject
*/
@@ -1656,6 +1656,9 @@
if (count($args) == 1) {
// this returns all the tables and their structure..
+ if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
+ $this->debug("Loading Generator as databaseStructure called with
args",1);
+ }
$x = new DB_DataObject;
$x->_database = $args[0];
@@ -1691,8 +1694,15 @@
// loaded already?
if (!empty($_DB_DATAOBJECT['INI'][$this->_database])) {
+
// database loaded - but this is table is not available..
- if (empty($_DB_DATAOBJECT['INI'][$this->_database][$this->__table])) {
+ if (
+ empty($_DB_DATAOBJECT['INI'][$this->_database][$this->__table])
+ && !empty($_DB_DATAOBJECT['CONFIG']['proxy'])
+ ) {
+ if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
+ $this->debug("Loading Generator to fetch Schema",1);
+ }
require_once 'DB/DataObject/Generator.php';
$x = new DB_DataObject_Generator;
$x->fillTableSchema($this->_database,$this->__table);
@@ -1750,16 +1760,22 @@
}
}
}
- // now have we loaded the structure.. - if not try building it..
+ // now have we loaded the structure..
- if (empty($_DB_DATAOBJECT['INI'][$this->_database][$this->__table])) {
+ if (!empty($_DB_DATAOBJECT['INI'][$this->_database][$this->__table])) {
+ return true;
+ }
+ // - if not try building it..
+ if (!empty($_DB_DATAOBJECT['CONFIG']['proxy'])) {
require_once 'DB/DataObject/Generator.php';
$x = new DB_DataObject_Generator;
$x->fillTableSchema($this->_database,$this->__table);
+ // should this fail!!!???
+ return true;
}
-
+ return $this->raiseError( "Unable to load schema for database and table",
DB_DATAOBJECT_ERROR_INVALIDARGS);
- return true;
+
}