mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Expose sqlite transaction via db.new_api
This commit is contained in:
parent
d3af35fa6d
commit
7e88bac83a
@ -1476,6 +1476,12 @@ class DB:
|
|||||||
self.user_version = 1
|
self.user_version = 1
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
self.conn.__enter__()
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, tb):
|
||||||
|
self.conn.__exit__(exc_type, exc_value, tb)
|
||||||
|
|
||||||
def clone_for_readonly_access(self, dest_dir: str) -> str:
|
def clone_for_readonly_access(self, dest_dir: str) -> str:
|
||||||
dbpath = os.path.abspath(self.conn.db_filename('main'))
|
dbpath = os.path.abspath(self.conn.db_filename('main'))
|
||||||
clone_db_path = os.path.join(dest_dir, os.path.basename(dbpath))
|
clone_db_path = os.path.join(dest_dir, os.path.basename(dbpath))
|
||||||
|
@ -294,6 +294,12 @@ class Cache:
|
|||||||
def last_modified(self):
|
def last_modified(self):
|
||||||
return self.backend.last_modified()
|
return self.backend.last_modified()
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
self.backend.__enter__()
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, tb):
|
||||||
|
self.backend.__exit__(exc_type, exc_value, tb)
|
||||||
|
|
||||||
@write_api
|
@write_api
|
||||||
def clear_caches(self, book_ids=None, template_cache=True, search_cache=True):
|
def clear_caches(self, book_ids=None, template_cache=True, search_cache=True):
|
||||||
if template_cache:
|
if template_cache:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user