public function executeSql()
    {
        $params = func_get_args();
        $sql = array_shift($params);

        if (!$sql)
            throw new Exception\LogicException("Can't execute SQL without SQL");
        elseif (is_array($sql)) {
            $params = $sql;
            $sql = array_shift($params);
        }
        $this->_parse_query_multimark($sql, $params);

        if (!$stmt = $this->pdo->prepare($sql)) {
            list($code, $drvrcode, $msg) = $this->pdo->errorInfo();
            $e = new Exception\QueryException(
                sprintf("[PDOStatement error] [SQLSTATE %s] (%s) %s", $code, $drvrcode, $msg)
            );
            throw $e;
        } elseif (!$stmt->execute($params) && Rails::env() == 'development') {
            list($code, $drvrcode, $msg) = $stmt->errorInfo();
            $e = new Exception\QueryException(
                sprintf("[PDOStatement error] [SQLSTATE %s] (%s) %s", $code, $drvrcode, $msg)
            );
            $e->setStatement($stmt, $params);
            throw $e;
        }

        $err = $stmt->errorInfo();

        if ($err[2]) {
            ActiveRecord::setLastError($err, $this->name);
            $e = new Exception\QueryException(
                sprintf("[SQLSTATE %s] (%s) %s", $err[0], (string)$err[1], $err[2])
            );
            $e->setStatement($stmt, $params);

            $msg  = "Error on database query execution\n";
            $msg .= $e->getMessage();
            Rails::log()->warning($msg);
        }

        return $stmt;
    }