Ejemplo n.º 1
0
void CxDlgTablePrimaryKey::OnButtonIndex() 
{
	ASSERT (m_pKeyParam);
	if (!m_pKeyParam)
		return;
	LPTABLEPARAMS pTable = (LPTABLEPARAMS)m_pTable;

	CxDlgIndexOption dlg;
	dlg.m_strTitle.LoadString(IDS_T_PRIMARY_KEY);// = _T("Primary Key Index Enforcement");
	dlg.m_nCallFor = 0;
	dlg.m_pParam = (LPVOID)&(m_pKeyParam->constraintWithClause);
	dlg.m_strDatabase = m_strDatabase;
	dlg.SetTableParams ((LPVOID)m_pTable);
	
	if (m_bAlter)
		dlg.SetAlter();
	if (!pTable->bCreate)
	{
		dlg.m_strTable = (LPCTSTR)StringWithoutOwner (pTable->objectname);
		dlg.m_strTableOwner = (LPCTSTR)StringWithoutOwner (pTable->szSchema);
		dlg.m_bFromCreateTable = FALSE;
	}
	else
		dlg.m_bFromCreateTable = TRUE;

	int answer = dlg.DoModal();
	if (answer == IDOK)
	{
		INDEXOPTION_IDX2STRUCT (&dlg, (LPVOID)&(m_pKeyParam->constraintWithClause));
	}
}
Ejemplo n.º 2
0
static void AddFile (HWND hwnd, LPTABLExFILE lpFile)
{
   int     hdl, ires;
   BOOL    bwsystem;
   char    buf       [MAXOBJECTNAME];
   char    buf2      [MAXOBJECTNAME];
   char    szOwner   [MAXOBJECTNAME];
   LPUCHAR parentstrings [MAXPLEVEL];
   LPAUDITDBPARAMS lpauditdb = GetDlgProp (hwnd);
   HWND hwndTables  = GetDlgItem (hwnd, IDC_AUDITDBF_TABLE);
   LPTABLExFILE
       ls  = lpFile,
       obj;
   char    szFileName[MAXOBJECTNAME];

   ZEROINIT (buf);
   parentstrings [0] = lpauditdb->DBName;
   parentstrings [1] = NULL;

   hdl      = GetCurMdiNodeHandle ();
   bwsystem = GetSystemFlag ();

   ires = DOMGetFirstObject (
       hdl,
       OT_TABLE,
       1,
       parentstrings,
       bwsystem,
       NULL,
       buf,
       szOwner,
       NULL);
   while (ires == RES_SUCCESS)
   {
       StringWithOwner (buf, szOwner, buf2);
       obj = FindStringInListTableAndFile (ls, buf2);
       if (obj)
       {
           wsprintf (szFileName,   "%s.trl", RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(buf)));
           x_strcpy (obj->FileName,  szFileName);
       }

       ires    = DOMGetNextObject (buf, szOwner, NULL);
   }
}
Ejemplo n.º 3
0
BOOL CxDlgUserMod::GenerateUsermodSyntax(CString& csCommandSyntax)
{
	TCHAR szusernamebuf[MAXOBJECTNAME];
	LPOBJECTLIST lpObjList = m_lpTblParam.lpTable;

	csCommandSyntax = _T("usermod ");
	csCommandSyntax += m_csDBName;
	if ( IsStarDatabase(m_nNodeHandle, (LPUCHAR)(LPCTSTR)m_csDBName) )
	{
		csCommandSyntax += _T("/star");
	}


	// -u flag
	DBAGetUserName ((LPUCHAR)(LPCTSTR)GetVirtNodeName(m_nNodeHandle),(LPUCHAR) szusernamebuf);
	csCommandSyntax += _T(" -u");
	csCommandSyntax += szusernamebuf;

	// tables list or current selected table
	if (bChooseTableEnable)
	{
		if (IsDlgButtonChecked(IDC_CHECK_SPECIF_TABLES) == BST_CHECKED)
		{
			while (lpObjList)
			{
				csCommandSyntax += _T(" ");
				csCommandSyntax += CString(StringWithoutOwner((LPUCHAR)lpObjList->lpObject));
				lpObjList = (LPOBJECTLIST)lpObjList->lpNext;
			}
		}
	}
	else
	{
		csCommandSyntax += _T(" ");
		csCommandSyntax += m_csTableName;
	}

	// -noint flag
	if (IsDlgButtonChecked(IDC_CHECK_NOINTERRUPT) == BST_CHECKED)
		csCommandSyntax += _T(" -noint");

	return TRUE;
}
Ejemplo n.º 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;
}
Ejemplo n.º 5
0
static BOOL FillStructureFromControls (HWND hwnd)
{
   char szGreatBuffer [MAX_RMCMD_BUFSIZE];
   char szBufferT     [MAX_RMCMD_BUFSIZE];
   char szBufferF     [MAX_RMCMD_BUFSIZE];
   char szSyscat      [22];
   char szBefore      [22];
   char szAfter       [22];
   char szCn          [10];
   char szActUser     [MAXOBJECTNAME];
   char szUserName    [MAXOBJECTNAME];
   char buftemp[200];

   HWND hwndSyscat         = GetDlgItem (hwnd, IDC_AUDITDB_SYSCAT);
   HWND hwndBefore         = GetDlgItem (hwnd, IDC_AUDITDB_BEFORE);
   HWND hwndAfter          = GetDlgItem (hwnd, IDC_AUDITDB_AFTER);
   HWND hwndCn             = GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER);
   HWND hwndActUser        = GetDlgItem (hwnd, IDC_AUDITDB_ACTION_USER);
   HWND hwndWait           = GetDlgItem (hwnd, IDC_AUDITDB_WAIT);
   HWND hwndInconsistent   = GetDlgItem (hwnd, IDC_AUDITDB_INCONSISTENT);
   HWND hwndTable          = GetDlgItem (hwnd, IDC_AUDITDB_TABLES);
   HWND hwndFile           = GetDlgItem (hwnd, IDC_AUDITDB_FILES);

   LPUCHAR vnodeName = GetVirtNodeName (GetCurMdiNodeHandle ());
   LPAUDITDBPARAMS     lpauditdb  = GetDlgProp (hwnd);
   LPTABLExFILE ls   = lpfile;

   ZEROINIT (szGreatBuffer);
   ZEROINIT (szBufferT);
   ZEROINIT (szBufferF);
   ZEROINIT (szSyscat);
   ZEROINIT (szBefore);
   ZEROINIT (szAfter);
   ZEROINIT (szCn);
   ZEROINIT (szActUser);

   // Verify if the length of the remote command do not exceed MAX_LINE_COMMAND.
   if (!VerifyBufferLen(hwnd))
   {
       ErrorMessage ((UINT) IDS_E_TOO_MANY_TABLES_SELECTED, RES_ERR);
       return FALSE;
   }

   if (Button_GetCheck (hwndFile))
       x_strcpy (szBufferF, " -file");

   if (Button_GetCheck (hwndTable))
   {
       char*  aTable;
       LPOBJECTLIST list = table.lpTable;

       if (list)
       {
           aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject));
           x_strcpy (szBufferT, " -table=");
           x_strcat (szBufferT, aTable);
           list = list->lpNext;
       }
       while (list)
       {
           x_strcat (szBufferT, ",");
           aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject));
           x_strcat (szBufferT, aTable);
           list = list->lpNext;
       }
   }

   if (Button_GetCheck (hwndFile) && ls && Modify (ls))
   {
       x_strcpy (szBufferF, " -file=");
       x_strcat (szBufferF, ls->FileName);
       ls = ls->next;

       while (ls)
       {
           x_strcat (szBufferF, ",");
           x_strcat (szBufferF, ls->FileName);
           ls = ls->next;
       }
   }

   if (Button_GetCheck (hwndSyscat))
       x_strcpy (szSyscat, "-a");
   else
       x_strcpy (szSyscat, "");

   wsprintf (szGreatBuffer,
       "auditdb %s %s %s %s",
       szSyscat,
       lpauditdb->DBName,
       szBufferT,
       szBufferF);
 
   Edit_GetText (hwndAfter,  szAfter,  sizeof (szAfter ));
   Edit_GetText (hwndBefore, szBefore, sizeof (szBefore));
   Edit_GetText (hwndCn,     szCn,     sizeof (szCn));

   ComboBox_GetText (hwndActUser, szActUser, sizeof (szActUser));

   if (x_strlen (szAfter) > 0)
   {
       x_strcat (szGreatBuffer, " -b");
       x_strcat (szGreatBuffer, szAfter);
   }

   if (x_strlen (szBefore) > 0)
   {
       x_strcat (szGreatBuffer, " -e");
       x_strcat (szGreatBuffer, szBefore);
   }

   if (Button_GetCheck (GetDlgItem (hwnd, IDC_AUDITDB_CKP)))
   {
       x_strcat (szGreatBuffer, " #c");
       if (x_strlen (szCn) > 0)
           x_strcat (szGreatBuffer, szCn);
   }

   if (x_strlen (szActUser) > 0)
   {
       x_strcat (szGreatBuffer, " -i");
       x_strcat (szGreatBuffer, szActUser);
   }

   if (Button_GetCheck (hwndWait))
       x_strcat (szGreatBuffer, " -wait");

   if (Button_GetCheck (hwndInconsistent))
       x_strcat (szGreatBuffer, " -inconsistent");
  
   ZEROINIT (szUserName);
   DBAGetUserName (vnodeName, szUserName);
   x_strcat (szGreatBuffer, " -u");
   x_strcat (szGreatBuffer, szUserName);


   wsprintf(buftemp,
       ResourceString ((UINT)IDS_T_RMCMD_AUDITDB), //"auditing database %s::%s",
       vnodeName,
       lpauditdb->DBName);
   execrmcmd(vnodeName,szGreatBuffer,buftemp);
   return TRUE;
}
Ejemplo n.º 6
0
static BOOL VerifyBufferLen(HWND hwnd)
{
   char szSyscat      [22];
   char szBefore      [22];
   char szAfter       [22];
   char szCn          [10];
   char szActUser     [MAXOBJECTNAME];
   char szUserName    [MAXOBJECTNAME];
   int nTotalLen = 0;
   HWND hwndSyscat         = GetDlgItem (hwnd, IDC_AUDITDB_SYSCAT);
   HWND hwndBefore         = GetDlgItem (hwnd, IDC_AUDITDB_BEFORE);
   HWND hwndAfter          = GetDlgItem (hwnd, IDC_AUDITDB_AFTER);
   HWND hwndCn             = GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER);
   HWND hwndActUser        = GetDlgItem (hwnd, IDC_AUDITDB_ACTION_USER);
   HWND hwndWait           = GetDlgItem (hwnd, IDC_AUDITDB_WAIT);
   HWND hwndInconsistent   = GetDlgItem (hwnd, IDC_AUDITDB_INCONSISTENT);
   HWND hwndTable          = GetDlgItem (hwnd, IDC_AUDITDB_TABLES);
   HWND hwndFile           = GetDlgItem (hwnd, IDC_AUDITDB_FILES);

   LPAUDITDBPARAMS     lpauditdb  = GetDlgProp (hwnd);
   LPTABLExFILE ls   = lpfile;

   ZEROINIT (szSyscat);
   ZEROINIT (szBefore);
   ZEROINIT (szAfter);
   ZEROINIT (szCn);
   ZEROINIT (szActUser);

   if (Button_GetCheck (hwndFile) && !ls)
       nTotalLen = x_strlen (" -file");

   if (Button_GetCheck (hwndTable))
   {
       char*  aTable;
       LPOBJECTLIST list = table.lpTable;

       if (list)
       {
           aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject));
           nTotalLen += x_strlen (" -table=");
           nTotalLen += x_strlen (aTable);
           list = list->lpNext;
       }
       while (list)
       {
           nTotalLen += x_strlen (",");
           aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject));
           nTotalLen += x_strlen ( aTable);
           list = list->lpNext;
       }
   }

   if (Button_GetCheck (hwndFile) && ls && Modify (ls))
   {
       if (ls)
       {
           nTotalLen += x_strlen (" -file=");
           nTotalLen += x_strlen (ls->FileName);
           ls = ls->next;
       }

       while (ls)
       {
           nTotalLen += x_strlen(",");
           nTotalLen += x_strlen (ls->FileName);
           ls = ls->next;
       }
   }

   if (Button_GetCheck (hwndSyscat))
       nTotalLen += x_strlen ("-a");

   nTotalLen += x_strlen ("auditdb    ");
   nTotalLen += x_strlen (lpauditdb->DBName);

   Edit_GetText (hwndAfter,  szAfter,  sizeof (szAfter ));
   Edit_GetText (hwndBefore, szBefore, sizeof (szBefore));
   Edit_GetText (hwndCn,     szCn,     sizeof (szCn));

   ComboBox_GetText (hwndActUser, szActUser, sizeof (szActUser));

   if (x_strlen (szAfter) > 0)
   {
       nTotalLen += x_strlen (" -b");
       nTotalLen += x_strlen (szAfter);
   }

   if (x_strlen (szBefore) > 0)
   {
       nTotalLen += x_strlen (" -e");
       nTotalLen += x_strlen (szBefore);
   }

   if (Button_GetCheck (GetDlgItem (hwnd, IDC_AUDITDB_CKP)))
   {
       nTotalLen += x_strlen (" #c");
       if (x_strlen (szCn) > 0)
           nTotalLen += x_strlen (szCn);
   }

   if (x_strlen (szActUser) > 0)
   {
       nTotalLen += x_strlen (" -i");
       nTotalLen += x_strlen (szActUser);
   }

   if (Button_GetCheck (hwndWait))
       nTotalLen += x_strlen (" -wait");

   if (Button_GetCheck (hwndInconsistent))
       nTotalLen += x_strlen (" -inconsistent");
  
   ZEROINIT (szUserName);
   DBAGetUserName (GetVirtNodeName ( GetCurMdiNodeHandle ()), szUserName);
   nTotalLen += x_strlen (" -u");
   nTotalLen += x_strlen (szUserName);

   if (nTotalLen<MAX_LINE_COMMAND)
       return TRUE;
   else
       return FALSE;
}
Ejemplo n.º 7
0
LONG CuDlgDomPropTableStatistic::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
	// cast received parameters
	int nNodeHandle = (int)wParam;
	LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
	ASSERT (nNodeHandle != -1);
	ASSERT (pUps);
	if (pUps->nIpmHint == FILTER_DOM_BKREFRESH) {
		ASSERT (FALSE);   // Should not occur!
		return 0L;
	}

	try
	{
		if (pUps->nType != m_nOT)
		{
			CleanStatisticItem();
			CleanListColumns();
			InitializeStatisticHeader(pUps->nType);
		}
		m_nOT = pUps->nType;

		int nNodeHandle = (int)wParam;
		BOOL bCheck = FALSE; 
		LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
		ASSERT (nNodeHandle != -1);
		ASSERT (pUps);
		LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
		ASSERT (lpRecord);
		if (!lpRecord)
			return 0L;
		m_statisticData.Cleanup();
		//
		// Ignore selected actions on filters
		switch (pUps->nIpmHint)
		{
		case 0:
			//
			// Normal updating
			break;
		case -1:
			//
			// Selection changes in the Right pane 
			bCheck = TRUE;
			break;
		default:
			//
			// Nothing to change on the display
			return 0L;
		}
		
		//
		// Check if we need the update or not:
		if (bCheck && m_bExecuted)
		{
			if (m_statisticData.m_strDBName.CompareNoCase ((const char *)lpRecord->extra) == 0)
				if (m_statisticData.m_strTable.CompareNoCase ((const char *)lpRecord->objName) == 0)
					if (m_statisticData.m_strTableOwner.CompareNoCase ((const char *)lpRecord->ownerName) == 0)
						return 0L;
		}

		m_statisticData.m_nOT = m_nOT;
		m_statisticData.m_strVNode      = (LPCTSTR)(LPUCHAR)GetVirtNodeName (nNodeHandle);
		m_statisticData.m_strDBName     = (const char *)lpRecord->extra;
		if (m_nOT == OT_TABLE)
		{
			m_statisticData.m_strTable      = RemoveDisplayQuotesIfAny((LPCTSTR)StringWithoutOwner(lpRecord->objName));
			m_statisticData.m_strTableOwner = (const char *)lpRecord->ownerName;
		}
		else
		if (m_nOT == OT_INDEX)
		{
			m_statisticData.m_strTable      = lpRecord->extra2;
			m_statisticData.m_strTableOwner = (const char *)lpRecord->ownerName;
			m_statisticData.m_strIndex      = RemoveDisplayQuotesIfAny((LPCTSTR)StringWithoutOwner(lpRecord->objName));
		}

		CleanStatisticItem();
		QueryStatColumns();
		
		if (m_cListColumn.GetItemCount() > 0)
		{
			//
			// This line cause to execute the member: OnItemchangedList1()
			m_cListColumn.SetItemState (0, LVIS_SELECTED, LVIS_SELECTED);
		}
		UpdateData (FALSE);
		m_bExecuted = TRUE;
		EnableButtons();
		return 0L;
	}
	catch (CMemoryException* e)
	{
		VDBA_OutOfMemoryMessage();
		e->Delete();
	}
	catch (CeSQLException e)
	{
		AfxMessageBox (e.m_strReason, MB_ICONEXCLAMATION|MB_OK);
	}
	catch (...)
	{
		//CString strMsg = _T("Internal error: cannot display the statistic of the table.");
		AfxMessageBox (VDBA_MfcResourceString(IDS_E_STAT_TABLE));
	}
	CleanStatisticItem();
	m_statisticData.Cleanup();
	return 0L;
}
Ejemplo n.º 8
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;
}
Ejemplo n.º 9
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;
}