diff options
author | Sören Tempel <soeren+git@soeren-tempel.net> | 2021-05-26 21:59:22 +0200 |
---|---|---|
committer | Sören Tempel <soeren+git@soeren-tempel.net> | 2021-05-26 21:59:22 +0200 |
commit | 662d93b8605f6c84dd228841a5c5d9eab3f59186 (patch) | |
tree | 35f4ddeddd6447147eeae608a82a9e68f1db3384 /saneterm | |
parent | 34d7db276acc15c61e20d94bbfaee15f35552966 (diff) |
history: simplify get_entry query even further
Since 61ca4b802c7df75de8a31c6e409eeae15190accf the explicit size check should no longer be needed, i.e. offset selects nothing already if the offset exceeds the amount of available entries.
Diffstat (limited to 'saneterm')
-rw-r--r-- | saneterm/history.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/saneterm/history.py b/saneterm/history.py index fba974a..01280b9 100644 --- a/saneterm/history.py +++ b/saneterm/history.py @@ -74,8 +74,7 @@ class History(): # Select an entry by the given offset. If the offset exceeds the # amount of available entries, select nothing and return None. self.__cur.execute(""" - SELECT entry FROM history WHERE exe=:exe AND - ( SELECT count(*) FROM history WHERE exe=:exe ) >= :offset + SELECT entry FROM history WHERE exe=:exe ORDER BY rowid DESC LIMIT 1 OFFSET :offset; """, {"exe": exe, "offset": offset}) |