Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class DB:
  2. def __init__(self):
  3. self.connection = connect('todo.db')
  4. self.cursor = self.connection.cursor()
  5.  
  6. def query(self, query):
  7. self.cursor.execute(query)
  8. return self.cursor.fetchall()
  9.  
  10. def update(self, query):
  11. self.cursor.execute(query)
  12. self.connection.commit()
  13. return self.cursor.fetchall()
  14.  
  15.  
  16. db = DB()
  17. db.update('INSERT INTO Tasks ("name") VALUES("Novi todo")')
  18. print(db.query('SELECT * FROM Tasks'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement