Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DB:
- def __init__(self):
- self.connection = connect('todo.db')
- self.cursor = self.connection.cursor()
- def query(self, query):
- self.cursor.execute(query)
- return self.cursor.fetchall()
- def update(self, query):
- self.cursor.execute(query)
- self.connection.commit()
- return self.cursor.fetchall()
- db = DB()
- db.update('INSERT INTO Tasks ("name") VALUES("Novi todo")')
- print(db.query('SELECT * FROM Tasks'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement