cvs: pear /DB_DataObject DataObject.php

From: Date: Thu, 05 Dec 2002 03:55:13 +0000
Subject: cvs: pear /DB_DataObject DataObject.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-7740@lists.php.net to get a copy of this message
alan_k Wed Dec 4 22:55:13 2002 EDT Modified files: /pear/DB_DataObject DataObject.php Log: adding patch for _database usage by Sergey Lipnevich - needs testing Index: pear/DB_DataObject/DataObject.php diff -u pear/DB_DataObject/DataObject.php:1.39 pear/DB_DataObject/DataObject.php:1.40 --- pear/DB_DataObject/DataObject.php:1.39 Wed Dec 4 22:40:12 2002 +++ pear/DB_DataObject/DataObject.php Wed Dec 4 22:55:13 2002 @@ -15,7 +15,7 @@ // | Author: Alan Knowles <alan@akbkhome.com> // +----------------------------------------------------------------------+ // -// $Id: DataObject.php,v 1.39 2002/12/05 03:40:12 alan_k Exp $ +// $Id: DataObject.php,v 1.40 2002/12/05 03:55:13 alan_k Exp $ // // Object Based Database Query Builder and data store // @@ -942,7 +942,9 @@ ); return; } - $this->_database = $connections[$this->_database_dsn_md5]->dsn["database"]; + if (!$this->_database) { + $this->_database = $connections[$this->_database_dsn_md5]->dsn["database"]; + } return; } @@ -950,28 +952,35 @@ $dsn = @$this->_database_dsn; if (!$dsn) { - if ($database = @$options["table_{$this->__table}"]) { - $dsn = $options["database_{$database}"]; + if (!$this->_database) { + $this->_database = @$options["table_{$this->__table}"]; + } + if (@$this->_database) { + $dsn = $options["database_{$this->_database}"]; } else if ($options['database']) { $dsn = $options['database']; } } + $this->_database_dsn_md5 = md5($dsn); if (@$connections[$this->_database_dsn_md5]) { if (!$GLOBALS['_DB_DATAOBJECT_PRODUCTION']) { $this->debug("USING CACHE", "CONNECT",3); } - $this->_database = $connections[$this->_database_dsn_md5]->dsn["database"]; + if (!$this->_database) { + $this->_database = $connections[$this->_database_dsn_md5]->dsn["database"]; + } return; } if (!$GLOBALS['_DB_DATAOBJECT_PRODUCTION']) { $this->debug("NEW CONNECTION", "CONNECT",3); - /* actualy make a connection */ - + /* actualy make a connection */ $this->debug("{$dsn} {$this->_database_dsn_md5}", "CONNECT",3); } + $connections[$this->_database_dsn_md5] = DB::connect($dsn); + if (!$GLOBALS['_DB_DATAOBJECT_PRODUCTION']) { $this->debug(serialize($connections), "CONNECT",3); } @@ -982,8 +991,11 @@ ); } - - $this->_database = $connections[$this->_database_dsn_md5]->dsn["database"]; + + if (!$this->_database) { + $this->_database = $connections[$this->_database_dsn_md5]->dsn["database"]; + } + return true; }

« previous php.pear.cvs (#7740) next »