From 5f66433898f89865a6682ad9aebfeef14b596dea Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 12 Mar 2006 10:38:37 +0000 Subject: adding TSQLMap module --- framework/DataAccess/TAdodbProvider.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'framework/DataAccess/TAdodbProvider.php') diff --git a/framework/DataAccess/TAdodbProvider.php b/framework/DataAccess/TAdodbProvider.php index 65e336a9..53eead61 100644 --- a/framework/DataAccess/TAdodbProvider.php +++ b/framework/DataAccess/TAdodbProvider.php @@ -35,7 +35,7 @@ class TAdodbProvider extends TDatabaseProvider public function getConnection() { - if(is_null($this->_connection)) + if(is_null($this->_connection) || is_null($this->_connection->getProvider())) { $this->importAdodbLibrary(); $this->_connection = new TAdodbConnection($this); @@ -147,21 +147,6 @@ class TAdodbConnection extends TDbConnection $this->setProvider($provider); } - /** - * PHP magic function. - * This method will pass all method calls to ADOConnection class - * provided in the ADODB library. - * @param mixed method name - * @param mixed method call parameters - * @param mixed return value of the method call - */ - public function __call($method, $params) - { - if(is_null($this->_connection) || !$this->_connection->IsConnected()) - $this->open(); - return call_user_func_array(array($this->_connection,$method),$params); - } - /** * Cleanup work before serializing. * This is a PHP defined magic method. @@ -169,7 +154,9 @@ class TAdodbConnection extends TDbConnection */ public function __sleep() { + //close any open connections before serializing. $this->close(); + $this->_connection = null; return array_keys(get_object_vars($this)); } @@ -181,6 +168,20 @@ class TAdodbConnection extends TDbConnection { } + /** + * PHP magic function. + * This method will pass all method calls to ADOConnection class + * provided in the ADODB library. + * @param mixed method name + * @param mixed method call parameters + * @param mixed return value of the method call + */ + public function __call($method, $params) + { + if(is_null($this->_connection) || !$this->_connection->IsConnected()) + $this->open(); + return call_user_func_array(array($this->_connection,$method),$params); + } public function getIsClosed() { -- cgit v1.2.3