/** * Prepare the sql text (may extend to dynamic sql). * @param TSqlMapStatement mapped statement. * @param string sql text. * @param SimpleXmlElement statement node. * @todo Extend to dynamic sql. */ 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) { $sql = new TSimpleDynamicSql($dynamics['parameters']); $sqlStatement = $dynamics['sql']; } else { $sql = new TStaticSql(); } $sqlStatement = preg_replace('/' . self::SIMPLE_PLACEHOLDER . '/', self::SIMPLE_MARK, $sqlStatement); $sql->buildPreparedStatement($statement, $sqlStatement); $statement->setSqlText($sql); }