Uwe Grauer schrieb: > Sibylle Koczian wrote: >> Hello, >> ...
>> >> I'm using a temporary cursor, like this, in a method of my bizobj: >> >> def nextMach(self, neubemerk=None): >> idst = self.getFieldVal('idst') >> gemacht = self.Record.gemacht >> crs = self.getTempCursor() >> try: >> crs.execute('EXECUTE PROCEDURE sp_naechstesmal(?, ?, ?)', >> (idst, gemacht, neubemerk)) > > params=(idst, gemacht, neubemerk) > crs.execute(sqlstr, params) > Same thing - as you wrote in your next post. ... >> >> Database is Firebird, and I suppose the transaction simply has to be >> committed. Is dBizobj.commitTransaction() the right method or is there a >> separate commit method for the temporary cursor? And do I need >> dBizobj.startTransaction() first? >> >> And is a temporary cursor the right way? >> >> Suppose the database has stored procedures for all inserts, updates, >> deletes. How to use that with a Dabo bizobj, which doesn't let me define >> my own insert, update, delete statements? >> >> Thank you, >> Sibylle >> > > Firebird needs transactions (even for selects)! Yes, I know. This is a Dabo problem, not a Firebird problem: what's the bizobj doing anyway and what have I got to do myself? > > In order to get you going i just show how i use a userdefined bizobj method: > > class MyBizobj(dabo.biz.dBizobj): > .... > def deleteCurrentRecord(self, startTransaction=True): > cursor = self._CurrentCursor > isTransactionManager = False > if startTransaction: > isTransactionManager = self._getTransactionToken() > if isTransactionManager: > cursor.beginTransaction() > try: > self.delete(startTransaction=False) > if isTransactionManager: > cursor.commitTransaction() > self._releaseTransactionToken() > all_ok = 1 > except dException.DBQueryException, e: > if isTransactionManager: > cursor.rollbackTransaction() > self._releaseTransactionToken() > raise dException.DBQueryException, e > except StandardError, e: > if isTransactionManager: > cursor.rollbackTransaction() > self._releaseTransactionToken() > raise StandardError, e > > > Instead of calling self.delete(startTransaction=False) you will need to > call execute for your stored proc. > It will work for a tempCursor and for the normal cursor, but i would use > a tempCursor. > Execute doesn't take a parameter startTransaction, so I suppose I need beginTransaction() and commitTransaction() (or rollbackTransaction()), right? With your example I hope I get this going. Thank you, Sibylle -- Sibylle Koczian _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/49da53b6.9070...@t-online.de