* src/GrampsDb/_GrampsBSDDB.py (transaction_begin,
transaction_commit): only do secondary index magic if not instructde otherwise; (BdbTransaction.__init__): accept additional argument, pass it on to Transaction class. * src/GrampsDb/_GrampsDbBase.py (Transaction.__init__): accept additional argument for no_magic. * src/GrampsDb/_ReadGedcom.py (NoteParser): count people during first pass; (parse_gedcom_file): start transaction with or without secondary index magic. * src/GrampsDb/_ReadXML.py (LineParser):count people during first pass; (parse): start transaction with or without secondary index magic. svn: r5865
This commit is contained in:
@@ -1865,18 +1865,29 @@ class Transaction:
|
||||
Defines a group of database commits that define a single logical
|
||||
operation.
|
||||
"""
|
||||
def __init__(self,msg,db,batch=False):
|
||||
def __init__(self,msg,db,batch=False,no_magic=False):
|
||||
"""
|
||||
Creates a new transaction. A Transaction instance should not be created
|
||||
directly, but by the GrampsDbBase class or classes derived from
|
||||
GrampsDbBase. The db parameter is a list-like interface that stores
|
||||
the commit data. This could be a simple list, or a RECNO-style database
|
||||
object.
|
||||
Creates a new transaction. A Transaction instance should not be
|
||||
created directly, but by the GrampsDbBase class or classes derived
|
||||
from GrampsDbBase. The db parameter is a list-like interface that
|
||||
stores the commit data. This could be a simple list, or a RECNO-style
|
||||
database object.
|
||||
|
||||
The batch parameter is set to True for large transactions. For such
|
||||
transactions, the list of changes is not maintained, and no undo
|
||||
is possible.
|
||||
|
||||
The no_magic parameter is ignored for non-batch transactions, and
|
||||
is also of no importance for DB backends other than BSD DB. For
|
||||
the BSDDB, when this paramter is set to True, some secondary
|
||||
indices will be removed at the beginning and then rebuilt at
|
||||
the end of such transaction (only if it is batch).
|
||||
"""
|
||||
self.db = db
|
||||
self.first = None
|
||||
self.last = None
|
||||
self.batch = batch
|
||||
self.no_magic = no_magic
|
||||
self.length = 0
|
||||
|
||||
self.person_add = []
|
||||
|
Reference in New Issue
Block a user