ImportGrdb.py: Remove duplication from derived classes
svn: r12661
This commit is contained in:
parent
035096e5b2
commit
d66632812f
@ -115,54 +115,12 @@ class GrampsBSDDBCursor(GrampsCursor):
|
|||||||
self.cursor = source.db.cursor(txn)
|
self.cursor = source.db.cursor(txn)
|
||||||
self.source = source
|
self.source = source
|
||||||
|
|
||||||
def first(self):
|
|
||||||
d = self.cursor.first()
|
|
||||||
if d:
|
|
||||||
return (d[0], pickle.loads(d[1]))
|
|
||||||
return None
|
|
||||||
|
|
||||||
def next(self):
|
|
||||||
d = self.cursor.next()
|
|
||||||
if d:
|
|
||||||
return (d[0], pickle.loads(d[1]))
|
|
||||||
return None
|
|
||||||
|
|
||||||
def close(self):
|
|
||||||
self.cursor.close()
|
|
||||||
|
|
||||||
def delete(self):
|
|
||||||
self.cursor.delete()
|
|
||||||
|
|
||||||
def get_length(self):
|
|
||||||
return self.source.stat()['ndata']
|
|
||||||
|
|
||||||
class GrampsBSDDBAssocCursor(GrampsCursor):
|
class GrampsBSDDBAssocCursor(GrampsCursor):
|
||||||
|
|
||||||
def __init__(self, source, txn=None):
|
def __init__(self, source, txn=None):
|
||||||
self.cursor = source.cursor(txn)
|
self.cursor = source.cursor(txn)
|
||||||
self.source = source
|
self.source = source
|
||||||
|
|
||||||
def first(self):
|
|
||||||
d = self.cursor.first()
|
|
||||||
if d:
|
|
||||||
return (d[0], pickle.loads(d[1]))
|
|
||||||
return None
|
|
||||||
|
|
||||||
def next(self):
|
|
||||||
d = self.cursor.next()
|
|
||||||
if d:
|
|
||||||
return (d[0], pickle.loads(d[1]))
|
|
||||||
return None
|
|
||||||
|
|
||||||
def close(self):
|
|
||||||
self.cursor.close()
|
|
||||||
|
|
||||||
def delete(self):
|
|
||||||
self.cursor.delete()
|
|
||||||
|
|
||||||
def get_length(self):
|
|
||||||
return self.source.stat()['ndata']
|
|
||||||
|
|
||||||
class GrampsBSDDBDupCursor(GrampsBSDDBAssocCursor):
|
class GrampsBSDDBDupCursor(GrampsBSDDBAssocCursor):
|
||||||
"""Cursor that includes handling for duplicate keys"""
|
"""Cursor that includes handling for duplicate keys"""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user