コード例 #1
0
void CvSda::OnDraw(CDC* pDC)
{
	CdSda* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	CString strTitle; 
	strTitle.LoadString (AFX_IDS_APP_TITLE);
	strTitle += INGRESII_QueryInstallationID();

	AfxGetMainWnd()->SetWindowText((LPCTSTR)strTitle);}
コード例 #2
0
BOOL CSqlqueryApp::InitInstance()
{
    _tsetlocale(LC_CTYPE ,"");
    BOOL bInit = COleControlModule::InitInstance();

    if (bInit)
    {
        AfxEnableControlContainer();
        TaskAnimateInitialize();
        m_strInstallationID = INGRESII_QueryInstallationID();
    }

    return bInit;
}
コード例 #3
0
BOOL CSvriiaApp::InitInstance() 
{
	m_strInstallationID = INGRESII_QueryInstallationID();
	m_pServer = new CaComServer();
	m_pServer->m_hInstServer = m_hInstance;
	_tsetlocale(LC_CTYPE ,"");	
	_tsetlocale(LC_COLLATE ,"");	
	BOOL bOk = CWinApp::InitInstance();
	if (bOk)
	{
		bOk = TaskAnimateInitialize();
		if (!bOk)
		{
			//
			// Failed to load the dll %1.
			CString strMsg;
			AfxFormatString1(strMsg, IDS_FAIL_TO_LOAD_DLL, _T("<TkAnimat.dll>"));
			AfxMessageBox (strMsg);
			return FALSE;
		}
	}
	m_userData4GetRow.InitResourceString();
	return bOk;
}
コード例 #4
0
int StartReplicServer (int hdl,  LPREPLICSERVERDATAMIN lpReplicServerDta )
{
	const LPCTSTR lpszIngresServiceName = _T("Ingres_Database_%s");
	const LPCTSTR lpszReplicServiceTempl = _T("Ingres_Replicator_%s_%d");
	int ires = RES_SUCCESS;
	TCHAR  tchszCommandLine[200];
	TCHAR* tchszCurLine;
	CString strVName = lpReplicServerDta->RunNode;
	CString msg;

#if !defined (MAINWIN)
	CString strLoc = LIBMON_getLocalHostName();
	if ( strVName.CompareNoCase(strLoc) == 0)
	{
		CString strReplicServiceName;
		CString strIngresServiceName;
		CString strII = INGRESII_QueryInstallationID(FALSE);

		if( strII.IsEmpty() )
		{
			AfxMessageBox (IDS_E_INSTALLATION_NOT_FOUND);
			return RES_ERR;
		}
		strReplicServiceName.Format(lpszReplicServiceTempl, (LPCTSTR)strII, lpReplicServerDta->serverno);
		strIngresServiceName.Format(lpszIngresServiceName,  (LPCTSTR)strII);

		if (!IsServiceInstalled ((LPCTSTR)strReplicServiceName)) 
		{
			// search max server no on local (run) node
			RESOURCEDATAMIN  ResDtaMin;
			REPLICSERVERDATAMIN ReplicSvrDta;
			int i,iservermax=0;
			LPUCHAR vnodeName = (LPUCHAR)GetVirtNodeName ( hdl );
			FillResStructFromDB(&ResDtaMin, lpReplicServerDta->ParentDataBaseName);

			/* 23-Dec-98 :  fixed "error system 3" when exiting the product, in the case       */
			/* VDBA detected that the replicator services were not installed, and proposed     */
			/* to install them automatically.                                                  */
			/* implementation: Replaced GetFirstMonInfo-GetNextMonInfo loop                    */
			/* with DBAGetFirstObject-DBAGetNextObject loop.                                   */
			/* this avoids using the cache for getting the list of servers                     */
			/* (for calculating the argument to be passed to "repinst"), because of a          */
			/* restriction of the cache for repl.servers: cache entries are attached to a node,*/
			/* but for repl.servers, the given entry needs to be connected to other nodes.     */
			/* A special management is implemented for "Monitor windows" attached cache        */
			/* entries, but in the current case, there isn't a monitor window open on the      */
			/* used node (which can be different from the open Monitor Window from which       */
			/* this stuff has been called.                                                     */

			int ires =DBAGetFirstObject (
				(LPUCHAR)vnodeName,
				OT_MON_REPLIC_SERVER,
				1,
				(LPUCHAR *)&ResDtaMin,
				TRUE,
				(LPUCHAR)&ReplicSvrDta,
				NULL,NULL);
			while (ires==RES_SUCCESS) 
			{
				if (! lstrcmpi((LPCTSTR)lpReplicServerDta->RunNode, (LPCTSTR)ReplicSvrDta.RunNode)) {
					if (ReplicSvrDta.serverno>iservermax)
						iservermax=ReplicSvrDta.serverno;
				}
				ires=DBAGetNextObject((LPUCHAR)&ReplicSvrDta,NULL,NULL);
			}
			if ( iservermax == 0 ) {
				//_T("Cannot retrieve number of server(s) - Install services Aborted."
				AfxMessageBox(IDS_E_NB_SERVERS);
				return RES_ERR;
			}
			//"The Ingres Replicator %d service is not installed.\n"
			//"Do you want to invoke 'repinst %d' in the background, "
			//"in order to install all Replicator services required by your replication scheme?"
			msg.Format(IDS_F_SERVICE_NOT_INSTALL,lpReplicServerDta->serverno,iservermax);
			int iansw;
			if (GVvista())
			{
				CMessageBox imb(NULL, msg);
				iansw=imb.DoModal();
			}
			else
				iansw = AfxMessageBox (msg, MB_YESNO|MB_ICONQUESTION);
			if (iansw == IDNO)
				return RES_ERR;
			CString Cmd;
			Cmd.Format(_T("repinst %d"),iservermax);
			if (LIBMON_Mysystem((LPTSTR)(LPCTSTR)Cmd)<0) {
				AfxMessageBox (IDS_E_REPINST_UTIL);//"Failure in invoking the repinst utility"
				return RES_ERR;
			}
			if (!IsServiceInstalled ((LPCTSTR)strReplicServiceName)) {
				AfxMessageBox (IDS_E_REPINST_INSTALL);//"The service has not been installed properly by the repinst utility"
				return RES_ERR;
			}
			//"DBA passwords are required for all services that have been created\n"
			//"Do you want to enter them now?\n"
			//"(If not, you will need to use the Control Panel Services option.)\n"
			//"(Some other settings for these services can only be changed through the control panel.)
			if (GVvista())
			{
				CString str;
				str.Format(IDS_I_PASSWORD_REQUIRED);
				CMessageBox imb(NULL, str);
				iansw = imb.DoModal();	
			}
			else
				iansw = AfxMessageBox (IDS_I_PASSWORD_REQUIRED, MB_YESNO|MB_ICONQUESTION);
			if (iansw == IDNO)
				return RES_ERR;
			// ask for user/password
			CaServiceConfig ServiceParms;
			if (!FillServiceConfig  (ServiceParms))
				return RES_ERR;
			BOOL bOK=TRUE;
			for (i=1;i<=iservermax;i++) {
				strReplicServiceName.Format(lpszReplicServiceTempl, (LPCTSTR)strII, i);
				if (GVvista())
				{
				     CString Cmd;
				     Cmd.Format(_T("repinst config %d -username:%s -password:%s"), iservermax, 
						ServiceParms.m_strAccount, ServiceParms.m_strPassword);
				     if (LIBMON_Mysystem((LPTSTR)(LPCTSTR)Cmd)<0)
				     {
				     	//"Failure in user/password setup for the 'Ingres Replicator %d' service"
					msg.Format(IDS_E_USER_PASSWORD_NB,i);
					AfxMessageBox (msg);
					bOK=FALSE;
				     }
				}
				else
				if (!SetServicePassword ((LPCTSTR) strReplicServiceName, ServiceParms)) {
					//"Failure in user/password setup for the 'Ingres Replicator %d' service"
					msg.Format(IDS_E_USER_PASSWORD_NB,i);
					AfxMessageBox (msg);
					bOK=FALSE;
				}
			}
			if (!bOK)
				return RES_ERR;
			if (!IsServiceRunning(strIngresServiceName)) {
				//"Ingres is currently not started as a service.\n"
				//"You must close all connections in VDBA (or Exit VDBA), "
				//"then stop Ingres, and restart it as a Service if you want "
				//"to start a replicator server on the local installation.\n"
				//"You must also make sure that the user/password for the Ingres service is correct.\n"
				//"Do you want to apply the user/password that you just entered for the replicator services?"
				iansw = AfxMessageBox (IDS_I_INGRES_NOT_STARTED, MB_YESNO|MB_ICONQUESTION);
				if (iansw == IDYES) {
					if (GVvista())
					{
					     CString Cmd;
					     Cmd.Format(_T("repinst config %d -username:%s -password:%s"), iservermax, 
							ServiceParms.m_strAccount, ServiceParms.m_strPassword);
					     if (LIBMON_Mysystem((LPTSTR)(LPCTSTR)Cmd)<0)
					     {
						//"Failure in user/password setup for the 'Ingres Replicator %d' service"
						msg.Format(IDS_E_USER_PASSWORD_NB,i);
						AfxMessageBox (msg);
						bOK=FALSE;
					     }
					}
					else
					if (!SetServicePassword ((LPCTSTR) strReplicServiceName, ServiceParms)) {
						//"Failure in user/password setup for the 'Ingres Replicator %d' service"
						msg.Format(IDS_E_USER_PASSWORD_NB,i);
						AfxMessageBox (msg);
						bOK=FALSE;
					}
				}
				return RES_ERR;
			}
		}
		if (!IsServiceRunning(strIngresServiceName)) {
			//"Ingres is currently not started as a service.\n"
			//"You must close all connections in VDBA (or Exit VDBA), "
			//"then stop Ingres, and restart it as a Service if you want "
			//"to start a replicator server on the local installation.\n"
			//"You must also make sure that the user/password for the Ingres service is correct.");
			AfxMessageBox (IDS_E_INGRES_NOT_STARTED);
			return RES_ERR;
		}
	}
#endif // MAINWIN

	// Verify if vnode name exist before start the remote command.
	VerifyAndUpdateVnodeName (&strVName);
	if (strVName.IsEmpty())
		return RES_ERR;

	_stprintf(tchszCommandLine, _T("ddstart %d"), lpReplicServerDta->serverno);

	if (!LIBMON_ExecRmcmdInBackground((TCHAR *)lpReplicServerDta->RunNode, tchszCommandLine, _T("")))
		return RES_ERR;

	// check for error (output line starting with a '*' character )
	ires=RES_SUCCESS;
	tchszCurLine=LIBMON_GetFirstTraceLine();
	while (tchszCurLine) {
		if (tchszCurLine[0]==_T('*'))
			CMnext(tchszCurLine);
		if (_tcslen(tchszCurLine)) {
			CString Msg;
			/* "Error from RMCMD server on '%s' :\n%s" */
			Msg.Format(IDS_E_ERROR_RMCMD, (LPCTSTR)strVName, tchszCurLine);
			AfxMessageBox(Msg, MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL);
			ires=RES_ERR;
		}
		tchszCurLine = LIBMON_GetNextSignificantTraceLine();
	}

	return ires;
}
コード例 #5
0
BOOL CuPropertyPageRestoreOption::OnInitDialog()
{
    CPropertyPage::OnInitDialog();
    CxPSheetRestore* pParent = (CxPSheetRestore*)GetParent();
    CaRestoreParam& Restore = pParent->GetData();

    HICON hIcon = theApp.LoadStandardIcon(IDI_EXCLAMATION);
    m_cIconWarning.SetIcon(hIcon);
    m_cIconWarning.Invalidate();
    DestroyIcon(hIcon);

#if !defined (_VIRTUAL_NODE_AVAILABLE)
    m_cCheckVNode.ShowWindow(SW_HIDE);
#endif

    CTypedPtrList<CObList, CaNameValue*> listEnvirenment;
    CaNameValue* pEnv = new CaNameValue(_T("II_TEMPORARY"), _T(""));
    listEnvirenment.AddTail(pEnv);
    INGRESII_CheckVariable (listEnvirenment);

    CString strBackupFile = pEnv->GetValue();
    if (!strBackupFile.IsEmpty())
    {
        strBackupFile += consttchszPathSep;
    }

    int i = 0;
    CString strFile = strBackupFile + _T("backup.ii_vcda");
    for (i=0; i<1024; i++)
    {
        if (i==0)
        {
            if (_taccess(strFile, 0) == -1)
                break;
        }
        else
        {
            strFile.Format (_T("backup%04d.ii_vcda"), i);
            strFile = strBackupFile + strFile;
            if (_taccess(strFile, 0) == -1)
                break;
        }
    }
    if (i == 1024)
    {
        CString strMsg;
        AfxFormatString1(strMsg, IDS_MSG_TOOMANAY_BACKUPFILE, (LPCTSTR)pEnv->GetValue());
        AfxMessageBox (strMsg);
    }
    else
    {
        m_cEditBackup.SetWindowText(strFile);
    }

    while (!listEnvirenment.IsEmpty())
        delete listEnvirenment.RemoveHead();

    //
    // Initialize the list of READONLY variables:
    BOOL bVariableDiff = FALSE;
    CString strII = INGRESII_QueryInstallationID(FALSE);
    CTypedPtrList< CObList, CaCdaDifference* >* pLd = Restore.m_plistDifference;
    if (pLd)
    {
        POSITION pos = pLd->GetHeadPosition();
        while (pos != NULL)
        {
            CaCdaDifference* pDiff = pLd->GetNext(pos);
            if (pDiff->GetType() == CDA_ENVSYSTEM || pDiff->GetType() == CDA_ENVUSER)
            {
                if (CaIngresVariable::IsReadOnly(pDiff->GetOriginalName(), strII))
                {
                    m_cListROVariable.AddString(pDiff->GetName());
                    bVariableDiff = TRUE;
                }
            }
        }
    }

    if (!bVariableDiff)
    {
        HICON hIcon = theApp.LoadStandardIcon(IDI_ASTERISK);
        m_cIconWarning.SetIcon(hIcon);
        m_cIconWarning.Invalidate();
        DestroyIcon(hIcon);
        m_cListROVariable.ShowWindow(SW_HIDE);
        CString strMsgInfo;
        strMsgInfo.LoadString(IDS_MSG_VARIABLE_RO);
        m_cStaticNonEditVariableInfo.SetWindowText(strMsgInfo);
    }

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}