def find_by_current_semester(self, current_semester):
        """Suchen eines Semester anhand vom Current Semester."""

        result = []
        cursor = self._cnx.cursor()
        command = "SELECT * FROM semester WHERE current_semester like '{}'".format(
            current_semester)
        cursor.execute(command)
        tuples = cursor.fetchall()

        if len(tuples) != 0:

            for (id, name, current_semester, create_time) in tuples:
                semester = Semester()
                semester.set_id(id)
                semester.set_name(name)
                semester.set_current_semester(current_semester)
                semester.set_create_time(create_time)
                result.append(semester)

        else:
            result = None

        self._cnx.commit()
        cursor.close()

        return result
    def find_by_key(self, id):
        """Suchen eines Semesters mit vorgegebener ID-Nummer."""

        result = []
        cursor = self._cnx.cursor()
        command = "SELECT * FROM semester WHERE id like '{}'".format(id)
        cursor.execute(command)
        tuples = cursor.fetchall()

        if len(tuples) != 0:

            for (id, name, current_semester, create_time) in tuples:
                semester = Semester()
                semester.set_id(id)
                semester.set_name(name)
                semester.set_current_semester(current_semester)
                semester.set_create_time(create_time)
                result.append(semester)

                result = semester

        else:
            result = None

        self._cnx.commit()
        cursor.close()

        return result
    def create_semester(self, name, current_semester):
        """Ein Semester anlegen"""
        semester = Semester()
        semester.set_name(name)
        semester.set_current_semester(current_semester)
        semester.set_id(1)

        with SemesterMapper() as mapper:
            return mapper.insert(semester)
    def find_by_name(self, name):

        result = []
        cursor = self._cnx.cursor()
        command = "SELECT * FROM semester WHERE name like '{}'".format(name)
        cursor.execute(command)
        tuples = cursor.fetchall()

        for (id, name, current_semester, create_time) in tuples:
            semester = Semester()
            semester.set_id(id)
            semester.set_name(name)
            semester.set_current_semester(current_semester)
            semester.set_create_time(create_time)
            result.append(semester)

        self._cnx.commit()
        cursor.close()

        return result
    def find_all(self):
        """Auslesen aller Semesters."""
        result = []
        cursor = self._cnx.cursor()
        command = "SELECT * FROM semester"
        cursor.execute(command)
        tuples = cursor.fetchall()

        for (id, name, current_semester, create_time) in tuples:
            semester = Semester()
            semester.set_id(id)
            semester.set_name(name)
            semester.set_current_semester(current_semester)
            semester.set_create_time(create_time)
            result.append(semester)

        self._cnx.commit()
        cursor.close()

        return result