-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
39 lines (25 loc) · 728 Bytes
/
Copy pathdatabase.py
File metadata and controls
39 lines (25 loc) · 728 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
29
30
31
32
33
34
35
36
37
import sqlite3 as sql
class DataBase():
def __init__(self):
try:
self.conn=sql.connect('feedback.db')
self.conn.execute("create table feedback (FName char[25], LName char[25], Email char[40], query char[200] ); ")
except:
pass
def Add(self,data):
cmd=f"INSERT INTO feedback VALUES ('{ data[0] }', '{ data[1] }', '{ data[2] }', '{ data[3] }');"
self.conn.execute(cmd)
self.conn.commit()
#self.conn.close()
def run(self,cmd):
# cmd="SELECT * FROM feedback;"
mycur=self.conn.cursor()
mycur.execute(cmd)
table=(mycur.fetchall())
return table
def close(self):
#self.conn.commit()
self.conn.close()
# obj=DataBase()
# print(obj.run("select * from feedback"))
# obj.close()