Project

General

Profile

« Previous | Next » 

Revision 3135

sql.py: DbConn: _savepoint starts at 1 because the driver is not in autocommit mode, so a transaction is already open

View differences:

sql.py
192 192
    def close(self):
193 193
        if not self.connected(): return
194 194
        
195
        # Record that the automatic transaction is now closed
196
        if not self.autocommit: self._savepoint -= 1
197
        
195 198
        self.db.close()
196 199
        self._reset()
197 200
    
......
226 229
                    log_level=4)))
227 230
                run_query(self, 'SET search_path TO '+(','.join(search_path)),
228 231
                    log_level=3)
232
            
233
            # Record that a transaction is already open
234
            if not self.autocommit: self._savepoint += 1
229 235
        
230 236
        return self.__db
231 237
    
......
403 409
    
404 410
    def do_autocommit(self):
405 411
        '''Autocommits if outside savepoint'''
406
        assert self._savepoint >= 0
407
        if self.autocommit and self._savepoint == 0:
412
        assert self._savepoint >= 1
413
        if self.autocommit and self._savepoint == 1:
408 414
            self.log_debug('Autocommitting', level=4)
409 415
            self.db.commit()
410 416
    

Also available in: Unified diff