Beispiel #1
0
 def add_participant(self,userid):
     with ConnectionPool() as cursor:
         cursor.execute('INSERT into event_user values(%s,%s)' ,    (self.event_id, userid))
         cursor.execute('SELECT username FROM user_table WHERE userid = %s' , (userid,))
         participant = cursor.fetchone()
         self.participant_arr.append(participant[0])
Beispiel #2
0
 def delete_participant(self, userid):
     with ConnectionPool() as cursor:
         cursor.execute('DELETE FROM event_user WHERE user_id = %s' ,(userid,))
         cursor.execute('SELECT username FROM user_table WHERE userid = %s' , (userid,))
         participant = cursor.fetchone()
     self.participant_arr.remove(participant[0])
Beispiel #3
0
 def is_seen(self):
     with ConnectionPool() as cursor:
         cursor.execute(
             'UPDATE news_table SET seen = %s WHERE news_id = %s',
             (True, self.news_id))
Beispiel #4
0
 def delete_new(self):
     with ConnectionPool() as cursor:
         cursor.execute('DELETE FROM news_table WHERE news_id = %s',
                        (self.news_id, ))
Beispiel #5
0
 def update_email(self, mail):
     with ConnectionPool() as cursor:
         cursor.execute(
             'UPDATE user_table set email = %s WHERE userid = %s',
             (mail, self.id))
     self.email = mail
Beispiel #6
0
 def get_owner_name(self):
     with ConnectionPool() as cursor:
         cursor.execute('SELECT username FROM user_table WHERE userid = %s' , (self.owner,))
         self.owner_name = cursor.fetchone()[0]
Beispiel #7
0
 def update_username(self, usern):
     with ConnectionPool() as cursor:
         cursor.execute(
             'UPDATE user_table set username = %s WHERE userid = %s',
             (usern, self.id))
     self.username = usern
Beispiel #8
0
 def delete_account(self):
     with ConnectionPool() as cursor:
         cursor.execute('DELETE FROM user_table WHERE userid = %s',
                        (self.id, ))
Beispiel #9
0
 def save_to_db(self):
     with ConnectionPool() as cursor:
         cursor.execute(
             'INSERT INTO user_table(first_name, surname, username, email, passwrd) VALUES(%s,%s,%s,%s,%s);',
             (self.first_name, self.surname, self.username, self.email,
              self.password))
Beispiel #10
0
 def remove_request(self, reqid):
     with ConnectionPool() as cursor:
         cursor.execute('DELETE FROM request_table where request_id = %s',
                        (reqid, ))
Beispiel #11
0
 def delete_comment(self):
     with ConnectionPool() as cursor:
         cursor.execute('DELETE FROM comment_table WHERE comment_id = %s',
                        (self.comment_id, ))