protected function prepareResults(PDOStatementHandle $statement, $errorLevel, $sql, $parameters = array())
    {

        // Catch error
        if ($this->hasError($statement)) {
            $this->lastStatementError = $statement->errorInfo();
            $statement->closeCursor();

            $this->databaseError($this->getLastError(), $errorLevel, $sql, $this->parameterValues($parameters));

            return null;
        }

        // Count and return results
        $this->rowCount = $statement->rowCount();
        return new PDOQuery($statement);
    }