def update(self, _values=None, **values):
        """
        Update a record in the database

        :param values: The values of the update
        :type values: dict

        :return: The number of records affected
        :rtype: int
        """
        if _values is not None:
            values.update(_values)

        values = OrderedDict(sorted(values.items()))

        bindings = list(values.values()) + self.get_bindings()

        sql = self._grammar.compile_update(self, values)

        return self._connection.update(sql, self._clean_bindings(bindings))