[SQLObject] Re: Problems with transactions
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Cyril E. <cy...@de...> - 2004-08-30 16:33:27
|
I answer my own message, I didn't understand that I must pass a transction object in lieu of the connection object. That works this way. But I think there is a problem yet with the pool of sql connections when doing multithreading. Not sure that the same SQL connection is used twice by _runWithConnection during a transaction implying multiple SQL statements. Any ideas? Cyril Elkaim Cyril Elkaim wrote: > Hello, again. > > Put it simply Transactions do not work. In fact you must have > autoCommit=True to make them work. Here is a transcript of what happens > when you set autoCommit=false: > > 1/Pool : ACQUIRE pool=[] > 1/QueryIns: INSERT INTO Repository.Category (id, description, > language, number) VALUES ('FR_FR.CAT1', 'Consultation', 'fr_FR', 'A') > 1/Pool : RELEASE (implicit, autocommit=0) pool=[] > 1/ROLLBACK: auto > 1/Pool : ACQUIRE pool=[] > 1/QueryOne: SELECT description, language, number FROM > Repository.Category WHERE id = 'FR_FR.CAT1' > 1/Pool : RELEASE (implicit, autocommit=0) pool=[] > 1/ROLLBACK: auto > > > The QueryOne request fails always because the INSERT request have been > roll back. The reason is that SQLObject creates, and closes a connection > for each SQL statement. Why this behaviour? Should it not be possible to > open the database connection when creating the SQLObject connection and > releasing it _only_ when its parent is destroyed by the client code? > > > Again, I'm ready to go into the code but I need to know the method to > send patches. > > > Cyril Elkaim > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click |