public function resolveSql(array $parameters = array())
    {
        // sql statement from template
        $sql = preg_replace_callback('|/\*\*(.+?)\*\*/|', function($match) use (&$parameters) {
            $name = trim($match[1]);

            $snippet = $this->builder->resolveSnippet($name, $parameters);

            return $snippet;
        }, $this->sql);

        // resolve parameters
        $types = '';
        $values = [];

        $sql = preg_replace_callback('/@(?P<type>.):(?P<name>.+?)@/', function($match) use (&$types, &$values, $parameters) {
            $types .= $match['type'];
            $values[] = $parameters[$match['name']];

            return $this->builder->resolveParameter(count($values), $match['type'], $match['name']);
        }, $sql);

        return (object)['sql' => $sql, 'types' => $types, 'parameters' => $values];
    }
public function resolveSql(array $parameters = array())
    {
        // sql statement from template
        $sql = preg_replace_callback('|/\*\*(.+?)\*\*/|', function($match) use (&$parameters) {
            $name = trim($match[1]);

            $snippet = $this->builder->resolveSnippet($name, $parameters);

            return $snippet;
        }, $this->sql);

        // resolve parameters
        $types = '';
        $values = [];

        $sql = preg_replace_callback('/@(?P<type>.):(?P<name>.+?)@/', function($match) use (&$types, &$values, $parameters) {
            $types .= $match['type'];
            $values[] = $parameters[$match['name']];

            return $this->builder->resolveParameter(count($values), $match['type'], $match['name']);
        }, $sql);

        return (object)['sql' => $sql, 'types' => $types, 'parameters' => $values];
    }
public function resolveSql ( array $ parameters = array ( ) ) { // sql statement from template $ sql = preg_replace_callback ( '|/\*\*(.+?)\*\*/|' , function ( $ match ) use ( & $ parameters ) { $ name = trim ( $ match [ 1 ] ) ; $ snippet = $ this -> builder -> resolveSnippet ( $ name , $ parameters ) ; return $ snippet ; } , $ this -> sql ) ; // resolve parameters $ types = '' ; $ values = [ ] ; $ sql = preg_replace_callback ( '/@(?P<type>.):(?P<name>.+?)@/' , function ( $ match ) use ( & $ types , & $ values , $ parameters ) { $ types .= $ match [ 'type' ] ; $ values [ ] = $ parameters [ $ match [ 'name' ] ] ; return $ this -> builder -> resolveParameter ( count ( $ values ) , $ match [ 'type' ] , $ match [ 'name' ] ) ; } , $ sql ) ; return ( object ) [ 'sql' => $ sql , 'types' => $ types , 'parameters' => $ values ] ; }
Resolve SQL statement.

@param   array                       $parameters         Optional parameters for forming SQL statement.
@return  string                                          Resolved SQL statement.
Resolve SQL statement .