-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.py
45 lines (28 loc) · 845 Bytes
/
db.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import sqlite3 as lite
async def userInsert(uName: str, rName: str):
con = lite.connect('user.db')
with con:
cur = con.cursor()
cur.execute("INSERT INTO Members VALUES('%s', '%s')" % (uName, rName))
pass
async def tableGet(table: str):
con = lite.connect('user.db')
with con:
cur = con.cursor()
cur.execute("SELECT * FROM %s" % table)
rows = cur.fetchall()
entries = {}
for row in rows:
entries[row[0]] = row[1]
return entries
def display(table: str):
con = lite.connect('user.db')
with con:
cur = con.cursor()
cur.execute("SELECT * FROM %s" % table)
rows = cur.fetchall()
for row in rows:
print(row)
print(type(row))
if __name__ == "__main__":
display('Members')