]> rtime.felk.cvut.cz Git - hubacji1/coffee-getter.git/commitdiff
Add database module
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 20 Mar 2019 11:36:06 +0000 (12:36 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 20 Mar 2019 11:49:51 +0000 (12:49 +0100)
cbdb.py [new file with mode: 0644]

diff --git a/cbdb.py b/cbdb.py
new file mode 100644 (file)
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()