コード例 #1
0
 def createCourse(self, names, semester):
     cursor = mysql.get_db().cursor()
     cursor.execute('INSERT INTO courses (name,semester) VALUES (%s,%s)', (
         names,
         semester,
     ))
     mysql.get_db().commit()
     cursor.close()
コード例 #2
0
ファイル: estudiantes.py プロジェクト: nicohare7/parcial2
 def createCourse(self, materia, semestre):
     cursor = mysql.get_db().cursor()
     cursor.execute(
         'INSERT INTO materias (materia,semestre) VALUES (%s,%s)', (
             materia,
             semestre,
         ))
     mysql.get_db().commit()
     cursor.close()
コード例 #3
0
 def createSession(self, course, date, starttime, endtime):
     cursor = mysql.get_db().cursor()
     cursor.execute(
         'INSERT INTO session (course,date,start_time,end_time) VALUES (%s,%s,%s,%s)',
         (
             course,
             date,
             starttime,
             endtime,
         ))
     mysql.get_db().commit()
     cursor.close()
コード例 #4
0
 def updateStudents(self, names, lastnames, phone, email, semester, id):
     cursor = mysql.get_db().cursor()
     cursor.execute(
         "UPDATE students SET names = %s, lastnames = %s, phone = %s, email = %s, semester = %s WHERE id = %s",
         (
             names,
             lastnames,
             phone,
             email,
             semester,
             id,
         ))
     mysql.get_db().commit()
     cursor.close()
コード例 #5
0
 def createStudents(self, uid, names, lastnames, phone, email, semester,
                    course):
     cursor = mysql.get_db().cursor()
     cursor.execute(
         'INSERT INTO students (uid, names,lastnames,phone,email,semester, course) VALUES (%s, %s,%s,%s,%s,%s,%s)',
         (
             uid,
             names,
             lastnames,
             phone,
             email,
             semester,
             course,
         ))
     mysql.get_db().commit()
     cursor.close()
コード例 #6
0
ファイル: estudiantes.py プロジェクト: nicohare7/parcial2
 def createStudents(self, uid, nombre, apellido, telefono, email, semestre,
                    curso):
     cursor = mysql.get_db().cursor()
     cursor.execute(
         'INSERT INTO registro_estudiantes (uid, nombre,apellido,telefono,email,semestre, curso) VALUES (%s, %s,%s,%s,%s,%s,%s)',
         (
             uid,
             nombre,
             apellido,
             telefono,
             email,
             semestre,
             curso,
         ))
     mysql.get_db().commit()
     cursor.close()
コード例 #7
0
ファイル: estudiantes.py プロジェクト: nicohare7/parcial2
 def listStudentsUnique(self, id):
     cursor = mysql.get_db().cursor()
     cursor.execute("SELECT * FROM registro_estudiantes WHERE id = %s",
                    (id, ))
     students = cursor.fetchone()
     cursor.close()
     return students
コード例 #8
0
ファイル: estudiantes.py プロジェクト: nicohare7/parcial2
 def updateStudents(self, uid, nombre, apellido, telefono, email, semestre,
                    curso, id):
     cursor = mysql.get_db().cursor()
     cursor.execute(
         "UPDATE registro_estudiantes SET uid = %s, nombre = %s, apellido = %s, telefono = %s, email = %s, semestre = %s, curso = %s WHERE id = %s",
         (
             uid,
             nombre,
             apellido,
             telefono,
             email,
             semestre,
             curso,
             id,
         ))
     mysql.get_db().commit()
     cursor.close()
コード例 #9
0
 def listSessions(self):
     cursor = mysql.get_db().cursor()
     cursor.execute("SELECT * FROM session")
     sessions = cursor.fetchall()
     cursor.close()
     return sessions
コード例 #10
0
 def deleteCourse(self, id):
     cursor = mysql.get_db().cursor()
     cursor.execute("DELETE FROM courses WHERE id = %s", (id, ))
     mysql.get_db().commit()
     cursor.close()
コード例 #11
0
 def listCourses(self):
     cursor = mysql.get_db().cursor()
     cursor.execute("SELECT * FROM courses")
     courses = cursor.fetchall()
     cursor.close()
     return courses
コード例 #12
0
 def listStudents(self):
     cursor = mysql.get_db().cursor()
     cursor.execute("SELECT * FROM students")
     students = cursor.fetchall()
     cursor.close()
     return students
コード例 #13
0
 def deleteStudents(self, id):
     cursor = mysql.get_db().cursor()
     cursor.execute("DELETE FROM students WHERE id = %s", (id, ))
     mysql.get_db().commit()
     cursor.close()