'Update the latest revision of the tags for the given user and room.
Args:
txn: The database cursor
user_id(str): The ID of the user.
room_id(str): The ID of the room.
next_id(int): The the revision to advance to.'

def _update_revision_txn(self, txn, user_id, room_id, next_id):

    txn.call_after(self._account_data_stream_cache.entity_has_changed, user_id, next_id)
    update_max_id_sql = 'UPDATE    account_data_max_stream_id    SET    stream_id    =    ?    WHERE    stream_id    <    ?'
    txn.execute(update_max_id_sql, (next_id, next_id))
    update_sql = 'UPDATE    room_tags_revisions    SET    stream_id    =    ?    WHERE    user_id    =    ?    AND    room_id    =    ?'
    txn.execute(update_sql, (next_id, user_id, room_id))
    if (txn.rowcount == 0):
        insert_sql = 'INSERT    INTO    room_tags_revisions    (user_id,    room_id,    stream_id)    VALUES    (?,    ?,    ?)'
        try:
            txn.execute(insert_sql, (user_id, room_id, next_id))
        except self.database_engine.module.IntegrityError:
            pass
