Qwael 4.0.0.0.2__py3-none-any.whl → 4.0.0.0.3__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 CHANGED
@@ -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 (db.update("users", {"ID": 3}, {"name": "Ali"}))
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 (db.delete("users", ID=3))
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) — db.get("users", ID=3, Variable=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") # filtrelerden çıkar
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 (db.get_all("users"))
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 []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 4.0.0.0.2
3
+ Version: 4.0.0.0.3
4
4
  Summary: Qwael: İşlevsel ve kolaylaştırılmış Python kütüphanesi
5
5
  Author: Bedirhan
6
6
  Author-email: bedirhan.oytpass@gmail.com
@@ -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=mLoyIgGyC1g29Qa-UrolIu8DZZFNAFxCQFlhFdTelSg,4037
4
+ Qwael/Multidata.py,sha256=juL3I9l8gz1PK77k-2uekGbCq-vk6wHKpUIjr3u4wL0,4735
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.2.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- qwael-4.0.0.0.2.dist-info/METADATA,sha256=jgGQejJJzP4GfICk6BI-UpxpClDJ9zgAD1SzkRAx4BQ,2280
9
- qwael-4.0.0.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- qwael-4.0.0.0.2.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
11
- qwael-4.0.0.0.2.dist-info/RECORD,,
7
+ qwael-4.0.0.0.3.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ qwael-4.0.0.0.3.dist-info/METADATA,sha256=s73humQzDWvHHkxYHnGKqmCJ3T38Pv8dvHM7UUeHNfQ,2280
9
+ qwael-4.0.0.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ qwael-4.0.0.0.3.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
11
+ qwael-4.0.0.0.3.dist-info/RECORD,,