void CxDlgIceProfile::OnOK() { CString csMsg; ICEPROFILEDATA ProfileInfoNew; memset(&ProfileInfoNew,0,sizeof(ICEPROFILEDATA)); if (!UpdateData(TRUE)) // Verify validation for m_lTimeOut value. return; if ( FillstructureFromCtrl(&ProfileInfoNew) == FALSE) return; if (!m_pStructProfileInfo->bAlter) { if (ICEAddobject((LPUCHAR)(LPCTSTR)m_csVnodeName ,OT_ICE_PROFILE,&ProfileInfoNew ) == RES_ERR) { csMsg.LoadString(IDS_E_ICE_ADD_PROFILE); MessageWithHistoryButton(m_hWnd,csMsg); return; } } else { if ( ICEAlterobject((LPUCHAR)(LPCTSTR)m_csVnodeName,OT_ICE_PROFILE, m_pStructProfileInfo, &ProfileInfoNew ) == RES_ERR ) { csMsg.LoadString(IDS_E_ICE_ALTER_PROFILE); MessageWithHistoryButton(m_hWnd,csMsg); return; } } CDialog::OnOK(); }
void CxDlgIceRole::OnOK() { CString csMsg; ICEROLEDATA StructRoleInfo; memset(&StructRoleInfo,0,sizeof(StructRoleInfo)); m_ctrlIceRoleName.GetWindowText((char *)StructRoleInfo.RoleName, sizeof(StructRoleInfo.RoleName)); m_edRoleComment.GetWindowText( (char *)StructRoleInfo.Comment, sizeof(StructRoleInfo.Comment)); if (!m_pStructRoleInfo->bAlter) { if (ICEAddobject((LPUCHAR)(LPCTSTR)m_csVirtNodeName ,OT_ICE_ROLE,&StructRoleInfo ) == RES_ERR) { csMsg.LoadString(IDS_E_ICE_ADD_ROLE); MessageWithHistoryButton(m_hWnd,csMsg); return; } } else { if ( ICEAlterobject((LPUCHAR)(LPCTSTR)m_csVirtNodeName,OT_ICE_ROLE, m_pStructRoleInfo, &StructRoleInfo ) == RES_ERR ) { csMsg.LoadString(IDS_E_ICE_ALTER_ROLE); MessageWithHistoryButton(m_hWnd,csMsg); return; } } CDialog::OnOK(); }
void CxDlgIceCommonCombo::FillComboBox() { int ires,nIndex; UCHAR buf [MAXOBJECTNAME]; UCHAR bufOwner[MAXOBJECTNAME]; UCHAR extradata[EXTRADATASIZE]; CString csCurrentMsg; m_ctrlCommon.ResetContent(); ires = DOMGetFirstObject ( m_nHnodeHandle, m_nID4FillCombo, 0, NULL, FALSE, NULL, buf, bufOwner, extradata); while (ires == RES_SUCCESS) { nIndex = m_ctrlCommon.AddString ((char *)buf); if ( nIndex == CB_ERR || nIndex == CB_ERRSPACE ) return; ires = DOMGetNextObject (buf, NULL, extradata); } if (ires != RES_SUCCESS && ires != RES_ENDOFDATA) { csCurrentMsg.LoadString(m_nMessageErrorFillCombo); MessageWithHistoryButton(m_hWnd,csCurrentMsg); } m_ctrlCommon.SetCurSel(0); }
void CxDlgIceProfile::FillDatabasesUsers () { int ires; UCHAR buf [MAXOBJECTNAME]; UCHAR bufOwner[MAXOBJECTNAME]; UCHAR extradata[EXTRADATASIZE]; CString csMsg; m_cbDbUser.ResetContent(); ires = DOMGetFirstObject ( m_nHnodeHandle, OT_ICE_DBUSER, 0, NULL, FALSE, NULL, buf, bufOwner, extradata); while (ires == RES_SUCCESS) { m_cbDbUser.AddString ((char *)buf); ires = DOMGetNextObject (buf, NULL, extradata); } if (ires != RES_SUCCESS && ires != RES_ENDOFDATA) { csMsg.LoadString(IDS_E_ICE_FILL_COMBO_DB_USER); MessageWithHistoryButton(m_hWnd,csMsg); } }
void CxDlgIceCommonCombo::OnOK() { ICEBUSUNITLOCATIONDATA Il; ICEPROFILEROLEDATA Ip; ICEPROFILECONNECTIONDATA Ic; ICEWEBUSERROLEDATA Ir; ICEWEBUSERCONNECTIONDATA Iw; LPVOID pStruct = NULL; LPUCHAR vnodeName = (LPUCHAR)GetVirtNodeName (m_nHnodeHandle); UpdateData(TRUE); switch (m_nCurrentObject) { case OT_ICE_WEBUSER_CONNECTION: memset(&Iw,0,sizeof(ICEWEBUSERCONNECTIONDATA)); lstrcpy((LPSTR)Iw.icedbconnection.ConnectionName,m_csCommon); lstrcpy((LPSTR)Iw.icewebuser.UserName,(LPSTR)(LPCTSTR)m_csParentName); pStruct = &Iw; break; case OT_ICE_WEBUSER_ROLE: memset(&Ir,0,sizeof(ICEWEBUSERROLEDATA)); lstrcpy((LPSTR)Ir.icerole.RoleName,m_csCommon); lstrcpy((LPSTR)Ir.icewebuser.UserName,(LPSTR)(LPCTSTR)m_csParentName); pStruct = &Ir; break; case OT_ICE_PROFILE_CONNECTION: memset(&Ic,0,sizeof(ICEPROFILECONNECTIONDATA)); lstrcpy((LPSTR)Ic.icedbconnection.ConnectionName,m_csCommon); lstrcpy((LPSTR)Ic.iceprofile.ProfileName,(LPSTR)(LPCTSTR)m_csParentName); pStruct = &Ic; break; case OT_ICE_PROFILE_ROLE: memset(&Ip,0,sizeof(ICEPROFILEROLEDATA)); lstrcpy((LPSTR)Ip.icerole.RoleName,m_csCommon); lstrcpy((LPSTR)Ip.iceprofile.ProfileName,(LPSTR)(LPCTSTR)m_csParentName); pStruct = &Ip; break; case OT_ICE_BUNIT_LOCATION: memset(&Il,0,sizeof(ICEBUSUNITLOCATIONDATA)); lstrcpy((LPSTR)Il.icelocation.LocationName,m_csCommon); lstrcpy((LPSTR)Il.icebusunit.Name,(LPSTR)(LPCTSTR)m_csParentName); pStruct = &Il; break; default: ASSERT(FALSE); return; } if ( ICEAddobject(vnodeName ,m_nCurrentObject,pStruct ) == RES_ERR ) { CString csMsg; csMsg.LoadString(m_nMessageID); MessageWithHistoryButton(m_hWnd,csMsg); return; } CDialog::OnOK(); }
void ErrorMessage (UINT message_id, int reason) { char MessageString [200]; char Reason [80]; char Message[200]; HWND CurrentFocus; switch (reason) { case RES_ERR: x_strcpy (Reason, ""); // Trial EMB #ifdef DISPLAY_SQLERR_MSG // Note : under debugger, we see that sqlcode has been reset // in the ReleaseSession/Rollback call // Also, the error text can be truncated - need full length if (sqlca.sqlcode < 0) wsprintf ( Reason, "error %ld : %s", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); #endif break; case RES_TIMEOUT: LoadString (hResource, (UINT)IDS_I_TIMEOUT, (LPSTR)Reason, sizeof (Reason)); break; case RES_NOGRANT: LoadString (hResource, (UINT)IDS_I_NOGRANT, (LPSTR)Reason, sizeof (Reason)); break; case RES_ALREADYEXIST: LoadString (hResource, (UINT)IDS_I_OBJECT_ALREADY_EXIST, (LPSTR)Reason, sizeof (Reason)); break; default: x_strcpy (Reason, ""); break; } ZEROINIT (MessageString); if (message_id == (UINT)IDS_E_CANNOT_ALLOCATE_MEMORY) x_strcpy (MessageString, "Cannot allocate memory."); else LoadString (hResource, (UINT)message_id, MessageString, sizeof (MessageString)); if (x_strlen (Reason) > 0) wsprintf (Message, "%s\n%s", Reason, MessageString); else wsprintf (Message, "%s", MessageString); CurrentFocus = GetFocus (); if (message_id == (UINT)IDS_E_CANNOT_ALLOCATE_MEMORY) MessageBox (NULL, Message, NULL, MB_ICONHAND|MB_SYSTEMMODAL|MB_OK); else { // MessageBox (NULL, Message, NULL, MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL); MessageWithHistoryButton(CurrentFocus, Message); } SetFocus (CurrentFocus); }
void ErrorMessage2 (char* message, char* buf) { char Message[ER_MAX_LEN]; HWND CurrentFocus; wsprintf (Message, "%s", message); CurrentFocus = GetFocus (); AddSqlError(message, buf, -1); MessageWithHistoryButton(CurrentFocus, Message); SetFocus (CurrentFocus); }
void CxDlgIceDbUser::OnOK() { CString csMsg; ICEDBUSERDATA StructDbUserNew; memset(&StructDbUserNew,0,sizeof(ICEDBUSERDATA)); UpdateData(TRUE); if ( m_csPassword != m_csConfirm ) { AfxMessageBox (IDS_E_PLEASE_RETYPE_PASSWORD); m_csPassword = _T(""); m_csConfirm = _T(""); UpdateData(FALSE); return; } if ( FillstructureFromCtrl(&StructDbUserNew) == FALSE ) return; if (!m_pStructDbUser->bAlter) { if ( ICEAddobject((LPUCHAR)(LPCTSTR)m_csVirtNodeName ,OT_ICE_DBUSER,&StructDbUserNew ) == RES_ERR ) { csMsg.LoadString(IDS_E_ICE_ADD_DATABASE_USER_FAILED); MessageWithHistoryButton(m_hWnd,csMsg); return; } } else { if ( ICEAlterobject((LPUCHAR)(LPCTSTR)m_csVirtNodeName,OT_ICE_DBUSER, m_pStructDbUser, &StructDbUserNew ) == RES_ERR ) { csMsg.LoadString(IDS_E_ICE_ALTER_DATABASE_USER_FAILED); MessageWithHistoryButton(m_hWnd,csMsg); return; } } CDialog::OnOK(); }
void CuEditableListCtrlDuplicateDbSelectLocation::InitSortComboBox() { int TypeLocation,i,iIndex,err; char szObject[MAXOBJECTNAME]; char szFilter[MAXOBJECTNAME]; BOOL bOnlyOneLocName; CComboBox* pCombo = COMBO_GetComboBox(); pCombo->ResetContent(); err = DOMGetFirstObject(GetCurMdiNodeHandle(), OT_LOCATION, 0, NULL, TRUE, NULL, (LPUCHAR)szObject, NULL, NULL); while (err == RES_SUCCESS) { BOOL bOK; for (i = 0, TypeLocation = 0,bOnlyOneLocName = TRUE;i <= LOCATIONDUMP;i++,TypeLocation=i) { if (DOMLocationUsageAccepted(GetCurMdiNodeHandle(),(LPUCHAR)szObject,TypeLocation,&bOK) == RES_SUCCESS && bOK) { switch (TypeLocation) { case LOCATIONDATABASE: case LOCATIONWORK: { if ( bOnlyOneLocName ) { iIndex = pCombo->AddString (szObject); bOnlyOneLocName = FALSE; } } break; } } } err = DOMGetNextObject ((LPUCHAR)szObject,(LPUCHAR)szFilter, NULL); } if (err != RES_SUCCESS && err != RES_ENDOFDATA) { //"Error while getting Location list." CString csMsg = VDBA_MfcResourceString (IDS_E_DUPLICATEDB_FILL_COMBO_LOCATION); MessageWithHistoryButton(m_hWnd,csMsg); } }
BOOL CxDlgObjectComment::FillListColumnWithComment( void ) { // // Get Session int hdl, nRes = RES_ERR ; TCHAR tcDBName [MAXOBJECTNAME]; TCHAR tcObjectName [MAXOBJECTNAME]; TCHAR tcObjectOwner [MAXOBJECTNAME]; CString strSess; m_tcObjComment = NULL; CString strVNodeName = (LPTSTR)GetVirtNodeName(m_nNodeHandle); x_strcpy(tcDBName,m_csDBName); x_strcpy(tcObjectName, m_csObjectName ); x_strcpy(tcObjectOwner,m_csObjectOwner); strSess.Format (_T("%s::%s"), (LPTSTR)(LPCTSTR)strVNodeName, (LPTSTR)(LPCTSTR)m_csDBName); nRes = Getsession ((LPUCHAR)(LPCTSTR)strSess, SESSION_TYPE_CACHEREADLOCK, &hdl); if (nRes != RES_SUCCESS) { TRACE0 (_T("CxDlgObjectComment::FillListColumnWithComment(): Fail to Get the session\n")); return FALSE; } nRes = SQLGetComment( (LPTSTR)(LPCTSTR)strVNodeName, tcDBName, tcObjectName, tcObjectOwner, &m_tcObjComment, m_ListColumn); ReleaseSession (hdl, RELEASE_COMMIT); if (nRes != RES_SUCCESS) { CString csMsg; csMsg.LoadString(IDS_E_COMMENTS_FAILED); MessageWithHistoryButton(m_hWnd,csMsg); return FALSE; } if (m_tcObjComment) SetCommentObject(m_tcObjComment); return TRUE; }
LONG CuDlgDomPropTblPages::OnUpdateData (WPARAM wParam, LPARAM lParam) { // cast received parameters int nNodeHandle = (int)wParam; LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam; ASSERT (nNodeHandle != -1); ASSERT (pUps); // ignore selected actions on filters switch (pUps->nIpmHint) { case 0: //case FILTER_DOM_SYSTEMOBJECTS: //case FILTER_DOM_BASEOWNER: //case FILTER_DOM_OTHEROWNER: break; case FILTER_DOM_BKREFRESH_DETAIL: if (m_Data.m_refreshParams.MustRefresh(pUps->pSFilter->bOnLoad, pUps->pSFilter->refreshtime)) break; // need to update else return 0; // no need to update break; default: return 0L; // nothing to change on the display } // Get info on the current item LPTREERECORD lpRecord = (LPTREERECORD)pUps->pStruct; ASSERT (lpRecord); ResetDisplay(); // // Get pages of table, even if system object (lpRecord->ownerName is "$ingres" ) // INGRESPAGEINFO pageinfo; memset(&pageinfo, 0, sizeof(INGRESPAGEINFO)); BOOL bOK = GetIngresPageInfo(nNodeHandle, lpRecord->extra, lpRecord->objName, lpRecord->ownerName, &pageinfo); if (!bOK) { // Need to reset pageinfo since has been partially filled by GetIngresPageInfo memset(&pageinfo, 0, sizeof(INGRESPAGEINFO)); // "Cannot Access Page Information" MessageWithHistoryButton(m_hWnd, VDBA_MfcResourceString (IDS_E_PAGE_INFORMATION)); } ASSERT (m_pPieCtrl && m_pPieCtrlHashTable); if (m_pPieCtrl && m_pPieCtrlHashTable) { // // Hash Table or Non-Hash Table. This value should be changed // upon the table's structure: // BOOL bHashTable = TRUE; ShowPieChartCtrl ((LPVOID)&pageinfo, pageinfo.bNewHash); /* double dPercent = 0.0; CString strTitle; CaPieInfoData* pData = m_pPieCtrl->GetPieInformation(); pData->Cleanup(); pData->SetCapacity ((double)pageinfo.ltotal, _T("")); if (pageinfo.linuse > 0) { dPercent = ((double)pageinfo.linuse / (double)pageinfo.ltotal) * 100.00; pData->AddPie2 (_T("In Use"), dPercent, RGB(0, 0, 192), (double)pageinfo.linuse); } else pData->AddLegend (_T("In Use"), RGB(0, 0, 192)); if (pageinfo.lfreed > 0) { dPercent = ((double)pageinfo.lfreed / (double)pageinfo.ltotal) * 100.00; pData->AddPie2 (_T("Freed"), dPercent, RGB(0, 192, .0), (double)pageinfo.lfreed); } else pData->AddLegend (_T("Freed"), RGB(0, 192, .0)); if (pageinfo.lneverused > 0) { dPercent = ((double)pageinfo.lneverused / (double)pageinfo.ltotal) * 100.00; pData->AddPie2 (_T("Never Used"), dPercent, RGB(255, 255, 0), (double)pageinfo.lneverused); } else pData->AddLegend (_T("Never Used"), RGB(255, 255, 0)); if (pageinfo.loverflow > 0) { dPercent = ((double)pageinfo.loverflow / (double)pageinfo.ltotal) * 100.00; pData->AddPie2 (_T("Overflow"), dPercent, RGB(255, 0, 0), (double)pageinfo.lneverused); } else pData->AddLegend (_T("Overflow"), RGB(255, 0, 0)); strTitle.Format (_T("Total = %d"), pageinfo.ltotal); pData->SetTitle(strTitle); m_pPieCtrl->UpdateLegend(); m_pPieCtrl->UpdatePieChart(); */ } // Update refresh info m_Data.m_refreshParams.UpdateRefreshParams(); CopyData (&m_Data, &pageinfo, TRUE); // pageinfo -> m_Data // Refresh display RefreshDisplay(); return 0L; }
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) { HWND hwndTempDoc; HLOCAL hmem = LocalAlloc(LHND, sizeof(infoDefaults)); LPSTRUCTINFO lpinfo = hmem ? LocalLock(hmem) : NULL; if (!lpinfo) { if (hmem) LocalFree(hmem); EndDialog(hwnd, -1); return TRUE; } // Since we modify infoDefaults, make a copy of it for each instance // of the dialog oldIngresVer = GetOIVers(); SetProp(hwnd, SZINFODEF, hmem); _fmemcpy(lpinfo, infoDefaults, sizeof(infoDefaults)); if (oldIngresVer >= OIVERS_30) { int i =0; for (i=0; i<4; i++) { lpinfo[i].nRowWidth = MAX_ROW_WIDTH_R3; } } LocalUnlock(hmem); hwndTempDoc = GetWindow(hwndMDIClient, GW_CHILD); if (hwndTempDoc) { if (GetOIVers()>=OIVERS_26) { BOOL bResult = SQLGetPageTypesPerTableTypes(GetVirtNodeName(GetCurMdiNodeHandle ()), pagetypespertabletypes); if (!bResult) { MessageWithHistoryButton(GetFocus(), ResourceString(IDS_E_CONNECTION_FAILED)); EndDialog(hwnd, -1); return TRUE; } if (PAGE_TYPE_V1 != 1 || PAGE_TYPE_V2 != 2 || PAGE_TYPE_V3 != 3 || PAGE_TYPE_V4 !=4 || PAGE_TYPE_V6 != 6 || PAGE_TYPE_V7 != 7) { myerror(ERR_INGRESPAGES); /* the parsing of dm34 trace output (in parse.cpp) assumes V1 == 1 V2 == 2 etc... */ EndDialog(hwnd, -1); return TRUE; } Button_SetCheck (GetDlgItem (hwnd, IDC_TYPE_TABLE), TRUE); } if (GetOIVers()>=OIVERS_30) RetrieveTupLen4PageSize(); } else { oldIngresVer = SetOIVers(OIVERS_90); // Simulate the current Ingres version 9.0 Button_SetCheck (GetDlgItem (hwnd, IDC_TYPE_TABLE), TRUE); pagetypespertabletypes [0] = PAGE_TYPE_V1; pagetypespertabletypes [1] = PAGE_TYPE_V3; pagetypespertabletypes [2] = PAGE_TYPE_V3; pagetypespertabletypes [3] = PAGE_TYPE_V3; pagetypespertabletypes [4] = PAGE_TYPE_V3; pagetypespertabletypes [5] = PAGE_TYPE_V3; pagetypespertabletypes [6] = PAGE_TYPE_V1; pagetypespertabletypes [7] = PAGE_TYPE_V4; pagetypespertabletypes [8] = PAGE_TYPE_V4; pagetypespertabletypes [9] = PAGE_TYPE_V4; pagetypespertabletypes [10] = PAGE_TYPE_V4; pagetypespertabletypes [11] = PAGE_TYPE_V4; if (bContinueShowMessage) { if (MSGContinueBox (ResourceString(IDS_W_CALCULATION_WITH_DEFAULT))) bContinueShowMessage = FALSE; } } // Force the catospin.dll to load SpinGetVersion(); if (!OccupyStructureControl(hwnd) || !OccupyPageSizeControl(hwnd)) { EndDialog(hwnd, -1); return TRUE; } if (GetOIVers() >= OIVERS_20) lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_OIV2_SPACECALC)); else lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_SPACECALC)); SubclassAllNumericEditControls(hwnd, EC_SUBCLASS); InitialiseSpinControls(hwnd); InitialiseEditControls(hwnd); UpdateControls(hwnd,TRUE); DoCalculation(hwnd); richCenterDialog(hwnd); return TRUE; }
BOOL CxDlgObjectComment::InitializeObjectColumns() { TCHAR tblNameWithOwner[MAXOBJECTNAME]; int ires, nLevel = 2; LPUCHAR aparents [MAXPLEVEL]; TCHAR tchszBuf [MAXOBJECTNAME]; TCHAR tchszOwner [MAXOBJECTNAME]; TCHAR tchszBufComplim[MAXOBJECTNAME]; LPTSTR lpszOwner = NULL; BOOL bSystem = FALSE; if (m_iCurObjType != OT_TABLE && m_iCurObjType != OT_VIEW) return FALSE; StringWithOwner((LPUCHAR)Quote4DisplayIfNeeded((LPTSTR)(LPCTSTR)m_csObjectName), (LPUCHAR)(LPTSTR)(LPCTSTR) m_csObjectOwner, (LPUCHAR)tblNameWithOwner); aparents[0] = (LPUCHAR)(LPCTSTR)m_csDBName; aparents[1] = (LPUCHAR)tblNameWithOwner; aparents[2] = NULL; nLevel = 2; tchszBuf[0] = 0; tchszOwner[0] = 0; tchszBufComplim[0] = 0; LPOBJECTLIST lpColTemp; LPCOMMENTCOLUMN lpCommentCol; ires = DOMGetFirstObject( m_nNodeHandle, (m_iCurObjType == OT_TABLE)? OT_COLUMN: OT_VIEWCOLUMN, nLevel, aparents, bSystem, NULL, (LPUCHAR)tchszBuf, (LPUCHAR)tchszOwner, (LPUCHAR)tchszBufComplim); if (ires != RES_SUCCESS && ires != RES_ENDOFDATA) { CString csMsg; csMsg.LoadString(IDS_E_COMMENTS_FAILED); MessageWithHistoryButton(m_hWnd,csMsg); return FALSE; } while (ires == RES_SUCCESS) { lpColTemp = AddListObjectTail(&m_ListColumn, sizeof(COMMENTCOLUMN)); if (!lpColTemp) { // Need to free previously allocated objects. ErrorMessage ( (UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); FreeObjectList(m_ListColumn); m_ListColumn = NULL; return FALSE; } lpCommentCol = (LPCOMMENTCOLUMN)lpColTemp->lpObject; lstrcpy((LPTSTR)lpCommentCol->szColumnName,tchszBuf); lpCommentCol->lpszComment = NULL; tchszBuf[0] = 0; tchszOwner[0] = 0; tchszBufComplim[0] = 0; ires = DOMGetNextObject ((LPUCHAR)tchszBuf, (LPUCHAR)tchszOwner, (LPUCHAR)tchszBufComplim); } return TRUE; }