-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_db.py
59 lines (49 loc) · 2.6 KB
/
test_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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from utils import *
from models.models import *
from config import *
connection = open_connection("hospital.db")
cursor = get_cursor(connection)
# def test_DB_creation():
# Database_Setup(cursor)
# def test_employee_insertion():
# employee1 = Employee(cursor, "Ahmed", "Alaa", 20, "+2", "0", "1028202598", "Egypt", "Cairo", "Dar El-Salam", "M", "[email protected]", "123456789", get_time_now_as_text(), 0, 0)
# employee1.insert()
# def test_Patient_insertion():
# patient1 = Patient(cursor, "Ahmed", "Sabry", 20, "+2", "0", "1067371115", "Egypt", "Cairo", "Helwan", "F", "[email protected]", "fuckfuck123")
# patient1.insert()
#test_Patient_insertion()
#Columns = [Employee[Employee.Age],Employee[Employee.PhoneNumber]]
# Columns = [Employee.Age.value,Employee.PhoneNumber.value]
# Columns2 = [Employee.All.value]
# Selectors = [(Employee.FNAME.value,"Ahmed"),(Employee.lNAME.value,"Alaa")]
# for i in Columns:
# print(i)
# #print(Employee.FNAME.value)
# #result = selectFromTable(cursor,'Employee',Employee_attributes,Columns2,Selectors)
# Columns3 = [Patient.All.value]
# Values =["Ahmed", "Sabry", 20, "+2", "1028202598", "Egypt", "Cairo", "Helwan", "M", "[email protected]", "123456789"]
# insert_general(cursor,'Patient',Patient_attributes,Columns3,Values)
# close_connection(connection)
#------------------------------------Prescription----------------------
# Columns = [Prescription.All.value]
# Values = [get_time_now_as_text(),'Cold','Medicine: Congestal for 5 days',1,1]
# insert_general(cursor,'Prescription',Prescription_attributes,Columns,Values)
# Columns2 = [Prescription.All.value]
# Values2 = [get_time_now_as_text(),'Cold','Medicine: Congestal for 5 days',2,2]
# insert_general(cursor,'Prescription',Prescription_attributes,Columns2,Values2)
#result1 = selectFromTable(cursor,'P',Prescription_attributes,[Prescription.All.value],[])
#connection.commit()
#result1 = selectFromTable(cursor,'Prescription',Prescription_attributes,[Prescription.All.value],[])
#connection.commit()
#result2 = Select_From_Prescription_Patient(cursor,'[email protected]')
#connection.commit()
#result2 = SelecT_ALL_Prescription_Patient(cursor,'[email protected]')
#connection.commit()
Doctors = selectFromTable(cursor,'Employee',Employee_attributes,[Employee.All.value],[(Employee.Group_id.value,'D'),(Employee.D_id.value,1)])
# print(Doctors)
#result = Select_From_Prescription_Employee(cursor,'[email protected]',[])
connection.commit()
result=Delete(cursor,'Patient',[Patient.Age.value],[50])
connection.commit()
connection.close()
#close_connection(connection)