-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
100 lines (95 loc) · 1.53 KB
/
Copy pathmain.py
File metadata and controls
100 lines (95 loc) · 1.53 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from table import *
from database import *
fields = [
{
"field": 'id',
"datatype": 'integer',
"size":'20',
"loc":0,
"val":''
},
{
"field": 'name',
"datatype": 'integer',
"size":'20',
"loc":0,
"val":''
},
{
"field": 'salary',
"datatype": 'integer',
"size":'20',
"loc":0,
"val":''
}
]
rows = [
{
"id" : 2004,
"name" : "Emily",
"salary": 12123
},
{
"id" : 2005,
"name" : "Emily",
"salary": 12123
},
{
"id" : 200,
"name" : "Emily",
"salary": 1212
}
]
location_fields = [
{
"field": 'id',
"datatype": 'integer',
"size":'20',
"loc":0,
"val":''
},
{
"field": 'name',
"datatype": 'integer',
"size":'20',
"loc":0,
"val":''
},
{
"field": 'cost',
"datatype": 'integer',
"size":'20',
"loc":0,
"val":''
}
]
location_rows = [
{
"id" : 2004,
"name" : "UK",
"cost": 12123
},
{
"id" : 2005,
"name" : "Berlin",
"cost": 12123
},
{
"id" : 200,
"name" : "India",
"cost": 1212
}
]
employees = Table(fields,rows, "employee")
locations = Table(location_fields,location_rows, "locations")
employees.print()
employees.select(id=200,name="UK")
employees.insert({"salary":200}, id=200)
employees.select(id=200,name="India")
locations.print()
locations.select(id=200,name="Berlin")
locations.insert({"cost":200}, id=200)
locations.select(id=200,name="India")
db = Database("ADMIN", employees, locations)
db.print()
db.get_tables()