changing autocommit

leitao-Zkq4WM0RTTBfJ/[email protected] (Breno Leit?o) Mon, 6 Dec 2004 17:51:38 -0200
Newsgroups gmane.comp.python.db.pypgsql.user
Organization Async Open Source, Brazil
Message-ID <[email protected]>
Hello guyz, 
    I am having a trouble with autocommit, the problem is: 
    I want that autocommit be alway on. Then i did a function called 
    atomic_start, that turn autocommit off and make the next commands a 
    transaction, so when i call atmic_commit, it commits,
    self.connection.commit. But i see that i cant change autocommit after i
    have activate a cursor, see: 

    AttributeError: Can't change autocommit when a cursor is active.

    Any suggestion?

Cheers, 

Breno Leitao
http://lcr.icmc.usp.br/~leitao
-- 
Async Open Source
(16) 3361 2331
São Carlos, SP
Brasil

Code: 
    def atomic_start(self):
        self.connection.autocommit = 0
        self.run_query(query)

    def atomic_commit(self): 
        self.connection.commit()
        self.connection.autocommit = 1



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/