Add Search ability

This commit is contained in:
Miguel Jacq 2025-11-01 17:44:23 +11:00
parent 72862f9a4f
commit 53e99af912
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
9 changed files with 224 additions and 9 deletions

View file

@ -100,6 +100,12 @@ class DBManager:
)
self.conn.commit()
def search_entries(self, text: str) -> list[str]:
cur = self.conn.cursor()
pattern = f"%{text}%"
cur.execute("SELECT * FROM entries WHERE TRIM(content) LIKE ?", (pattern,))
return [r for r in cur.fetchall()]
def dates_with_content(self) -> list[str]:
cur = self.conn.cursor()
cur.execute("SELECT date FROM entries WHERE TRIM(content) <> '';")