Qwael 4.0.0.0.2__py3-none-any.whl → 4.0.0.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Qwael/Multidata.py +167 -12
- {qwael-4.0.0.0.2.dist-info → qwael-4.0.0.0.4.dist-info}/METADATA +1 -1
- {qwael-4.0.0.0.2.dist-info → qwael-4.0.0.0.4.dist-info}/RECORD +6 -6
- {qwael-4.0.0.0.2.dist-info → qwael-4.0.0.0.4.dist-info}/WHEEL +0 -0
- {qwael-4.0.0.0.2.dist-info → qwael-4.0.0.0.4.dist-info}/licenses/LICENSE +0 -0
- {qwael-4.0.0.0.2.dist-info → qwael-4.0.0.0.4.dist-info}/top_level.txt +0 -0
Qwael/Multidata.py
CHANGED
|
@@ -22,9 +22,15 @@ class Admin:
|
|
|
22
22
|
print("Connection Error:", e)
|
|
23
23
|
|
|
24
24
|
# ------------------------------------------------------
|
|
25
|
-
#
|
|
25
|
+
# ADD
|
|
26
26
|
# ------------------------------------------------------
|
|
27
27
|
def add(self, table, **kwargs):
|
|
28
|
+
external_control = None
|
|
29
|
+
|
|
30
|
+
if "Control" in kwargs:
|
|
31
|
+
external_control = kwargs["Control"]
|
|
32
|
+
kwargs.pop("Control")
|
|
33
|
+
|
|
28
34
|
keys = ", ".join(kwargs.keys())
|
|
29
35
|
values = ", ".join(["%s"] * len(kwargs))
|
|
30
36
|
sql = f"INSERT INTO {table} ({keys}) VALUES ({values})"
|
|
@@ -33,13 +39,19 @@ class Admin:
|
|
|
33
39
|
self.cursor.execute(sql, tuple(kwargs.values()))
|
|
34
40
|
self.conn.commit()
|
|
35
41
|
print("Added!")
|
|
42
|
+
if external_control is not None:
|
|
43
|
+
external_control.append(True)
|
|
44
|
+
return True
|
|
36
45
|
except mysql.connector.Error as e:
|
|
37
46
|
print("Insert Error:", e)
|
|
47
|
+
if external_control is not None:
|
|
48
|
+
external_control.append(False)
|
|
49
|
+
return False
|
|
38
50
|
|
|
39
51
|
# ------------------------------------------------------
|
|
40
|
-
# UPDATE
|
|
52
|
+
# UPDATE
|
|
41
53
|
# ------------------------------------------------------
|
|
42
|
-
def update(self, table, where: dict, data: dict):
|
|
54
|
+
def update(self, table, where: dict, data: dict, Control=None):
|
|
43
55
|
set_clause = ", ".join([f"{k}=%s" for k in data])
|
|
44
56
|
where_clause = " AND ".join([f"{k}=%s" for k in where])
|
|
45
57
|
|
|
@@ -50,13 +62,25 @@ class Admin:
|
|
|
50
62
|
self.cursor.execute(sql, values)
|
|
51
63
|
self.conn.commit()
|
|
52
64
|
print("Updated!")
|
|
65
|
+
if Control is not None:
|
|
66
|
+
Control.append(True)
|
|
67
|
+
return True
|
|
53
68
|
except mysql.connector.Error as e:
|
|
54
69
|
print("Update Error:", e)
|
|
70
|
+
if Control is not None:
|
|
71
|
+
Control.append(False)
|
|
72
|
+
return False
|
|
55
73
|
|
|
56
74
|
# ------------------------------------------------------
|
|
57
|
-
# DELETE
|
|
75
|
+
# DELETE
|
|
58
76
|
# ------------------------------------------------------
|
|
59
77
|
def delete(self, table, **kwargs):
|
|
78
|
+
external_control = None
|
|
79
|
+
|
|
80
|
+
if "Control" in kwargs:
|
|
81
|
+
external_control = kwargs["Control"]
|
|
82
|
+
kwargs.pop("Control")
|
|
83
|
+
|
|
60
84
|
where_clause = " AND ".join([f"{k}=%s" for k in kwargs])
|
|
61
85
|
sql = f"DELETE FROM {table} WHERE {where_clause}"
|
|
62
86
|
|
|
@@ -64,21 +88,30 @@ class Admin:
|
|
|
64
88
|
self.cursor.execute(sql, tuple(kwargs.values()))
|
|
65
89
|
self.conn.commit()
|
|
66
90
|
print("Deleted!")
|
|
91
|
+
if external_control is not None:
|
|
92
|
+
external_control.append(True)
|
|
93
|
+
return True
|
|
67
94
|
except mysql.connector.Error as e:
|
|
68
95
|
print("Delete Error:", e)
|
|
96
|
+
if external_control is not None:
|
|
97
|
+
external_control.append(False)
|
|
98
|
+
return False
|
|
69
99
|
|
|
70
100
|
# ------------------------------------------------------
|
|
71
|
-
# GET (tek veri)
|
|
101
|
+
# GET (tek veri)
|
|
72
102
|
# ------------------------------------------------------
|
|
73
103
|
def get(self, table, **kwargs):
|
|
74
104
|
external_var = None
|
|
105
|
+
external_control = None
|
|
75
106
|
|
|
76
|
-
# Variable parametresini dışarı al
|
|
77
107
|
if "Variable" in kwargs:
|
|
78
108
|
external_var = kwargs["Variable"]
|
|
79
|
-
kwargs.pop("Variable")
|
|
109
|
+
kwargs.pop("Variable")
|
|
110
|
+
|
|
111
|
+
if "Control" in kwargs:
|
|
112
|
+
external_control = kwargs["Control"]
|
|
113
|
+
kwargs.pop("Control")
|
|
80
114
|
|
|
81
|
-
# WHERE oluştur
|
|
82
115
|
where_clause = " AND ".join([f"{k}=%s" for k in kwargs])
|
|
83
116
|
sql = f"SELECT * FROM {table} WHERE {where_clause} LIMIT 1"
|
|
84
117
|
|
|
@@ -87,30 +120,152 @@ class Admin:
|
|
|
87
120
|
row = self.cursor.fetchone()
|
|
88
121
|
|
|
89
122
|
if row:
|
|
90
|
-
# Variable={} gönderilmişse doldur
|
|
91
123
|
if external_var is not None:
|
|
92
124
|
external_var.clear()
|
|
93
125
|
external_var.update(row)
|
|
94
126
|
|
|
127
|
+
if external_control is not None:
|
|
128
|
+
external_control.append(True)
|
|
129
|
+
|
|
95
130
|
print("Data found:", row)
|
|
96
131
|
return row
|
|
97
132
|
|
|
98
133
|
print("No data found.")
|
|
134
|
+
if external_control is not None:
|
|
135
|
+
external_control.append(False)
|
|
99
136
|
return None
|
|
100
137
|
|
|
101
138
|
except mysql.connector.Error as e:
|
|
102
139
|
print("Get Error:", e)
|
|
140
|
+
if external_control is not None:
|
|
141
|
+
external_control.append(False)
|
|
142
|
+
return None
|
|
103
143
|
|
|
104
144
|
# ------------------------------------------------------
|
|
105
|
-
# GET ALL
|
|
145
|
+
# GET ALL
|
|
106
146
|
# ------------------------------------------------------
|
|
107
|
-
def get_all(self, table):
|
|
147
|
+
def get_all(self, table, Control=None):
|
|
108
148
|
sql = f"SELECT * FROM {table}"
|
|
109
149
|
|
|
110
150
|
try:
|
|
111
151
|
self.cursor.execute(sql)
|
|
112
152
|
rows = self.cursor.fetchall()
|
|
153
|
+
if Control is not None:
|
|
154
|
+
Control.append(True)
|
|
113
155
|
return rows
|
|
114
156
|
except mysql.connector.Error as e:
|
|
115
157
|
print("Get All Error:", e)
|
|
116
|
-
|
|
158
|
+
if Control is not None:
|
|
159
|
+
Control.append(False)
|
|
160
|
+
return []
|
|
161
|
+
|
|
162
|
+
# ------------------------------------------------------
|
|
163
|
+
# CONTROLL
|
|
164
|
+
# db.Controll("Users", ID=3, name="Ali", Control=durum)
|
|
165
|
+
# ------------------------------------------------------
|
|
166
|
+
def Controll(self, table, **kwargs):
|
|
167
|
+
external_control = None
|
|
168
|
+
|
|
169
|
+
if "Control" in kwargs:
|
|
170
|
+
external_control = kwargs["Control"]
|
|
171
|
+
kwargs.pop("Control")
|
|
172
|
+
|
|
173
|
+
filters = {}
|
|
174
|
+
checks = {}
|
|
175
|
+
|
|
176
|
+
for key, value in kwargs.items():
|
|
177
|
+
if key.isupper():
|
|
178
|
+
filters[key] = value
|
|
179
|
+
else:
|
|
180
|
+
checks[key] = value
|
|
181
|
+
|
|
182
|
+
if not filters:
|
|
183
|
+
print("Controll Error: ID gibi bir filtre gerekli.")
|
|
184
|
+
if external_control is not None:
|
|
185
|
+
external_control.append(False)
|
|
186
|
+
return False
|
|
187
|
+
|
|
188
|
+
where_clause = " AND ".join([f"{k}=%s" for k in filters])
|
|
189
|
+
sql = f"SELECT * FROM {table} WHERE {where_clause} LIMIT 1"
|
|
190
|
+
|
|
191
|
+
try:
|
|
192
|
+
self.cursor.execute(sql, tuple(filters.values()))
|
|
193
|
+
row = self.cursor.fetchone()
|
|
194
|
+
|
|
195
|
+
if not row:
|
|
196
|
+
print("Controll: Veri yok.")
|
|
197
|
+
if external_control is not None:
|
|
198
|
+
external_control.append(False)
|
|
199
|
+
return False
|
|
200
|
+
|
|
201
|
+
for key, expected in checks.items():
|
|
202
|
+
if key not in row or row[key] != expected:
|
|
203
|
+
print("Controll: Uyuşmayan değer:", key)
|
|
204
|
+
if external_control is not None:
|
|
205
|
+
external_control.append(False)
|
|
206
|
+
return False
|
|
207
|
+
|
|
208
|
+
print("Controll: Doğru.")
|
|
209
|
+
if external_control is not None:
|
|
210
|
+
external_control.append(True)
|
|
211
|
+
return True
|
|
212
|
+
|
|
213
|
+
except mysql.connector.Error as e:
|
|
214
|
+
print("Controll Error:", e)
|
|
215
|
+
if external_control is not None:
|
|
216
|
+
external_control.append(False)
|
|
217
|
+
return False
|
|
218
|
+
|
|
219
|
+
# ------------------------------------------------------
|
|
220
|
+
# ID_CONTROL
|
|
221
|
+
# db.ID_Control("Users", name="Ali", ID=bura, Control=durum)
|
|
222
|
+
# ------------------------------------------------------
|
|
223
|
+
def ID_Control(self, table, **kwargs):
|
|
224
|
+
external_id_var = None
|
|
225
|
+
external_control = None
|
|
226
|
+
|
|
227
|
+
if "ID" in kwargs:
|
|
228
|
+
external_id_var = kwargs["ID"]
|
|
229
|
+
kwargs.pop("ID")
|
|
230
|
+
|
|
231
|
+
if "Control" in kwargs:
|
|
232
|
+
external_control = kwargs["Control"]
|
|
233
|
+
kwargs.pop("Control")
|
|
234
|
+
|
|
235
|
+
filters = kwargs
|
|
236
|
+
|
|
237
|
+
if not filters:
|
|
238
|
+
print("ID_Control Error: name gibi filtre gerekli.")
|
|
239
|
+
if external_control is not None:
|
|
240
|
+
external_control.append(False)
|
|
241
|
+
return False
|
|
242
|
+
|
|
243
|
+
where_clause = " AND ".join([f"{k}=%s" for k in filters])
|
|
244
|
+
sql = f"SELECT ID FROM {table} WHERE {where_clause} LIMIT 1"
|
|
245
|
+
|
|
246
|
+
try:
|
|
247
|
+
self.cursor.execute(sql, tuple(filters.values()))
|
|
248
|
+
row = self.cursor.fetchone()
|
|
249
|
+
|
|
250
|
+
if not row:
|
|
251
|
+
print("ID_Control: Veri yok.")
|
|
252
|
+
if external_control is not None:
|
|
253
|
+
external_control.append(False)
|
|
254
|
+
return False
|
|
255
|
+
|
|
256
|
+
if external_id_var is not None:
|
|
257
|
+
external_id_var.clear()
|
|
258
|
+
external_id_var["ID"] = row["ID"]
|
|
259
|
+
|
|
260
|
+
print("ID_Control: ID bulundu:", row["ID"])
|
|
261
|
+
|
|
262
|
+
if external_control is not None:
|
|
263
|
+
external_control.append(True)
|
|
264
|
+
|
|
265
|
+
return row["ID"]
|
|
266
|
+
|
|
267
|
+
except mysql.connector.Error as e:
|
|
268
|
+
print("ID_Control Error:", e)
|
|
269
|
+
if external_control is not None:
|
|
270
|
+
external_control.append(False)
|
|
271
|
+
return False
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Qwael/DRİVE.py,sha256=OTiyoXFb5iFP7hXr2QHnH3c0pHZijZr1sFsqguXtMfc,12976
|
|
2
2
|
Qwael/DoIP.py,sha256=5ujPzbZGepFZN0-tMI9Unodvo2gJG3PDL2ShqdBJjdE,418
|
|
3
3
|
Qwael/MultiDB.py,sha256=glptDsH22TyklZrA_ywStnsT6bGnq7JsSR5NN_U1NII,17286
|
|
4
|
-
Qwael/Multidata.py,sha256=
|
|
4
|
+
Qwael/Multidata.py,sha256=h4VfaYh75tqjxcdpVqDQFOEhuMgoBX6YWkiNGs_42bE,8978
|
|
5
5
|
Qwael/__init__.py,sha256=8-RUlmpcvWxxqHWc4_sSpHdxAetSy7Oe6YNDfOGpvRw,234
|
|
6
6
|
Qwael/filesz.py,sha256=M93tuP-BQxmySgjtYR5uQ3Otx2AfqbfAuKD6pyZDBC4,3859
|
|
7
|
-
qwael-4.0.0.0.
|
|
8
|
-
qwael-4.0.0.0.
|
|
9
|
-
qwael-4.0.0.0.
|
|
10
|
-
qwael-4.0.0.0.
|
|
11
|
-
qwael-4.0.0.0.
|
|
7
|
+
qwael-4.0.0.0.4.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
qwael-4.0.0.0.4.dist-info/METADATA,sha256=CexTzwBwALLxJxmf8EO4ZnTc6xX0niI0POBmtImDTt4,2280
|
|
9
|
+
qwael-4.0.0.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
qwael-4.0.0.0.4.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
|
|
11
|
+
qwael-4.0.0.0.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|