Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def next(self, flags=0): return self.get_1(flags|db.DB_NEXT)
def prev(self, flags=0): return self.get_1(flags|db.DB_PREV)
def open (self, path, purge=0):
self.path = path
if purge:
self.purge_database()
print 'DB3OPEN: path=%s contains %s' %(path, os.listdir(path))
self._pdb = self.db3open('PDB01', db.DB_BTREE)
self._adb = self.db3open('AUT01', db.DB_BTREE)
self._kdb = self.db3open('KEY01', db.DB_BTREE)
self._ndb = self.db3open('NUM01', db.DB_BTREE)
self._rdb = self.db3open('REF01', db.DB_BTREE)
self._tdb = self.db3open('TIT01', db.DB_BTREE)
self._cnf = self.db3open('CNF01', db.DB_HASH)
self.sysid = Counter(self._cnf, 'SYS', 1)
self.tmpid = Counter (self._cnf, 'TMP', 999000000)
self.syscnt = Counter(self._cnf, 'SZS', 0)
self.tmpcnt = Counter(self._cnf, 'SZT', 0)
return
It assumes that the tables either exist and are in the right
format or do not exist (in which case they get created).
It is the responsibility of upgrade code to either create
or remove invalid secondary index tables.
"""
# index tables used just for speeding up searches
self.surnames = self.__open_db(self.full_name, SURNAMES, db.DB_BTREE,
db.DB_DUP | db.DB_DUPSORT)
db_maps = [
("id_trans", IDTRANS, db.DB_HASH, 0),
("fid_trans", FIDTRANS, db.DB_HASH, 0),
("eid_trans", EIDTRANS, db.DB_HASH, 0),
("pid_trans", PIDTRANS, db.DB_HASH, 0),
("sid_trans", SIDTRANS, db.DB_HASH, 0),
("cid_trans", CIDTRANS, db.DB_HASH, 0),
("oid_trans", OIDTRANS, db.DB_HASH, 0),
("rid_trans", RIDTRANS, db.DB_HASH, 0),
("nid_trans", NIDTRANS, db.DB_HASH, 0),
("tag_trans", TAGTRANS, db.DB_HASH, 0),
("parents", PPARENT, db.DB_HASH, 0),
("reference_map_primary_map", REF_PRI, db.DB_BTREE, 0),
("reference_map_referenced_map", REF_REF, db.DB_BTREE, db.DB_DUPSORT),
]
for (dbmap, dbname, dbtype, dbflags) in db_maps:
_db = self.__open_db(self.full_name, dbname, dbtype,
db.DB_DUP | dbflags)
setattr(self, dbmap, _db)
def first(self, flags=0): return self.get_1(flags|db.DB_FIRST)
def last(self, flags=0): return self.get_1(flags|db.DB_LAST)
def open (self, path, purge=0):
self.path = path
if purge:
self.purge_database()
print 'DB3OPEN: path=%s contains %s' %(path, os.listdir(path))
self._pdb = self.db3open('PDB01', db.DB_BTREE)
self._adb = self.db3open('AUT01', db.DB_BTREE)
self._kdb = self.db3open('KEY01', db.DB_BTREE)
self._ndb = self.db3open('NUM01', db.DB_BTREE)
self._rdb = self.db3open('REF01', db.DB_BTREE)
self._tdb = self.db3open('TIT01', db.DB_BTREE)
self._cnf = self.db3open('CNF01', db.DB_HASH)
self.sysid = Counter(self._cnf, 'SYS', 1)
self.tmpid = Counter (self._cnf, 'TMP', 999000000)
self.syscnt = Counter(self._cnf, 'SZS', 0)
self.tmpcnt = Counter(self._cnf, 'SZT', 0)
return
def next_nodup(self, flags=0): return self.get_1(flags|db.DB_NEXT_NODUP)
def prev_nodup(self, flags=0): return self.get_1(flags|db.DB_PREV_NODUP)