예제 #1
0
BOOL CappIjaCtrl::InitInstance()
{
	BOOL bInit = COleControlModule::InitInstance();
	m_bHelpFileAvailable = TRUE;
	m_strHelpFile = _T("ija.chm");
	m_strNewHelpPath = _T("");
	_tsetlocale(LC_TIME, _T(""));
	_tsetlocale(LC_NUMERIC,_T(""));
	_tsetlocale(LC_COLLATE,_T(""));
	_tsetlocale(LC_CTYPE,_T(""));
	m_sessionManager.SetDescription (_T("Ingres Journal Analyzer"));
	m_dateFormat = II_DATE_US;
	if (bInit)
	{
		//
		// Allow to use the owner prefixed of table in the argument of the auditdb command:
		m_bTableWithOwnerAllowed = TRUE;

		m_strAllUser = _T("<all>");
		LPCTSTR pEnv  = _tgetenv(_T("II_SYSTEM"));
		if (!pEnv)
		{
			CString strMsg = _T("II_SYSTEM is not defined");
			strMsg.LoadString (IDS_MSG_II_SYSTEM_NOT_DEFINED);
			AfxMessageBox (strMsg);
			m_strLocalIISystem = _T("");
		}
		else
			m_strLocalIISystem = (LPCTSTR)pEnv;

		CString strValue;
		BOOL bOK = INGRESII_CheckVariable (_T("II_DATE_FORMAT"), strValue);
		if (bOK)
		{
			if (strValue.IsEmpty())
			{
				//
				// US (default format)
				m_dateFormat = II_DATE_US;
			}
			else
			if (strValue.CompareNoCase (_T("US")) == 0)
			{
				m_dateFormat = II_DATE_US;
			}
			else
			if (strValue.CompareNoCase (_T("MULTINATIONAL")) == 0)
			{
				m_dateFormat = II_DATE_MULTINATIONAL;
			}
			else
			if (strValue.CompareNoCase (_T("II_DATE_MULTINATIONAL4")) == 0)
			{
				m_dateFormat = II_DATE_MULTINATIONAL4;
			}
			if (strValue.CompareNoCase (_T("ISO")) == 0)
			{
				m_dateFormat = II_DATE_ISO;
			}
			else
			if (strValue.CompareNoCase (_T("SWEDEN")) == 0 || strValue.CompareNoCase (_T("FINLAND")) == 0)
			{
				m_dateFormat = II_DATE_SWEDEN; // Use the Sweden II_DATE_FORMAT
			}
			else
			if (strValue.CompareNoCase (_T("GERMAN")) == 0)
			{
				m_dateFormat = II_DATE_GERMAN;
			}
			else
			if (strValue.CompareNoCase (_T("YMD")) == 0)
			{
				m_dateFormat = II_DATE_YMD;
			}
			else
			if (strValue.CompareNoCase (_T("DMY")) == 0)
			{
				m_dateFormat = II_DATE_DMY;
			}
			else
			if (strValue.CompareNoCase (_T("MDY")) == 0)
			{
				m_dateFormat = II_DATE_MDY;
			}
		}

		m_dateCenturyBoundary = 0;
		strValue = _T("");
		bOK = INGRESII_CheckVariable (_T("II_DATE_CENTURY_BOUNDARY"), strValue);
		if (bOK && !strValue.IsEmpty())
			m_dateCenturyBoundary = _ttoi (strValue);
		
#ifdef MAINWIN
		m_strLocalIITemporary = _T("/tmp");
#else
		m_strLocalIITemporary = m_strLocalIISystem + _T("\\ingres\\temp");
#endif
		strValue = _T("");
		bOK = INGRESII_CheckVariable (_T("II_TEMPORARY"), strValue);
		if (bOK && !strValue.IsEmpty())
			m_strLocalIITemporary = strValue;
	}

	return bInit;
}
예제 #2
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
}