From de021710e1c0dae732e61ecb42a9ac60440f55ee Mon Sep 17 00:00:00 2001 From: "godzilla80@gmx.net" <> Date: Thu, 19 Mar 2009 21:20:47 +0000 Subject: replace is_null() function calls with native native language constuct --- .../Data/SqlMap/Configuration/TParameterMap.php | 8 ++--- framework/Data/SqlMap/Configuration/TResultMap.php | 8 ++--- .../Data/SqlMap/Configuration/TResultProperty.php | 8 ++--- .../SqlMap/Configuration/TSqlMapCacheModel.php | 8 ++--- .../Data/SqlMap/Configuration/TSqlMapStatement.php | 4 +-- .../Configuration/TSqlMapXmlConfiguration.php | 40 +++++++++++----------- .../Data/SqlMap/DataMapper/TSqlMapPagedList.php | 8 ++--- .../Data/SqlMap/Statements/TCachingStatement.php | 8 ++--- .../Data/SqlMap/Statements/TMappedStatement.php | 34 +++++++++--------- .../Statements/TPreparedStatementFactory.php | 4 +-- framework/Data/TDataSourceConfig.php | 8 ++--- 11 files changed, 69 insertions(+), 69 deletions(-) (limited to 'framework/Data') diff --git a/framework/Data/SqlMap/Configuration/TParameterMap.php b/framework/Data/SqlMap/Configuration/TParameterMap.php index f4fbbe1c..4b5ee144 100644 --- a/framework/Data/SqlMap/Configuration/TParameterMap.php +++ b/framework/Data/SqlMap/Configuration/TParameterMap.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -140,12 +140,12 @@ class TParameterMap extends TComponent { $value = $this->getObjectValue($parameterValue,$property); - if(!is_null($handler=$this->createTypeHandler($property, $registry))) + if(($handler=$this->createTypeHandler($property, $registry))!==null) $value = $handler->getParameter($value); $value = $this->nullifyDefaultValue($property,$value); - if(!is_null($type = $property->getType())) + if(($type = $property->getType())!==null) $value = $registry->convertToType($type, $value); return $value; @@ -197,7 +197,7 @@ class TParameterMap extends TComponent */ protected function nullifyDefaultValue($property,$value) { - if(!is_null($nullValue = $property->getNullValue())) + if(($nullValue = $property->getNullValue())!==null) { if($nullValue === $value) $value = null; diff --git a/framework/Data/SqlMap/Configuration/TResultMap.php b/framework/Data/SqlMap/Configuration/TResultMap.php index d59d9522..e85dc1aa 100644 --- a/framework/Data/SqlMap/Configuration/TResultMap.php +++ b/framework/Data/SqlMap/Configuration/TResultMap.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -162,7 +162,7 @@ class TResultMap extends TComponent $handler = $registry->getTypeHandler($this->getClass()); try { - if(!is_null($handler)) + if($handler!==null) return $handler->createNewInstance(); else return $registry->createInstanceOf($this->getClass()); @@ -184,12 +184,12 @@ class TResultMap extends TComponent public function resolveSubMap($registry,$row) { $subMap = $this; - if(!is_null($disc = $this->getDiscriminator())) + if(($disc = $this->getDiscriminator())!==null) { $value = $disc->getMapping()->getPropertyValue($registry,$row); $subMap = $disc->getSubMap((string)$value); - if(is_null($subMap)) + if($subMap===null) $subMap = $this; else if($subMap !== $this) $subMap = $subMap->resolveSubMap($registry,$row); diff --git a/framework/Data/SqlMap/Configuration/TResultProperty.php b/framework/Data/SqlMap/Configuration/TResultProperty.php index 8e20d5e4..7316ef0b 100644 --- a/framework/Data/SqlMap/Configuration/TResultProperty.php +++ b/framework/Data/SqlMap/Configuration/TResultProperty.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -242,7 +242,7 @@ class TResultProperty extends TComponent $value = $this->getTypedValue($registry,$row[$index]); else if(isset($row[$name])) $value = $this->getTypedValue($registry,$row[$name]); - if(is_null($value) && !is_null($this->getNullValue())) + if(($value===null) && ($this->getNullValue()!==null)) $value = $this->getTypedValue($registry,$this->getNullValue()); return $value; } @@ -302,7 +302,7 @@ class TResultProperty extends TComponent */ public function instanceOfListType($target) { - if(is_null($this->getType())) + if($this->getType()===null) return TPropertyAccess::get($target,$this->getProperty()) instanceof TList; return $this->getPropertyValueType() == self::LIST_TYPE; } @@ -315,7 +315,7 @@ class TResultProperty extends TComponent */ public function instanceOfArrayType($target) { - if(is_null($this->getType())) + if($this->getType()===null) { $prop = TPropertyAccess::get($target,$this->getProperty()); if(is_object($prop)) diff --git a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php index d7984dc4..5d19a3a3 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -79,7 +79,7 @@ class TSqlMapCacheModel extends TComponent */ public function initialize($cache=null) { - if(is_null($cache)) + if($cache===null) $this->_cache= Prado::createComponent($this->getImplementationClass()); else $this->_cache=$cache; @@ -127,7 +127,7 @@ class TSqlMapCacheModel extends TComponent //if flush ? $value = $this->_cache->get($key); $this->_requests++; - if(!is_null($value)) + if($value!==null) $this->_hits++; return $value; } @@ -141,7 +141,7 @@ class TSqlMapCacheModel extends TComponent if($key instanceof TSqlMapCacheKey) $key = $key->getHash(); - if(!is_null($value)) + if($value!==null) $this->_cache->set($key, $value); } diff --git a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php index 3afcc75f..7e1783a3 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php @@ -5,7 +5,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -275,7 +275,7 @@ class TSqlMapStatement extends TComponent protected function createInstanceOf($registry,$type,$row=null) { $handler = $registry->getTypeHandler($type); - if(!is_null($handler)) + if($handler!==null) return $handler->createNewInstance($row); else return $registry->createInstanceOf($type); diff --git a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php index f2d13966..ba8c3d0c 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php @@ -4,14 +4,14 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration */ Prado::using('System.Data.SqlMap.Configuration.TSqlMapStatement'); - + /** * TSqlMapXmlConfig class file. * @@ -255,7 +255,7 @@ class TSqlMapXmlConfiguration extends TSqlMapXmlConfigBuilder $resultMap, $this->_configFile, $entry->getID()); } } - if(!is_null($entry->getDiscriminator())) + if($entry->getDiscriminator()!==null) $entry->getDiscriminator()->initialize($this->_manager); } } @@ -309,16 +309,16 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder private $_FlushOnExecuteStatements=array(); - /** - * Regular expressions for escaping simple/inline parameter symbols - */ - const SIMPLE_MARK='$'; - const INLINE_SYMBOL='#'; - const ESCAPED_SIMPLE_MARK_REGEXP='/\$\$/'; - const ESCAPED_INLINE_SYMBOL_REGEXP='/\#\#/'; - const SIMPLE_PLACEHOLDER='`!!`'; - const INLINE_PLACEHOLDER='`!!!`'; - + /** + * Regular expressions for escaping simple/inline parameter symbols + */ + const SIMPLE_MARK='$'; + const INLINE_SYMBOL='#'; + const ESCAPED_SIMPLE_MARK_REGEXP='/\$\$/'; + const ESCAPED_INLINE_SYMBOL_REGEXP='/\#\#/'; + const SIMPLE_PLACEHOLDER='`!!`'; + const INLINE_PLACEHOLDER='`!!!`'; + /** * @param TSqlMapXmlConfiguration parent xml configuration. */ @@ -434,7 +434,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder foreach($node->xpath('subMap') as $subMapNode) { - if(is_null($discriminator)) + if($discriminator===null) throw new TSqlMapConfigurationException( 'sqlmap_undefined_discriminator', $node, $this->_configFile,$subMapNode); $subMap = new TSubMap; @@ -442,7 +442,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder $discriminator->addSubMap($subMap); } - if(!is_null($discriminator)) + if($discriminator!==null) $resultMap->setDiscriminator($discriminator); return $resultMap; @@ -542,7 +542,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder $scope['file'] = $this->_configFile; $scope['node'] = $node; - $sqlStatement=preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP,self::INLINE_PLACEHOLDER,$sqlStatement); + $sqlStatement=preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP,self::INLINE_PLACEHOLDER,$sqlStatement); if($statement->parameterMap() === null) { // Build a Parametermap with the inline parameters. @@ -559,7 +559,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder } $sqlStatement = $sqlText['sql']; } - $sqlStatement=preg_replace('/'.self::INLINE_PLACEHOLDER.'/',self::INLINE_SYMBOL,$sqlStatement); + $sqlStatement=preg_replace('/'.self::INLINE_PLACEHOLDER.'/',self::INLINE_SYMBOL,$sqlStatement); $this->prepareSql($statement, $sqlStatement, $node); } @@ -574,7 +574,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder protected function prepareSql($statement,$sqlStatement, $node) { $simpleDynamic = new TSimpleDynamicParser; - $sqlStatement=preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP,self::SIMPLE_PLACEHOLDER,$sqlStatement); + $sqlStatement=preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP,self::SIMPLE_PLACEHOLDER,$sqlStatement); $dynamics = $simpleDynamic->parse($sqlStatement); if(count($dynamics['parameters']) > 0) { @@ -583,7 +583,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder } else $sql = new TStaticSql(); - $sqlStatement=preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/',self::SIMPLE_MARK,$sqlStatement); + $sqlStatement=preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/',self::SIMPLE_MARK,$sqlStatement); $sql->buildPreparedStatement($statement, $sqlStatement); $statement->setSqlText($sql); } @@ -737,4 +737,4 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder } } } - + diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php b/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php index 86171c1e..68b0c638 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap @@ -178,7 +178,7 @@ class TSqlMapPagedList extends TPagedList */ public function getIsNextPageAvailable() { - return !is_null($this->_nextPageList); + return $this->_nextPageList!==null; } /** @@ -186,7 +186,7 @@ class TSqlMapPagedList extends TPagedList */ public function getIsPreviousPageAvailable() { - return !is_null($this->_prevPageList); + return $this->_prevPageList!==null; } /** @@ -194,7 +194,7 @@ class TSqlMapPagedList extends TPagedList */ public function getIsLastPage() { - return is_null($this->_nextPageList) || $this->_nextPageList->getCount() < 1; + return ($this->_nextPageList===null) || $this->_nextPageList->getCount() < 1; } /** diff --git a/framework/Data/SqlMap/Statements/TCachingStatement.php b/framework/Data/SqlMap/Statements/TCachingStatement.php index c8a748c1..fcaeb974 100644 --- a/framework/Data/SqlMap/Statements/TCachingStatement.php +++ b/framework/Data/SqlMap/Statements/TCachingStatement.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Statements @@ -47,7 +47,7 @@ class TCachingStatement implements IMappedStatement $sql = $this->createCommand($connection, $parameter, $skip, $max); $key = $this->getCacheKey(array(clone($sql), $keyProperty, $valueProperty,$skip, $max)); $map = $this->getStatement()->getCache()->get($key); - if(is_null($map)) + if($map===null) { $map = $this->_mappedStatement->runQueryForMap( $connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate); @@ -71,7 +71,7 @@ class TCachingStatement implements IMappedStatement $sql = $this->createCommand($connection, $parameter, $skip, $max); $key = $this->getCacheKey(array(clone($sql), $parameter, $skip, $max)); $list = $this->getStatement()->getCache()->get($key); - if(is_null($list)) + if($list===null) { $list = $this->_mappedStatement->runQueryForList( $connection, $parameter, $sql, $result, $delegate); @@ -85,7 +85,7 @@ class TCachingStatement implements IMappedStatement $sql = $this->createCommand($connection, $parameter); $key = $this->getCacheKey(array(clone($sql), $parameter)); $object = $this->getStatement()->getCache()->get($key); - if(is_null($object)) + if($object===null) { $object = $this->_mappedStatement->runQueryForObject($connection, $sql, $result); $this->getStatement()->getCache()->set($key, $object); diff --git a/framework/Data/SqlMap/Statements/TMappedStatement.php b/framework/Data/SqlMap/Statements/TMappedStatement.php index 6a9130fe..6b11b107 100644 --- a/framework/Data/SqlMap/Statements/TMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TMappedStatement.php @@ -231,7 +231,7 @@ class TMappedStatement extends TComponent implements IMappedStatement $connection->setActive(true); $reader = $sql->query(); //$reader = $this->executeSQLQueryLimit($connection, $sql, $max, $skip); - if(!is_null($delegate)) + if($delegate!==null) { foreach($reader as $row) { @@ -304,14 +304,14 @@ class TMappedStatement extends TComponent implements IMappedStatement //$recordSet = $this->executeSQLQuery($connection, $sql); $connection->setActive(true); $reader = $command->query(); - if(!is_null($delegate)) + if($delegate!==null) { //while($row = $recordSet->fetchRow()) foreach($reader as $row) { $obj = $this->applyResultMap($row); $key = TPropertyAccess::get($obj, $keyProperty); - $value = is_null($valueProperty) ? $obj : + $value = ($valueProperty===null) ? $obj : TPropertyAccess::get($obj, $valueProperty); $param = new TResultSetMapItemParameter($key, $value, $parameter, $map); $this->raiseRowDelegate($delegate, $param); @@ -324,7 +324,7 @@ class TMappedStatement extends TComponent implements IMappedStatement { $obj = $this->applyResultMap($row); $key = TPropertyAccess::get($obj, $keyProperty); - $map[$key] = is_null($valueProperty) ? $obj : + $map[$key] = ($valueProperty===null) ? $obj : TPropertyAccess::get($obj, $valueProperty); } } @@ -426,7 +426,7 @@ class TMappedStatement extends TComponent implements IMappedStatement // var_dump($command,$parameter); $result = $command->execute(); - if(is_null($generatedKey)) + if($generatedKey===null) $generatedKey = $this->getPostGeneratedSelectKey($connection, $parameter); $this->executePostSelect($connection); @@ -445,7 +445,7 @@ class TMappedStatement extends TComponent implements IMappedStatement if($this->_statement instanceof TSqlMapInsert) { $selectKey = $this->_statement->getSelectKey(); - if(!is_null($selectKey) && !$selectKey->getIsAfter()) + if(($selectKey!==null) && !$selectKey->getIsAfter()) return $this->executeSelectKey($connection, $parameter, $selectKey); } } @@ -461,7 +461,7 @@ class TMappedStatement extends TComponent implements IMappedStatement if($this->_statement instanceof TSqlMapInsert) { $selectKey = $this->_statement->getSelectKey(); - if(!is_null($selectKey) && $selectKey->getIsAfter()) + if(($selectKey!==null) && $selectKey->getIsAfter()) return $this->executeSelectKey($connection, $parameter, $selectKey); } } @@ -575,7 +575,7 @@ class TMappedStatement extends TComponent implements IMappedStatement */ protected function fillResultClass($resultClass, $row, $resultObject) { - if(is_null($resultObject)) + if($resultObject===null) { $registry = $this->getManager()->getTypeHandlers(); $resultObject = $this->_statement->createInstanceOfResultClass($registry,$row); @@ -643,7 +643,7 @@ class TMappedStatement extends TComponent implements IMappedStatement $registry = $this->getManager()->getTypeHandlers(); $resultMap = $resultMap->resolveSubMap($registry,$row); - if(is_null($resultObject)) + if($resultObject===null) $resultObject = $resultMap->createInstanceOfResult($registry); if(is_object($resultObject)) @@ -734,10 +734,10 @@ class TMappedStatement extends TComponent implements IMappedStatement */ protected function fillDefaultResultMap($resultMap, $row, $resultObject) { - if(is_null($resultObject)) + if($resultObject===null) $resultObject=''; - if(!is_null($resultMap)) + if($resultMap!==null) $result = $this->fillArrayResultMap($resultMap, $row, $resultObject); else $result = $row; @@ -762,8 +762,8 @@ class TMappedStatement extends TComponent implements IMappedStatement $registry=$this->getManager()->getTypeHandlers(); foreach($resultMap->getColumns() as $column) { - if(is_null($column->getType()) - && !is_null($resultObject) && !is_object($resultObject)) + if(($column->getType()===null) + && ($resultObject!==null) && !is_object($resultObject)) $column->setType(gettype($resultObject)); $result[$column->getProperty()] = $column->getPropertyValue($registry,$row); } @@ -800,7 +800,7 @@ class TMappedStatement extends TComponent implements IMappedStatement { $resultObject = $property->getPropertyValue($registry,$row); } - else if(strlen($select) == 0 && is_null($nested)) + else if(strlen($select) == 0 && ($nested===null)) { $value = $property->getPropertyValue($registry,$row); @@ -810,7 +810,7 @@ class TMappedStatement extends TComponent implements IMappedStatement else $resultObject = $value; } - else if(!is_null($nested)) + else if($nested!==null) { if($property->instanceOfListType($resultObject) || $property->instanceOfArrayType($resultObject)) { @@ -995,8 +995,8 @@ class TSqlMapObjectCollectionTree */ public function add($parent, $node, $object='') { - if(isset($this->_entries[$parent]) && !is_null($this->_entries[$parent]) - && isset($this->_entries[$node]) && !is_null($this->_entries[$node])) + if(isset($this->_entries[$parent]) && ($this->_entries[$parent]!==null) + && isset($this->_entries[$node]) && ($this->_entries[$node]!==null)) { $this->_entries[$node] = $object; return; diff --git a/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php b/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php index 44603408..a2a9df03 100644 --- a/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php +++ b/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Statements @@ -35,7 +35,7 @@ class TPreparedStatementFactory { $this->_preparedStatement = new TPreparedStatement(); $this->_preparedStatement->setPreparedSql($this->_commandText); - if(!is_null($this->_statement->parameterMap())) + if($this->_statement->parameterMap()!==null) $this->createParametersForTextCommand(); return $this->_preparedStatement; } diff --git a/framework/Data/TDataSourceConfig.php b/framework/Data/TDataSourceConfig.php index 9a81ff8c..53a5ef22 100644 --- a/framework/Data/TDataSourceConfig.php +++ b/framework/Data/TDataSourceConfig.php @@ -1,10 +1,10 @@ - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data @@ -131,7 +131,7 @@ class TDataSourceConfig extends TModule */ public function setConnectionClass($value) { - if(!is_null($this->_conn)) + if($this->_conn!==null) throw new TConfigurationException('datasource_dbconnection_exists', $value); $this->_connClass=$value; } @@ -153,4 +153,4 @@ class TDataSourceConfig extends TModule throw new TConfigurationException('datasource_dbconnection_invalid',$id); } } - + -- cgit v1.2.3