On 1/16/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, Jan 16, 2007 at 03:53:39PM +0100, Dr. Markus Gritsch wrote: > > Unfortunately, I had to further modify the previous patch to get > > reconnected in all cases: The __init__ method of the Iteration class > > has also to use the hack. Further, due to my missing insight into the > > inner workings of SQLObject, I totally neglect the self._pool stuff of > > DBAPI, which (I have the feeling) is not perfect -- therefore I > > labeled the patch to be a hack. > > May be instead of going all the way down the hackish path we could think > of a more generic approach. Let's add an empty (no-op) abstract method to > the DBAPI class > > def wakeup(self, raw_connection): > return raw_connection > > that will be called from getConnection and Iteration. Than MySQLConnection > could overide the method. Something like this: > > def wakeup(self, raw_connection): > try: > raw_connection.ping() > return raw_connection > except MySQLdb.OperationalError, e: > if e.args[0] in ( 2006, 2013 ): # SERVER_GONE or SERVER_LOST error > print 'reconnecting because of', e > conn = self.makeConnection() > return conn > else: > raise
Sounds quite ok. Still, have you any opinion about the pooling-stuff? Further, Dan had also some concerns about transactions. He wrote that if the reconnectiong would happen at MySQLdb level, it could be handled gracefully, but that things will get messed up which the patch to SQLObject, if transactions are involved. Kind regard, Markus ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss