def updateAccount(account): cur = mysql.cursor() cur.execute( """UPDATE accounts SET username = %s, password = %s, email = %s, admin = %s, present = %s, nom = %s, prenom = %s, ecole = %s, annee = %s, phone = %s, specialite = %s, theme = %s WHERE id = %s""", ( account[1], account[2], account[3], account[4], account[5], account[6], account[7], account[8], account[9], account[10], account[11], account[12], account[0], )) mysql.commit() return True
def delSujet(_id): cur = mysql.cursor() cur.execute("""DELETE FROM sujets WHERE id = %s""", (_id,)) mysql.commit() return True
def delConfig(_id): cur = mysql.cursor() cur.execute("""DELETE FROM config WHERE id = %s""", (_id, )) mysql.commit() return True
def delInfos(_id): cur = mysql.cursor() cur.execute("""DELETE FROM infos WHERE id = %s""", (_id, )) mysql.commit() return True
def delAccount(_id): cur = mysql.cursor() cur.execute("""DELETE FROM accounts WHERE id = %s""", (_id, )) mysql.commit() return True
def presentAccounts(): cursor = mysql.cursor() cursor.execute("""UPDATE accounts SET present = %s""", (False, )) mysql.commit() return True
def presentAccount(_id): cursor = mysql.cursor() cursor.execute( """UPDATE accounts SET present = %s WHERE id =%s""", (True, _id)) mysql.commit() return True
def registSujets(sujet): cursor = mysql.cursor() cursor.execute(""" INSERT INTO sujets (sujet, type) VALUES (%s,%s)""", (sujet[0], sujet[1],)) mysql.commit() return True
def updateSujet(_id, sujet): cur = mysql.cursor() cur.execute("""UPDATE sujets SET sujet = %s, type = %s WHERE id = %s""", (sujet[0], sujet[1], _id,)) mysql.commit() return True
def updatePassword(password, username): cur = mysql.cursor() cur.execute( """UPDATE accounts SET password = %s WHERE username = %s""", ( password, username, )) mysql.commit() return True
def registInfos(info): cursor = mysql.cursor() cursor.execute( """ INSERT INTO infos (datedb, description) VALUES (%s, %s)""", ( info[0], info[1], )) mysql.commit() return True
def registMatchs(match): cursor = mysql.cursor() cursor.execute( """ INSERT INTO matchs (datedb, type, sujet, equipe, gouvernement, opposition, meilorateur, meilequipe, jury) VALUES (%s,%s, %s, %s, %s, %s, %s, %s, %s)""", (match[0], match[1], match[2], match[3], match[4], match[5], match[6], match[7], match[8])) mysql.commit() return True
def registConfig(config): cursor = mysql.cursor() cursor.execute( """ INSERT INTO config (type, name, value, description) VALUES (%s,%s, %s, %s)""", ( config[0], config[1], config[2], config[3], )) mysql.commit() return True
def updateMatch(_id, match): cur = mysql.cursor() cur.execute( """UPDATE matchs SET datedb = %s, type = %s, sujet = %s, equipe = %s, gouvernement = %s, opposition = %s, meilorateur = %s, meilequipe = %s, jury = %s WHERE id = %s""", (match[0], match[1], match[2], match[3], match[4], match[5], match[6], match[7], match[8], _id)) mysql.commit() return True
def registAccount(account): cursor = mysql.cursor() cursor.execute( """ INSERT INTO accounts (username, password, email, admin, present, nom, prenom, ecole, annee, phone, specialite, theme, token) VALUES (%s,%s, %s, %s, 0, %s, %s, %s, %s, %s, %s, 'light', %s)""", (account[0], account[1], account[2], account[3], account[4], account[5], account[6], account[7], account[8], account[9], account[10])) mysql.commit() return True
def registCours(cours): cursor = mysql.cursor() cursor.execute( """INSERT INTO cours (titre, datedb, start, end, lien, color) VALUES (%s, %s,%s, %s, %s, %s)""", ( cours[0], cours[1], cours[2], cours[3], cours[4], cours[5], )) mysql.commit() return True
def updateConfig(_id, config): cur = mysql.cursor() cur.execute( """UPDATE config SET type = %s, name = %s, value = %s, description = %s WHERE id = %s""", ( config[0], config[1], config[2], config[3], _id, )) mysql.commit() return True