def GetDeviceByDeviceId(deviceid): cmd = """\ EXEC GetDeviceByDeviceId {0} """.format(deviceid) cursor.execute(cmd) return_value = cursor.fetchall() return return_value
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()
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
def get_gamestate(): cursor.execute("SELECT * FROM levelup.gamestate") return json.loads(cursor.fetchall()[0][0])
def get_positions(): cursor.execute("SELECT POSITION FROM levelup.players") return [player[0] for player in cursor.fetchall()]
def get_position(player_name): cursor.execute("SELECT POSITION FROM levelup.players WHERE PLAYER_NAME=%s", (player_name, )) return cursor.fetchall()[0][0]
def get_names(): cursor.execute("SELECT PLAYER_NAME FROM levelup.players") return [player[0] for player in cursor.fetchall()]
def get_player_name(position): cursor.execute("SELECT PLAYER_NAME FROM levelup.players WHERE POSITION=%s", (position, )) return cursor.fetchall()[0][0]
def has_host(): cursor.execute("SELECT COUNT(*) FROM levelup.players WHERE POSITION='N'") return cursor.fetchall()[0][0] == 1