def getStudentsByClassId(self, classId): sql = "SELECT * FROM student WHERE ClassId = %s" value = (classId, ) self.cursor.execute(sql, value) try: obj = self.cursor.fetchall() return Student.CreateStudent(obj) except mysql.connector.Error as err: print("Error : ", err)
def getStudentById(self, id): sql = "SELECT * FROM student WHERE Id = %s" value = (id, ) self.cursor.execute(sql, value) try: obj = self.cursor.fetchone() return Student.CreateStudent(obj) except mysql.connector.Error as err: print("Error : ", err)