get_transaction().commit() does not commit
I guess it is another newbie question, but I can not save data to the DB: I open the DB like this: self.st = FileStorage.FileStorage(self.mountedDB) self.db = DB(self.st) self.connection = self.db.open() self.dbroot = self.connection.root() self.dbroot = OOBTree() return (True,'db mounted:'+ self.mountedDB) Next I make a number of changes to self.dbroot: self.dbroot[CstNo] [FY] ['1'] ['E'] = {} self.dbroot[CstNo] [FY] ['1'] ['S'] = {} self.dbroot[CstNo] [FY] ['1'] ['accno'] = {} self.dbroot[CstNo] [FY] ['1'] ['acba' ] = {} self._p_changed = 1 get_transaction().commit() And then I close: get_transaction().commit() # commit any changes that may be pending. self.connection.close() self.db.close() self.st.close() When I open again and try verify whether the keys exist, using self.dbroot.has_key(CstNo) # for example they do not exist. Looking at the DB with a text editor to see what is in there, reveals that there is nothing. The entire program runs through without any error.
Harm, Have a loot at Andreas Jung's article on persistance in python: http://www.linux-magazine.com/issue/13/Python.pdf Regards, Pieter -- http://zwiki.org/PieterB
Harm_Kirchhoff@mail.digital.co.jp wrote at 2003-11-14 19:28 +0900:
I guess it is another newbie question, but I can not save data to the DB:
I open the DB like this:
self.st = FileStorage.FileStorage(self.mountedDB) self.db = DB(self.st) self.connection = self.db.open() self.dbroot = self.connection.root() self.dbroot = OOBTree() return (True,'db mounted:'+ self.mountedDB)
Next I make a number of changes to self.dbroot:
self.dbroot[CstNo] [FY] ['1'] ['E'] = {}
Are you sure, this code is executed? An "OOBTree" would not allow these operations.
... When I open again and try verify whether the keys exist, using self.dbroot.has_key(CstNo) # for example they do not exist. Looking at the DB with a text editor to see what is in there, reveals that there is nothing. The entire program runs through without any error.
There must be more about which you do not tell us. Somewhere inside this darkness is something that confuses you. -- Dieter
participants (3)
-
Dieter Maurer -
Harm_Kirchhoff@mail.digital.co.jp -
PieterB