Qwael 4.0.0.0.2__tar.gz → 4.0.0.0.3__tar.gz
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-4.0.0.0.2 → qwael-4.0.0.0.3}/PKG-INFO +1 -1
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael/Multidata.py +52 -11
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael.egg-info/PKG-INFO +1 -1
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/setup.py +1 -1
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/LICENSE +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael/DR/304/260VE.py" +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael/DoIP.py +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael/MultiDB.py +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael/__init__.py +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael/filesz.py +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael.egg-info/SOURCES.txt +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael.egg-info/dependency_links.txt +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael.egg-info/requires.txt +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/Qwael.egg-info/top_level.txt +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/README.md +0 -0
- {qwael-4.0.0.0.2 → qwael-4.0.0.0.3}/setup.cfg +0 -0
|
@@ -25,6 +25,8 @@ class Admin:
|
|
|
25
25
|
# INSERT (db.add)
|
|
26
26
|
# ------------------------------------------------------
|
|
27
27
|
def add(self, table, **kwargs):
|
|
28
|
+
Control = kwargs.pop("Control", None)
|
|
29
|
+
|
|
28
30
|
keys = ", ".join(kwargs.keys())
|
|
29
31
|
values = ", ".join(["%s"] * len(kwargs))
|
|
30
32
|
sql = f"INSERT INTO {table} ({keys}) VALUES ({values})"
|
|
@@ -33,13 +35,20 @@ class Admin:
|
|
|
33
35
|
self.cursor.execute(sql, tuple(kwargs.values()))
|
|
34
36
|
self.conn.commit()
|
|
35
37
|
print("Added!")
|
|
38
|
+
|
|
39
|
+
if Control is not None:
|
|
40
|
+
Control.append(True)
|
|
41
|
+
|
|
36
42
|
except mysql.connector.Error as e:
|
|
37
43
|
print("Insert Error:", e)
|
|
38
44
|
|
|
45
|
+
if Control is not None:
|
|
46
|
+
Control.append(False)
|
|
47
|
+
|
|
39
48
|
# ------------------------------------------------------
|
|
40
|
-
# UPDATE
|
|
49
|
+
# UPDATE
|
|
41
50
|
# ------------------------------------------------------
|
|
42
|
-
def update(self, table, where: dict, data: dict):
|
|
51
|
+
def update(self, table, where: dict, data: dict, Control=None):
|
|
43
52
|
set_clause = ", ".join([f"{k}=%s" for k in data])
|
|
44
53
|
where_clause = " AND ".join([f"{k}=%s" for k in where])
|
|
45
54
|
|
|
@@ -50,13 +59,20 @@ class Admin:
|
|
|
50
59
|
self.cursor.execute(sql, values)
|
|
51
60
|
self.conn.commit()
|
|
52
61
|
print("Updated!")
|
|
62
|
+
|
|
63
|
+
if Control is not None:
|
|
64
|
+
Control.append(True)
|
|
65
|
+
|
|
53
66
|
except mysql.connector.Error as e:
|
|
54
67
|
print("Update Error:", e)
|
|
55
68
|
|
|
69
|
+
if Control is not None:
|
|
70
|
+
Control.append(False)
|
|
71
|
+
|
|
56
72
|
# ------------------------------------------------------
|
|
57
|
-
# DELETE
|
|
73
|
+
# DELETE
|
|
58
74
|
# ------------------------------------------------------
|
|
59
|
-
def delete(self, table, **kwargs):
|
|
75
|
+
def delete(self, table, Control=None, **kwargs):
|
|
60
76
|
where_clause = " AND ".join([f"{k}=%s" for k in kwargs])
|
|
61
77
|
sql = f"DELETE FROM {table} WHERE {where_clause}"
|
|
62
78
|
|
|
@@ -64,21 +80,27 @@ class Admin:
|
|
|
64
80
|
self.cursor.execute(sql, tuple(kwargs.values()))
|
|
65
81
|
self.conn.commit()
|
|
66
82
|
print("Deleted!")
|
|
83
|
+
|
|
84
|
+
if Control is not None:
|
|
85
|
+
Control.append(True)
|
|
86
|
+
|
|
67
87
|
except mysql.connector.Error as e:
|
|
68
88
|
print("Delete Error:", e)
|
|
69
89
|
|
|
90
|
+
if Control is not None:
|
|
91
|
+
Control.append(False)
|
|
92
|
+
|
|
70
93
|
# ------------------------------------------------------
|
|
71
|
-
# GET (tek veri)
|
|
94
|
+
# GET (tek veri)
|
|
72
95
|
# ------------------------------------------------------
|
|
73
|
-
def get(self, table, **kwargs):
|
|
96
|
+
def get(self, table, Control=None, **kwargs):
|
|
74
97
|
external_var = None
|
|
75
98
|
|
|
76
99
|
# Variable parametresini dışarı al
|
|
77
100
|
if "Variable" in kwargs:
|
|
78
101
|
external_var = kwargs["Variable"]
|
|
79
|
-
kwargs.pop("Variable")
|
|
102
|
+
kwargs.pop("Variable")
|
|
80
103
|
|
|
81
|
-
# WHERE oluştur
|
|
82
104
|
where_clause = " AND ".join([f"{k}=%s" for k in kwargs])
|
|
83
105
|
sql = f"SELECT * FROM {table} WHERE {where_clause} LIMIT 1"
|
|
84
106
|
|
|
@@ -87,30 +109,49 @@ class Admin:
|
|
|
87
109
|
row = self.cursor.fetchone()
|
|
88
110
|
|
|
89
111
|
if row:
|
|
90
|
-
# Variable={} gönderilmişse doldur
|
|
91
112
|
if external_var is not None:
|
|
92
113
|
external_var.clear()
|
|
93
114
|
external_var.update(row)
|
|
94
115
|
|
|
95
116
|
print("Data found:", row)
|
|
117
|
+
|
|
118
|
+
if Control is not None:
|
|
119
|
+
Control.append(True)
|
|
120
|
+
|
|
96
121
|
return row
|
|
97
122
|
|
|
98
123
|
print("No data found.")
|
|
124
|
+
|
|
125
|
+
if Control is not None:
|
|
126
|
+
Control.append(False)
|
|
127
|
+
|
|
99
128
|
return None
|
|
100
129
|
|
|
101
130
|
except mysql.connector.Error as e:
|
|
102
131
|
print("Get Error:", e)
|
|
103
132
|
|
|
133
|
+
if Control is not None:
|
|
134
|
+
Control.append(False)
|
|
135
|
+
|
|
104
136
|
# ------------------------------------------------------
|
|
105
|
-
# GET ALL
|
|
137
|
+
# GET ALL
|
|
106
138
|
# ------------------------------------------------------
|
|
107
|
-
def get_all(self, table):
|
|
139
|
+
def get_all(self, table, Control=None):
|
|
108
140
|
sql = f"SELECT * FROM {table}"
|
|
109
141
|
|
|
110
142
|
try:
|
|
111
143
|
self.cursor.execute(sql)
|
|
112
144
|
rows = self.cursor.fetchall()
|
|
145
|
+
|
|
146
|
+
if Control is not None:
|
|
147
|
+
Control.append(True)
|
|
148
|
+
|
|
113
149
|
return rows
|
|
150
|
+
|
|
114
151
|
except mysql.connector.Error as e:
|
|
115
152
|
print("Get All Error:", e)
|
|
153
|
+
|
|
154
|
+
if Control is not None:
|
|
155
|
+
Control.append(False)
|
|
156
|
+
|
|
116
157
|
return []
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|