-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathunlocks.py
24 lines (19 loc) · 864 Bytes
/
unlocks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import datetime
class Unlocks(object):
def __init__(self):
pass
def migrate(self, dbConnection, db_schema_version):
if db_schema_version < 11:
dbConnection.execute('''CREATE TABLE unlocks
(time TIMESTAMP,
location TEXT,
barcode TEXT)''')
def injectData(self, dbConnection, data):
for datum in data:
dbConnection.execute(
'''INSERT INTO unlocks(time, location, barcode) VALUES(?,?,?)''',
(datum["time"], datum["location"], datum["barcode"]))
def addEntry(self, dbConnection, location, barcode):
dbConnection.execute(
'''INSERT INTO unlocks(time, location, barcode) VALUES(?,?,?)''',
(datetime.datetime.now(), location, barcode))