コード例 #1
0
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;
}
コード例 #2
0
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;
}
コード例 #3
0
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;
}
コード例 #4
0
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;
}
コード例 #5
0
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;
}
コード例 #6
0
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;
}