Exemplo n.º 1
0
def GetDeviceByDeviceId(deviceid):
    cmd = """\
        EXEC GetDeviceByDeviceId {0}
        """.format(deviceid)

    cursor.execute(cmd)

    return_value = cursor.fetchall()
    return return_value
Exemplo n.º 2
0
def get_next_messages(message_id):
    cursor.execute(
        "SELECT SENDER, MESSAGE FROM levelup.messages WHERE id>%s ORDER BY ID ASC",
        (message_id, )
    )
    return cursor.fetchall()
Exemplo n.º 3
0
def get_largest_id():
    cursor.execute(
        "SELECT MAX(ID) FROM levelup.messages"
    )
    id = cursor.fetchall()[0][0]
    return int(id) if id is not None else 0
Exemplo n.º 4
0
def get_gamestate():
    cursor.execute("SELECT * FROM levelup.gamestate")
    return json.loads(cursor.fetchall()[0][0])
Exemplo n.º 5
0
def get_positions():
    cursor.execute("SELECT POSITION FROM levelup.players")
    return [player[0] for player in cursor.fetchall()]
Exemplo n.º 6
0
def get_position(player_name):
    cursor.execute("SELECT POSITION FROM levelup.players WHERE PLAYER_NAME=%s",
                   (player_name, ))
    return cursor.fetchall()[0][0]
Exemplo n.º 7
0
def get_names():
    cursor.execute("SELECT PLAYER_NAME FROM levelup.players")
    return [player[0] for player in cursor.fetchall()]
Exemplo n.º 8
0
def get_player_name(position):
    cursor.execute("SELECT PLAYER_NAME FROM levelup.players WHERE POSITION=%s",
                   (position, ))
    return cursor.fetchall()[0][0]
Exemplo n.º 9
0
def has_host():
    cursor.execute("SELECT COUNT(*) FROM levelup.players WHERE POSITION='N'")
    return cursor.fetchall()[0][0] == 1