Exemple #1
0
void CuDlgDomPropStaticProfile::ResetDisplay()
{
  UpdateData (FALSE);   // Mandatory!
  m_cListCtrl.DeleteAllItems();
  VDBA_OnGeneralSettingChange(&m_cListCtrl);
  // Force immediate update of all children controls
  RedrawAllChildWindows(m_hWnd);
}
Exemple #2
0
void CuDlgDomPropView::ResetDisplay()
{
  UpdateData (FALSE);   // Mandatory!
  m_clistCtrl.DeleteAllItems();
  m_edText.SetWindowText(_T(""));
  m_ctrlEditComment.SetWindowText(_T(""));
  VDBA_OnGeneralSettingChange(&m_clistCtrl);
  // Force immediate update of all children controls
  RedrawAllChildWindows(m_hWnd);
}
Exemple #3
0
LONG CuDlgDomPropStaticProfile::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:    // eligible
      case FILTER_DOM_BASEOWNER:
      //case FILTER_DOM_OTHEROWNER:
      break;

    case FILTER_DOM_BKREFRESH:
      // eligible if UpdateType is compatible with DomGetFirst/Next object type,
      // or is ot_virtnode, which means refresh for all whatever the type is
      if (pUps->pSFilter->UpdateType != OT_VIRTNODE &&
          pUps->pSFilter->UpdateType != OT_PROFILE)
        return 0L;
      break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListCtrl);
        return 0L;
    default:
      return 0L;    // nothing to change on the display
  }

  // Get info on the current item
  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();
  //
  // Get list of Profiles
  //
  m_Data.m_uaStaticProfile.RemoveAll();

  int     iret;
  LPUCHAR aparentsTemp[MAXPLEVEL];

  UCHAR   buf[MAXOBJECTNAME];
  UCHAR   bufOwner[MAXOBJECTNAME];
  UCHAR   bufComplim[MAXOBJECTNAME];

  // parent preparation
  aparentsTemp[0] = aparentsTemp[1] = aparentsTemp[2] = NULL;

  memset (&bufComplim, '\0', sizeof(bufComplim));
  memset (&bufOwner, '\0', sizeof(bufOwner));
  iret =  DOMGetFirstObject(nNodeHandle,
                            OT_PROFILE,
                            0,                            // level,
                            aparentsTemp,                 // Temp mandatory!
                            pUps->pSFilter->bWithSystem,  // bwithsystem
                            NULL,                         // lpowner
                            buf,
                            bufOwner,
                            bufComplim);
  if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
    // Erroneous case!
    CuNameOnly errItem(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE), TRUE);   // Special"<Data Unavailable>"
    m_Data.m_uaStaticProfile.Add(errItem);
  }
  else {
    while (iret == RES_SUCCESS) {
      CuNameOnly item((const char*)buf, FALSE);   // Not special, but regular
      m_Data.m_uaStaticProfile.Add(item);

      iret = DOMGetNextObject(buf, bufOwner, bufComplim);
    }
  }
  if (m_Data.m_uaStaticProfile.GetCount() == 0) {
    CuNameOnly noItem(VDBA_MfcResourceString (IDS_E_NO_PROFILE), TRUE);//"<No Profile>"
    m_Data.m_uaStaticProfile.Add(noItem);
  }

  // Refresh display
  RefreshDisplay();

  return 0L;
}
Exemple #4
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;
}
Exemple #5
0
LONG CuDlgDomPropTblInteg::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:    // eligible
      //case FILTER_DOM_BASEOWNER:
      //case FILTER_DOM_OTHEROWNER:
      break;

    case FILTER_DOM_BKREFRESH:
      // eligible if UpdateType is compatible with DomGetFirst/Next object type,
      // or is ot_virtnode, which means refresh for all whatever the type is
      if (pUps->pSFilter->UpdateType != OT_VIRTNODE &&
          pUps->pSFilter->UpdateType != OT_INTEGRITY)
        return 0L;
      break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListCtrl);
        return 0L;
    default:
      return 0L;    // nothing to change on the display
  }

  // Get info on the current item
  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();
  //
  // Get list of Tbl for the replication
  //
  m_Data.m_uaTblInteg.RemoveAll();

  int     iret;
  UCHAR   buf[MAXOBJECTNAME];
  UCHAR   bufOwner[MAXOBJECTNAME];
  UCHAR   bufComplim[MAXOBJECTNAME];

  //
  // CHECK EXISTENCE SINCE REGISTERED TABLE MIGHT NOT REALLY EXIST YET
  //
  int   resultType;
  UCHAR resultObjectName[MAXOBJECTNAME];
  UCHAR resultOwnerName[MAXOBJECTNAME];
  UCHAR resultExtraData[MAXOBJECTNAME];
  char* parentStrings[3];
  parentStrings[0] = (char*)lpRecord->extra;  // DBName
  parentStrings[1] = parentStrings[2] = NULL;

  // preparation for get limited info - added static type - added all related granted types
  LPUCHAR lpName = NULL;
  LPUCHAR lpOwner = NULL;
  int basicType = GetBasicType(lpRecord->recType);
  m_Data.m_objType = basicType;
  switch (basicType) {
    case OT_TABLE:
    case OT_SCHEMAUSER_TABLE:
      lpName = (LPUCHAR)lpRecord->objName;
      lpOwner = (LPUCHAR)lpRecord->ownerName;
      break;
    case OT_STATIC_INTEGRITY:
      lpName = (LPUCHAR)lpRecord->extra2;
      lpOwner = (LPUCHAR)lpRecord->tableOwner;
      break;
    default:
      ASSERT(FALSE);
      return 0L;
  }

  iret = DOMGetObjectLimitedInfo(nNodeHandle,
                                 lpName,                           // object name,
                                 lpOwner,                          // object owner
                                 OT_TABLE,                         // iobjecttype
                                 1,                                // level
                                 (unsigned char **)parentStrings,  // parenthood
                                 TRUE,                             // bwithsystem
                                 &resultType,
                                 resultObjectName,
                                 resultOwnerName,
                                 resultExtraData
                                 );
  if (iret == RES_ENDOFDATA)
    iret = RES_ERR;           // Non-existent: ERROR !!!
  if (iret == RES_SUCCESS) {
    LPUCHAR aparentsTemp[MAXPLEVEL];

    // prepare parenthood with schema where relevant
    aparentsTemp[0] = lpRecord->extra;  // DBName

    UCHAR bufParent1[MAXOBJECTNAME];
    aparentsTemp[1] = bufParent1;
    x_strcpy((char *)buf, (const char *)resultObjectName);
    StringWithOwner(buf, resultOwnerName, aparentsTemp[1]); // schema.name

    aparentsTemp[2] = NULL;

    memset (&bufComplim, '\0', sizeof(bufComplim));
    memset (&bufOwner, '\0', sizeof(bufOwner));
    iret =  DOMGetFirstObject(nNodeHandle,
                              OT_INTEGRITY,
                              2,                            // level,
                              aparentsTemp,                 // Temp mandatory!
                              pUps->pSFilter->bWithSystem,  // bwithsystem
                              NULL,                         // lpowner
                              buf,
                              bufOwner,
                              bufComplim);
  }
  if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
    // Erroneous case!
    CuNameWithOwner errItem(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE));//"<Data Unavailable>"
    m_Data.m_uaTblInteg.Add(errItem);
  }
  else {
    while (iret == RES_SUCCESS) {
      CuNameWithOwner item((const char*)buf, _T(""));   // no owner
      m_Data.m_uaTblInteg.Add(item);

      iret = DOMGetNextObject(buf, bufOwner, bufComplim);
    }
  }
  if (m_Data.m_uaTblInteg.GetCount() == 0) {
    CuNameWithOwner noItem(VDBA_MfcResourceString (IDS_E_NO_INTEGRITY));//"<No Integrity>"
    m_Data.m_uaTblInteg.Add(noItem);
  }

  // Refresh display
  RefreshDisplay();

  return 0L;
}
Exemple #6
0
LONG CuDlgDomPropRoleXGrantedDb::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:  // can be system objects (replicator dd_xyz)
      //case FILTER_DOM_BASEOWNER:
      //case FILTER_DOM_OTHEROWNER:
      break;

    case FILTER_DOM_BKREFRESH:
      // eligible if UpdateType is compatible with DomGetFirst/Next object type,
      // or is ot_virtnode, which means refresh for all whatever the type is
      if (pUps->pSFilter->UpdateType != OT_VIRTNODE &&
          pUps->pSFilter->UpdateType != OT_DATABASE)
        return 0L;
      break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListCtrl);
        return 0L;
    default:
      return 0L;    // nothing to change on the display
  }

  // Get info on the current item
  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();
  //
  // Get list of granted objects
  //
  m_Data.m_uaRoleXGrantedDb.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));

  // Xref return code
  LPUCHAR aparentsResult[MAXPLEVEL];
  UCHAR   bufParResult0[MAXOBJECTNAME];
  UCHAR   bufParResult1[MAXOBJECTNAME];
  UCHAR   bufParResult2[MAXOBJECTNAME];
  aparentsResult[0] = bufParResult0;
  aparentsResult[1] = bufParResult1;
  aparentsResult[2] = bufParResult2;

  // prepare parenthood with schema where relevant
  aparentsTemp[0] = lpRecord->objName;
  aparentsTemp[1] = aparentsTemp[2] = NULL;

  BOOL bError = FALSE;
  for (int index = 0; index < NBDBGRANTED; index++) {
    iret =  DOMGetFirstRelObject(nNodeHandle,
                                 aGrantedType[index],
                                 1,                           // level,
                                 aparentsTemp,                // Temp mandatory!
                                 pUps->pSFilter->bWithSystem, // bwithsystem
                                 NULL,                        // base owner
                                 NULL,                        // other owner
                                 aparentsResult,
                                 buf,
                                 bufOwner,
                                 bufComplim);
     if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
       bError = TRUE;
       continue;
    }
    else {
      while (iret == RES_SUCCESS) {
        CuGrantedDb grantedDb((const char *)buf,                // obj name
                              (const char *)_T(""),             // No obj owner
                              (const char *)_T(""),             // No obj parent
                              aGrantedType[index]               // grant type
                              );
        CuMultFlag *pRefGrantedDb = m_Data.m_uaRoleXGrantedDb.Find(&grantedDb);
        if (pRefGrantedDb)
          m_Data.m_uaRoleXGrantedDb.Merge(pRefGrantedDb, &grantedDb);
        else
          m_Data.m_uaRoleXGrantedDb.Add(grantedDb);

        iret = DOMGetNextRelObject(aparentsResult, buf, bufOwner, bufComplim);
      }
    }
  }

  // Manage error case
  if (bError)
  {
    /* "<Data Unavailable>" */
    CuGrantedDb grantedDb1(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE));
    m_Data.m_uaRoleXGrantedDb.Add(grantedDb1);
  }

  // Manage no granted object
  if (m_Data.m_uaRoleXGrantedDb.GetCount() == 0)
  {
    CuGrantedDb grantedDb2(VDBA_MfcResourceString (IDS_E_NO_GRANTED_DB));
    m_Data.m_uaRoleXGrantedDb.Add(grantedDb2);
  }

  ASSERT (m_Data.m_uaRoleXGrantedDb.GetCount() > 0 );

  // Refresh display
  RefreshDisplay();

  return 0L;
}
Exemple #7
0
LONG CuDlgDomPropTableGrantees::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:  // can be $ingres
        //case FILTER_DOM_BASEOWNER:
        //case FILTER_DOM_OTHEROWNER:
        break;

    case FILTER_DOM_BKREFRESH:
        // eligible if UpdateType is compatible with DomGetFirst/Next object type,
        // or is ot_virtnode, which means refresh for all whatever the type is
        if (pUps->pSFilter->UpdateType != OT_VIRTNODE &&
                pUps->pSFilter->UpdateType != OTLL_GRANTEE)
            return 0L;
        break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListCtrl);
        return 0L;
    default:
        return 0L;    // nothing to change on the display
    }

    // Get info on the current item
    LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
    ASSERT (lpRecord);
    ResetDisplay();
    //
    // Get list of Grantees
    //
    m_Data.m_uaTableGrantees.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;  // parent DB Name

    UCHAR bufParent1[MAXOBJECTNAME];
    aparentsTemp[1] = bufParent1;
    switch (lpRecord->recType) {
    case OT_TABLE:
    case OTR_GRANTEE_SEL_TABLE:
    case OTR_GRANTEE_INS_TABLE:
    case OTR_GRANTEE_UPD_TABLE:
    case OTR_GRANTEE_DEL_TABLE:
    case OTR_GRANTEE_REF_TABLE:
    case OTR_GRANTEE_CPI_TABLE:
    case OTR_GRANTEE_CPF_TABLE:
    case OTR_GRANTEE_ALL_TABLE:
    case OTR_LOCATIONTABLE:
    case OT_REPLIC_REGTABLE:
    case OT_SCHEMAUSER_TABLE:
    case OTR_REPLIC_CDDS_TABLE:
        x_strcpy((char *)buf, (const char *)lpRecord->objName);
        break;
    case OT_STATIC_TABLEGRANTEES:
        x_strcpy((char *)buf, (const char *)lpRecord->extra2);
        break;
    default:
        ASSERT (FALSE);
        buf[0] = '\0';
    }
    ASSERT (lpRecord->ownerName);
    StringWithOwner(buf, lpRecord->ownerName, aparentsTemp[1]); // schema.name

    aparentsTemp[2] = NULL;

    // loop on grants
    BOOL bError = FALSE;
    for (int index = 0; index < NBTBLGRANTEES; index++) {
        iret =  DOMGetFirstObject(nNodeHandle,
                                  aGrantType[index],
                                  2,                            // level,
                                  aparentsTemp,                 // Temp mandatory!
                                  pUps->pSFilter->bWithSystem,  // bwithsystem
                                  NULL,                         // lpowner
                                  buf,
                                  bufOwner,
                                  bufComplim);
        if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
            bError = TRUE;
            continue;
        }
        else {
            while (iret == RES_SUCCESS) {
                // received data:
                // - Grantee name in buf
                CuTableGrantee grantee((const char *)buf,     // Grantee name (user/group/role)
                                       FALSE,                 // not special item
                                       aGrantType[index]    // grant type
                                      );

                // Solve type on the fly and SetGranteeType
                int granteeType;
                UCHAR resBuf[MAXOBJECTNAME];
                UCHAR resBuf2[MAXOBJECTNAME];
                UCHAR resBuf3[MAXOBJECTNAME];
                int res = DOMGetObjectLimitedInfo(nNodeHandle,
                                                  buf,
                                                  bufOwner,
                                                  OT_GRANTEE,
                                                  0,     // level
                                                  NULL,  // parentstrings,
                                                  TRUE,
                                                  &granteeType,
                                                  resBuf,
                                                  resBuf2,
                                                  resBuf3);
                if (res != RES_SUCCESS)
                    grantee.SetGranteeType(OT_ERROR);
                else
                    grantee.SetGranteeType(granteeType);

                CuMultFlag *pRefGrantee = m_Data.m_uaTableGrantees.Find(&grantee);
                if (pRefGrantee)
                    m_Data.m_uaTableGrantees.Merge(pRefGrantee, &grantee);
                else
                    m_Data.m_uaTableGrantees.Add(grantee);

                iret = DOMGetNextObject(buf, bufOwner, bufComplim);
            }
        }
    }

    // Manage error case
    if (bError)
    {
        /* "<Data Unavailable>" */
        CuTableGrantee grantee1(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE),
                                TRUE);
        m_Data.m_uaTableGrantees.Add(grantee1);
    }

    // Manage no grantee
    if (m_Data.m_uaTableGrantees.GetCount() == 0)
    {
        /* "<No Grantee>" */
        CuTableGrantee grantee2(VDBA_MfcResourceString (IDS_E_NO_GRANTEE), TRUE);
        m_Data.m_uaTableGrantees.Add(grantee2);
    }

    ASSERT (m_Data.m_uaTableGrantees.GetCount() > 0 );

    // Refresh display
    RefreshDisplay();

    return 0L;
}
Exemple #8
0
LONG CuDlgDomPropDbSeq::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:    // eligible
    //case FILTER_DOM_BASEOWNER:
    case FILTER_DOM_OTHEROWNER:
        break;

    case FILTER_DOM_BKREFRESH:
        // eligible if UpdateType is compatible with DomGetFirst/Next object type,
        // or is ot_virtnode, which means refresh for all whatever the type is
        if (pUps->pSFilter->UpdateType != OT_VIRTNODE &&
                pUps->pSFilter->UpdateType != OT_PROCEDURE)
            return 0L;
        break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListCtrl);
        return 0L;
    default:
        return 0L;    // nothing to change on the display
    }

    ResetDisplay();
    // Get info on the current item
    LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
    ASSERT (lpRecord);

    //
    // Get list of Proc for the replication
    //
    m_Data.m_uaDbSeq.RemoveAll();

    int     iret;
    LPUCHAR aparentsTemp[MAXPLEVEL];

    UCHAR   buf[MAXOBJECTNAME];
    UCHAR   bufOwner[MAXOBJECTNAME];
    UCHAR   bufComplim[MAXOBJECTNAME];

    // parent preparation - added static type.
    int basicType = GetBasicType(lpRecord->recType);
    switch (basicType) {
    case OT_DATABASE:
        aparentsTemp[0] = lpRecord->objName;
        break;
    case OT_STATIC_SEQUENCE:
        aparentsTemp[0] = lpRecord->extra;
        break;
    default:
        ASSERT(FALSE);
        return 0L;
    }
    aparentsTemp[1] = aparentsTemp[2] = NULL;
    m_Data.m_objType = basicType;

    memset (&bufComplim, '\0', sizeof(bufComplim));
    memset (&bufOwner, '\0', sizeof(bufOwner));
    iret =  DOMGetFirstObject(nNodeHandle,
                              OT_SEQUENCE,
                              1,                            // level,
                              aparentsTemp,                 // Temp mandatory!
                              pUps->pSFilter->bWithSystem,  // bwithsystem
                              (LPUCHAR)pUps->pSFilter->lpOtherOwner, // lpowner
                              buf,
                              bufOwner,
                              bufComplim);
    if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
        // Erroneous case!
        CuNameWithOwner errItem(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE));//"<Data Unavailable>"
        m_Data.m_uaDbSeq.Add(errItem);
    }
    else {
        while (iret == RES_SUCCESS) {
            CuNameWithOwner item((const char*)buf, (const char*)bufOwner);
            m_Data.m_uaDbSeq.Add(item);

            iret = DOMGetNextObject(buf, bufOwner, bufComplim);
        }
    }
    if (m_Data.m_uaDbSeq.GetCount() == 0) {
        CuNameWithOwner noItem(VDBA_MfcResourceString (IDS_E_NO_SEQUENCE));//"<No Sequence>"
        m_Data.m_uaDbSeq.Add(noItem);
    }

    // Refresh display
    RefreshDisplay();

    return 0L;
}
Exemple #9
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;
}
Exemple #10
0
LONG CuDlgDomPropReplicConn::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:
      // eligible if UpdateType is compatible with DomGetFirst/Next object type,
      // or is ot_virtnode, which means refresh for all whatever the type is
      if (pUps->pSFilter->UpdateType != OT_VIRTNODE &&
          pUps->pSFilter->UpdateType != OT_REPLIC_CONNECTION)
        return 0L;
      break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListCtrl);
        return 0L;
    default:
      return 0L;    // nothing to change on the display
  }

  // Get info on the current item
  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();

  //
  // Get list of Conn for the replication
  //
  m_Data.m_uaReplicConn.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->extra;
  aparentsTemp[1] = aparentsTemp[2] = NULL;

  iret =  DOMGetFirstObject(nNodeHandle,
                            OT_REPLIC_CONNECTION,
                            1,                            // level,
                            aparentsTemp,                 // Temp mandatory!
                            pUps->pSFilter->bWithSystem,  // bwithsystem
                            NULL,                         // lpowner
                            buf,
                            bufOwner,
                            bufComplim);
  if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
    // Erroneous case!
    CuNameWithNumber unavail(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE));//_T("<Data Unavailable>")
    m_Data.m_uaReplicConn.Add(unavail);
  }
  else {
    while (iret == RES_SUCCESS) {
      int iNumber = (int)(long)getint(bufOwner);
      CString cs = buf;
      int idxSpace = cs.Find(_T(' '));
      ASSERT (idxSpace != -1);
      if (idxSpace != -1) {
        int len = cs.GetLength();
        CString cs2 = cs.Right(len - idxSpace);
        cs2.TrimLeft();
        ASSERT (!cs2.IsEmpty());
        cs = cs2;
      }
      CuNameWithNumber conn(cs, iNumber);
      m_Data.m_uaReplicConn.Add(conn);

      iret = DOMGetNextObject(buf, bufOwner, bufComplim);
    }
  }
  if (m_Data.m_uaReplicConn.GetCount() == 0) {
    CuNameWithNumber noConn(VDBA_MfcResourceString (IDS_E_NO_CONNECTION));//"<No Connection>"
    m_Data.m_uaReplicConn.Add(noConn);
  }

  // Refresh display
  RefreshDisplay();

  return 0L;
}
Exemple #11
0
LONG CuDlgDomPropIceFacetNPageRoles::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:    // eligible
        //case FILTER_DOM_BASEOWNER:
        //case FILTER_DOM_OTHEROWNER:
        break;

    case FILTER_DOM_BKREFRESH:
        // eligible if UpdateType is compatible with DomGetFirst/Next object type,
        // or is ot_virtnode, which means refresh for all whatever the type is
        if (pUps->pSFilter->UpdateType != OT_VIRTNODE &&
                pUps->pSFilter->UpdateType != OT_ICE_GENERIC)
            return 0L;
        break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListCtrl);
        return 0L;
    default:
        return 0L;    // nothing to change on the display
    }

    ResetDisplay();
    // Get info on the current item
    LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
    ASSERT (lpRecord);

    //
    // Get list of FacetNPageRoles
    //
    m_Data.m_uaIceFacetNPageAccessdef.RemoveAll();

    int     iret;
    LPUCHAR aparentsTemp[MAXPLEVEL];

    UCHAR   buf[MAXOBJECTNAME];
    UCHAR   bufOwner[MAXOBJECTNAME];
    UCHAR   bufComplim[MAXOBJECTNAME];

    // no parent preparation - check type
    ASSERT (lpRecord->recType == OT_STATIC_ICE_BUNIT_FACET_ROLE ||
            lpRecord->recType == OT_ICE_BUNIT_FACET             ||
            lpRecord->recType == OT_STATIC_ICE_BUNIT_PAGE_ROLE ||
            lpRecord->recType == OT_ICE_BUNIT_PAGE
           );
    m_Data.m_objType = lpRecord->recType;   // MANDATORY!

    // parent bunit name in aparentsTemp[0]
    // parent facet or page name in aparentsTemp[1]
    aparentsTemp[0] = lpRecord->extra;
    switch (lpRecord->recType) {
    case OT_ICE_BUNIT_FACET:
    case OT_ICE_BUNIT_PAGE:
        aparentsTemp[1] = lpRecord->objName;
        break;
    case OT_STATIC_ICE_BUNIT_FACET_ROLE:
    case OT_STATIC_ICE_BUNIT_PAGE_ROLE:
        aparentsTemp[1] = lpRecord->extra2;
        break;
    default:
        ASSERT(FALSE);
        return 0L;
    }
    aparentsTemp[2] = NULL;

    // request type:
    int reqType = -1;
    switch (lpRecord->recType) {
    case OT_ICE_BUNIT_FACET:
    case OT_STATIC_ICE_BUNIT_FACET_ROLE:
        reqType = OT_ICE_BUNIT_FACET_ROLE;
        break;
    case OT_ICE_BUNIT_PAGE:
    case OT_STATIC_ICE_BUNIT_PAGE_ROLE:
        reqType = OT_ICE_BUNIT_PAGE_ROLE;
        break;
    default:
        ASSERT(FALSE);
        return 0L;
    }

    memset (&bufComplim, '\0', sizeof(bufComplim));
    memset (&bufOwner, '\0', sizeof(bufOwner));
    iret =  DOMGetFirstObject(nNodeHandle,
                              reqType,
                              2,                            // level,
                              aparentsTemp,                 // Temp mandatory!
                              pUps->pSFilter->bWithSystem,  // bwithsystem
                              NULL,                         // lpowner
                              buf,
                              bufOwner,
                              bufComplim);
    if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
        // Erroneous case!
        CuIceFacetNPageAccessdef errItem(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE));   // Special item"<Data Unavailable>"
        m_Data.m_uaIceFacetNPageAccessdef.Add(errItem);
    }
    else {
        while (iret == RES_SUCCESS) {
            BOOL bExecute = getint(bufComplim);
            BOOL bRead    = getint(bufComplim + STEPSMALLOBJ);
            BOOL bUpdate  = getint(bufComplim + (2*STEPSMALLOBJ));
            BOOL bDelete  = getint(bufComplim + (3*STEPSMALLOBJ));
            CuIceFacetNPageAccessdef item((const char*)buf, bExecute, bRead, bUpdate, bDelete);   // Regular item
            m_Data.m_uaIceFacetNPageAccessdef.Add(item);

            iret = DOMGetNextObject(buf, bufOwner, bufComplim);
        }
    }
    if (m_Data.m_uaIceFacetNPageAccessdef.GetCount() == 0) {
        CuIceFacetNPageAccessdef noItem(VDBA_MfcResourceString(IDS_NO_ROLE));//"< No Role >"      // Special item
        m_Data.m_uaIceFacetNPageAccessdef.Add(noItem);
    }

    // Refresh display
    RefreshDisplay();

    return 0L;
}