Add batch to DictionaryDB; update Query updates in batch mode
This commit is contained in:
parent
f7a367e602
commit
feaf10b8c9
@ -88,8 +88,8 @@ class Bookmarks:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
class DictionaryTxn(DbTxn):
|
class DictionaryTxn(DbTxn):
|
||||||
def __init__(self, message, db):
|
def __init__(self, message, db, batch=False):
|
||||||
DbTxn.__init__(self, message, db)
|
DbTxn.__init__(self, message, db, batch)
|
||||||
|
|
||||||
def get(self, key, default=None, txn=None, **kwargs):
|
def get(self, key, default=None, txn=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -525,7 +525,7 @@ class Struct(object):
|
|||||||
def update_db(self, trans=None):
|
def update_db(self, trans=None):
|
||||||
if self.db:
|
if self.db:
|
||||||
if trans is None:
|
if trans is None:
|
||||||
with self.transaction("Struct Update", self.db) as trans:
|
with self.transaction("Struct Update", self.db, batch=True) as trans:
|
||||||
new_obj = from_struct(self.struct)
|
new_obj = from_struct(self.struct)
|
||||||
name, handle = self.struct["_class"], self.struct["handle"]
|
name, handle = self.struct["_class"], self.struct["handle"]
|
||||||
old_obj = self.db.get_from_name_and_handle(name, handle)
|
old_obj = self.db.get_from_name_and_handle(name, handle)
|
||||||
|
Loading…
Reference in New Issue
Block a user