Re: [SQLObject] mysql connection losses
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2004-03-18 16:37:54
|
David Warnock wrote: > Looking at the db api spec and DBAPIConnection I wonder what would > happen if we called rollback again in the getConnection. > > In theory there cannot be a transaction in progress as release > connection will have already done a commit or rollback. > > So what is the effect of calling rollback, rollback on a connection? I > guess we might get an exception which is easy to cope with, but will it > do enough for us to know if the connection is valid? That seems like it might be problematic. For instance, what if rollback is a no-op or something? It shouldn't be, but I wouldn't feel confident that there's not a hidden corner case in the semantics. > Otherwise it will need to do it in the db specific classes eg for mysql > there is conn.ping() for mysql see > http://www.esrf.fr/computing/bliss/python2/MySQL/MySQLdb-2.html That looks like the right thing to use. Doing it in a database-specific way is no problem. It just requires an additional method call in getConnection (say, pingConnection), which by default is a no-op, and we override it for the various databases. Ian |