diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2015-01-20 22:02:33 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2015-01-20 22:02:33 +0100 |
commit | 90b5141367db5fcac9ba72042278556612b5dc3f (patch) | |
tree | 369112fd85eab39d36f4726f4f763828e6c560a4 /framework/Data/SqlMap/DataMapper | |
parent | f6c4b70070a8e4378a37f750d53920e44bcc5857 (diff) |
One class per file: framework/Data
Diffstat (limited to 'framework/Data/SqlMap/DataMapper')
14 files changed, 472 insertions, 386 deletions
diff --git a/framework/Data/SqlMap/DataMapper/TInvalidPropertyException.php b/framework/Data/SqlMap/DataMapper/TInvalidPropertyException.php new file mode 100644 index 00000000..2defaf0f --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TInvalidPropertyException.php @@ -0,0 +1,19 @@ +<?php +/** + * TSqlMapException is the base exception class for all SqlMap exceptions. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ + +/** + * TInvalidPropertyException, raised when setting or getting an invalid property. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ +class TInvalidPropertyException extends TSqlMapException +{ +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TLazyLoadList.php b/framework/Data/SqlMap/DataMapper/TLazyLoadList.php index d50c1b84..e0601e44 100644 --- a/framework/Data/SqlMap/DataMapper/TLazyLoadList.php +++ b/framework/Data/SqlMap/DataMapper/TLazyLoadList.php @@ -98,44 +98,4 @@ class TLazyLoadList return in_array($method, get_class_methods($this->_innerList)); return false; } -} - -/** - * TObjectProxy sets up a simple object that intercepts method calls to a - * particular object and relays the call to handler object. - * - * @author Wei Zhuo <weizho[at]gmail[dot]com> - * @package System.Data.SqlMap - * @since 3.1 - */ -class TObjectProxy -{ - private $_object; - private $_handler; - - /** - * @param object handler to method calls. - * @param object the object to by proxied. - */ - public function __construct($handler, $object) - { - $this->_handler = $handler; - $this->_object = $object; - } - - /** - * Relay the method call to the handler object (if able to be handled), otherwise - * it calls the proxied object's method. - * @param string method name called - * @param array method arguments - * @return mixed method return value. - */ - public function __call($method,$params) - { - if($this->_handler->hasMethod($method)) - return $this->_handler->intercept($method, $params); - else - return call_user_func_array(array($this->_object, $method), $params); - } -} - +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TObjectProxy.php b/framework/Data/SqlMap/DataMapper/TObjectProxy.php new file mode 100644 index 00000000..957c8a8f --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TObjectProxy.php @@ -0,0 +1,49 @@ +<?php +/** + * TLazyLoadList, TObjectProxy classes file. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Data.SqlMap + */ + +/** + * TObjectProxy sets up a simple object that intercepts method calls to a + * particular object and relays the call to handler object. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ +class TObjectProxy +{ + private $_object; + private $_handler; + + /** + * @param object handler to method calls. + * @param object the object to by proxied. + */ + public function __construct($handler, $object) + { + $this->_handler = $handler; + $this->_object = $object; + } + + /** + * Relay the method call to the handler object (if able to be handled), otherwise + * it calls the proxied object's method. + * @param string method name called + * @param array method arguments + * @return mixed method return value. + */ + public function __call($method,$params) + { + if($this->_handler->hasMethod($method)) + return $this->_handler->intercept($method, $params); + else + return call_user_func_array(array($this->_object, $method), $params); + } +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapApplicationCache.php b/framework/Data/SqlMap/DataMapper/TSqlMapApplicationCache.php new file mode 100644 index 00000000..bb3cb6c0 --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TSqlMapApplicationCache.php @@ -0,0 +1,139 @@ +<?php +/** + * TSqlMapCache class file contains FIFO, LRU, and GLOBAL cache implementations. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Data.SqlMap + */ + +/** + * TSqlMapApplicationCache uses the default Prado application cache for + * caching SqlMap results. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ +class TSqlMapApplicationCache implements ICache +{ + protected $_cacheModel=null; + + /** + * Create a new cache with limited cache size. + * @param TSqlMapCacheModel $cacheModel. + */ + public function __construct($cacheModel=null) + { + $this->_cacheModel=$cacheModel; + } + + /** + * + * @return string a KeyListID for the cache model. + */ + protected function getKeyListId() + { + $id='keyList'; + if ($this->_cacheModel instanceof TSqlMapCacheModel) + $id.='_'.$this->_cacheModel->getId(); + return $id; + } + /** + * Retreive keylist from cache or create it if it doesn't exists + * @return TList + */ + protected function getKeyList() + { + if (($keyList=$this->getCache()->get($this->getKeyListId()))===false) + { + $keyList=new TList(); + $this->getCache()->set($this->getKeyListId(), $keyList); + } + return $keyList; + } + + protected function setKeyList($keyList) + { + $this->getCache()->set($this->getKeyListId(), $keyList); + } + + /** + * @param string item to be deleted. + */ + public function delete($key) + { + $keyList=$this->getKeyList(); + $keyList->remove($key); + $this->getCache()->delete($key); + $this->setKeyList($keyList); + } + + /** + * Deletes all items in the cache, only for data cached by sqlmap cachemodel + */ + public function flush() + { + $keyList=$this->getKeyList(); + $cache=$this->getCache(); + foreach ($keyList as $key) + { + $cache->delete($key); + } + // Remove the old keylist + $cache->delete($this->getKeyListId()); + } + + /** + * @return mixed Gets a cached object with the specified key. + */ + public function get($key) + { + $result = $this->getCache()->get($key); + if ($result === false) + { + // if the key has not been found in cache (e.g expired), remove from keylist + $keyList=$this->getKeyList(); + if ($keyList->contains($key)) + { + $keyList->remove($key); + $this->setKeyList($keyList); + } + } + return $result === false ? null : $result; + } + + /** + * Stores a value identified by a key into cache. + * @param string the key identifying the value to be cached + * @param mixed the value to be cached + */ + public function set($key, $value,$expire=0,$dependency=null) + { + $this->getCache()->set($key, $value, $expire,$dependency); + $keyList=$this->getKeyList(); + if (!$keyList->contains($key)) + { + $keyList->add($key); + $this->setKeyList($keyList); + } + } + + /** + * @return ICache Application cache instance. + */ + protected function getCache() + { + return Prado::getApplication()->getCache(); + } + + /** + * @throws TSqlMapException not implemented. + */ + public function add($id,$value,$expire=0,$dependency=null) + { + throw new TSqlMapException('sqlmap_use_set_to_store_cache'); + } +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapCache.php b/framework/Data/SqlMap/DataMapper/TSqlMapCache.php index aa853b6c..33a270cd 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapCache.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapCache.php @@ -80,211 +80,4 @@ abstract class TSqlMapCache implements ICache { throw new TSqlMapException('sqlmap_use_set_to_store_cache'); } -} - -/** - * First-in-First-out cache implementation, removes - * object that was first added when the cache is full. - * - * @author Wei Zhuo <weizhuo[at]gmail[dot]com> - * @package System.Data.SqlMap - * @since 3.1 - */ -class TSqlMapFifoCache extends TSqlMapCache -{ - /** - * @return mixed Gets a cached object with the specified key. - */ - public function get($key) - { - return $this->_cache->itemAt($key); - } - - /** - * Stores a value identified by a key into cache. - * The expire and dependency parameters are ignored. - * @param string cache key - * @param mixed value to cache. - */ - public function set($key, $value,$expire=0,$dependency=null) - { - $this->_cache->add($key, $value); - $this->_keyList->add($key); - if($this->_keyList->getCount() > $this->_cacheSize) - { - $oldestKey = $this->_keyList->removeAt(0); - $this->_cache->remove($oldestKey); - } - } -} - -/** - * Least recently used cache implementation, removes - * object that was accessed last when the cache is full. - * - * @author Wei Zhuo <weizhuo[at]gmail[dot]com> - * @package System.Data.SqlMap - * @since 3.1 - */ -class TSqlMapLruCache extends TSqlMapCache -{ - /** - * @return mixed Gets a cached object with the specified key. - */ - public function get($key) - { - if($this->_keyList->contains($key)) - { - $this->_keyList->remove($key); - $this->_keyList->add($key); - return $this->_cache->itemAt($key); - } - } - - /** - * Stores a value identified by a key into cache. - * The expire and dependency parameters are ignored. - * @param string the key identifying the value to be cached - * @param mixed the value to be cached - */ - public function set($key, $value,$expire=0,$dependency=null) - { - $this->_cache->add($key, $value); - $this->_keyList->add($key); - if($this->_keyList->getCount() > $this->_cacheSize) - { - $oldestKey = $this->_keyList->removeAt(0); - $this->_cache->remove($oldestKey); - } - } -} - -/** - * TSqlMapApplicationCache uses the default Prado application cache for - * caching SqlMap results. - * - * @author Wei Zhuo <weizho[at]gmail[dot]com> - * @package System.Data.SqlMap - * @since 3.1 - */ -class TSqlMapApplicationCache implements ICache -{ - protected $_cacheModel=null; - - /** - * Create a new cache with limited cache size. - * @param TSqlMapCacheModel $cacheModel. - */ - public function __construct($cacheModel=null) - { - $this->_cacheModel=$cacheModel; - } - - /** - * - * @return string a KeyListID for the cache model. - */ - protected function getKeyListId() - { - $id='keyList'; - if ($this->_cacheModel instanceof TSqlMapCacheModel) - $id.='_'.$this->_cacheModel->getId(); - return $id; - } - /** - * Retreive keylist from cache or create it if it doesn't exists - * @return TList - */ - protected function getKeyList() - { - if (($keyList=$this->getCache()->get($this->getKeyListId()))===false) - { - $keyList=new TList(); - $this->getCache()->set($this->getKeyListId(), $keyList); - } - return $keyList; - } - - protected function setKeyList($keyList) - { - $this->getCache()->set($this->getKeyListId(), $keyList); - } - - /** - * @param string item to be deleted. - */ - public function delete($key) - { - $keyList=$this->getKeyList(); - $keyList->remove($key); - $this->getCache()->delete($key); - $this->setKeyList($keyList); - } - - /** - * Deletes all items in the cache, only for data cached by sqlmap cachemodel - */ - public function flush() - { - $keyList=$this->getKeyList(); - $cache=$this->getCache(); - foreach ($keyList as $key) - { - $cache->delete($key); - } - // Remove the old keylist - $cache->delete($this->getKeyListId()); - } - - /** - * @return mixed Gets a cached object with the specified key. - */ - public function get($key) - { - $result = $this->getCache()->get($key); - if ($result === false) - { - // if the key has not been found in cache (e.g expired), remove from keylist - $keyList=$this->getKeyList(); - if ($keyList->contains($key)) - { - $keyList->remove($key); - $this->setKeyList($keyList); - } - } - return $result === false ? null : $result; - } - - /** - * Stores a value identified by a key into cache. - * @param string the key identifying the value to be cached - * @param mixed the value to be cached - */ - public function set($key, $value,$expire=0,$dependency=null) - { - $this->getCache()->set($key, $value, $expire,$dependency); - $keyList=$this->getKeyList(); - if (!$keyList->contains($key)) - { - $keyList->add($key); - $this->setKeyList($keyList); - } - } - - /** - * @return ICache Application cache instance. - */ - protected function getCache() - { - return Prado::getApplication()->getCache(); - } - - /** - * @throws TSqlMapException not implemented. - */ - public function add($id,$value,$expire=0,$dependency=null) - { - throw new TSqlMapException('sqlmap_use_set_to_store_cache'); - } -} - +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapConfigurationException.php b/framework/Data/SqlMap/DataMapper/TSqlMapConfigurationException.php new file mode 100644 index 00000000..8d5556c8 --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TSqlMapConfigurationException.php @@ -0,0 +1,20 @@ +<?php +/** + * TSqlMapException is the base exception class for all SqlMap exceptions. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ + +/** + * TSqlMapConfigurationException, raised during configuration file parsing. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ +class TSqlMapConfigurationException extends TSqlMapException +{ + +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapDuplicateException.php b/framework/Data/SqlMap/DataMapper/TSqlMapDuplicateException.php new file mode 100644 index 00000000..008d8f08 --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TSqlMapDuplicateException.php @@ -0,0 +1,19 @@ +<?php +/** + * TSqlMapException is the base exception class for all SqlMap exceptions. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ + +/** + * TSqlMapDuplicateException, raised when a duplicate mapped statement is found. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ +class TSqlMapDuplicateException extends TSqlMapException +{ +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapException.php b/framework/Data/SqlMap/DataMapper/TSqlMapException.php index bce03a5c..720ee7ee 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapException.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapException.php @@ -1,5 +1,4 @@ <?php - /** * TSqlMapException is the base exception class for all SqlMap exceptions. * @@ -7,6 +6,7 @@ * @package System.Data.SqlMap * @since 3.1 */ + class TSqlMapException extends TException { /** @@ -56,55 +56,4 @@ class TSqlMapException extends TException $msgFile=$dir.'/messages.txt'; return $msgFile; } -} - -/** - * TSqlMapConfigurationException, raised during configuration file parsing. - * - * @author Wei Zhuo <weizho[at]gmail[dot]com> - * @package System.Data.SqlMap - * @since 3.1 - */ -class TSqlMapConfigurationException extends TSqlMapException -{ - -} - -/** - * TSqlMapUndefinedException, raised when mapped statemented are undefined. - * - * @author Wei Zhuo <weizho[at]gmail[dot]com> - * @package System.Data.SqlMap - * @since 3.1 - */ -class TSqlMapUndefinedException extends TSqlMapException -{ - -} - -/** - * TSqlMapDuplicateException, raised when a duplicate mapped statement is found. - * - * @author Wei Zhuo <weizho[at]gmail[dot]com> - * @package System.Data.SqlMap - * @since 3.1 - */ -class TSqlMapDuplicateException extends TSqlMapException -{ -} - -/** - * TInvalidPropertyException, raised when setting or getting an invalid property. - * - * @author Wei Zhuo <weizho[at]gmail[dot]com> - * @package System.Data.SqlMap - * @since 3.1 - */ -class TInvalidPropertyException extends TSqlMapException -{ -} - -class TSqlMapExecutionException extends TSqlMapException -{ -} - +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapExecutionException.php b/framework/Data/SqlMap/DataMapper/TSqlMapExecutionException.php new file mode 100644 index 00000000..90896c35 --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TSqlMapExecutionException.php @@ -0,0 +1,12 @@ +<?php +/** + * TSqlMapException is the base exception class for all SqlMap exceptions. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ + +class TSqlMapExecutionException extends TSqlMapException +{ +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapFifoCache.php b/framework/Data/SqlMap/DataMapper/TSqlMapFifoCache.php new file mode 100644 index 00000000..3c036a97 --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TSqlMapFifoCache.php @@ -0,0 +1,46 @@ +<?php +/** + * TSqlMapCache class file contains FIFO, LRU, and GLOBAL cache implementations. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Data.SqlMap + */ + +/** + * First-in-First-out cache implementation, removes + * object that was first added when the cache is full. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ +class TSqlMapFifoCache extends TSqlMapCache +{ + /** + * @return mixed Gets a cached object with the specified key. + */ + public function get($key) + { + return $this->_cache->itemAt($key); + } + + /** + * Stores a value identified by a key into cache. + * The expire and dependency parameters are ignored. + * @param string cache key + * @param mixed value to cache. + */ + public function set($key, $value,$expire=0,$dependency=null) + { + $this->_cache->add($key, $value); + $this->_keyList->add($key); + if($this->_keyList->getCount() > $this->_cacheSize) + { + $oldestKey = $this->_keyList->removeAt(0); + $this->_cache->remove($oldestKey); + } + } +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapLruCache.php b/framework/Data/SqlMap/DataMapper/TSqlMapLruCache.php new file mode 100644 index 00000000..e34cad84 --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TSqlMapLruCache.php @@ -0,0 +1,51 @@ +<?php +/** + * TSqlMapCache class file contains FIFO, LRU, and GLOBAL cache implementations. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Data.SqlMap + */ + +/** + * Least recently used cache implementation, removes + * object that was accessed last when the cache is full. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ +class TSqlMapLruCache extends TSqlMapCache +{ + /** + * @return mixed Gets a cached object with the specified key. + */ + public function get($key) + { + if($this->_keyList->contains($key)) + { + $this->_keyList->remove($key); + $this->_keyList->add($key); + return $this->_cache->itemAt($key); + } + } + + /** + * Stores a value identified by a key into cache. + * The expire and dependency parameters are ignored. + * @param string the key identifying the value to be cached + * @param mixed the value to be cached + */ + public function set($key, $value,$expire=0,$dependency=null) + { + $this->_cache->add($key, $value); + $this->_keyList->add($key); + if($this->_keyList->getCount() > $this->_cacheSize) + { + $oldestKey = $this->_keyList->removeAt(0); + $this->_cache->remove($oldestKey); + } + } +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandler.php b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandler.php new file mode 100644 index 00000000..a5d3f39c --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandler.php @@ -0,0 +1,92 @@ +<?php +/** + * TSqlMapTypeHandlerRegistry, and abstract TSqlMapTypeHandler classes file. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Data.SqlMap + */ + +/** + * A simple interface for implementing custom type handlers. + * + * Using this interface, you can implement a type handler that + * will perform customized processing before parameters are set + * on and after values are retrieved from the database. + * Using a custom type handler you can extend + * the framework to handle types that are not supported, or + * handle supported types in a different way. For example, + * you might use a custom type handler to implement proprietary + * BLOB support (e.g. Oracle), or you might use it to handle + * booleans using "Y" and "N" instead of the more typical 0/1. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ +abstract class TSqlMapTypeHandler extends TComponent +{ + private $_dbType='NULL'; + private $_type; + /** + * @param string database field type. + */ + public function setDbType($value) + { + $this->_dbType=$value; + } + + /** + * @return string database field type. + */ + public function getDbType() + { + return $this->_dbType; + } + + public function getType() + { + if($this->_type===null) + return get_class($this); + else + return $this->_type; + } + + public function setType($value) + { + $this->_type=$value; + } + + /** + * Performs processing on a value before it is used to set + * the parameter of a IDbCommand. + * @param object The interface for setting the value. + * @param object The value to be set. + */ + public abstract function getParameter($object); + + + /** + * Performs processing on a value before after it has been retrieved + * from a database + * @param object The interface for getting the value. + * @return mixed The processed value. + */ + public abstract function getResult($string); + + + /** + * Casts the string representation of a value into a type recognized by + * this type handler. This method is used to translate nullValue values + * into types that can be appropriately compared. If your custom type handler + * cannot support nullValues, or if there is no reasonable string representation + * for this type (e.g. File type), you can simply return the String representation + * as it was passed in. It is not recommended to return null, unless null was passed + * in. + * @param array result row. + * @return mixed + */ + public abstract function createNewInstance($row=null); +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php index 18b8ef99..f6a22ee1 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php @@ -103,87 +103,4 @@ class TSqlMapTypeHandlerRegistry settype($value, $type); return $value; } -} - -/** - * A simple interface for implementing custom type handlers. - * - * Using this interface, you can implement a type handler that - * will perform customized processing before parameters are set - * on and after values are retrieved from the database. - * Using a custom type handler you can extend - * the framework to handle types that are not supported, or - * handle supported types in a different way. For example, - * you might use a custom type handler to implement proprietary - * BLOB support (e.g. Oracle), or you might use it to handle - * booleans using "Y" and "N" instead of the more typical 0/1. - * - * @author Wei Zhuo <weizho[at]gmail[dot]com> - * @package System.Data.SqlMap - * @since 3.1 - */ -abstract class TSqlMapTypeHandler extends TComponent -{ - private $_dbType='NULL'; - private $_type; - /** - * @param string database field type. - */ - public function setDbType($value) - { - $this->_dbType=$value; - } - - /** - * @return string database field type. - */ - public function getDbType() - { - return $this->_dbType; - } - - public function getType() - { - if($this->_type===null) - return get_class($this); - else - return $this->_type; - } - - public function setType($value) - { - $this->_type=$value; - } - - /** - * Performs processing on a value before it is used to set - * the parameter of a IDbCommand. - * @param object The interface for setting the value. - * @param object The value to be set. - */ - public abstract function getParameter($object); - - - /** - * Performs processing on a value before after it has been retrieved - * from a database - * @param object The interface for getting the value. - * @return mixed The processed value. - */ - public abstract function getResult($string); - - - /** - * Casts the string representation of a value into a type recognized by - * this type handler. This method is used to translate nullValue values - * into types that can be appropriately compared. If your custom type handler - * cannot support nullValues, or if there is no reasonable string representation - * for this type (e.g. File type), you can simply return the String representation - * as it was passed in. It is not recommended to return null, unless null was passed - * in. - * @param array result row. - * @return mixed - */ - public abstract function createNewInstance($row=null); -} - +}
\ No newline at end of file diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapUndefinedException.php b/framework/Data/SqlMap/DataMapper/TSqlMapUndefinedException.php new file mode 100644 index 00000000..44e968ec --- /dev/null +++ b/framework/Data/SqlMap/DataMapper/TSqlMapUndefinedException.php @@ -0,0 +1,20 @@ +<?php +/** + * TSqlMapException is the base exception class for all SqlMap exceptions. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ + +/** + * TSqlMapUndefinedException, raised when mapped statemented are undefined. + * + * @author Wei Zhuo <weizho[at]gmail[dot]com> + * @package System.Data.SqlMap + * @since 3.1 + */ +class TSqlMapUndefinedException extends TSqlMapException +{ + +}
\ No newline at end of file |