static BOOL FillStructureFromControls (HWND hwnd, LPGRANTPARAMS lpgrant) { HWND hwndGrantees = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GRANTEES); HWND hwndDBevents = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_DBEVENT); int max_item_number = CAListBox_GetSelCount (hwndDBevents); if (max_item_number >= 1) { lpgrant->lpobject = AddItemToListWithOwner (hwndDBevents); if (!lpgrant->lpobject) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT) IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } max_item_number = CAListBox_GetSelCount (hwndGrantees); if (max_item_number >= 1) { lpgrant->lpgrantee = AddItemToListQuoted (hwndGrantees); if (!lpgrant->lpgrantee) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); EndDialog (hwnd, FALSE); return FALSE; } } if (Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_USER))) lpgrant->GranteeType = OT_USER; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GROUP))) lpgrant->GranteeType = OT_GROUP; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_ROLE))) lpgrant->GranteeType = OT_ROLE; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_PUBLIC))) { lpgrant->GranteeType = OT_PUBLIC; // Public FreeObjectList (lpgrant->lpgrantee); lpgrant->lpgrantee= NULL; lpgrant->lpgrantee = APublicUser (); if (!lpgrant->lpgrantee) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } lpgrant->Privileges [GRANT_RAISE] = Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_RAISE)); lpgrant->Privileges [GRANT_REGISTER] = Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_REGISTER)); lpgrant->grant_option = Button_GetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_OPTION)); return TRUE; }
static BOOL FillStructureFromControls (HWND hwnd, LPGRANTPARAMS lpgrant) { int max_item_number; HWND hwndDatabases = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES); HWND hwndGrantees = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES); HWND hwndProcedures= GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES); max_item_number = CAListBox_GetSelCount (hwndProcedures); if (max_item_number >= 1) { lpgrant->lpobject = AddItemToList (hwndProcedures); if (!lpgrant->lpobject) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT) IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } max_item_number = CAListBox_GetSelCount (hwndGrantees); if (max_item_number >= 1) { lpgrant->lpgrantee = AddItemToList (hwndGrantees); if (!lpgrant->lpgrantee) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } if (Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_USER))) lpgrant->GranteeType = OT_USER; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GROUP))) lpgrant->GranteeType = OT_GROUP; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_ROLE))) lpgrant->GranteeType = OT_ROLE; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PUBLIC))) { lpgrant->GranteeType = OT_PUBLIC; // Public FreeObjectList (lpgrant->lpgrantee); lpgrant->lpgrantee = APublicUser (); if (!lpgrant->lpgrantee) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } if (lpgrant->ObjectType == OT_SEQUENCE) { lpgrant->grant_option = FALSE; lpgrant->Privileges[GRANT_NEXT_SEQUENCE] = TRUE; return TRUE; } lpgrant->grant_option = Button_GetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_OPTION)); return TRUE; }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPGRANTPARAMS lpgrant = GetDlgProp (hwnd); HWND hwndDatabases = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES); HWND hwndGrantees = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES); HWND hwndProcedures = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES); int ires; switch (id) { case IDOK: if (!FillStructureFromControls (hwnd, lpgrant)) break; ires = DBAAddObject (GetVirtNodeName ( GetCurMdiNodeHandle ()), OTLL_GRANT, (void *) lpgrant); if (ires != RES_SUCCESS) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_GRANT_PROCEDURE_FAILED, ires); break; } else EndDialog (hwnd, TRUE); FreeAttachedPointers (lpgrant, OTLL_GRANT); break; case IDCANCEL: FreeAttachedPointers (lpgrant, OTLL_GRANT); EndDialog (hwnd, FALSE); break; case IDC_GNREF_PROCEDURE_PROCEDURES: case IDC_GNREF_PROCEDURE_GRANTEES: EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_USER: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_USER); EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_GROUP: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_GROUP); EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_ROLE: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_ROLE); EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_PUBLIC: CAListBox_ResetContent (hwndGrantees); EnableDisableOKButton (hwnd); break; case IDC_GNREF_PROCEDURE_DATABASES: { char selString [MAXOBJECTNAME+1]; if (codeNotify == CBN_SELCHANGE) { CAListBoxDestroyItemData (hwndProcedures); CAListBox_ResetContent (hwndProcedures); ComboBox_GetText (hwndDatabases, selString, sizeof (selString)); x_strcpy (lpgrant->DBName, selString); if (lpgrant->ObjectType == OT_PROCEDURE) { if (!CAListBoxFillProcedures (hwndProcedures, selString)) CAListBoxDestroyItemData (hwndProcedures); } else { if (!CAListBoxFillSequences (hwndProcedures, lpgrant->DBName)) CAListBoxDestroyItemData (hwndProcedures); } } EnableDisableOKButton (hwnd); } break; } }
LONG CuDlgDomPropTableColumns::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; case FILTER_SETTING_CHANGE: VDBA_OnGeneralSettingChange(&m_cListColumns); return 0L; default: return 0L; // nothing to change on the display } // Get info on the object TABLEPARAMS tableparams; memset (&tableparams, 0, sizeof (tableparams)); LPTREERECORD lpRecord = (LPTREERECORD)pUps->pStruct; ASSERT (lpRecord); ResetDisplay(); x_strcpy ((char *)tableparams.DBName, (const char *)lpRecord->extra); x_strcpy ((char *)tableparams.objectname, RemoveDisplayQuotesIfAny((LPCTSTR)StringWithoutOwner(lpRecord->objName))); x_strcpy ((char *)tableparams.szSchema, (const char *)lpRecord->ownerName); tableparams.detailSubset = TABLE_SUBSET_COLUMNSONLY; // minimize query duration int dummySesHndl; int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle), OT_TABLE, &tableparams, FALSE, &dummySesHndl); if (iResult != RES_SUCCESS) { // Table may not exist if propagate too fast if (iResult != RES_ENDOFDATA) ASSERT (FALSE); // Reset m_Data CuDomPropDataTableColumns tempData; tempData.m_refreshParams = m_Data.m_refreshParams; m_Data = tempData; // Create error item and that's it! /* "<Data Unavailable>" */ CuTblColumn tblColumn1(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE)); m_Data.m_uaColumns.Add(tblColumn1); // Refresh display RefreshDisplay(); return 0L; } // Update refresh info m_Data.m_refreshParams.UpdateRefreshParams(); TCHAR *lpObjComment = NULL; int iret = RES_SUCCESS; LPOBJECTLIST ls ,lpColTemp,lpObjCol = NULL; LPCOMMENTCOLUMN lpCommentCol; ls = tableparams.lpColumns; while (ls) { lpColTemp = AddListObjectTail(&lpObjCol, sizeof(COMMENTCOLUMN)); if (!lpColTemp) { // Need to free previously allocated objects. FreeObjectList(lpObjCol); lpObjCol = NULL; break; } LPCOLUMNPARAMS lstbl=(LPCOLUMNPARAMS)ls->lpObject; lpCommentCol = (LPCOMMENTCOLUMN)lpColTemp->lpObject; lstrcpy((LPTSTR)lpCommentCol->szColumnName,(LPCTSTR)(LPUCHAR)lstbl->szColumn); lpCommentCol->lpszComment = NULL; ls=(LPOBJECTLIST)ls->lpNext; } if (lpObjCol) iret = VDBAGetCommentInfo ( (LPTSTR)(LPUCHAR)GetVirtNodeName(nNodeHandle), (LPTSTR)tableparams.DBName, (LPTSTR)tableparams.objectname, (LPTSTR)tableparams.szSchema, &lpObjComment, lpObjCol); else ASSERT (FALSE); // update member variables, for display/load/save purpose // list of columns m_Data.m_uaColumns.RemoveAll(); ls = tableparams.lpColumns; ASSERT (ls); // No columns is unacceptable while (ls) { LPCOLUMNPARAMS lpCol = (LPCOLUMNPARAMS)ls->lpObject; ASSERT (lpCol); // Column name CString csName = lpCol->szColumn; // Format "column type" CString csType = ""; if (lstrcmpi(lpCol->tchszInternalDataType, lpCol->tchszDataType) != 0) { ASSERT (lpCol->tchszInternalDataType[0]); csType = lpCol->tchszInternalDataType; // UDTs if (lstrcmpi(lpCol->tchszInternalDataType,VDBA_MfcResourceString(IDS_OBJECT_KEY)) == 0 || lstrcmpi(lpCol->tchszInternalDataType,VDBA_MfcResourceString(IDS_TABLE_KEY) ) == 0) { if (lpCol->bSystemMaintained) csType += VDBA_MfcResourceString(IDS_SYSTEM_MAINTAINED); else csType += VDBA_MfcResourceString(IDS_NO_SYSTEM_MAINTAINED); } } else { LPUCHAR lpType; lpType = GetColTypeStr(lpCol); if (lpType) { csType = lpType; ESL_FreeMem(lpType); } else { // Unknown type: put type name "as is" - length will not be displayed csType = lpCol->tchszDataType; } } // Format "default specification" CString csDefSpec = ""; if (lpCol->lpszDefSpec) csDefSpec = lpCol->lpszDefSpec; // Format "Comment" CString csTblComment = ""; LPOBJECTLIST LsObj = lpObjCol; LPCOMMENTCOLUMN lpCommentCol; while (LsObj) { lpCommentCol = (LPCOMMENTCOLUMN)LsObj->lpObject; if (strcmp((LPTSTR)lpCommentCol->szColumnName,(LPTSTR)lpCol->szColumn) == 0) { if (iret!=RES_SUCCESS && !lpCommentCol->lpszComment) csTblComment.LoadString(IDS_NOT_AVAILABLE); else { if (lpCommentCol->lpszComment) csTblComment = lpCommentCol->lpszComment; } } LsObj = (LPOBJECTLIST)LsObj->lpNext; } // item on the stack CuTblColumn tblColumn(csName, // LPCTSTR name, csType, // LPCTSTR type, ??? Code complexe lpCol->nKeySequence,// int primKeyRank, lpCol->bNullable, // BOOL bNullable, lpCol->bDefault, // BOOL bWithDefault, csDefSpec, // LPCTSTR defSpec csTblComment ); // LPCTSTR comment on column CuMultFlag *pRefCol = m_Data.m_uaColumns.Find(&tblColumn); ASSERT (!pRefCol); m_Data.m_uaColumns.Add(tblColumn); // Loop on next column ls = (LPOBJECTLIST)ls->lpNext; } // liberate detail structure FreeAttachedPointers (&tableparams, OT_TABLE); // liberate column comment ls = lpObjCol; while (ls) { lpCommentCol = (LPCOMMENTCOLUMN)ls->lpObject; if (lpCommentCol->lpszComment) ESL_FreeMem (lpCommentCol->lpszComment); ls = (LPOBJECTLIST)ls->lpNext; } FreeObjectList(lpObjCol); if (lpObjComment) ESL_FreeMem (lpObjComment); // Refresh display RefreshDisplay(); return 0L; }
static BOOL FillStructureFromControls (HWND hwnd, LPSECURITYALARMPARAMS lpsecurity) { char buf [MAXOBJECTNAME]; // char buffowner [MAXOBJECTNAME]; // char bufftable [MAXOBJECTNAME]; char szDBE [MAXOBJECTNAME]; char szName [MAXOBJECTNAME]; LPCHECKEDOBJECTS obj; LPCHECKEDOBJECTS list = NULL; int i, max_database_number, checked; HWND hwndDB = GetDlgItem (hwnd, IDC_SALARM_ONTABLE); HWND hwndUsers = GetDlgItem (hwnd, IDC_SALARM_BYUSER ); HWND hwndSuccess = GetDlgItem (hwnd, IDC_SALARM_SUCCESS); HWND hwndFailure = GetDlgItem (hwnd, IDC_SALARM_FAILURE); HWND hwndSelect = GetDlgItem (hwnd, IDC_SALARM_SELECT); HWND hwndDelete = GetDlgItem (hwnd, IDC_SALARM_DELETE); HWND hwndInsert = GetDlgItem (hwnd, IDC_SALARM_INSERT); HWND hwndUpdate = GetDlgItem (hwnd, IDC_SALARM_UPDATE); HWND hwndConnect = GetDlgItem (hwnd, IDC_SALARM_CONNECT); HWND hwndDisconnect = GetDlgItem (hwnd, IDC_SALARM_DISCONNECT); HWND hwndDBE = GetDlgItem (hwnd, IDC_SALARM_DBEVENT); HWND hwndDBEText = GetDlgItem (hwnd, IDC_SALARM_DBEVENT_TEXT); HWND hwndName = GetDlgItem (hwnd, IDC_SALARM_NAME); x_strcpy (lpsecurity->DBName, "iidbdb"); ZEROINIT (szName); Edit_GetText (hwndName, szName, sizeof (szName)); x_strcpy (lpsecurity->ObjectName, szName); lpsecurity->bsuccfail [SECALARMSUCCESS] = Button_GetCheck (hwndSuccess); lpsecurity->bsuccfail [SECALARMFAILURE] = Button_GetCheck (hwndFailure); // // Get selection from // toggle buttons (Select, Delete, Insert, Update) // lpsecurity->baccesstype [SECALARMSEL] = Button_GetCheck (hwndSelect); lpsecurity->baccesstype [SECALARMDEL] = Button_GetCheck (hwndDelete); lpsecurity->baccesstype [SECALARMINS] = Button_GetCheck (hwndInsert); lpsecurity->baccesstype [SECALARMUPD] = Button_GetCheck (hwndUpdate); lpsecurity->baccesstype [SECALARMCONNECT] = Button_GetCheck (hwndConnect ); lpsecurity->baccesstype [SECALARMDISCONN] = Button_GetCheck (hwndDisconnect); // // Get the names of users that have been checked and // insert into the list // if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_USER))) lpsecurity->iAuthIdType = OT_USER; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_GROUP))) lpsecurity->iAuthIdType = OT_GROUP; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_ROLE))) lpsecurity->iAuthIdType = OT_ROLE; else if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_PUBLIC))) lpsecurity->iAuthIdType = OT_PUBLIC; else lpsecurity->iAuthIdType = OT_USER; max_database_number = CAListBox_GetCount (hwndUsers); if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_PUBLIC))) { obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS)); if (!obj) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } else { x_strcpy (obj->dbname, lppublicsysstring()); obj->bchecked = TRUE; list = AddCheckedObject (list, obj); } } for (i = 0; i < max_database_number; i++) { checked = CAListBox_GetSel (hwndUsers, i); if (checked == 1) { CAListBox_GetText (hwndUsers, i, buf); obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS)); if (!obj) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } else { if (x_strcmp (buf, lppublicdispstring()) == 0) x_strcpy (obj->dbname, lppublicsysstring()); else x_strcpy (obj->dbname, QuoteIfNeeded(buf)); obj->bchecked = TRUE; list = AddCheckedObject (list, obj); } } } lpsecurity->lpfirstUser = list; // // Get the names of Database that have been checked and // insert into the list // max_database_number = CAListBox_GetCount (hwndDB); list = NULL; for (i=0; i<max_database_number; i++) { checked = CAListBox_GetSel (hwndDB, i); if (checked) { CAListBox_GetText (hwndDB, i, buf); obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS)); if (!obj) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } else { x_strcpy (obj->dbname, buf); obj->bchecked = TRUE; list = AddCheckedObject (list, obj); } } } lpsecurity->lpfirstTable = list; ComboBox_GetText (hwndDBE, szDBE, sizeof (szDBE)); if ((x_strlen (szDBE) > 0 ) && (x_strcmp (szDBE, szSecurityDBEvent) != 0)) { char szOwner [MAXOBJECTNAME]; char szAll [MAXOBJECTNAME]; int len, nSel; nSel = ComboBox_GetCurSel (hwndDBE); x_strcpy (szOwner, (char *) ComboBox_GetItemData (hwndDBE, nSel)); StringWithOwner (szDBE, szOwner, szAll); x_strcpy (lpsecurity->DBEvent, szAll); len = Edit_GetTextLength (hwndDBEText); if (len > 0) { lpsecurity->lpDBEventText = ESL_AllocMem ((len*sizeof(TCHAR)) + sizeof(TCHAR)); if (lpsecurity->lpDBEventText) { Edit_GetText (hwndDBEText, lpsecurity->lpDBEventText, len+1); // Emb 26/06/97: +1 was missing --> lost character if (EscapedSimpleQuote(&lpsecurity->lpDBEventText) == RES_ERR) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } else { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } } lpsecurity->bDBEvent = TRUE; } else if (lpsecurity->lpDBEventText) { ESL_FreeMem (lpsecurity->lpDBEventText); lpsecurity->lpDBEventText = NULL; } return TRUE; }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPSECURITYALARMPARAMS lpsecurity = GetDlgProp (hwnd); HWND hwndUsers = GetDlgItem (hwnd, IDC_SALARM_BYUSER ); HWND hwndTables = GetDlgItem (hwnd, IDC_SALARM_ONTABLE ); HWND hwndName = GetDlgItem (hwnd, IDC_SALARM_NAME ); int idu; int i, n, idt; int ires; char szName [MAXOBJECTNAME]; switch (id) { case IDOK: if (!FillStructureFromControls (hwnd, lpsecurity)) break; // // Call the low level function to write data on disk // ires = DBAAddObject (GetVirtNodeName (GetCurMdiNodeHandle ()), OTLL_SECURITYALARM, (void *) lpsecurity ); if (ires != RES_SUCCESS) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CREATE_SECURITY_FAILED, ires); break; } else EndDialog (hwnd, TRUE); FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); break; case IDCANCEL: EndDialog (hwnd, FALSE); FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); break; case IDC_SALARM_BYUSER: if (Edit_GetText (hwndName, szName, sizeof (szName)) != 0 && CAListBox_GetSelCount (hwndUsers) > 1) { idu=CAListBox_GetCurSel (hwndUsers); n = CAListBox_GetCount (hwndUsers); for (i=0; i<n; i++) CAListBox_SetSel (hwndUsers, FALSE, i); CAListBox_SetCurSel (hwndUsers, idu); CAListBox_SetSel (hwndUsers, TRUE, idu); //"Multiple auth-id is not allowed if the security alarm has a name." MessageBox(hwnd, ResourceString(IDS_ERR_USING_CHECKPOINT), NULL, MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); EnableDisableOKButton (hwnd); } else if (CAListBox_GetSelCount (hwndUsers) > 1) Edit_Enable(hwndName,FALSE); else Edit_Enable(hwndName,TRUE); EnableDisableOKButton (hwnd); break; case IDC_SALARM_ONTABLE: if (codeNotify == CALBN_CHECKCHANGE) { idt = CAListBox_GetCurSel (hwndTables); n = CAListBox_GetCount (hwndTables); for (i=0; i<n; i++) CAListBox_SetSel (hwndTables, FALSE, i); CAListBox_SetCurSel (hwndTables, idt); CAListBox_SetSel (hwndTables, TRUE, idt); if (bNoDisplayMessageDB == FALSE) { int iret; //"Only one database can be checked. Previous database, if any, was unchecked.\nDon't display this message any more?" iret = MessageBox(hwnd, ResourceString(IDS_ERR_DATABASE_BE_CHECKED), NULL, MB_OKCANCEL | MB_ICONEXCLAMATION | MB_TASKMODAL); if (iret == IDOK) bNoDisplayMessageDB=TRUE; } } EnableDisableOKButton (hwnd); break; case IDC_SALARM_SUCCESS: case IDC_SALARM_FAILURE: case IDC_SALARM_SUCCESSFAILURE: case IDC_SALARM_SELECT: case IDC_SALARM_DELETE: case IDC_SALARM_INSERT: case IDC_SALARM_UPDATE: case IDC_SALARM_CONNECT: case IDC_SALARM_DISCONNECT: EnableDisableOKButton (hwnd); break; case IDC_SALARM_USER: if (Button_GetCheck (hwndCtl)) { CAListBox_ResetContent (hwndUsers); CAListBoxFillUsers (hwndUsers); EnableDisableOKButton (hwnd); } break; case IDC_SALARM_GROUP: if (Button_GetCheck (hwndCtl)) { CAListBox_ResetContent (hwndUsers); CAListBoxFillGroups (hwndUsers); EnableDisableOKButton (hwnd); } break; case IDC_SALARM_ROLE: if (Button_GetCheck (hwndCtl)) { CAListBox_ResetContent (hwndUsers); CAListBoxFillRoles (hwndUsers); EnableDisableOKButton (hwnd); } break; case IDC_SALARM_PUBLIC: if (Button_GetCheck (hwndCtl)) { CAListBox_ResetContent (hwndUsers); EnableDisableOKButton (hwnd); } break; case IDC_SALARM_DBEVENT: if (codeNotify == CBN_SELCHANGE) { char szItem [MAXOBJECTNAME]; ZEROINIT (szItem); ComboBox_GetText (hwndCtl, szItem, sizeof (szItem)); if (x_strcmp (szItem, szSecurityDBEvent) == 0) { lpsecurity->bDBEvent = FALSE; EnableControl (hwnd, FALSE); } else EnableControl (hwnd, TRUE); } break; } }
LONG CuDlgDomPropDDb::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 } ResetDisplay(); // Get info on the object DATABASEPARAMS DbParams; memset (&DbParams, 0, sizeof (DbParams)); LPTREERECORD lpRecord = (LPTREERECORD)pUps->pStruct; ASSERT (lpRecord); // // Get Detail Info // lstrcpy ((LPTSTR)DbParams.objectname, (LPCTSTR)lpRecord->objName); DbParams.DbType = lpRecord->parentDbType; int dummySesHndl; int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle), OT_DATABASE, &DbParams, FALSE, &dummySesHndl); if (iResult != RES_SUCCESS) { ASSERT (FALSE); // Reset m_Data CuDomPropDataDDb tempData; tempData.m_refreshParams = m_Data.m_refreshParams; m_Data = tempData; // Refresh display RefreshDisplay(); return 0L; } // Update refresh info m_Data.m_refreshParams.UpdateRefreshParams(); // update member variables, for display/load/save purpose m_Data.m_csOwner = DbParams.szOwner ; m_Data.m_csLocDb = DbParams.szDbDev ; m_Data.m_csLocChk = DbParams.szChkpDev; m_Data.m_csLocJnl = DbParams.szJrnlDev; m_Data.m_csLocDmp = DbParams.szDmpDev; m_Data.m_csLocSrt = DbParams.szSortDev; // liberate detail structure FreeAttachedPointers (&DbParams, OT_DATABASE); // // Get name of Coordinator Database // int iret; LPUCHAR aparentsTemp[MAXPLEVEL]; LPUCHAR aparentsResult[MAXPLEVEL]; UCHAR bufParResult0[MAXOBJECTNAME]; UCHAR bufParResult1[MAXOBJECTNAME]; UCHAR bufParResult2[MAXOBJECTNAME]; UCHAR buf[MAXOBJECTNAME]; UCHAR bufOwner[MAXOBJECTNAME]; UCHAR bufComplim[MAXOBJECTNAME]; aparentsResult[0] = bufParResult0; aparentsResult[1] = bufParResult1; aparentsResult[2] = bufParResult2; memset (&bufComplim, '\0', sizeof(bufComplim)); memset (&bufOwner, '\0', sizeof(bufOwner)); aparentsTemp[0] = lpRecord->objName; aparentsTemp[1] = aparentsTemp[2] = NULL; iret = DOMGetFirstRelObject(nNodeHandle, OTR_CDB, 1, // level, aparentsTemp, // Temp mandatory! TRUE, // bwithsystem NULL, // base owner NULL, // other owner aparentsResult, buf, bufOwner, bufComplim); if (iret != RES_SUCCESS) { ASSERT (FALSE); // Reset m_Data CuDomPropDataDDb tempData; m_Data = tempData; // Refresh display RefreshDisplay(); return 0L; } m_Data.m_csCoordinator = buf; // Refresh display RefreshDisplay(); return 0L; }
LONG CuDlgDomPropProcLink::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 object PROCEDUREPARAMS ProcedureParams; memset (&ProcedureParams, 0, sizeof (ProcedureParams)); LPTREERECORD lpRecord = (LPTREERECORD)pUps->pStruct; ASSERT (lpRecord); ResetDisplay(); // // Get Detail Info // x_strcpy ((char *)ProcedureParams.objectname, (const char *)lpRecord->objName); x_strcpy ((char *)ProcedureParams.objectowner, (const char *)lpRecord->ownerName); x_strcpy ((char *)ProcedureParams.DBName, (const char *)lpRecord->extra); int dummySesHndl; int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle), OT_PROCEDURE, &ProcedureParams, FALSE, &dummySesHndl); if (iResult != RES_SUCCESS) { ASSERT (FALSE); // Reset m_Data CuDomPropDataProcedure tempData; tempData.m_refreshParams = m_Data.m_refreshParams; m_Data = tempData; // Refresh display RefreshDisplay(); return 0L; } // Update refresh info m_Data.m_refreshParams.UpdateRefreshParams(); // update member variables, for display/load/save purpose m_Data.m_csText = ProcedureParams.lpProcedureText; // liberate detail structure FreeAttachedPointers (&ProcedureParams, OT_PROCEDURE); // // No list of Rules executing procedure // m_Data.m_acsRulesExecutingProcedure.RemoveAll(); // For serialization only // // Refresh display // RefreshDisplay(); return 0L; }
LONG CuDlgDomPropView::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; case FILTER_SETTING_CHANGE: VDBA_OnGeneralSettingChange(&m_clistCtrl); return 0L; default: return 0L; // nothing to change on the display } // Get info on the object VIEWPARAMS ViewParams; memset (&ViewParams, 0, sizeof (ViewParams)); LPTREERECORD lpRecord = (LPTREERECORD)pUps->pStruct; ASSERT (lpRecord); ResetDisplay(); // // Get Detail Info // x_strcpy ((char *)ViewParams.objectname, RemoveDisplayQuotesIfAny((LPCTSTR)StringWithoutOwner(lpRecord->objName))); x_strcpy ((char *)ViewParams.szSchema, (const char *)lpRecord->ownerName); x_strcpy ((char *)ViewParams.DBName, (const char *)lpRecord->extra); int dummySesHndl; int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle), OT_VIEW, &ViewParams, FALSE, &dummySesHndl); if (iResult != RES_SUCCESS) { ASSERT (FALSE); // Reset m_Data CuDomPropDataView tempData; tempData.m_refreshParams = m_Data.m_refreshParams; m_Data = tempData; // Refresh display RefreshDisplay(); return 0L; } // Update refresh info m_Data.m_refreshParams.UpdateRefreshParams(); // update member variables, for display/load/save purpose m_Data.m_csText = ViewParams.lpViewText; // liberate detail structure FreeAttachedPointers (&ViewParams, OT_VIEW); // // Get list of view components // m_Data.m_acsViewComponents.RemoveAll(); m_Data.m_acsSchema.RemoveAll(); m_Data.m_awCompType.RemoveAll(); int iret; LPUCHAR aparentsTemp[MAXPLEVEL]; UCHAR buf[MAXOBJECTNAME]; UCHAR bufOwner[MAXOBJECTNAME]; UCHAR bufComplim[MAXOBJECTNAME]; memset (&bufComplim, '\0', sizeof(bufComplim)); memset (&bufOwner, '\0', sizeof(bufOwner)); // prepare parenthood with schema where relevant aparentsTemp[0] = lpRecord->extra; // DBName UCHAR bufParent1[MAXOBJECTNAME]; aparentsTemp[1] = bufParent1; x_strcpy((char *)buf, (const char *)lpRecord->objName); StringWithOwner(buf, lpRecord->ownerName, aparentsTemp[1]); // schema.name aparentsTemp[2] = NULL; iret = DOMGetFirstObject(nNodeHandle, OT_VIEWTABLE, 2, // level, aparentsTemp, // Temp mandatory! pUps->pSFilter->bWithSystem, // bwithsystem NULL, // owner buf, bufOwner, bufComplim); if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) { // Erroneous case! CString csUnavail; csUnavail.LoadString(IDS_TM_ERR_ERR);// = "< Data Unavailable >"; m_Data.m_acsViewComponents.Add(csUnavail); m_Data.m_acsSchema.Add(_T("")); m_Data.m_awCompType.Add(OT_VIEWTABLE); // unresolved view component } else { while (iret == RES_SUCCESS) { m_Data.m_acsViewComponents.Add((LPCTSTR)buf); m_Data.m_acsSchema.Add((LPCTSTR)bufOwner); // Solve type on the fly int viewCompType; UCHAR resBuf[MAXOBJECTNAME]; UCHAR resBuf2[MAXOBJECTNAME]; UCHAR resBuf3[MAXOBJECTNAME]; LPUCHAR aparentsSolve[MAXPLEVEL]; aparentsSolve[0] = lpRecord->extra; // DBName aparentsSolve[1] = aparentsSolve[2] = NULL; int res = DOMGetObjectLimitedInfo(nNodeHandle, buf, bufOwner, OT_VIEWTABLE, 1, // level aparentsSolve, // parentstrings, TRUE, &viewCompType, resBuf, resBuf2, resBuf3); if (res != RES_SUCCESS) viewCompType = OT_VIEWTABLE; m_Data.m_awCompType.Add(viewCompType); // OT_TABLE or OT_VIEW, or OT_VIEWTABLE if error iret = DOMGetNextObject(buf, bufOwner, bufComplim); } } if (m_Data.m_acsViewComponents.GetUpperBound() == -1) { CString csNoViewComp; csNoViewComp.LoadString(IDS_VIEW_COMPONENTS);// = "< No View Components>"; m_Data.m_acsViewComponents.Add(csNoViewComp); m_Data.m_acsSchema.Add(_T("")); m_Data.m_awCompType.Add(OT_VIEWTABLE); // unresolved view component } // Get comment TCHAR *lpObjComment = NULL; LPOBJECTLIST lpObjCol = NULL; iret = VDBAGetCommentInfo ( (LPTSTR)(LPUCHAR)GetVirtNodeName(nNodeHandle), (LPTSTR)ViewParams.DBName, (LPTSTR)ViewParams.objectname, (LPTSTR)ViewParams.szSchema, &lpObjComment, lpObjCol); if (iret!=RES_SUCCESS) { CString csMsg; csMsg.LoadString(IDS_NOT_AVAILABLE); m_ctrlEditComment.SetWindowText(csMsg); m_Data.m_csComment = csMsg; } else if (lpObjComment) { m_ctrlEditComment.SetWindowText(lpObjComment); m_Data.m_csComment = lpObjComment; ESL_FreeMem(lpObjComment); } else { m_ctrlEditComment.SetWindowText(_T("")); m_Data.m_csComment.Empty(); } // // Refresh display // RefreshDisplay(); return 0L; }
LONG CuDlgDomPropRole::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: // because list of grantees can contain "$ingres" //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 object ROLEPARAMS roleParams; memset (&roleParams, 0, sizeof (roleParams)); LPTREERECORD lpRecord = (LPTREERECORD)pUps->pStruct; ASSERT (lpRecord); ResetDisplay(); // // Manage "Public" special case // CString csPublic(lppublicdispstring()); if (csPublic.CompareNoCase ((const char *)lpRecord->objName) == 0) { // Unacceptable for this property page since managed differently in AllocateUserPageInfo() (mainvi2.cpp) ASSERT (FALSE); // Reset m_Data CuDomPropDataRole tempData; tempData.m_refreshParams = m_Data.m_refreshParams; m_Data = tempData; // Refresh display RefreshDisplay(); return 0L; } // starting from here, "Normal" case // // Get Detail Info // x_strcpy ((char *)roleParams.ObjectName, (const char *)lpRecord->objName); int dummySesHndl; int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle), OT_ROLE, &roleParams, FALSE, &dummySesHndl); if (iResult != RES_SUCCESS) { ASSERT (FALSE); // Reset m_Data CuDomPropDataRole tempData; tempData.m_refreshParams = m_Data.m_refreshParams; m_Data = tempData; // Refresh display RefreshDisplay(); return 0L; } // Update refresh info m_Data.m_refreshParams.UpdateRefreshParams(); // update member variables, for display/load/save purpose if (roleParams.lpLimitSecLabels) m_Data.m_csLimSecureLabel = roleParams.lpLimitSecLabels; else m_Data.m_csLimSecureLabel = ""; ASSERT (sizeof(m_Data.m_aPrivilege) == sizeof (roleParams.Privilege) ); memcpy(m_Data.m_aPrivilege, roleParams.Privilege, sizeof (roleParams.Privilege)); ASSERT (sizeof(m_Data.m_aSecAudit) == sizeof (roleParams.bSecAudit) ); memcpy(m_Data.m_aSecAudit, roleParams.bSecAudit, sizeof (roleParams.bSecAudit)); // liberate detail structure FreeAttachedPointers (&roleParams, OT_ROLE); // // Get list of grantees on role // m_Data.m_acsGranteesOnRole.RemoveAll(); int iret; LPUCHAR aparentsTemp[MAXPLEVEL]; UCHAR buf[MAXOBJECTNAME]; UCHAR bufOwner[MAXOBJECTNAME]; UCHAR bufComplim[MAXOBJECTNAME]; memset (&bufComplim, '\0', sizeof(bufComplim)); memset (&bufOwner, '\0', sizeof(bufOwner)); aparentsTemp[0] = lpRecord->objName; aparentsTemp[1] = aparentsTemp[2] = NULL; iret = DOMGetFirstObject(nNodeHandle, OT_ROLEGRANT_USER, 1, // level, aparentsTemp, // Temp mandatory! pUps->pSFilter->bWithSystem, // bwithsystem NULL, // lpowner buf, bufOwner, bufComplim); if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) { // Erroneous case! CString csUnavail = VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE);//"<Data Unavailable>" m_Data.m_acsGranteesOnRole.Add(csUnavail); } else { while (iret == RES_SUCCESS) { m_Data.m_acsGranteesOnRole.Add((LPCTSTR)buf); iret = DOMGetNextObject(buf, bufOwner, bufComplim); } } if (m_Data.m_acsGranteesOnRole.GetUpperBound() == -1) { CString csNoGrantee = VDBA_MfcResourceString (IDS_E_NO_GRANTEE);//"<No Grantee>"; m_Data.m_acsGranteesOnRole.Add(csNoGrantee); } // Refresh display RefreshDisplay(); return 0L; }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPGRANTPARAMS lpgrant = GetDlgProp (hwnd); HWND hwndGrantees = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GRANTEES); HWND hwndDBevents = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_DBEVENT); int ires; switch (id) { case IDOK: if (!FillStructureFromControls (hwnd, lpgrant)) break; ires = DBAAddObject (GetVirtNodeName (GetCurMdiNodeHandle ()), OTLL_GRANT, (void *) lpgrant); if (ires != RES_SUCCESS) { FreeAttachedPointers (lpgrant, OTLL_GRANT); ErrorMessage ((UINT)IDS_E_GRANT_DBEVENT_FAILED, RES_ERR); break; } else EndDialog (hwnd, TRUE); FreeAttachedPointers (lpgrant, OTLL_GRANT); break; case IDCANCEL: EndDialog (hwnd, FALSE); break; case IDC_GRANT_DBEVENT_RAISE: case IDC_GRANT_DBEVENT_REGISTER: EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_GRANTEES: case IDC_GRANT_DBEVENT_DBEVENT: EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_USER: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_USER); EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_GROUP: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_GROUP); EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_ROLE: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_ROLE); EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_PUBLIC: CAListBox_ResetContent (hwndGrantees); EnableDisableOKButton (hwnd); break; } }
LONG CuDlgDomPropIntegrity::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 object INTEGRITYPARAMS IntegrityParams; memset (&IntegrityParams, 0, sizeof (IntegrityParams)); LPTREERECORD lpRecord = (LPTREERECORD)pUps->pStruct; ASSERT (lpRecord); ResetDisplay(); // // Get Detail Info // IntegrityParams.number = lpRecord->complimValue; x_strcpy ((char *)IntegrityParams.DBName, (const char *)lpRecord->extra); x_strcpy ((char *)IntegrityParams.TableName, RemoveDisplayQuotesIfAny((LPCTSTR)StringWithoutOwner(lpRecord->extra2))); x_strcpy ((char *)IntegrityParams.TableOwner, (const char *)lpRecord->tableOwner); int dummySesHndl; int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle), OT_INTEGRITY, &IntegrityParams, FALSE, &dummySesHndl); if (iResult != RES_SUCCESS) { ASSERT (FALSE); // Reset m_Data CuDomPropDataIntegrity tempData; tempData.m_refreshParams = m_Data.m_refreshParams; m_Data = tempData; // Refresh display RefreshDisplay(); return 0L; } // Update refresh info m_Data.m_refreshParams.UpdateRefreshParams(); // update member variables, for display/load/save purpose m_Data.m_lNumber = IntegrityParams.number; m_Data.m_csText = IntegrityParams.lpIntegrityText; // liberate detail structure FreeAttachedPointers (&IntegrityParams, OT_INTEGRITY); // Refresh display RefreshDisplay(); return 0L; }
int GetDetailInfoLL(LPUCHAR lpVirtNode,int iobjecttype, void *lpparameters, BOOL bRetainSessForLock, int *ilocsession) { int iret, SessType; char connectname[MAXOBJECTNAME]; if (!lpparameters) { myerror(ERR_INVPARAMS); return RES_ERR; } if (bRetainSessForLock) SessType=SESSION_TYPE_CACHEREADLOCK; else SessType=SESSION_TYPE_CACHENOREADLOCK; switch (iobjecttype) { case OT_SEQUENCE: { LPSEQUENCEPARAMS pseqprm=(LPSEQUENCEPARAMS) lpparameters; if (!*(pseqprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pseqprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pseqprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfSequence(pseqprm); } break; case OT_REPLIC_CONNECTION_V11: { LPREPLCONNECTPARAMS lpaddrepl= (LPREPLCONNECTPARAMS)lpparameters; ; wsprintf(connectname,"%s::%s",lpVirtNode,lpaddrepl->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret = ReplicConnectV11(lpaddrepl); } break; case OT_REPLIC_CONNECTION: { LPREPLCONNECTPARAMS lpaddrepl= (LPREPLCONNECTPARAMS)lpparameters; ; wsprintf(connectname,"%s::%s",lpVirtNode,lpaddrepl->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret = ReplicConnect(lpaddrepl); } break; case OT_DBEVENT: iret =RES_SUCCESS; // no displayable property // TO BE FINISHED session not opened. break; case OT_ROLE: { LPROLEPARAMS proleprm=(LPROLEPARAMS) lpparameters; if (!*(proleprm->ObjectName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfRole(proleprm); } break; //JFS Begin case OT_REPLIC_CDDS : case OT_REPLIC_CDDS_V11 : { LPREPCDDS lpcdds = (LPREPCDDS)lpparameters; wsprintf(connectname,"%s::%s",lpVirtNode,lpcdds->DBName); iret = Getsession(connectname, SESSION_TYPE_INDEPENDENT, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret = CDDSLoadAll(lpcdds,lpVirtNode); } break; //JFS End case OT_GROUP : { LPGROUPPARAMS pgrpprm=(LPGROUPPARAMS) lpparameters; if (!*(pgrpprm->ObjectName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfGrp(pgrpprm); } break; case OT_INTEGRITY: { LPINTEGRITYPARAMS pintegrityprm=(LPINTEGRITYPARAMS) lpparameters; if (!*(pintegrityprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pintegrityprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfIntegrity(pintegrityprm); } break; case OT_LOCATION: { LPLOCATIONPARAMS plocprm=(LPLOCATIONPARAMS) lpparameters; if (!*(plocprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfLoc(plocprm); } break; case OT_PROCEDURE: { LPPROCEDUREPARAMS pprocprm=(LPPROCEDUREPARAMS) lpparameters; if (!*(pprocprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pprocprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pprocprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfProcedure(pprocprm); } break; case OT_RULE: { LPRULEPARAMS pruleprm=(LPRULEPARAMS) lpparameters; if (!*(pruleprm->RuleName)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pruleprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pruleprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfRule(pruleprm); } break; case OT_USER : { LPUSERPARAMS pusrprm=(LPUSERPARAMS) lpparameters; if (!*(pusrprm->ObjectName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfUsr(pusrprm); } break; case OT_PROFILE : { LPPROFILEPARAMS pprofprm=(LPPROFILEPARAMS) lpparameters; if (!*(pprofprm->ObjectName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfProf(pprofprm); } break; case OT_VIEW: { LPVIEWPARAMS pviewprm=(LPVIEWPARAMS) lpparameters; if (!*(pviewprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pviewprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pviewprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfView(pviewprm); } break; case OT_INDEX: { LPINDEXPARAMS pindexprm=(LPINDEXPARAMS) lpparameters; if (!*(pindexprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pindexprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::%s",lpVirtNode, pindexprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; x_strcpy(pindexprm->szNodeName, lpVirtNode); iret=GetInfIndex(pindexprm); } break; case OT_TABLE: { LPTABLEPARAMS ptableprm=(LPTABLEPARAMS) lpparameters; if (!*(ptableprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(ptableprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::%s",lpVirtNode, ptableprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; x_strcpy(ptableprm->szNodeName, lpVirtNode); iret=GetInfTable(ptableprm); } break; case OT_DATABASE: { LPDATABASEPARAMS pbaseprm=(LPDATABASEPARAMS) lpparameters; wsprintf(connectname,"%s::%s",lpVirtNode,pbaseprm->objectname); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfBaseExtend(pbaseprm); // retrieve UNICODE information pbaseprm->bUnicodeDBNFD = 0; pbaseprm->bUnicodeDBNFC = 0; if (iret==RES_SUCCESS && GetOIVers() >= OIVERS_26) { TCHAR tcVersion[40]; TCHAR tcNormalization[40]; INGRESII_llDBMSInfo(_T("unicode_level"),tcVersion); INGRESII_llDBMSInfo(_T("unicode_normalization"), tcNormalization); if (tcVersion[0] != '0' && (x_strcmp(tcNormalization, "NFD")==0)) pbaseprm->bUnicodeDBNFD = 1; if (tcVersion[0]!='0' && (x_strcmp(tcNormalization, "NFC")==0)) pbaseprm->bUnicodeDBNFC = 1; } // Retrieve the current Catalog Page Size if (iret==RES_SUCCESS && GetOIVers() >= OIVERS_30) iret = GetCatalogPageSize(pbaseprm); if (iret==RES_SUCCESS) iret=ReleaseSession(*ilocsession, RELEASE_COMMIT); else ReleaseSession(*ilocsession, RELEASE_ROLLBACK); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfBase(pbaseprm); } break; default : iret=RES_ERR; } if (bRetainSessForLock) // The session was asked to be retained for... return iret; // ... locking purposes, return without releasing. if (iret==RES_SUCCESS) iret=ReleaseSession(*ilocsession, RELEASE_COMMIT); else ReleaseSession(*ilocsession, RELEASE_ROLLBACK); return iret; }
static BOOL FillStructureFromControls (HWND hwnd, LPSECURITYALARMPARAMS lpsecurity) { char buf [MAXOBJECTNAME]; char buffowner [MAXOBJECTNAME]; char bufftable [MAXOBJECTNAME]; LPCHECKEDOBJECTS obj; LPCHECKEDOBJECTS list = NULL; int i, max_database_number, checked; HWND hwndUsers = GetDlgItem (hwnd, IDC_REFALARM_BYUSER ); HWND hwndTables = GetDlgItem (hwnd, IDC_REFALARM_ONTABLE); HWND hwndSuccess = GetDlgItem (hwnd, IDC_REFALARM_SUCCESS); HWND hwndFailure = GetDlgItem (hwnd, IDC_REFALARM_FAILURE); HWND hwndSelect = GetDlgItem (hwnd, IDC_REFALARM_SELECT); HWND hwndDelete = GetDlgItem (hwnd, IDC_REFALARM_DELETE); HWND hwndInsert = GetDlgItem (hwnd, IDC_REFALARM_INSERT); HWND hwndUpdate = GetDlgItem (hwnd, IDC_REFALARM_UPDATE); lpsecurity->bsuccfail [SECALARMSUCCESS] = Button_GetCheck (hwndSuccess); lpsecurity->bsuccfail [SECALARMFAILURE] = Button_GetCheck (hwndFailure); // // Get selection from // toggle buttons (Select, Delete, Insert, Update) // lpsecurity->baccesstype [SECALARMSEL] = Button_GetCheck (hwndSelect); lpsecurity->baccesstype [SECALARMDEL] = Button_GetCheck (hwndDelete); lpsecurity->baccesstype [SECALARMINS] = Button_GetCheck (hwndInsert); lpsecurity->baccesstype [SECALARMUPD] = Button_GetCheck (hwndUpdate); // // Get the names of users that have been checked and // insert into the list // max_database_number = CAListBox_GetCount (hwndUsers); for (i=0; i<max_database_number; i++) { checked = CAListBox_GetSel (hwndUsers, i); if (checked) { CAListBox_GetText (hwndUsers, i, buf); obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS)); if (!obj) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); break; } else { if (x_strcmp (buf, lppublicdispstring()) == 0) x_strcpy (obj->dbname, lppublicsysstring()); else x_strcpy (obj->dbname, buf); obj->bchecked = TRUE; list = AddCheckedObject (list, obj); } } } lpsecurity->lpfirstUser = list; // // Get the names of Tables that have been checked and // insert into the list // max_database_number = CAListBox_GetCount (hwndTables); list = NULL; for (i = 0; i < max_database_number; i++) { checked = CAListBox_GetSel (hwndTables, i); if (checked) { CAListBox_GetText (hwndTables, i, buf); x_strcpy (buffowner, (char *) CAListBox_GetItemData (hwndTables, i)); obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS)); if (!obj) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR); return FALSE; } else { StringWithOwner (buf, buffowner, bufftable); x_strcpy (obj->dbname, bufftable); obj->bchecked = TRUE; list = AddCheckedObject (list, obj); } } } lpsecurity->lpfirstTable = list; return TRUE; }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPSECURITYALARMPARAMS lpsecurity = GetDlgProp (hwnd); int ires; switch (id) { case IDOK: if (!FillStructureFromControls (hwnd, lpsecurity)) break; // // Call the low level function to write data on disk // ires = DBAAddObject ( GetVirtNodeName ( GetCurMdiNodeHandle ()), OTLL_SECURITYALARM, (void *) lpsecurity ); if (ires != RES_SUCCESS) { FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); ErrorMessage ((UINT)IDS_E_CREATE_SECURITY_FAILED, ires); break; } else EndDialog (hwnd, TRUE); FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); break; case IDCANCEL: FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); EndDialog (hwnd, FALSE); break; case IDC_REFALARM_BYUSER: EnableDisableOKButton (hwnd); break; case IDC_REFALARM_DATABASE: { char szDatabaseName [MAXOBJECTNAME]; HWND hwndDatabase = GetDlgItem (hwnd, IDC_REFALARM_DATABASE); HWND hwndTables = GetDlgItem (hwnd, IDC_REFALARM_ONTABLE); switch (codeNotify) { case CBN_SELCHANGE: ComboBox_GetText (hwndDatabase, szDatabaseName, sizeof (szDatabaseName)); if (x_strlen (szDatabaseName) > 0) { x_strcpy (lpsecurity->DBName, szDatabaseName); CAListBoxDestroyItemData (hwndTables); CAListBox_ResetContent (hwndTables); if (!CAListBoxFillTables (hwndTables, lpsecurity->DBName, FALSE)) CAListBoxDestroyItemData (hwndTables); } break; } EnableDisableOKButton (hwnd); } break; case IDC_REFALARM_ONTABLE: EnableDisableOKButton (hwnd); break; case IDC_REFALARM_SUCCESS: case IDC_REFALARM_FAILURE: case IDC_REFALARM_SELECT: case IDC_REFALARM_DELETE: case IDC_REFALARM_INSERT: case IDC_REFALARM_UPDATE: EnableDisableOKButton (hwnd); break; } }