
On Oct 3, 2006, at 2:03 PM, Fabian Groffen wrote:
On 03-10-2006 13:59:16 +0200, Ronald Oussoren wrote:
Something completely different: how do I coax the python DB-API implementation out of autocommit mode?
import MonetSQLdb conn = MonetSQLdb.connect() cursor = conn.cursor() conn.commit() # -> raises RuntimeError
Any updates you do through 'conn' are also instantationious, e.g. no transactions. I can use the 'START TRANSACTION' query to explictly start a transaction, but I then have to keep track of whether I've used 'START TRANSACTION' on one of the active cursors because executing START TRANSACTION inside a transaction seems to break that transaction.
The effect I'm looking after is that of the interactive MapiClient when autocommit is disabled: you don't have to start transactions explicitly but are always in one.
Isn't there a conn.setAutoCommit() or something? Switching off auto-commit, is done through a control command Xautocommit 0 (or 1 to enable it again). It is different from START TRANSACTION in that sense that upon a COMMIT the auto-commit is retained (switched off).
I did find a mapi_setAutocommit function in MapiLib that isn't exposed through the DB-API interface. I've added a setAutocommit method to MonetSQLdb.Connection that calls the mapi method of the same name and that does work. Thanks again, Ronald
---------------------------------------------------------------------- --- 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 _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users