From 3d3f8d3832921f99daf8ce1953304763c2e76c62 Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 14 Apr 2006 06:22:09 +0000 Subject: Importing SQLMap + sample + docs. --- .../SQLMap/Configuration/TDiscriminator.php | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 framework/DataAccess/SQLMap/Configuration/TDiscriminator.php (limited to 'framework/DataAccess/SQLMap/Configuration/TDiscriminator.php') diff --git a/framework/DataAccess/SQLMap/Configuration/TDiscriminator.php b/framework/DataAccess/SQLMap/Configuration/TDiscriminator.php new file mode 100644 index 00000000..0ee34e3e --- /dev/null +++ b/framework/DataAccess/SQLMap/Configuration/TDiscriminator.php @@ -0,0 +1,86 @@ +_column; } + public function setColumn($value){ $this->_column = $value; } + + public function getType(){ return $this->_type; } + public function setType($value){ $this->_type = $value; } + + public function getTypeHandler(){ return $this->_typeHandler; } + public function setTypeHandler($value){ $this->_typeHandler = $value; } + + public function getDbType(){ return $this->_dbType; } + public function setDbType($value){ $this->_dbType = $value; } + + public function getColumnIndex(){ return $this->_columnIndex; } + public function setColumnIndex($value){ $this->_columnIndex = $value; } + + public function getNullValue(){ return $this->_nullValue; } + public function setNullValue($value){ $this->_nullValue = $value; } + + public function getMapping(){ return $this->_mapping; } + + public function getResultMaps(){ return $this->_resultMaps; } + public function setResultMaps($value){ $this->_resultMaps = $value; } + + public function add($subMap) + { + $this->_subMaps[] = $subMap; + } + + public function getSubMap($value) + { + if(isset($this->_resultMaps[$value])) + return $this->_resultMaps[$value]; + else + return null; + } + + public function initMapping($sqlMap, $resultMap) + { + $this->_mapping = new TResultProperty; + $this->_mapping->setColumn($this->getColumn()); + $this->_mapping->setColumnIndex($this->getColumnIndex()); + $this->_mapping->setType($this->getType()); + $this->_mapping->setTypeHandler($this->getTypeHandler()); + $this->_mapping->setDbType($this->getDbType()); + $this->_mapping->setNullValue($this->getNullValue()); + $this->_mapping->initialize($sqlMap, $resultMap); + } + + public function initialize($sqlMap) + { + foreach($this->_subMaps as $subMap) + { + $this->_resultMaps[$subMap->getValue()] = + $sqlMap->getResultMap($subMap->getResultMapping()); + } + } +} + + +class TSubMap extends TComponent +{ + private $_value=''; + private $_resultMapping=''; + + public function getValue(){ return $this->_value; } + public function setValue($value){ $this->_value = $value; } + + public function getResultMapping(){ return $this->_resultMapping; } + public function setResultMapping($value){ $this->_resultMapping = $value; } +} + +?> \ No newline at end of file -- cgit v1.2.3