Some headway on database stuff

This commit is contained in:
2025-10-14 20:41:37 -04:00
parent a30961f884
commit 16dc75a57d
7 changed files with 34 additions and 4 deletions

View File

View File

@@ -35,13 +35,13 @@ class Database():
return self.query(query_string, values)[0]
def delete(self, table: str, where: list[dict]=None) -> int:
def delete(self, table: str, values: list, where: list[dict]=None) -> int:
query_string = "DELETE FROM {table}{where}".format(
table = table,
where = self.__generate_basic_where_clause(where) if not where is None else ""
)
return self.query(query_string)[0]
return self.query(query_string, values)[0]
def __generate_basic_where_clause(self, where: list[dict]):
return " WHERE {clauses}".format(

View File

@@ -1,9 +1,9 @@
from database import Database
from .database import Database
import sqlite3
class SQLite(Database):
def __init__(self, db_name: str):
super(self, Database).__init__()
super(Database, self).__init__()
self.db = sqlite3.connect(db_name)
self.db.autocommit = True