예제 #1
0
    def execute(cls) -> List['PlayersOnline_Result']:

        session = Session()

        query = 'call PlayersOnline'

        query_result = session.execute(query).fetchall()

        result: List[PlayersOnline_Result] = list(
            map(PlayersOnline_Result.bind, query_result))

        return result
예제 #2
0
def create_session(dictionary):
    '''
    creates session entry in the database
    '''
    checkDisconnected(dictionary)
    for s_id, s_info in dictionary.items():
        if not s_id in session_list:
            session_list.append(s_id)
        session = Session()
        setattr(session, '_id', s_id)
        session.isDisconnected = False
        for info in s_info:
            if info == 'type':
                setattr(session, '_type', s_info[info])
            else:
                setattr(session, info, s_info[info])
        session.save()