sqlthon 0.0.12__tar.gz → 0.0.13__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.
- {sqlthon-0.0.12 → sqlthon-0.0.13}/PKG-INFO +1 -1
- {sqlthon-0.0.12 → sqlthon-0.0.13}/pyproject.toml +1 -1
- {sqlthon-0.0.12 → sqlthon-0.0.13}/src/sqlthon/__init__.py +1 -1
- {sqlthon-0.0.12 → sqlthon-0.0.13}/src/sqlthon/core.py +9 -6
- {sqlthon-0.0.12 → sqlthon-0.0.13}/src/sqlthon.egg-info/PKG-INFO +1 -1
- {sqlthon-0.0.12 → sqlthon-0.0.13}/README.md +0 -0
- {sqlthon-0.0.12 → sqlthon-0.0.13}/setup.cfg +0 -0
- {sqlthon-0.0.12 → sqlthon-0.0.13}/src/sqlthon/keywords.py +0 -0
- {sqlthon-0.0.12 → sqlthon-0.0.13}/src/sqlthon.egg-info/SOURCES.txt +0 -0
- {sqlthon-0.0.12 → sqlthon-0.0.13}/src/sqlthon.egg-info/dependency_links.txt +0 -0
- {sqlthon-0.0.12 → sqlthon-0.0.13}/src/sqlthon.egg-info/top_level.txt +0 -0
|
@@ -15,7 +15,7 @@ Channel: https://ble.ir/saums_channel
|
|
|
15
15
|
from .core import Connect, Field
|
|
16
16
|
|
|
17
17
|
__all__ = ['Connect', 'Field']
|
|
18
|
-
__version__ = '0.0.
|
|
18
|
+
__version__ = '0.0.13'
|
|
19
19
|
__author__ = "SAUMS"
|
|
20
20
|
__email__ = "saums1391@gmail.com"
|
|
21
21
|
__description__ = "Operate With SQLite3 Buy Simple"
|
|
@@ -45,7 +45,7 @@ def _compile(expr):
|
|
|
45
45
|
if isinstance(expr.left, _Expression) or isinstance(expr.right, _Expression):
|
|
46
46
|
left_sql, left_params = _compile(expr.left)
|
|
47
47
|
right_sql, right_params = _compile(expr.right)
|
|
48
|
-
sql = f"{left_sql} {expr.op} {right_sql}"
|
|
48
|
+
sql = f"({left_sql}) {expr.op} ({right_sql})"
|
|
49
49
|
params = left_params + right_params
|
|
50
50
|
return sql, params
|
|
51
51
|
elif isinstance(expr.left, _Aggregate):
|
|
@@ -275,7 +275,8 @@ class Connect:
|
|
|
275
275
|
# ____________| BASIC |_________
|
|
276
276
|
def run_query(self, code: str, parameters: tuple=()) -> list:
|
|
277
277
|
self._cur.execute(code, parameters)
|
|
278
|
-
|
|
278
|
+
if not "SELECT" in code:
|
|
279
|
+
self._con.commit()
|
|
279
280
|
return self._cur.fetchall()
|
|
280
281
|
|
|
281
282
|
def optimize(self) -> None:
|
|
@@ -284,10 +285,12 @@ class Connect:
|
|
|
284
285
|
self._con.commit()
|
|
285
286
|
|
|
286
287
|
def save_to_database(self) -> None:
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
self.
|
|
290
|
-
|
|
288
|
+
try:
|
|
289
|
+
with self._con:
|
|
290
|
+
for sql_code in self._changes:
|
|
291
|
+
self._cur.execute(*sql_code)
|
|
292
|
+
finally:
|
|
293
|
+
self._changes.clear()
|
|
291
294
|
|
|
292
295
|
def close(self):
|
|
293
296
|
self._con.close()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|