예제 #1
0
 def set_university_tram_stop(user_id, stop):
     command = f"INSERT INTO addresses (UserId, University) VALUES({user_id},'{stop}') ON DUPLICATE KEY UPDATE" \
               f" University='{stop}'"
     return DB.exec_command(command)
예제 #2
0
 def get_all():
     DB.exec_command('SELECT * FROM addresses', False)
     return cur.fetchall()
예제 #3
0
 def add_or_update(user_id, address):
     command = f"INSERT INTO addresses (UserId, Address) VALUES({user_id},'{address}') ON DUPLICATE KEY UPDATE" \
               f" Address='{address}'"
     return DB.exec_command(command)
예제 #4
0
 def set_home_tram_stop(user_id, stop):
     command = f"INSERT INTO addresses (UserId, Home) VALUES({user_id},'{stop}') ON DUPLICATE KEY UPDATE" \
               f" Home='{stop}'"
     return DB.exec_command(command)
예제 #5
0
 def get_all():
     DB.exec_command('SELECT * FROM groups', False)
     return cur.fetchall()
예제 #6
0
 def contains(user_id):
     DB.exec_command(f'SELECT * FROM addresses WHERE UserId={user_id}',
                     False)
     return cur.fetchone()
예제 #7
0
 def get(user_id):
     DB.exec_command(f'SELECT GroupName FROM groups WHERE UserId={user_id}', False)
     return cur.fetchone()
예제 #8
0
 def add_or_update(user_id, group):
     command = f"INSERT INTO groups (UserId, GroupName) VALUES({user_id},'{group}') ON DUPLICATE KEY UPDATE" \
               f" GroupName='{group}'"
     return DB.exec_command(command)
예제 #9
0
 def set_hint_shown(user_id):
     DB.exec_command(
         f'UPDATE portal SET HintShown=1 WHERE UserId={user_id}')
     return cur.fetchone()
예제 #10
0
 def get_all():
     DB.exec_command('SELECT * FROM portal', False)
     return cur.fetchall()
예제 #11
0
 def get_hint_shown(user_id):
     DB.exec_command(f'SELECT HintShown FROM portal WHERE UserId={user_id}',
                     False)
     return cur.fetchone()
예제 #12
0
 def update_subjects(user_id, subjects: []):
     subj_str = ','.join(subjects)
     command = f"UPDATE portal SET Subjects='{subj_str}' WHERE UserId='{user_id}'"
     return DB.exec_command(command)
예제 #13
0
 def add_or_update(user_id, login, password):
     command = f"INSERT INTO portal (UserId, Login, Password) VALUES({user_id}, '{login}', '{password}')" \
               f" ON DUPLICATE KEY UPDATE" \
               f" Login='******', Password='******'"
     return DB.exec_command(command)
예제 #14
0
 def get(user_id):
     DB.exec_command(
         f'SELECT Login, Password FROM portal WHERE UserId={user_id}',
         False)
     return cur.fetchone()
예제 #15
0
 def add_or_update(user_id, expiration_date):
     command = f"INSERT INTO premium (UserId, ExpirationDate) VALUES({user_id},'{expiration_date}') ON DUPLICATE KEY UPDATE" \
               f" ExpirationDate='{expiration_date}'"
     return DB.exec_command(command)