コード例 #1
0
def GetDeviceByDeviceId(deviceid):
    cmd = """\
        EXEC GetDeviceByDeviceId {0}
        """.format(deviceid)

    cursor.execute(cmd)

    return_value = cursor.fetchall()
    return return_value
コード例 #2
0
ファイル: messageDao.py プロジェクト: ZibingZhang/Level-Up
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()
コード例 #3
0
ファイル: messageDao.py プロジェクト: ZibingZhang/Level-Up
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
コード例 #4
0
def get_gamestate():
    cursor.execute("SELECT * FROM levelup.gamestate")
    return json.loads(cursor.fetchall()[0][0])
コード例 #5
0
def get_positions():
    cursor.execute("SELECT POSITION FROM levelup.players")
    return [player[0] for player in cursor.fetchall()]
コード例 #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]
コード例 #7
0
def get_names():
    cursor.execute("SELECT PLAYER_NAME FROM levelup.players")
    return [player[0] for player in cursor.fetchall()]
コード例 #8
0
def get_player_name(position):
    cursor.execute("SELECT PLAYER_NAME FROM levelup.players WHERE POSITION=%s",
                   (position, ))
    return cursor.fetchall()[0][0]
コード例 #9
0
def has_host():
    cursor.execute("SELECT COUNT(*) FROM levelup.players WHERE POSITION='N'")
    return cursor.fetchall()[0][0] == 1