def check_entry_duplicate(self): command = "SELECT title FROM entries where email = %s" c.execute(command,(self.email,)) value = c.fetchall() return value
def get_entry_by_id(self,entry_id): command = "SELECT * FROM entries WHERE entry_id = %s and email = %s " c.execute(command,(entry_id,self.email)) value = c.fetchone() return value
def modify_entry(self, entry_id): command = "UPDATE entries SET title = %s , content = %s WHERE entry_id = %s " c.execute(command, (self.title, self.content, entry_id))
def get_all_entries(self): command = "SELECT * FROM entries WHERE email = %s " c.execute(command,(self.email,)) value=c.fetchall() return value
def add_entry(self): command = '''INSERT INTO entries (email,title, date, content) VALUES (%s, %s, %s, %s) ''' c.execute(command, (self.email,self.title, self.date, self.content))
def login_user(self): command ="SELECT email FROM users WHERE email = %s AND password=%s" c.execute(command,(self.email, self.password)) value=c.fetchone() return value
def check_duplicate(self): command = "SELECT email FROM users where email = %s" c.execute(command,(self.email,)) value = c.fetchone() return value
def add_user(self): command = '''INSERT INTO users (email, username, password) VALUES (%s, %s, %s)''' c.execute(command, (self.email, self.username, self.password))