Support to list snapshot

This commit is contained in:
WQY\qiong
2023-03-03 20:40:05 +08:00
parent bb3cd2bb7f
commit dde045b6b8
3 changed files with 12 additions and 0 deletions

View File

@@ -162,6 +162,14 @@ def execute_redo(name: str) -> ChangeSet:
return ChangeSet.from_list(e)
def list_snapshot(name: str) -> list[tuple[int, str]]:
rows = read_all(name, f'select * from operation order by id')
result = []
for row in rows:
result.append((int(row['id']), str(row['tag'])))
return result
def have_snapshot(name: str, tag: str) -> bool:
return read(name, f"select id from snapshot_operation where tag = '{tag}'") != None