Now using batch transactions
This commit is contained in:
parent
d69f8a6d3c
commit
8be61709b8
@ -495,16 +495,14 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
return None
|
||||
|
||||
def transaction_commit(self, txn):
|
||||
## FIXME
|
||||
pass
|
||||
self.dbapi.commit()
|
||||
|
||||
def get_undodb(self):
|
||||
## FIXME
|
||||
return None
|
||||
|
||||
def transaction_abort(self, txn):
|
||||
## FIXME
|
||||
pass
|
||||
self.dbapi.rollback()
|
||||
|
||||
@staticmethod
|
||||
def _validated_id_prefix(val, default):
|
||||
@ -1248,7 +1246,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_person(self, person, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if person.handle in self.person_map:
|
||||
emit = "person-update"
|
||||
self.dbapi.execute("""UPDATE person SET gramps_id = ?,
|
||||
@ -1267,6 +1264,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
self._order_by_person_key(person),
|
||||
person.gramps_id,
|
||||
pickle.dumps(person.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
@ -1274,7 +1272,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_family(self, family, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if family.handle in self.family_map:
|
||||
emit = "family-update"
|
||||
self.dbapi.execute("""UPDATE family SET gramps_id = ?,
|
||||
@ -1288,6 +1285,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
self.dbapi.execute("insert into family values(?, ?, ?);",
|
||||
[family.handle, family.gramps_id,
|
||||
pickle.dumps(family.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
@ -1295,7 +1293,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_citation(self, citation, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if citation.handle in self.citation_map:
|
||||
emit = "citation-update"
|
||||
self.dbapi.execute("""UPDATE citation SET gramps_id = ?,
|
||||
@ -1313,6 +1310,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
self._order_by_citation_key(citation),
|
||||
citation.gramps_id,
|
||||
pickle.dumps(citation.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
@ -1320,7 +1318,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_source(self, source, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if source.handle in self.source_map:
|
||||
emit = "source-update"
|
||||
self.dbapi.execute("""UPDATE source SET gramps_id = ?,
|
||||
@ -1338,6 +1335,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
self._order_by_source_key(source),
|
||||
source.gramps_id,
|
||||
pickle.dumps(source.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
@ -1345,7 +1343,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_repository(self, repository, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if repository.handle in self.repository_map:
|
||||
emit = "repository-update"
|
||||
self.dbapi.execute("""UPDATE repository SET gramps_id = ?,
|
||||
@ -1358,6 +1355,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
emit = "repository-add"
|
||||
self.dbapi.execute("insert into repository values(?, ?, ?);",
|
||||
[repository.handle, repository.gramps_id, pickle.dumps(repository.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
@ -1365,7 +1363,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_note(self, note, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if note.handle in self.note_map:
|
||||
emit = "note-update"
|
||||
self.dbapi.execute("""UPDATE note SET gramps_id = ?,
|
||||
@ -1378,6 +1375,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
emit = "note-add"
|
||||
self.dbapi.execute("insert into note values(?, ?, ?);",
|
||||
[note.handle, note.gramps_id, pickle.dumps(note.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
@ -1385,7 +1383,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_place(self, place, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if place.handle in self.place_map:
|
||||
emit = "place-update"
|
||||
self.dbapi.execute("""UPDATE place SET gramps_id = ?,
|
||||
@ -1403,6 +1400,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
self._order_by_place_key(place),
|
||||
place.gramps_id,
|
||||
pickle.dumps(place.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
@ -1410,7 +1408,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_event(self, event, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if event.handle in self.event_map:
|
||||
emit = "event-update"
|
||||
self.dbapi.execute("""UPDATE event SET gramps_id = ?,
|
||||
@ -1425,6 +1422,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
[event.handle,
|
||||
event.gramps_id,
|
||||
pickle.dumps(event.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
@ -1432,7 +1430,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_tag(self, tag, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if tag.handle in self.tag_map:
|
||||
emit = "tag-update"
|
||||
self.dbapi.execute("""UPDATE tag SET blob = ?,
|
||||
@ -1447,6 +1444,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
[tag.handle,
|
||||
self._order_by_tag_key(tag),
|
||||
pickle.dumps(tag.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
@ -1454,7 +1452,6 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
|
||||
def commit_media_object(self, media, trans, change_time=None):
|
||||
emit = None
|
||||
if True or not trans.batch:
|
||||
if media.handle in self.media_map:
|
||||
emit = "media-update"
|
||||
self.dbapi.execute("""UPDATE media SET gramps_id = ?,
|
||||
@ -1472,6 +1469,7 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
||||
self._order_by_media_key(media),
|
||||
media.gramps_id,
|
||||
pickle.dumps(media.serialize())])
|
||||
if not trans.batch:
|
||||
self.dbapi.commit()
|
||||
# Emit after added:
|
||||
if emit:
|
||||
|
Loading…
Reference in New Issue
Block a user