From: Jiri Vlasak Date: Wed, 20 Mar 2019 11:36:06 +0000 (+0100) Subject: Add database module X-Git-Tag: v0.1.0~8^2~1 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hubacji1/coffee-getter.git/commitdiff_plain/671d055dd16ec89f2f37c8c1ca5d99b9a6b530c3 Add database module --- diff --git a/cbdb.py b/cbdb.py new file mode 100644 index 0000000..a96f371 --- /dev/null +++ b/cbdb.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +"""Database access.""" +from sqlite3 import connect +from cbconf import Conf + +class Db: + def __init__(self, dbpath=False): + if dbpath: + self.con = connect(dbpath) + else: + cfg = Conf() + self.con = connect(cfg.getCoffeeDbPath()) + self.cur = self.con.cursor() + return None + + def __del__(self): + self.con.close()