-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgetId.py
More file actions
28 lines (22 loc) · 683 Bytes
/
Copy pathgetId.py
File metadata and controls
28 lines (22 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sqlite3
from userdataclass import jsondata
class GetID:
def __init__(self):
self.dataclass = jsondata()
self.path = self.dataclass.getdatapath()
def getID(self):
conn = sqlite3.connect(self.path + '/database.db')
cursor = conn.execute("SELECT currentId FROM config;")
for row in cursor:
id = row[0]
conn.close()
return id
def setID(self, id):
conn = sqlite3.connect(self.path + '/database.db')
sql = "UPDATE config set currentId = " + str(id) +";"
conn.execute(sql)
conn.commit()
conn.close()
# test = GetID()
# test.setID(2001)
# print(test.getID())