/**
  * Extract inline parameter maps.
  * @param TSqlMapStatement statement object.
  * @param string sql text
  * @param SimpleXmlElement statement node.
  */
 protected function applyInlineParameterMap($statement, $sqlStatement, $node)
 {
     $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.
         // if they exist. Then delete inline infos from sqltext.
         $parameterParser = new TInlineParameterMapParser();
         $sqlText = $parameterParser->parse($sqlStatement, $scope);
         if (count($sqlText['parameters']) > 0) {
             $map = new TParameterMap();
             $map->setID($statement->getID() . '-InLineParameterMap');
             $statement->setInlineParameterMap($map);
             foreach ($sqlText['parameters'] as $property) {
                 $map->addProperty($property);
             }
         }
         $sqlStatement = $sqlText['sql'];
     }
     $sqlStatement = preg_replace('/' . self::INLINE_PLACEHOLDER . '/', self::INLINE_SYMBOL, $sqlStatement);
     $this->prepareSql($statement, $sqlStatement, $node);
 }
예제 #2
0
 /**
  * @param TParameterMap add a new parameter map to this SQLMap.
  * @throws TSqlMapDuplicateException
  */
 public function addParameterMap(TParameterMap $parameter)
 {
     $key = $parameter->getID();
     if ($this->_parameterMaps->contains($key) == true) {
         throw new TSqlMapDuplicateException('sqlmap_already_contains_parameter_map', $key);
     }
     $this->_parameterMaps->add($key, $parameter);
 }