From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- .../Configuration/TInlineParameterMapParser.php | 156 ++++++++++----------- 1 file changed, 78 insertions(+), 78 deletions(-) (limited to 'framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php') diff --git a/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php b/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php index b78a235c..914d7eb7 100644 --- a/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php +++ b/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php @@ -1,79 +1,79 @@ - - * @link http://www.pradosoft.com/ + + * @link http://www.pradosoft.com/ * @copyright Copyright © 2005-2012 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id$ - * @package System.Data.SqlMap.Configuration - */ - -/** - * TInlineParameterMapParser class. - * - * The inline parameter map syntax lets you embed the property name, - * the property type, the column type, and a null value replacement into a - * parametrized SQL statement. - * - * @author Wei Zhuo - * @version $Id$ - * @package System.Data.SqlMap.Configuration - * @since 3.1 - */ -class TInlineParameterMapParser -{ - /** - * Regular expression for parsing inline parameter maps. - */ - const PARAMETER_TOKEN_REGEXP = '/#([^#]+)#/'; - - /** - * Parse the sql text for inline parameters. - * @param string sql text - * @param array file and node details for exception message. - * @return array 'sql' and 'parameters' name value pairs. - */ - public function parse($sqlText, $scope) - { - $matches = array(); - $mappings = array(); - preg_match_all(self::PARAMETER_TOKEN_REGEXP, $sqlText, $matches); - - for($i = 0, $k=count($matches[1]); $i<$k; $i++) - { - $mappings[] = $this->parseMapping($matches[1][$i], $scope); - $sqlText = str_replace($matches[0][$i], '?', $sqlText); - } - return array('sql'=>$sqlText, 'parameters'=>$mappings); - } - - /** - * Parse inline parameter with syntax as - * #propertyName,type=string,dbype=Varchar,nullValue=N/A,handler=string# - * @param string parameter token - * @param array file and node details for exception message. - */ - protected function parseMapping($token, $scope) - { - $mapping = new TParameterProperty; - $properties = explode(',', $token); - $mapping->setProperty(trim(array_shift($properties))); - foreach($properties as $property) - { - $prop = explode('=',$property); - $name = trim($prop[0]); $value=trim($prop[1]); - if($mapping->canSetProperty($name)) - $mapping->{'set'.$name}($value); - else - { - throw new TSqlMapUndefinedException( - 'sqlmap_undefined_property_inline_map', - $name, $scope['file'], $scope['node'], $token); - } - } - return $mapping; - } -} - + * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @package System.Data.SqlMap.Configuration + */ + +/** + * TInlineParameterMapParser class. + * + * The inline parameter map syntax lets you embed the property name, + * the property type, the column type, and a null value replacement into a + * parametrized SQL statement. + * + * @author Wei Zhuo + * @version $Id$ + * @package System.Data.SqlMap.Configuration + * @since 3.1 + */ +class TInlineParameterMapParser +{ + /** + * Regular expression for parsing inline parameter maps. + */ + const PARAMETER_TOKEN_REGEXP = '/#([^#]+)#/'; + + /** + * Parse the sql text for inline parameters. + * @param string sql text + * @param array file and node details for exception message. + * @return array 'sql' and 'parameters' name value pairs. + */ + public function parse($sqlText, $scope) + { + $matches = array(); + $mappings = array(); + preg_match_all(self::PARAMETER_TOKEN_REGEXP, $sqlText, $matches); + + for($i = 0, $k=count($matches[1]); $i<$k; $i++) + { + $mappings[] = $this->parseMapping($matches[1][$i], $scope); + $sqlText = str_replace($matches[0][$i], '?', $sqlText); + } + return array('sql'=>$sqlText, 'parameters'=>$mappings); + } + + /** + * Parse inline parameter with syntax as + * #propertyName,type=string,dbype=Varchar,nullValue=N/A,handler=string# + * @param string parameter token + * @param array file and node details for exception message. + */ + protected function parseMapping($token, $scope) + { + $mapping = new TParameterProperty; + $properties = explode(',', $token); + $mapping->setProperty(trim(array_shift($properties))); + foreach($properties as $property) + { + $prop = explode('=',$property); + $name = trim($prop[0]); $value=trim($prop[1]); + if($mapping->canSetProperty($name)) + $mapping->{'set'.$name}($value); + else + { + throw new TSqlMapUndefinedException( + 'sqlmap_undefined_property_inline_map', + $name, $scope['file'], $scope['node'], $token); + } + } + return $mapping; + } +} + -- cgit v1.2.3