Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def zapisz_do_bazy(self):
- con = sqlite3.connect("konto.db")
- with con:
- cur = con.cursor()
- cur.execute("DROP TABLE IF EXISTS transakcje")
- cur.execute(
- "CREATE TABLE transakcje(id INT, waluta TEXT, ilosc FLOAT)"
- )
- for i, t in enumerate(self._transakcje):
- cur.execute(
- f"INSERT INTO transakcje VALUES({i}, '{t['waluta']}', {t['ilosc']})"
- )
- def wczytaj_z_bazy(self):
- con = sqlite3.connect("konto.db")
- with con:
- cur = con.cursor()
- cur.execute("SELECT * FROM transakcje")
- rows = cur.fetchall()
- for row in rows:
- self.zatwierdz(row[2], row[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement