def open(self): """(re)load existing database""" if self.verbose: print "gadfly: loading database", self.databasename from gfdb0 import File_Storage0, Database0 if self.directory: directory = self.directory else: directory = "." fs = self.fs = File_Storage0(self.databasename, directory) db = self.database = fs.load(sql) self.transid = self.transid + 1 self.working_db = Database0(db, self.transaction_log())
def startup(self, databasename, directory, scratch=0, verbose=0): from gfdb0 import Database0, File_Storage0 verbose = self.verbose if verbose: print "gadfly: starting up new ", databasename if self.database: raise error, "cannot startup, database bound" self.databasename = databasename self.directory = directory db = self.database = Database0() db.is_scratch = scratch or self.is_scratch self.fs = File_Storage0(databasename, directory) self.working_db = Database0(db, self.transaction_log()) # commit initializes database files and log structure self.commit() # for now: all transactions serialized # working db shared among all transactions/cursors self.transid = self.transid + 1 self.working_db = Database0(db, self.transaction_log())