Ejemplo n.º 1
0
LONG CuDlgIpmPageProcesses::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
	BOOL bOK = FALSE;
	CPtrList listInfoStruct;
	LOGPROCESSDATAMIN* pData;
	LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
	CString strID;
	CString strPID; 
	CString strType;
	CString strOpenDB;
	CString strWrite;
	CString strForce;
	CString strWait;
	CString strBegin;
	CString strEnd;

	ASSERT (pUps);
	switch (pUps->nIpmHint)
	{
	case 0:
		break;
	default:
		return 0L;
	}

	try
	{
		LOGPROCESSDATAMIN structData;
		CdIpmDoc* pDoc = (CdIpmDoc*)wParam;
		ResetDisplay();
		CaIpmQueryInfo queryInfo(pDoc, OT_MON_LOGPROCESS, pUps, (LPVOID)&structData, sizeof(structData));

		bOK = IPM_QueryInfo (&queryInfo, listInfoStruct);
		if (bOK)
		{
			while (!listInfoStruct.IsEmpty())
			{
				pData = (LOGPROCESSDATAMIN*)listInfoStruct.RemoveHead();
				GetDisplayInfo (pData, strID, strPID, strType, strOpenDB, strWrite, strForce, strWait, strBegin, strEnd);
				AddProcess (strID, strPID, strType, strOpenDB, strWrite, strForce, strWait, strBegin, strEnd, pData);
			}
		}
		return 0L;
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
	}
	catch (CeIpmException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	while (!listInfoStruct.IsEmpty())
		delete (LOGPROCESSDATAMIN*)listInfoStruct.RemoveHead();
	return 0L;
}
Ejemplo n.º 2
0
LONG CuDlgIpmPageLockLists::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
	BOOL bOK = FALSE;
	CPtrList listInfoStruct;
	LOCKLISTDATAMIN* pData;
	LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
	CString strID;
	CString strSession;
	CString strCount;
	CString strLogical;
	CString strMaxL;
	CString strStatus;

	ASSERT (pUps);
	switch (pUps->nIpmHint)
	{
	case 0:
	case FILTER_SYSTEM_LOCK_LISTS:
		break;
	default:
		return 0L;
	}
	try
	{
		LOCKLISTDATAMIN structData;
		CdIpmDoc* pDoc = (CdIpmDoc*)wParam;
		ResetDisplay();
		CaIpmQueryInfo queryInfo(pDoc, OT_MON_LOCKLIST, pUps, (LPVOID)&structData, sizeof(structData));

		bOK = IPM_QueryInfo (&queryInfo, listInfoStruct);
		if (bOK)
		{
			while (!listInfoStruct.IsEmpty())
			{
				pData = (LOCKLISTDATAMIN*)listInfoStruct.RemoveHead();
				GetDisplayInfo (pData, strID, strSession, strCount, strLogical, strMaxL, strStatus);
				AddLockList (strID, strSession, strCount, strLogical, strMaxL, strStatus, pData);
			}
		}
		return 0L;
	}
	catch (CMemoryException* e)
	{
		MessageBeep (-1);
		theApp.OutOfMemoryMessage ();
		e->Delete();
	}
	catch (CeIpmException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	while (!listInfoStruct.IsEmpty())
		delete (LOCKLISTDATAMIN*)listInfoStruct.RemoveHead();
	return 0L;
}
Ejemplo n.º 3
0
int
CGenethonDoc::GetPIRFile( CString PathName, int Append )
{

	CPtrList CommentList;
	CPtrList SequenceList;

	if ( !ReadPIRFile( &CommentList, &SequenceList, PathName ) ) {
		while ( !CommentList.IsEmpty() ) {
			delete (CString *)CommentList.RemoveHead();
		}
		while ( !SequenceList.IsEmpty() ) {
			delete (SeqNameStruct *)SequenceList.RemoveHead();
		}
		return 0;
	}

//	gMaxStrSize;

	return ProcessRows( CommentList, SequenceList, Append );

}
Ejemplo n.º 4
0
LONG CuDlgReplicationServerPageAssignment::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
	LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
	CPtrList listInfoStruct;
	switch (pUps->nIpmHint)
	{
	case 0:
		break;
	default:
		return 0L;
	}
	
	ASSERT (pUps);
	try
	{
		REPLICSERVERDATAMIN RepSvrdta  = *((LPREPLICSERVERDATAMIN)pUps->pStruct);
		//
		// Empty the control:
		m_cListCtrl.DeleteAllItems();
		CdIpmDoc* pIpmDoc = (CdIpmDoc*)wParam;

		CaIpmQueryInfo queryInfo(pIpmDoc, OT_MON_REPLIC_CDDS_ASSIGN,pUps);
		queryInfo.SetNode((LPCTSTR)RepSvrdta.LocalDBNode);
		queryInfo.SetDatabase ((LPCTSTR)RepSvrdta.LocalDBName);

		BOOL bOK = IPM_QueryInfo (&queryInfo, listInfoStruct);
		if (bOK)
		{
			POSITION pos = listInfoStruct.GetHeadPosition();
			while (pos != NULL)
			{
				REPLICCDDSASSIGNDATAMIN* pCdds = (REPLICCDDSASSIGNDATAMIN*)listInfoStruct.GetNext(pos);
				AddItem (pCdds);
			}
		}
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
	}
	catch (CeIpmException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}

	while (!listInfoStruct.IsEmpty())
		delete (REPLICCDDSASSIGNDATAMIN*)listInfoStruct.RemoveHead();
	return 0L;
}
void CXTPMarkupEventHandlerMap::RemoveAll()
{
	POSITION pos = m_mapHandlers.GetStartPosition();
	while (pos)
	{
		CPtrList* pHandlers;
		CXTPMarkupRoutedEvent* pEvent;
		m_mapHandlers.GetNextAssoc(pos, pEvent, pHandlers);

		while (!pHandlers->IsEmpty())
		{
			CXTPMarkupDelegate* pDelegate = (CXTPMarkupDelegate*)pHandlers->RemoveTail();
			MARKUP_RELEASE(pDelegate);
		}
		delete pHandlers;
	}
	m_mapHandlers.RemoveAll();
}
Ejemplo n.º 6
0
int 
CGenethonDoc::GetTextFile( CString PathName, int Append, 
	const CString& SeqName, double SeqWeight, DWORD TextStart, const CString& Descr, int IUPAC )
{

	CPtrList CommentList;
	CPtrList SequenceList;

	gMaxStrSize = 0L;

	if ( !ReadTextFile ( &CommentList, &SequenceList, PathName, SeqName, SeqWeight, TextStart, Descr, IUPAC ) ) {
		while ( !SequenceList.IsEmpty() ) {
			delete (SeqNameStruct *)SequenceList.RemoveHead();
		}
		return 0;
	}

	return ProcessRows( CommentList, SequenceList, Append );
}
Ejemplo n.º 7
0
bool CORDBList::ReadDBInfo()
{
CDBInfo			*db;
CStdioFile		listfile, infofile;
CFileStatus		fstatus;
CFileException	e;
CPtrList		plist;
char			data[1025];
char			*tmp;


	if (infofile.Open(m_ordbinfo, CFile::modeRead)) {
		while (1) {
			memset(data, 0x00, 1024);
			TRY {
				if (infofile.ReadString(data, 1024) == NULL) break;
				data[strlen(data)-1] = NULL;

				db = new CDBInfo();
				tmp = strtok(data, " ");	// db name
				if (tmp) {
					db->m_dbname.Format("%s", tmp);
				}
				tmp = strtok(NULL, " "); // permanent
				if (tmp) {
					if (!strcmp(tmp, "1")) db->m_permanent = true;
					else				  db->m_permanent = false;
				} 
				plist.AddTail(db);
			}
			CATCH_ALL(e)
			{
				break;
			}
			END_CATCH_ALL
		}
		infofile.Close();
	} 

	if (listfile.Open(m_ordblist, CFile::modeRead)) {
		listfile.GetStatus(fstatus);
		m_LastTime = fstatus.m_mtime;
	} else {
		return false;
	}

	while (1) {
		memset(data, 0x00, 1024);
		TRY {
			if (listfile.ReadString(data, 1024) == NULL) break;
			data[strlen(data)-1] = NULL;

			db = new CDBInfo();
			tmp = strtok(data, " ");	// db name
			if (tmp) {
				db->m_dbname.Format("%s", tmp);
			}
			tmp = strtok(NULL, " "); // db path
			if (tmp) {
				db->m_dbpath.Format("%s", tmp);
			}
			tmp = strtok(NULL, " "); // host
			if (tmp) {
				db->m_host.Format("%s", tmp);
			}
			tmp = strtok(NULL, " "); // log path
			if (tmp) {
				db->m_logpath.Format("%s", tmp);
			}
			int cnt = (int) plist.GetCount();
			if (cnt > 0) {
				for (int i = 0; i < cnt; i++) {
					CDBInfo *p = (CDBInfo *)plist.GetAt(plist.FindIndex(i));
					if (db->m_dbname == p->m_dbname) {
						db->m_permanent = p->m_permanent;
						break;
					}
				}
			}
			m_List.AddTail(db);
		}
		CATCH_ALL(e)
		{
			break;
		}
		END_CATCH_ALL
	}

	listfile.Close();

	while (!plist.IsEmpty()) {
		CDBInfo *p = (CDBInfo *)plist.RemoveHead();
		delete p;
	}

	return true;
}
Ejemplo n.º 8
0
BOOL IPM_BuildItemPath (CdIpmDoc* pDoc, CTypedPtrList<CObList, CuIpmTreeFastItem*>& listItemPath)
{
	ASSERT(!pDoc->GetSelectKey().IsEmpty());
	if (pDoc->GetSelectKey().IsEmpty())
		return FALSE;

	BOOL bOK = FALSE;
	int  nLevel = 0;
	int  nParent0type = 0;
	int  nObjectType  = 0;
	CString strParent0 = _T("");
	CString strStaticParent = _T("");
	CStringArray& arrayItemPath = pDoc->GetItemPath();
	void* pStructParent = NULL;
	int narrayItemPathSize = arrayItemPath.GetSize();
	ASSERT(narrayItemPathSize >= 1);
	if (narrayItemPathSize < 1)
		return FALSE;
	CString strObject = arrayItemPath.GetAt(0);
	//
	// Default (from old class CuIpmObjDesc in vdba):
	BOOL bObjectNeedsNameCheck = FALSE;
	BOOL bObjectHasStaticBranch= TRUE;
	BOOL bStaticParentNeedsNameCheck= FALSE;

	if (pDoc->GetSelectKey().CompareNoCase (_T("SERVER")) == 0)
	{
		//
		// Old class CuIpmObjDesc_SERVER in vdba (no overwrite the 3 default booleans above.
		nObjectType  = OT_MON_SERVER;
	}
	else
	if (pDoc->GetSelectKey().CompareNoCase (_T("SESSION")) == 0)
	{
		//
		// Old class CuIpmObjDesc_SESSION in vdba (no overwrite the 3 default booleans above.
		nLevel = 1; // Parent is the SERVER. EX: ii\ingres\158
		nParent0type = OT_MON_SERVER;
		nObjectType  = OT_MON_SESSION;
		ASSERT(narrayItemPathSize >= 2);
		if (narrayItemPathSize < 2)
			return FALSE;
		strParent0   = arrayItemPath.GetAt(0);
		strObject    = arrayItemPath.GetAt(1);
	}
	else
	if (pDoc->GetSelectKey().CompareNoCase (_T("REPLICSERVER")) == 0)
	{
		//
		// Old class CuIpmObjDesc_REPLICSERVER in vdba (overwrite the 2 default booleans above.
		bStaticParentNeedsNameCheck = TRUE;
		bObjectHasStaticBranch = FALSE;
		nLevel = 1; // Parent is the database name
		nParent0type = OT_DATABASE;
		nObjectType  = OT_MON_REPLIC_SERVER;
		ASSERT(narrayItemPathSize >= 1);
		if (narrayItemPathSize < 1)
			return FALSE;
		strStaticParent = _T("Replication");
		strParent0   = arrayItemPath.GetAt(0);
		if (narrayItemPathSize > 1)
			strObject    = arrayItemPath.GetAt(1);
	}
	else
	if (pDoc->GetSelectKey().CompareNoCase (_T("LOGINFO")) == 0)
	{
		//
		// Old class CuIpmObjDesc_LOGINFO in vdba (overwrite the 1 default boolean above.
		bObjectNeedsNameCheck = TRUE;
		strObject.LoadString(IDS_TM_LOGINFO); // "Log information"
	}

	if (nLevel > 0)
	{
		ASSERT (nParent0type);
		ASSERT (!strParent0.IsEmpty());
		// Static parent
		if (bStaticParentNeedsNameCheck) 
		{
			//
			// Only for replication:
			listItemPath.AddTail(new CaTreeItemPath(TRUE, nParent0type, NULL, TRUE, strStaticParent));
		}
		else
		{
			listItemPath.AddTail(new CaTreeItemPath(TRUE, nParent0type));
		}

		int reqSize = IPM_StructSize(nParent0type);
		CPtrList listInfoStruct;
		IPMUPDATEPARAMS ups;
		memset (&ups, 0, sizeof(ups));
		CaIpmQueryInfo queryInfo(pDoc, nParent0type, &ups, (LPVOID)NULL, reqSize);
		queryInfo.SetReportError(FALSE);

		bOK = IPM_QueryInfo (&queryInfo, listInfoStruct);
		if (bOK)
		{
			POSITION p = NULL, pos = listInfoStruct.GetHeadPosition();

			while (pos != NULL)
			{
				p = pos;
				LPVOID pObject = listInfoStruct.GetNext(pos);
				if (MatchedStruct (nParent0type, strParent0, pObject))
				{
					pStructParent = pObject;
					listInfoStruct.RemoveAt (p);
					listItemPath.AddTail(new CaTreeItemPath(FALSE, nParent0type, pObject)); // non-static
					break;
				}
			}
			while (!listInfoStruct.IsEmpty())
				delete listInfoStruct.RemoveHead();
		}

		if (!pStructParent)
			return FALSE;
	}

	//
	// Object itself:
	if (strObject.IsEmpty())
		return bOK;

	if (bObjectNeedsNameCheck)
	{
		listItemPath.AddTail(new CaTreeItemPath(TRUE,  nObjectType, NULL, TRUE, strObject));  // Root item
		bOK = TRUE;
	}
	else
	{
		if (bObjectHasStaticBranch)
			listItemPath.AddTail(new CaTreeItemPath(TRUE, nObjectType));  // static

		int reqSize = IPM_StructSize(nObjectType);
		CPtrList listInfoStruct;
		IPMUPDATEPARAMS ups;
		memset (&ups, 0, sizeof(ups));
		ups.nType   = nParent0type;
		ups.pStruct = pStructParent;
		ups.pSFilter= NULL;

		CaIpmQueryInfo queryInfo(pDoc, nObjectType, &ups, (LPVOID)NULL, reqSize);
		queryInfo.SetReportError(FALSE);

		BOOL bHasObjects = IPM_QueryInfo (&queryInfo, listInfoStruct);
		if (bHasObjects)
		{
#if !defined (_IGNORE_NOT_MATCHED_ITEM)
			bOK = FALSE;
#endif
			POSITION p = NULL, pos = listInfoStruct.GetHeadPosition();
			while (pos != NULL)
			{
				p = pos;
				LPVOID pObject = listInfoStruct.GetNext(pos);
				if (MatchedStruct (nObjectType, strObject, pObject))
				{
					bOK = TRUE;
					listInfoStruct.RemoveAt (p);
					listItemPath.AddTail(new CaTreeItemPath(FALSE, nObjectType, pObject)); // non-static
					break;
				}
			}
			while (!listInfoStruct.IsEmpty())
				delete listInfoStruct.RemoveHead();
		}
	}

	return bOK;
}