def getSchedule(self, name): """ Get a schedule with the given name. :param str name: The name of the schedule. :return: A new Schedule object. :rtype: Schedule :raises GroupManagerDb.Error: If the schedule does not exist or other database error. """ schedule = None try: cursor = self._database.cursor() cursor.execute( "SELECT schedule FROM schedules WHERE schedule_name=?", (name, )) result = cursor.fetchone() if result != None: schedule = Schedule() schedule.wireDecode(bytearray(result[0])) cursor.close() except Exception as ex: raise GroupManagerDb.Error( "Sqlite3GroupManagerDb.getSchedule: SQLite error: " + str(ex)) if schedule == None: raise GroupManagerDb.Error( "Sqlite3GroupManagerDb.getSchedule: Cannot get the result from the database") return schedule