def insert( office_id: int, department_id: int, category: str, dni: str, firstname: str, surname: str, birthdate: str, email: str, ) -> int: """ Insert a new professor -Input: *All of the properties of the professor - Output: *The OID assigned to the professor that we have inserted """ q = ( "INSERT INTO Professors (officeId, departmentId, category, dni, firstname, surname, birthdate, email) " "VALUES (%s, %s, %s, %s, %s, %s, %s, %s)" ) params = ( office_id, department_id, category, dni, firstname, surname, birthdate, email, ) return base_dal.execute(q, params)
def update( oid: int, name: str, acronym: str, n_credits: int, course: int, subject_type: str, degreeId: int, departmentId: int, ) -> int: """ Update one subject -Input: *All of the properties of the subject, including the OID that we want to update -Output: *The OID of the subject that we have updated """ q = "UPDATE subjects SET name = %s, acronym = %s, credits = %s, course = %s, type = %s, degreeId = %s, departmentId = %s WHERE subjectId = %s" params = ( name, acronym, n_credits, course, subject_type, degreeId, departmentId, oid, ) return base_dal.execute(q, params)
def delete(oid: int) -> int: """ Delete one subject -Input: *The OID of the subject that we want to delete -Output: *The OID of the subject that was deleted """ q = "DELETE FROM subjects WHERE subjectId = %s" params = (oid, ) return base_dal.execute(q, params)
def update(oid: int, name: str) -> int: """ Update one department -Input: *All of the properties of the department, including the OID that we want to update -Output: *The OID of the department that we have updated """ q = "UPDATE Departments SET name = %s WHERE departmentId = %s" params = (name, oid) return execute(q, params)
def delete(oid: int) -> int: """ Delete one professor -Input: *The OID of the professor that we want to delete -Output: *The OID of the professor that was deleted """ q = "DELETE FROM Professors WHERE professorId = %s" params = (oid,) return base_dal.execute(q, params)
def delete(oid: int) -> int: """ Delete one department -Input: *The OID of the department that we want to delete -Output: *The OID of the department that was deleted """ q = "DELETE FROM Departments WHERE departmentId = %s" params = (oid, ) return execute(q, params)
def delete(oid: int) -> int: """ Delete one department -Input: *The OID of the group that we want to delete -Output: *The OID of the group that was deleted """ q = "DELETE FROM Groups WHERE groupId = %s" params = (oid, ) return base_dal.execute(q, params)
def insert(name: str) -> int: """ Insert a new department -Input: *All of the properties of the department - Output: *The OID assigned to the department that we have inserted """ q = "INSERT INTO Departments (name) VALUES (%s)" params = (name, ) return execute(q, params)
def delete(oid: int) -> int: """ Delete one TeachingLoad -Input: *The OID of the TeachingLoad that we want to delete -Output: *The OID of the TeachingLoad that was deleted """ q = "DELETE FROM TeachingLoads WHERE teachingLoadId = %s" params = (oid, ) return base_dal.execute(q, params)
def insert(name: str, activity: str, year: int, subjectId: int, classroomId: int) -> int: """ Insert a new group -Input: *All of the properties of the group - Output: *The OID assigned to the group that we have inserted """ q = "INSERT INTO Groups (name, activity, year, subjectId, classroomId) VALUES (%s, %s, %s, %s, %s)" params = (name, activity, year, subjectId, classroomId) return base_dal.execute(q, params)
def insert(professorId: int, groupId: int, credits: int) -> int: """ Insert a new TeachingLoad -Input: *All of the properties of the TeachingLoad - Output: *The OID assigned to the TeachingLoad that we have inserted """ q = ("INSERT INTO TeachingLoads (professorId, groupId, credits) " "VALUES (%s, %s, %s)") params = ( professorId, groupId, credits, ) return base_dal.execute(q, params)
def update( oid: int, name: str, activity: str, year: int, subjectId: int, classroomId: int, ) -> int: """ Update one group -Input: *All of the properties of the group, including the OID that we want to update -Output: *The OID of the group that we have updated """ q = "UPDATE Groups SET name = %s, activity = %s, year = %s, subjectId = %s, classroomId = %s WHERE groupId = %s" params = (name, activity, year, subjectId, classroomId, oid) return base_dal.execute(q, params)
def update(oid: int, professorId: int, groupId: int, credits: int) -> int: """ Update one TeachingLoad -Input: *All of the properties of the TeachingLoad, including the OID that we want to update -Output: *The OID of the TeachingLoad that we have updated """ q = ( "UPDATE TeachingLoads SET teachingLoadId = %s, professorId = %s, groupId = %s, " "credits = %s WHERE teachingLoadId = %s") params = ( professorId, groupId, credits, oid, ) return base_dal.execute(q, params)
def insert( name: str, acronym: str, n_credits: int, course: int, subject_type: str, degreeId: int, departmentId: int, ) -> int: """ Insert a new subject -Input: *All of the properties of the subject - Output: *The OID assigned to the subject that we have inserted """ q = "INSERT INTO Subjects (name, acronym, credits, course, type, degreeId, departmentId) VALUES (%s, %s, %s, %s, %s, %s, %s)" params = (name, acronym, n_credits, course, subject_type, degreeId, departmentId) return base_dal.execute(q, params)
def update( oid: int, office_id: int, department_id: int, category: str, dni: str, first_name: str, surname: str, birth_date: str, email: str, ) -> int: """ Update one professor -Input: *All of the properties of the professor, including the OID that we want to update -Output: *The OID of the professor that we have updated """ q = ( "UPDATE Professors SET officeId = %s, departmentId = %s, category = %s, " "dni = %s, firstname = %s, surname = %s, birthdate = %s, email = %s WHERE professorId = %s" ) params = ( office_id, department_id, category, dni, first_name, surname, birth_date, email, oid, ) return base_dal.execute(q, params)