def destructor(self): assert isinstance(self, W_Connection) if self.release: roci.OCITransRollback(self.handle, self.environment.errorHandle, roci.OCI_DEFAULT) roci.OCISessionRelease(self.handle, self.environment.errorHandle, None, 0, roci.OCI_DEFAULT) else: if self.sessionHandle: roci.OCITransRollback(self.handle, self.environment.errorHandle, roci.OCI_DEFAULT) roci.OCISessionEnd(self.handle, self.environment.errorHandle, self.sessionHandle, roci.OCI_DEFAULT) if self.serverHandle: roci.OCIServerDetach(self.serverHandle, self.environment.errorHandle, roci.OCI_DEFAULT)
def close(self, space): # make sure we are actually connnected self._checkConnected(space) # perform a rollback status = roci.OCITransRollback(self.handle, self.environment.errorHandle, roci.OCI_DEFAULT) self.environment.checkForError(status, "Connection_Close(): rollback") # logoff of the server if self.sessionHandle: status = roci.OCISessionEnd(self.handle, self.environment.errorHandle, self.sessionHandle, roci.OCI_DEFAULT) self.environment.checkForError(status, "Connection_Close(): end session") roci.OCIHandleFree(self.handle, roci.OCI_HTYPE_SVCCTX) self.handle = lltype.nullptr(roci.OCISvcCtx.TO)
def __del__(self): if self.release: roci.OCITransRollback( self.handle, self.environment.errorHandle, roci.OCI_DEFAULT) roci.OCISessionRelease( self.handle, self.environment.errorHandle, None, 0, roci.OCI_DEFAULT) else: if self.sessionHandle: roci.OCITransRollback( self.handle, self.environment.errorHandle, roci.OCI_DEFAULT) roci.OCISessionEnd( self.handle, self.environment.errorHandle, self.sessionHandle, roci.OCI_DEFAULT) if self.serverHandle: roci.OCIServerDetach( self.serverHandle, self.environment.errorHandle, roci.OCI_DEFAULT)