'Get all new events'

@defer.inlineCallbacks
def get_all_new_events_stream(self, from_id, current_id, limit):

    def get_all_new_events_stream_txn(txn):
        sql = 'SELECT    e.stream_ordering,    e.event_id    FROM    events    AS    e    WHERE    ?    <    e.stream_ordering    AND    e.stream_ordering    <=    ?    ORDER    BY    e.stream_ordering    ASC    LIMIT    ?'
        txn.execute(sql, (from_id, current_id, limit))
        rows = txn.fetchall()
        upper_bound = current_id
        if (len(rows) == limit):
            upper_bound = rows[(-1)][0]
        return (upper_bound, [row[1] for row in rows])
    (upper_bound, event_ids) = (yield self.runInteraction('get_all_new_events_stream', get_all_new_events_stream_txn))
    events = (yield self._get_events(event_ids))
    defer.returnValue((upper_bound, events))
