Add Search ability
This commit is contained in:
parent
72862f9a4f
commit
53e99af912
9 changed files with 224 additions and 9 deletions
|
|
@ -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) <> '';")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue