|
From: alejo a. <a_l...@ya...> - 2005-08-29 22:11:22
|
Hi,
I have a problem with transaction, when i put commit
it's ok but when i put rollback i have some problems
like:
assert not self._obsolete, "This transaction has
already gone through COMMIT/ROLLBACK; create another
transaction"
AssertionError: This transaction has already gone
through COMMIT/ROLLBACK; create another transaction
I don't why.
thanks for your advice.
from sqlobject import *
__connection__ =
connectionForURI("sqlite:///home/alejo/base1.db")
__connection__.autoCommit=False
trans = __connection__.transaction()
class PruebaT(SQLObject):
_cacheValue = False
_connection = trans
a = IntCol()
class PruebaT1(SQLObject):
_cacheValue = False
_connection = trans
a = IntCol()
PruebaT.dropTable(ifExists=True)
PruebaT.createTable()
trans.commit()
#trans.begin()
#trans.commit()
#trans.rollback()
a1 = PruebaT(a=1)
a2 = PruebaT(a=2)
a1.set(a=3)
a3 = list(PruebaT.select(PruebaT.q.id == 2))[0]
a3.set(a=7)
print "a2 --> ",a2
print "a3 --> ",a3
print a1
#trans.rollback()
#trans.commit()
#trans.rollback()
a2.set(a=5)
print "A2: ",a2
#trans.commit()
##
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|