diff sat/memory/sqlite.py @ 3079:f8cc88c773c8

core (memory/sqlite): added `before_uid` filter to retrieve history before a message UID
author Goffi <goffi@goffi.org>
date Thu, 05 Dec 2019 22:58:06 +0100
parents ab2696e34d29
children 0c29155ac68b
line wrap: on
line diff
--- a/sat/memory/sqlite.py	Mon Nov 18 22:34:13 2019 +0100
+++ b/sat/memory/sqlite.py	Thu Dec 05 22:58:06 2019 +0100
@@ -625,6 +625,9 @@
             if 'timestamp_start' in filters:
                 query_parts.append("AND timestamp>= ?")
                 values.append(float(filters['timestamp_start']))
+            if 'before_uid' in filters:
+                query_parts.append("AND history.rowid<(select rowid from history where uid=?)")
+                values.append(filters['before_uid'])
             if 'body' in filters:
                 # TODO: use REGEXP (function to be defined) instead of GLOB: https://www.sqlite.org/lang_expr.html
                 query_parts.append("AND message LIKE ?")