diff options
author | wei <> | 2006-12-03 22:26:04 +0000 |
---|---|---|
committer | wei <> | 2006-12-03 22:26:04 +0000 |
commit | 503cdec992e78bf4180fa720800b9d3a3bc551e2 (patch) | |
tree | 0a53819ddc430e5224583dc9efa403f320eeb814 | |
parent | bf8caefce718cc38ccfd121d9cd718f42021b2b9 (diff) |
Allow TDbConnection and TDbCommand to be serialized.
20 files changed, 78 insertions, 4 deletions
diff --git a/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php b/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php index ec177a84..1df54035 100644 --- a/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php +++ b/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php @@ -3,6 +3,9 @@ * TActiveRecordException class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Exceptions
*/
diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index fd49e413..4969da09 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -3,6 +3,9 @@ * TActiveRecord class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord
*/
@@ -373,10 +376,10 @@ abstract class TActiveRecord extends TComponent {
if($findOne = substr(strtolower($method),0,6)==='findby')
$condition = $method[6]==='_' ? substr($method,7) : substr($method,6);
- else if(substr(strtolower($method,0,9)==='findallby'))
+ else if(substr(strtolower($method),0,9)==='findallby')
$condition = $method[9]==='_' ? substr($method,10) : substr($method,9);
else
- throw new TActiveRecordException('ar_invalid_finder_method',$method);
+ return null;//throw new TActiveRecordException('ar_invalid_finder_method',$method);
$fields = array();
foreach(preg_split('/and|_and_/i',$condition) as $field)
$fields[] = $field.' = ?';
diff --git a/framework/Data/ActiveRecord/TActiveRecordCriteria.php b/framework/Data/ActiveRecord/TActiveRecordCriteria.php index 8e7735a7..457b5dc0 100644 --- a/framework/Data/ActiveRecord/TActiveRecordCriteria.php +++ b/framework/Data/ActiveRecord/TActiveRecordCriteria.php @@ -3,6 +3,9 @@ * TActiveRecordCriteria class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord
*/
diff --git a/framework/Data/ActiveRecord/TActiveRecordGateway.php b/framework/Data/ActiveRecord/TActiveRecordGateway.php index 829230fc..19c8552f 100644 --- a/framework/Data/ActiveRecord/TActiveRecordGateway.php +++ b/framework/Data/ActiveRecord/TActiveRecordGateway.php @@ -3,6 +3,9 @@ * TActiveRecordGateway, TActiveRecordStatementType, TActiveRecordGatewayEventParameter classes file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord
*/
diff --git a/framework/Data/ActiveRecord/TActiveRecordManager.php b/framework/Data/ActiveRecord/TActiveRecordManager.php index cff02988..12ca993f 100644 --- a/framework/Data/ActiveRecord/TActiveRecordManager.php +++ b/framework/Data/ActiveRecord/TActiveRecordManager.php @@ -3,6 +3,9 @@ * TActiveRecordManager and TActiveRecordEventParameter classes file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord
*/
diff --git a/framework/Data/ActiveRecord/TActiveRecordStateRegistry.php b/framework/Data/ActiveRecord/TActiveRecordStateRegistry.php index 4493d4cb..59222e44 100644 --- a/framework/Data/ActiveRecord/TActiveRecordStateRegistry.php +++ b/framework/Data/ActiveRecord/TActiveRecordStateRegistry.php @@ -3,6 +3,9 @@ * TActiveRecordStateRegistry class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TDbMetaData.php b/framework/Data/ActiveRecord/Vendor/TDbMetaData.php index 490515f6..4bbc62ee 100644 --- a/framework/Data/ActiveRecord/Vendor/TDbMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TDbMetaData.php @@ -3,6 +3,9 @@ * TDbMetaData class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php b/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php index 69f49dc1..44b33ab1 100644 --- a/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php +++ b/framework/Data/ActiveRecord/Vendor/TDbMetaDataCommon.php @@ -3,6 +3,9 @@ * TDbMetaDataCommon class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TDbMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TDbMetaDataInspector.php index ee7f339e..6c23ccb2 100644 --- a/framework/Data/ActiveRecord/Vendor/TDbMetaDataInspector.php +++ b/framework/Data/ActiveRecord/Vendor/TDbMetaDataInspector.php @@ -3,6 +3,9 @@ * TDbMetaDataInspector class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php index 8f4abf99..b5bd4050 100644 --- a/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php @@ -3,6 +3,9 @@ * TMysqlColumnMetaData class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlMetaData.php b/framework/Data/ActiveRecord/Vendor/TMysqlMetaData.php index 7902146d..1289afa5 100644 --- a/framework/Data/ActiveRecord/Vendor/TMysqlMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TMysqlMetaData.php @@ -3,6 +3,9 @@ * TMysqlMetaData class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php index 6075d2bc..1c63eec1 100644 --- a/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php +++ b/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php @@ -3,6 +3,9 @@ * TMysqlMetaDataInspector class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php index 2b801b09..d6ea8ca7 100644 --- a/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php @@ -3,6 +3,9 @@ * TPgsqlColumnMetaData class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaData.php b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaData.php index 7f4f1f82..5fc0fcaf 100644 --- a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaData.php @@ -3,6 +3,9 @@ * TPgsqlMetaData class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php index df31b9c0..bcdfefe3 100644 --- a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php +++ b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php @@ -3,6 +3,9 @@ * TPgsqlMetaDataInspector class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php index 94029cfa..366bfce2 100644 --- a/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php @@ -3,6 +3,9 @@ * TSqliteColumnMetaData class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteMetaData.php b/framework/Data/ActiveRecord/Vendor/TSqliteMetaData.php index a5f45090..75c30c93 100644 --- a/framework/Data/ActiveRecord/Vendor/TSqliteMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TSqliteMetaData.php @@ -3,6 +3,9 @@ * TSqliteMetaData class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
@@ -64,9 +67,10 @@ class TSqliteMetaData extends TDbMetaDataCommon */
public function postQuery($rows)
{
+ $data = array();
foreach($rows as $k=>$v)
- $rows[$k] = $this->postQueryRow($v);
- return $rows;
+ $data[$k] = $this->postQueryRow($v);
+ return $data;
}
}
diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php index 07fa3187..29bc3b8a 100644 --- a/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php +++ b/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php @@ -3,6 +3,9 @@ * TSqliteMetaDataInspector class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data.ActiveRecord.Vendor
*/
diff --git a/framework/Data/TDbCommand.php b/framework/Data/TDbCommand.php index 98bb31ea..a84ef39c 100644 --- a/framework/Data/TDbCommand.php +++ b/framework/Data/TDbCommand.php @@ -54,6 +54,15 @@ class TDbCommand extends TComponent }
/**
+ * Set the statement to null when serializing.
+ */
+ public function __sleep()
+ {
+ $this->_statement=null;
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
* @return string the SQL statement to be executed
*/
public function getText()
@@ -193,6 +202,7 @@ class TDbCommand extends TComponent */
public function query()
{
+// Prado::debug();
try
{
if($this->_statement instanceof PDOStatement)
diff --git a/framework/Data/TDbConnection.php b/framework/Data/TDbConnection.php index f0a0bc0d..3a1cc764 100644 --- a/framework/Data/TDbConnection.php +++ b/framework/Data/TDbConnection.php @@ -102,6 +102,15 @@ class TDbConnection extends TComponent }
/**
+ * Close the connection when serializing.
+ */
+ public function __sleep()
+ {
+ $this->close();
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
* @return array list of available PDO drivers
* @see http://www.php.net/manual/en/function.pdo-getavailabledrivers.php
*/
|