From 00d7445c268886be982311169aa85e2d7a025e82 Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Wed, 11 Feb 2026 10:45:42 +0000 Subject: [PATCH] fix: add fetchall() and fetchone() helper methods to DatabaseManager - Code was calling db.fetchall() and db.fetchone() but these methods didn't exist - Add helper methods that execute query and return results - Fixes template loading and other database operations --- core/database.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/core/database.py b/core/database.py index 714045e..bcddad6 100644 --- a/core/database.py +++ b/core/database.py @@ -152,6 +152,34 @@ class DatabaseManager: conn = self.get_connection() return conn.executemany(query, parameters) + def fetchall(self, query: str, parameters: tuple = ()) -> List[sqlite3.Row]: + """ + Execute query and fetch all results. + + Args: + query: SQL query string + parameters: Query parameters + + Returns: + List of row objects + """ + cursor = self.execute(query, parameters) + return cursor.fetchall() + + def fetchone(self, query: str, parameters: tuple = ()) -> Optional[sqlite3.Row]: + """ + Execute query and fetch first result. + + Args: + query: SQL query string + parameters: Query parameters + + Returns: + Single row or None + """ + cursor = self.execute(query, parameters) + return cursor.fetchone() + def commit(self) -> None: """Commit current transaction.""" if self._connection: