Horde_Db_Adapter_Base::_replaceParameters PHP Method

_replaceParameters() protected method

Replace ? in a SQL statement with quoted values from $args
protected _replaceParameters ( string $sql, array $args ) : string
$sql string SQL statement.
$args array TODO
return string Modified SQL statement.
    protected function _replaceParameters($sql, array $args)
    {
        $paramCount = substr_count($sql, '?');
        if (count($args) != $paramCount) {
            $this->_logError('Parameter count mismatch: ' . $sql, 'Horde_Db_Adapter_Base::_replaceParameters');
            throw new Horde_Db_Exception(sprintf('Parameter count mismatch, expecting %d, got %d', $paramCount, count($args)));
        }
        $sqlPieces = explode('?', $sql);
        $sql = array_shift($sqlPieces);
        while (count($sqlPieces)) {
            $sql .= $this->quote(array_shift($args)) . array_shift($sqlPieces);
        }
        return $sql;
    }