diff options
Diffstat (limited to 'gn3')
-rw-r--r-- | gn3/db/__init__.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py index 19135fc..d89dbf4 100644 --- a/gn3/db/__init__.py +++ b/gn3/db/__init__.py @@ -44,10 +44,10 @@ def update(conn: Any, k, v in asdict(data).items() if v is not None and k in TABLEMAP[table]) sql += " WHERE " - sql += "AND ".join(f"{TABLEMAP[table].get(k)} = " - f"'{escape_string(str(v)).decode('utf-8')}'" for - k, v in asdict(where).items() - if v is not None and k in TABLEMAP[table]) + sql += " AND ".join(f"{TABLEMAP[table].get(k)} = " + f"'{escape_string(str(v)).decode('utf-8')}'" for + k, v in asdict(where).items() + if v is not None and k in TABLEMAP[table]) with conn.cursor() as cursor: cursor.execute(sql) return cursor.rowcount @@ -61,10 +61,10 @@ def fetchone(conn: Any, return None sql = f"SELECT * FROM {table} " sql += "WHERE " - sql += "AND ".join(f"{TABLEMAP[table].get(k)} = " - f"'{escape_string(str(v)).decode('utf-8')}'" for - k, v in asdict(where).items() - if v is not None and k in TABLEMAP[table]) + sql += " AND ".join(f"{TABLEMAP[table].get(k)} = " + f"'{escape_string(str(v)).decode('utf-8')}'" for + k, v in asdict(where).items() + if v is not None and k in TABLEMAP[table]) with conn.cursor() as cursor: cursor.execute(sql) return DATACLASSMAP[table](*cursor.fetchone()) |