예제 #1
0
 def close(self):
     """ Close the connection. The connection will be unusable from this
     point forward; an Error  exception will be raised if any operation
     is attempted with the connection. The same applies to all cursor
     objects trying to use the connection.  Note that closing a connection
     without committing the changes first will cause an implicit rollback
     to be performed.
     """
     if self.mapi:
         if not self.autocommit:
             self.rollback()
         self.mapi.disconnect()
         self.mapi = None
     else:
         raise exceptions.Error("already closed")
예제 #2
0
 def __mapi_check(self):
     """ check if there is a connection with a server """
     if not self.mapi:
         raise exceptions.Error("connection closed")
     return True