diff options
author | christophe.boulain <> | 2008-12-03 14:22:03 +0000 |
---|---|---|
committer | christophe.boulain <> | 2008-12-03 14:22:03 +0000 |
commit | 6228873cf9d6471463d2413e7dfd7447f759baf2 (patch) | |
tree | 496a0e658330c39d4caa35602ba9f783b6f24f9c /framework/Data/SqlMap | |
parent | e8f239fea7351b248302a593a8e5eaa2a88c3e80 (diff) |
Merge from trunk
Diffstat (limited to 'framework/Data/SqlMap')
31 files changed, 20 insertions, 35 deletions
diff --git a/framework/Data/SqlMap/Configuration/TDiscriminator.php b/framework/Data/SqlMap/Configuration/TDiscriminator.php index 75ce2352..747c4158 100644 --- a/framework/Data/SqlMap/Configuration/TDiscriminator.php +++ b/framework/Data/SqlMap/Configuration/TDiscriminator.php @@ -230,4 +230,3 @@ class TSubMap extends TComponent }
}
-?> diff --git a/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php b/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php index d29d5f27..2e8f38d6 100644 --- a/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php +++ b/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php @@ -27,7 +27,7 @@ class TInlineParameterMapParser /**
* Regular expression for parsing inline parameter maps.
*/
- const PARAMETER_TOKEN_REGEXP = '/#(#?[^#]+#?)#/';
+ const PARAMETER_TOKEN_REGEXP = '/#([^#]+)#/';
/**
* Parse the sql text for inline parameters.
@@ -77,4 +77,3 @@ class TInlineParameterMapParser }
}
-?> diff --git a/framework/Data/SqlMap/Configuration/TParameterMap.php b/framework/Data/SqlMap/Configuration/TParameterMap.php index 117c6037..f4fbbe1c 100644 --- a/framework/Data/SqlMap/Configuration/TParameterMap.php +++ b/framework/Data/SqlMap/Configuration/TParameterMap.php @@ -205,4 +205,3 @@ class TParameterMap extends TComponent return $value;
}
}
-?> diff --git a/framework/Data/SqlMap/Configuration/TParameterProperty.php b/framework/Data/SqlMap/Configuration/TParameterProperty.php index d0af3a75..dcea754c 100644 --- a/framework/Data/SqlMap/Configuration/TParameterProperty.php +++ b/framework/Data/SqlMap/Configuration/TParameterProperty.php @@ -136,4 +136,3 @@ class TParameterProperty extends TComponent }
}
-?> diff --git a/framework/Data/SqlMap/Configuration/TResultMap.php b/framework/Data/SqlMap/Configuration/TResultMap.php index 168041d2..d59d9522 100644 --- a/framework/Data/SqlMap/Configuration/TResultMap.php +++ b/framework/Data/SqlMap/Configuration/TResultMap.php @@ -198,4 +198,3 @@ class TResultMap extends TComponent }
}
-?> diff --git a/framework/Data/SqlMap/Configuration/TResultProperty.php b/framework/Data/SqlMap/Configuration/TResultProperty.php index 711fa7a0..8e20d5e4 100644 --- a/framework/Data/SqlMap/Configuration/TResultProperty.php +++ b/framework/Data/SqlMap/Configuration/TResultProperty.php @@ -326,4 +326,3 @@ class TResultProperty extends TComponent }
}
-?> diff --git a/framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php b/framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php index 6df8cefd..9a9b1277 100644 --- a/framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php +++ b/framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php @@ -43,4 +43,3 @@ class TSimpleDynamicParser }
}
-?> diff --git a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php index edb78ea7..d7984dc4 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php @@ -214,4 +214,3 @@ class TSqlMapCacheKey }
}
-?> diff --git a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php index 77b714fd..3afcc75f 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php @@ -428,4 +428,3 @@ class TSqlMapSelectKey extends TSqlMapStatement }
}
-?> diff --git a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php index d0c57d57..f2d13966 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php @@ -309,6 +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='`!!!`'; + /**
* @param TSqlMapXmlConfiguration parent xml configuration.
*/
@@ -532,6 +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); if($statement->parameterMap() === null)
{
// Build a Parametermap with the inline parameters.
@@ -548,6 +559,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder }
$sqlStatement = $sqlText['sql'];
}
+ $sqlStatement=preg_replace('/'.self::INLINE_PLACEHOLDER.'/',self::INLINE_SYMBOL,$sqlStatement); $this->prepareSql($statement, $sqlStatement, $node);
}
@@ -562,6 +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); $dynamics = $simpleDynamic->parse($sqlStatement);
if(count($dynamics['parameters']) > 0)
{
@@ -570,6 +583,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder }
else
$sql = new TStaticSql();
+ $sqlStatement=preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/',self::SIMPLE_MARK,$sqlStatement); $sql->buildPreparedStatement($statement, $sqlStatement);
$statement->setSqlText($sql);
}
@@ -724,4 +738,3 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder }
}
-?> diff --git a/framework/Data/SqlMap/DataMapper/TLazyLoadList.php b/framework/Data/SqlMap/DataMapper/TLazyLoadList.php index 02b08e8e..69b20bf6 100644 --- a/framework/Data/SqlMap/DataMapper/TLazyLoadList.php +++ b/framework/Data/SqlMap/DataMapper/TLazyLoadList.php @@ -142,4 +142,3 @@ class TObjectProxy }
}
-?> diff --git a/framework/Data/SqlMap/DataMapper/TPropertyAccess.php b/framework/Data/SqlMap/DataMapper/TPropertyAccess.php index 23e854ac..a27cb50f 100644 --- a/framework/Data/SqlMap/DataMapper/TPropertyAccess.php +++ b/framework/Data/SqlMap/DataMapper/TPropertyAccess.php @@ -106,7 +106,8 @@ class TPropertyAccess $object = $object->{$getter}();
else if(in_array($prop, array_keys(get_object_vars($object))))
$object = $object->{$prop};
- return false;
+ else
+ return false;
}
else
return false;
diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapCache.php b/framework/Data/SqlMap/DataMapper/TSqlMapCache.php index 61c5bb95..05b72e08 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapCache.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapCache.php @@ -225,4 +225,3 @@ class TSqlMapApplicationCache implements ICache }
}
-?> diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapException.php b/framework/Data/SqlMap/DataMapper/TSqlMapException.php index 69a0b0cd..0bf0ac32 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapException.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapException.php @@ -113,4 +113,3 @@ class TSqlMapExecutionException extends TSqlMapException {
}
-?> diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php b/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php index b3a88653..86171c1e 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php @@ -206,4 +206,3 @@ class TSqlMapPagedList extends TPagedList }
}
-?> diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php index aa39dce1..05866395 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php @@ -190,4 +190,3 @@ abstract class TSqlMapTypeHandler extends TComponent public abstract function createNewInstance($row=null);
}
-?> diff --git a/framework/Data/SqlMap/Statements/IMappedStatement.php b/framework/Data/SqlMap/Statements/IMappedStatement.php index 94189420..dc628c9e 100644 --- a/framework/Data/SqlMap/Statements/IMappedStatement.php +++ b/framework/Data/SqlMap/Statements/IMappedStatement.php @@ -80,4 +80,3 @@ interface IMappedStatement public function executeQueryForObject($connection,$parameter, $result=null);
}
-?> diff --git a/framework/Data/SqlMap/Statements/TCachingStatement.php b/framework/Data/SqlMap/Statements/TCachingStatement.php index 7c9498d4..c8a748c1 100644 --- a/framework/Data/SqlMap/Statements/TCachingStatement.php +++ b/framework/Data/SqlMap/Statements/TCachingStatement.php @@ -106,4 +106,3 @@ class TCachingStatement implements IMappedStatement }
}
-?> diff --git a/framework/Data/SqlMap/Statements/TDeleteMappedStatement.php b/framework/Data/SqlMap/Statements/TDeleteMappedStatement.php index bb95cab9..1a3d738a 100644 --- a/framework/Data/SqlMap/Statements/TDeleteMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TDeleteMappedStatement.php @@ -22,4 +22,3 @@ class TDeleteMappedStatement extends TUpdateMappedStatement {
}
-?> diff --git a/framework/Data/SqlMap/Statements/TInsertMappedStatement.php b/framework/Data/SqlMap/Statements/TInsertMappedStatement.php index 28ade045..1efb5b6b 100644 --- a/framework/Data/SqlMap/Statements/TInsertMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TInsertMappedStatement.php @@ -47,4 +47,3 @@ class TInsertMappedStatement extends TMappedStatement }
}
-?> diff --git a/framework/Data/SqlMap/Statements/TMappedStatement.php b/framework/Data/SqlMap/Statements/TMappedStatement.php index 2feeba90..6a9130fe 100644 --- a/framework/Data/SqlMap/Statements/TMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TMappedStatement.php @@ -4,7 +4,7 @@ *
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @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
@@ -561,7 +561,7 @@ class TMappedStatement extends TComponent implements IMappedStatement else
$obj = $this->fillDefaultResultMap(null, $row, $resultObject);
if(class_exists('TActiveRecord',false) && $obj instanceof TActiveRecord)
- //Create a new clean active record. + //Create a new clean active record.
$obj=TActiveRecord::createRecord(get_class($obj),$obj);
return $obj;
}
@@ -1115,7 +1115,7 @@ class TSqlMapObjectCollectionTree else if(is_array($list))
$list[] = $this->_entries[$node]['object'];
else
- throw TSqlMapExecutionException(
+ throw new TSqlMapExecutionException(
'sqlmap_property_must_be_list');
}
@@ -1216,4 +1216,3 @@ class TResultSetMapItemParameter extends TComponent }
}
-?> diff --git a/framework/Data/SqlMap/Statements/TPreparedCommand.php b/framework/Data/SqlMap/Statements/TPreparedCommand.php index 76407190..99bb6eff 100644 --- a/framework/Data/SqlMap/Statements/TPreparedCommand.php +++ b/framework/Data/SqlMap/Statements/TPreparedCommand.php @@ -58,4 +58,3 @@ class TPreparedCommand }
}
-?> diff --git a/framework/Data/SqlMap/Statements/TPreparedStatement.php b/framework/Data/SqlMap/Statements/TPreparedStatement.php index be005e81..7d862378 100644 --- a/framework/Data/SqlMap/Statements/TPreparedStatement.php +++ b/framework/Data/SqlMap/Statements/TPreparedStatement.php @@ -41,4 +41,3 @@ class TPreparedStatement extends TComponent }
-?> diff --git a/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php b/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php index 5c3e2f22..44603408 100644 --- a/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php +++ b/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php @@ -47,4 +47,3 @@ class TPreparedStatementFactory }
}
-?> diff --git a/framework/Data/SqlMap/Statements/TSelectMappedStatement.php b/framework/Data/SqlMap/Statements/TSelectMappedStatement.php index a8253536..1802db2f 100644 --- a/framework/Data/SqlMap/Statements/TSelectMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TSelectMappedStatement.php @@ -34,4 +34,3 @@ class TSelectMappedStatement extends TMappedStatement }
-?> diff --git a/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php b/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php index 38554778..910fd659 100644 --- a/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php +++ b/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php @@ -47,4 +47,3 @@ class TSimpleDynamicSql extends TStaticSql }
}
-?> diff --git a/framework/Data/SqlMap/Statements/TStaticSql.php b/framework/Data/SqlMap/Statements/TStaticSql.php index 8f4687df..eba54ed7 100644 --- a/framework/Data/SqlMap/Statements/TStaticSql.php +++ b/framework/Data/SqlMap/Statements/TStaticSql.php @@ -34,4 +34,3 @@ class TStaticSql extends TComponent }
}
-?> diff --git a/framework/Data/SqlMap/Statements/TUpdateMappedStatement.php b/framework/Data/SqlMap/Statements/TUpdateMappedStatement.php index c0aa798e..633ec797 100644 --- a/framework/Data/SqlMap/Statements/TUpdateMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TUpdateMappedStatement.php @@ -47,4 +47,3 @@ class TUpdateMappedStatement extends TMappedStatement }
}
-?> diff --git a/framework/Data/SqlMap/TSqlMapConfig.php b/framework/Data/SqlMap/TSqlMapConfig.php index 5a779dda..98f2a844 100644 --- a/framework/Data/SqlMap/TSqlMapConfig.php +++ b/framework/Data/SqlMap/TSqlMapConfig.php @@ -162,4 +162,3 @@ class TSqlMapConfig extends TDataSourceConfig }
}
-?> diff --git a/framework/Data/SqlMap/TSqlMapGateway.php b/framework/Data/SqlMap/TSqlMapGateway.php index dd7c2069..97b31b50 100644 --- a/framework/Data/SqlMap/TSqlMapGateway.php +++ b/framework/Data/SqlMap/TSqlMapGateway.php @@ -259,4 +259,3 @@ class TSqlMapGateway extends TComponent }
}
-?> diff --git a/framework/Data/SqlMap/TSqlMapManager.php b/framework/Data/SqlMap/TSqlMapManager.php index 62c2de20..290050d1 100644 --- a/framework/Data/SqlMap/TSqlMapManager.php +++ b/framework/Data/SqlMap/TSqlMapManager.php @@ -258,4 +258,3 @@ class TSqlMapManager extends TComponent }
}
-?> |