summaryrefslogtreecommitdiff
path: root/jfr_playoff/db.py
diff options
context:
space:
mode:
Diffstat (limited to 'jfr_playoff/db.py')
-rw-r--r--jfr_playoff/db.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/jfr_playoff/db.py b/jfr_playoff/db.py
new file mode 100644
index 0000000..aa0c2e2
--- /dev/null
+++ b/jfr_playoff/db.py
@@ -0,0 +1,19 @@
+import mysql.connector
+
+class PlayoffDB(object):
+
+ db_cursor = None
+
+ def __init__(self, settings):
+ self.database = mysql.connector.connect(
+ user=settings['user'],
+ password=settings['pass'],
+ host=settings['host'],
+ port=settings['port']
+ )
+ self.db_cursor = self.database.cursor(buffered=True)
+
+ def fetch(self, db, sql, params):
+ self.db_cursor.execute(sql.replace('#db#', db), params)
+ row = self.db_cursor.fetchone()
+ return row