Commits

Sean Summers committed c9e0b9b

added read-write options

  • Participants
  • Parent commits 32fba9b

Comments (0)

Files changed (3)

 *.idx
 *.swp
 *.db4o
+*.pyc
+data/*
 
 del abspath, dirname, jar, listdir, moduledir, path, sep
 
+from db4o import *
 import com.db4o.Db4oEmbedded.newConfiguration
 import com.db4o.Db4oEmbedded.openFile
 
+def readwriteConfiguration():
+    ''' create a read write DB4O configuration object (to feed db()) '''
+    config = com.db4o.Db4oEmbedded.newConfiguration()
+    cf = config.file()
+    cf.readOnly(False)
+    cf.lockDatabaseFile(True)
+    cf.recoveryMode(True)
+    try:
+        cf.generateCommitTimestamps(True) # >=8.0
+    except AttributeError:
+        cf.generateVersionNumbers(com.db4o.config.ConfigScope.GLOBALLY)   # <8.0
+    cf.generateUUIDs(com.db4o.config.ConfigScope.GLOBALLY)
+    co = config.common()
+    co.callbacks(False)
+    co.callConstructors(False) ## ??
+    co.detectSchemaChanges(True)
+    co.testConstructors(False)
+    try: # >=8.0
+        cid = config.idSystem()
+        cid.useStackedBTreeSystem()
+    except:
+        pass
+    return config
+
 def readonlyConfiguration():
     ''' create a read only DB4O configuration object (to feed db()) '''
     config = com.db4o.Db4oEmbedded.newConfiguration()