Esempio n. 1
0
static BOOL OccupyStructureControl (HWND hwnd)
/*
	Function:
		Fills the structure drop down box with the structure names.

	Parameters:
		hwnd	- Handle to the dialog window.

	Returns:
		TRUE if successful.
*/
{
	int i = 0;
	BOOL bRetVal = TRUE;
	HWND hwndCtl = GetDlgItem (hwnd, IDC_STRUCTURE);
	HLOCAL hmem;
	LPSTRUCTINFO lpinfo;

	if (!IsWindow(hwndCtl))
	{
		ASSERT(FALSE);
		return FALSE;
	}

	hmem = GetProp(hwnd, SZINFODEF);
	lpinfo = LocalLock(hmem);	

	while (lpinfo[i].nStructName != -1)
	{
		char szStructName[50];
		int nIdx;

		if (LoadString(hResource, lpinfo[i].nStructName, szStructName, sizeof(szStructName)) == 0)
			bRetVal = FALSE;

		nIdx = ComboBox_AddString(hwndCtl, szStructName);

		if (nIdx == CB_ERR)
			bRetVal = FALSE;
		else
			ComboBox_SetItemData(hwndCtl, nIdx, (LPARAM)i);

		if (GetOIVers() >= OIVERS_20)
			lpinfo[i].nIngresVersion = GetOIVers();

		i++;
	}

	// Set the first string in the list as the default
	if (bRetVal)
		ComboBox_SetCurSel(hwndCtl, 0);

	LocalUnlock(hmem);

	return bRetVal;
}
Esempio n. 2
0
static BOOL OccupyPageSizeControl (HWND hwnd)
/*
	Function:
   Ingres version == 1.x :
      Hide combobox and static name.
   Ingres version == 2.x :
      Fills the Page_size drop down box with the page size.
      

	Parameters:
		hwnd	- Handle to the dialog window.

	Returns:
		TRUE if successful.
*/
{
	BOOL bRetVal = TRUE;
	DWORD dwi;
	int nIdx;

	char szpagesize[20];
	HWND hwndCtl = GetDlgItem (hwnd, IDC_PAGESIZE);

	int ishowstate = GetOIVers() >= OIVERS_26 ? SW_SHOW : SW_HIDE;
	ShowWindow(GetDlgItem(hwnd,IDC_FRAME_PAGEORINDEX),ishowstate);
	ShowWindow(GetDlgItem(hwnd,IDC_TYPE_TABLE),ishowstate);
	ShowWindow(GetDlgItem(hwnd,IDC_TYPE_INDEX),ishowstate);

	if (GetOIVers() >= OIVERS_20) {
		ShowWindow(GetDlgItem(hwnd,IDC_STATIC_PAGESIZE),SW_SHOW);
		ShowWindow(GetDlgItem(hwnd,IDC_PAGESIZE),SW_SHOW);

		for (dwi=2048;dwi<65537;dwi=dwi*2)  {
			wsprintf(szpagesize,"%5ld",dwi);
			nIdx = ComboBox_AddString(hwndCtl,szpagesize );

			if (nIdx == CB_ERR)	{
				bRetVal = FALSE;
			break;
			}
			else
				ComboBox_SetItemData(hwndCtl, nIdx, dwi);
		}
		// Set the first string in the list as the default
		if (bRetVal)
			ComboBox_SetCurSel(hwndCtl, 0);
	}
	else {
		ShowWindow(GetDlgItem(hwnd,IDC_STATIC_PAGESIZE),SW_HIDE);
		ShowWindow(GetDlgItem(hwnd,IDC_PAGESIZE),SW_HIDE);
	}
	return bRetVal;
}
Esempio n. 3
0
static int RetrieveTupLen4PageSize( void )
{
	int iret, SessType, ilocsession,dwRange;
	char connectname[MAXOBJECTNAME];
	char szValue[40];
	char szConst[MAX_ENUMTUPLEN][14] = {"tup_len_2k", "tup_len_4k",
	                                    "tup_len_8k", "tup_len_16k",
	                                    "tup_len_32k", "tup_len_64k" };

	if (GetOIVers() >= OIVERS_30)
	{
		SessType=SESSION_TYPE_CACHENOREADLOCK;

		wsprintf(connectname,"%s::iidbdb",GetVirtNodeName(GetCurMdiNodeHandle ()));
		iret = Getsession(connectname, SessType, &ilocsession);
		if (iret !=RES_SUCCESS)
			return RES_ERR;

		for (dwRange=0;dwRange<MAX_ENUMTUPLEN;dwRange++)  {
			INGRESII_llDBMSInfo(szConst[dwRange],szValue);
			if (szValue[0] != '0')
				iTabRowsSpanPages[dwRange] = my_atoi(szValue);
		}

		if (iret==RES_SUCCESS)
			iret=ReleaseSession(ilocsession, RELEASE_COMMIT);
		else
			ReleaseSession(ilocsession, RELEASE_ROLLBACK);
	}
	return RES_SUCCESS;
}
Esempio n. 4
0
static void Adjust4FillFactors(HWND hwnd)
/*
	Function:
		Adjusts the maximum values of limits that are affected by the
		changes in fill factors.

	Parameters:
		hwnd		- Handle of dialog window

	Returns:
		None.
*/
{
	INFOOFFSET infoIdx = GetSelectedStructure(hwnd);
	STRUCTINFO info;
	HLOCAL hmem = GetProp(hwnd, SZINFODEF);
	LPSTRUCTINFO lpinfo = LocalLock(hmem);

	info.nIngresVersion= GetOIVers();

	GetDialogInfo(hwnd, &info);

	/* 
	** BUG #112863 : in r3 the row width can be 256K and row can span page!
	*/
	if (info.nIngresVersion < OIVERS_30)
	{
		if (info.dwPageSize == 65536L)
			lpinfo[infoIdx].nRowWidth = 32767L;
		else
			lpinfo[infoIdx].nRowWidth = info.dwPageSize - GetPageOverHead(info.iPageType) - GetRowOverHead(info.iPageType);
	}

	LocalUnlock(hmem);
}
Esempio n. 5
0
BOOL CuDlgDomPropRoleXGrantedDb::OnInitDialog() 
{
  CDialog::OnInitDialog();

  // subclass list control and connect image list
  VERIFY (m_cListCtrl.SubclassDlgItem (IDC_MFC_LIST1, this));
  m_ImageList.Create(16, 16, TRUE, 1, 1);
  m_ImageList.AddIcon(IDI_TREE_STATIC_DATABASE);
  m_cListCtrl.SetImageList (&m_ImageList, LVSIL_SMALL);
  m_ImageCheck.Create (IDB_CHECK_NOFRAME, 16, 1, RGB (255, 0, 0));
  m_cListCtrl.SetCheckImageList(&m_ImageCheck);

  CHECKMARK_COL_DESCRIBE  aColumns[LAYOUT_NUMBER] = {
    { _T(""),               FALSE, 80 + 16+4 },   // 16+4 for image
    {   _T("access"),    TRUE,  -1 },     //  OT_DBGRANT_ACCESY_USER,
    {   _T("no access"),    TRUE,  -1 },  //  OT_DBGRANT_ACCESN_USER,
    {   _T("crepr"),    TRUE,  -1 },      //  OT_DBGRANT_CREPRY_USER,
    {   _T("no crepr"),    TRUE,  -1 },   //  OT_DBGRANT_CREPRN_USER,
    {   _T("cretb"),    TRUE,  -1 },      //  OT_DBGRANT_CRETBY_USER,
    {   _T("no cretb"),    TRUE,  -1 },   //  OT_DBGRANT_CRETBN_USER,
    {   _T("dbadm"),    TRUE,  -1 },      //  OT_DBGRANT_DBADMY_USER,
    {   _T("no dbadm"),    TRUE,  -1 },   //  OT_DBGRANT_DBADMN_USER,
    {   _T("lkmod"),    TRUE,  -1 },      //  OT_DBGRANT_LKMODY_USER,
    {   _T("no lkmod"),    TRUE,  -1 },   //  OT_DBGRANT_LKMODN_USER,
    {   _T("qryio"),    TRUE,  -1 },      //  OT_DBGRANT_QRYIOY_USER,
    {   _T("no qryio"),    TRUE,  -1 },   //  OT_DBGRANT_QRYION_USER,
    {   _T("qryrw"),    TRUE,  -1 },      //  OT_DBGRANT_QRYRWY_USER,
    {   _T("no qryrw"),    TRUE,  -1 },   //  OT_DBGRANT_QRYRWN_USER,
    {   _T("updsc"),    TRUE,  -1 },      //  OT_DBGRANT_UPDSCY_USER,
    {   _T("no updsc"),    TRUE,  -1 },   //  OT_DBGRANT_UPDSCN_USER,

    {   _T("selsc"),    TRUE,  -1 },      //  OT_DBGRANT_SELSCY_USER,
    {   _T("no selsc"),    TRUE,  -1 },   //  OT_DBGRANT_SELSCN_USER,
    {   _T("cnctl"),    TRUE,  -1 },      //  OT_DBGRANT_CNCTLY_USER,
    {   _T("no cnctl"),    TRUE,  -1 },   //  OT_DBGRANT_CNCTLN_USER,
    {   _T("idltl"),    TRUE,  -1 },      //  OT_DBGRANT_IDLTLY_USER,
    {   _T("no idltl"),    TRUE,  -1 },   //  OT_DBGRANT_IDLTLN_USER,
    {   _T("sespr"),    TRUE,  -1 },      //  OT_DBGRANT_SESPRY_USER,
    {   _T("no sespr"),    TRUE,  -1 },   //  OT_DBGRANT_SESPRN_USER,
    {   _T("tblst"),    TRUE,  -1 },      //  OT_DBGRANT_TBLSTY_USER,
    {   _T("no tblst"),    TRUE,  -1 },   //  OT_DBGRANT_TBLSTN_USER,

    {   _T("qrycpu"),    TRUE,  -1 },        //  OT_DBGRANT_QRYCPY_USER,
    {   _T("no qrycpu"),    TRUE,  -1 },     //  OT_DBGRANT_QRYCPN_USER,
    {   _T("qrypage"),    TRUE,  -1 },       //  OT_DBGRANT_QRYPGY_USER,
    {   _T("no qrypage"),    TRUE,  -1 },    //  OT_DBGRANT_QRYPGN_USER,
    {   _T("qrycost"),    TRUE,  -1 },       //  OT_DBGRANT_QRYCOY_USER,
    {   _T("no qrycost"),    TRUE,  -1 },    //  OT_DBGRANT_QRYCON_USER,
    {   _T("sequence"),    TRUE,  -1 },      //  OT_DBGRANT_SEQCRY_USER,
    {   _T("no sequence"),    TRUE,  -1 }    //  OT_DBGRANT_SEQCRN_USER,
  };
  lstrcpy(aColumns[0].szCaption, VDBA_MfcResourceString(IDS_TC_NAME));// _T("Name")
  InitializeColumns(m_cListCtrl, aColumns, GetOIVers()>=OIVERS_30? LAYOUT_NUMBER: LAYOUT_NUMBER-2);

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 6
0
static void DoCalculation (HWND hwnd)
{
	INFOOFFSET infoIdx = GetSelectedStructure(hwnd);
	STRUCTINFO info;
	DWORD dwTotalPages = 0;
	char szNumber[50];

	// Verify all controls are within their limits.

	if (!VerifyAllNumericEditControls(hwnd, TRUE, TRUE))
		return;

	info.nIngresVersion= GetOIVers();

	GetDialogInfo (hwnd, &info);

	switch (infoIdx)
	{
		case STRUCT_HASH:
			dwTotalPages = CalculateHash(hwnd, &info);
			break;

		case STRUCT_ISAM:
			dwTotalPages = CalculateIsam(hwnd, &info);
			break;

		case STRUCT_HEAP:
			dwTotalPages = CalculateHeap(hwnd, &info);
			break;

		case STRUCT_BTREE:
			dwTotalPages = CalculateBtree(hwnd, &info);
			break;

		default:
			ASSERT(NULL);
	}

	if (dwTotalPages != (DWORD)-1)
	{
		// Update the results display

		double dBytes;

		my_dwtoa(dwTotalPages, szNumber, 10);
		Static_SetText(GetDlgItem(hwnd, IDC_INGRESPAGES), szNumber);

		dBytes = (double)dwTotalPages * (double)info.dwPageSize; // PS 
		sprintf (szNumber, "%.0f", dBytes);
		Static_SetText(GetDlgItem(hwnd, IDC_BYTES), szNumber);
	}
	else
	{
		SetCalcError(hwnd);
	}
}
Esempio n. 7
0
void CuDlgDomPropRole::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	SubclassControls();
	if (GetOIVers() >= OIVERS_30)
	{
		m_edLimSecureLabel.ShowWindow(SW_HIDE);
		CWnd* pWnd = GetDlgItem(IDC_MFC_STATIC1);
		if (pWnd && pWnd->m_hWnd)
			pWnd->ShowWindow(SW_HIDE);
	}
}
Esempio n. 8
0
BOOL CxDlgRoleSec::OnInitDialog() 
{
	CDialog::OnInitDialog();

	CxDlgRole *m_pParent;
	m_pParent = (CxDlgRole *)GetParent()->GetParent();
	m_pParam = m_pParent->m_pParam;
	InitClassMembers();

	ASSERT (m_pParam && m_pParam->m_nNodeHandle != -1);
	if (!m_pParam || m_pParam->m_nNodeHandle == -1)
	{
		EndDialog (IDCANCEL);
		return FALSE;
	}
	if (GetOIVers() >= OIVERS_30)
	{
		CWnd* pWnd = GetDlgItem(IDC_MFC_STATIC1);
		if (pWnd && pWnd->m_hWnd)
			pWnd->ShowWindow(SW_HIDE);
		pWnd = GetDlgItem(IDC_MFC_EDIT3);
		if (pWnd && pWnd->m_hWnd)
			pWnd->ShowWindow(SW_HIDE);
	}
	if (m_pParam->m_bCreate)
	{
		VERIFY (m_cCheckListBoxDatabase.SubclassDlgItem (IDC_MFC_LIST2, this));
		HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
		if (hFont == NULL)
			hFont = (HFONT)GetStockObject(ANSI_VAR_FONT);
	}
	else
	{
		GetDlgItem(IDC_MFC_LIST2)->ShowWindow(SW_HIDE);
		GetDlgItem(IDC_MFC_STATIC_ACCESSDB)->ShowWindow(SW_HIDE);
	}

	FillDatabases();
	OnCheckExternalPassword();


	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 9
0
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
	HWND hwndTempDoc;
	HLOCAL hmem = LocalAlloc(LHND, sizeof(infoDefaults));
	LPSTRUCTINFO lpinfo = hmem ? LocalLock(hmem) : NULL;

	if (!lpinfo)
	{
		if (hmem)
			LocalFree(hmem);
		EndDialog(hwnd, -1);
		return TRUE;
	}

	// Since we modify infoDefaults, make a copy of it for each instance
	// of the dialog
	oldIngresVer = GetOIVers();
	SetProp(hwnd, SZINFODEF, hmem);
	_fmemcpy(lpinfo, infoDefaults, sizeof(infoDefaults));
	if (oldIngresVer >= OIVERS_30)
	{
		int i =0;
		for (i=0; i<4; i++)
		{
			lpinfo[i].nRowWidth = MAX_ROW_WIDTH_R3;
		}
	}
	LocalUnlock(hmem);

	hwndTempDoc = GetWindow(hwndMDIClient, GW_CHILD);
	if (hwndTempDoc)
	{
		if (GetOIVers()>=OIVERS_26) {
			BOOL bResult = SQLGetPageTypesPerTableTypes(GetVirtNodeName(GetCurMdiNodeHandle ()), pagetypespertabletypes);
			if (!bResult) {
				MessageWithHistoryButton(GetFocus(), ResourceString(IDS_E_CONNECTION_FAILED));
				EndDialog(hwnd, -1);
				return TRUE;
			}
			if (PAGE_TYPE_V1 != 1 || PAGE_TYPE_V2 != 2 || PAGE_TYPE_V3 != 3 || PAGE_TYPE_V4 !=4 || PAGE_TYPE_V6 != 6 || PAGE_TYPE_V7 != 7) {
				myerror(ERR_INGRESPAGES); /* the parsing of dm34 trace output (in parse.cpp) assumes V1 == 1 V2 == 2 etc... */
				EndDialog(hwnd, -1);
				return TRUE;
			}
			Button_SetCheck (GetDlgItem (hwnd, IDC_TYPE_TABLE), TRUE);
		}
		if (GetOIVers()>=OIVERS_30)
			RetrieveTupLen4PageSize();
}
	else
	{
		oldIngresVer = SetOIVers(OIVERS_90); // Simulate the current Ingres version 9.0
		Button_SetCheck (GetDlgItem (hwnd, IDC_TYPE_TABLE), TRUE);
		pagetypespertabletypes [0]  = PAGE_TYPE_V1;
		pagetypespertabletypes [1]  = PAGE_TYPE_V3;
		pagetypespertabletypes [2]  = PAGE_TYPE_V3;
		pagetypespertabletypes [3]  = PAGE_TYPE_V3;
		pagetypespertabletypes [4]  = PAGE_TYPE_V3;
		pagetypespertabletypes [5]  = PAGE_TYPE_V3;
		pagetypespertabletypes [6]  = PAGE_TYPE_V1;
		pagetypespertabletypes [7]  = PAGE_TYPE_V4;
		pagetypespertabletypes [8]  = PAGE_TYPE_V4;
		pagetypespertabletypes [9]  = PAGE_TYPE_V4;
		pagetypespertabletypes [10] = PAGE_TYPE_V4;
		pagetypespertabletypes [11] = PAGE_TYPE_V4;
		if (bContinueShowMessage)
		{
			if (MSGContinueBox (ResourceString(IDS_W_CALCULATION_WITH_DEFAULT)))
				bContinueShowMessage = FALSE;
		}
	}

	// Force the catospin.dll to load
	SpinGetVersion();

	if (!OccupyStructureControl(hwnd) || !OccupyPageSizeControl(hwnd))
	{
		EndDialog(hwnd, -1);
		return TRUE;
	}
	if (GetOIVers() >= OIVERS_20)
		lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_OIV2_SPACECALC));
	else
		lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_SPACECALC));

	SubclassAllNumericEditControls(hwnd, EC_SUBCLASS);

	InitialiseSpinControls(hwnd);
	InitialiseEditControls(hwnd);
	UpdateControls(hwnd,TRUE);
	DoCalculation(hwnd);
	richCenterDialog(hwnd);
	return TRUE;
}
Esempio n. 10
0
BOOL CxDlgTablePrimaryKey::OnInitDialog() 
{
	ASSERT (m_pKeyParam);
	if (!m_pKeyParam)
		return FALSE;
	CDialog::OnInitDialog();
	VERIFY(m_cButtonUp.SubclassDlgItem(IDC_MFC_BUTTON6, this));
	VERIFY(m_cButtonDown.SubclassDlgItem(IDC_MFC_BUTTON7, this));
	VERIFY (m_cListCtrl.SubclassDlgItem (IDC_MFC_LIST1, this));
	m_ImageCheck.Create (IDB_CHECK_NOFRAME, 16, 1, RGB (255, 0, 0));
	m_cListCtrl.SetCheckImageList(&m_ImageCheck);

	LV_COLUMN lvcolumn;
	TCHAR     szColHeader [2][16];
	lstrcpy(szColHeader [0],VDBA_MfcResourceString(IDS_TC_COLUMN));   // _T("Column")
	lstrcpy(szColHeader [1],VDBA_MfcResourceString(IDS_TC_NULLABLE)); // _T("Nullable")
	int       i;
	int       hWidth [2] = {130, 80};
	//
	// Set the number of columns: 2
	// List of columns of Base Table:
	memset (&lvcolumn, 0, sizeof (LV_COLUMN));
	lvcolumn.mask = LVCF_FMT|LVCF_SUBITEM|LVCF_TEXT|LVCF_WIDTH;
	for (i=0; i<2; i++)
	{
		lvcolumn.fmt = LVCFMT_LEFT;
		lvcolumn.pszText = szColHeader[i];
		lvcolumn.iSubItem = i;
		lvcolumn.cx = hWidth[i];
		if (i==0)
			m_cListCtrl.InsertColumn (i, &lvcolumn); 
		else
		{
			lvcolumn.fmt = LVCFMT_CENTER;
			m_cListCtrl.InsertColumn (i, &lvcolumn, TRUE);
		}
	}
	m_cEditKeyName.LimitText (33);
	LPSTRINGLIST ls = m_pKeyParam->pListTableColumn;
	while (ls != NULL)
	{
		AddTableColumn (ls->lpszString, (ls->extraInfo1==0)? TRUE: FALSE);
		ls = ls->next;
	}

	ls = m_pKeyParam->pListKey;
	while (ls != NULL)
	{
		m_cListKey.AddString (ls->lpszString);
		ls = ls->next;
	}
	m_nDelMode = m_pKeyParam->nMode;
	m_bAlter = m_pKeyParam->bAlter;
	SetDisplayMode();
	m_cButtonDeleteCascade.ShowWindow (m_bAlter? SW_SHOW: SW_HIDE);
	EnableControls();

	//
	// Hide the button index enhancement if not Ingres >= 2.5
	if ( GetOIVers() < OIVERS_25 || 
		(IsVW() && m_pTable && ((LPTABLEPARAMS)m_pTable)->bCreateVectorWise)) //disable for Ingres VW
	{
		m_cButtonIndex.ShowWindow (SW_HIDE);
	}

	PushHelpId(m_bAlter? HELPID_IDD_PRIMARYKEY_ALTER: HELPID_IDD_PRIMARYKEY_ADD);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 11
0
int GetDetailInfoLL(LPUCHAR lpVirtNode,int iobjecttype, void *lpparameters,
                  BOOL bRetainSessForLock, int *ilocsession)
{
   int iret, SessType;
   char connectname[MAXOBJECTNAME];


   if (!lpparameters) {
      myerror(ERR_INVPARAMS);
      return RES_ERR;
   }

   if (bRetainSessForLock)
      SessType=SESSION_TYPE_CACHEREADLOCK;
   else
      SessType=SESSION_TYPE_CACHENOREADLOCK;

   switch (iobjecttype) {
      case OT_SEQUENCE:
       {
       LPSEQUENCEPARAMS pseqprm=(LPSEQUENCEPARAMS) lpparameters;

       if (!*(pseqprm->objectname)) {
          myerror(ERR_INVPARAMS);
          return RES_ERR;
       }

       if (!*(pseqprm->DBName)) {
          myerror(ERR_INVPARAMS);
          return RES_ERR;
       }

       wsprintf(connectname,"%s::%s",lpVirtNode, pseqprm->DBName);

       iret = Getsession(connectname, SessType, ilocsession);
       if (iret !=RES_SUCCESS)
          return RES_ERR;

       iret=GetInfSequence(pseqprm);

       }
         break;

      case OT_REPLIC_CONNECTION_V11:
       {
       LPREPLCONNECTPARAMS   lpaddrepl= (LPREPLCONNECTPARAMS)lpparameters; ;
       wsprintf(connectname,"%s::%s",lpVirtNode,lpaddrepl->DBName);
       iret = Getsession(connectname, SessType, ilocsession);

       if (iret !=RES_SUCCESS)
         return RES_ERR;
       iret = ReplicConnectV11(lpaddrepl);
       
       }
       break;
      case OT_REPLIC_CONNECTION:
       {
       LPREPLCONNECTPARAMS   lpaddrepl= (LPREPLCONNECTPARAMS)lpparameters; ;
       wsprintf(connectname,"%s::%s",lpVirtNode,lpaddrepl->DBName);
       iret = Getsession(connectname, SessType, ilocsession);

       if (iret !=RES_SUCCESS)
         return RES_ERR;
       iret = ReplicConnect(lpaddrepl);
       }
       break;
      case OT_DBEVENT:
         iret =RES_SUCCESS; // no displayable property
         // TO BE FINISHED session not opened.

         break;
      case OT_ROLE:
         {
            LPROLEPARAMS proleprm=(LPROLEPARAMS) lpparameters;

            if (!*(proleprm->ObjectName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            FreeAttachedPointers(lpparameters, iobjecttype);

            wsprintf(connectname,"%s::iidbdb",lpVirtNode);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfRole(proleprm);

         }
         break;

//JFS Begin
      case OT_REPLIC_CDDS :
      case OT_REPLIC_CDDS_V11 :
         {
            LPREPCDDS lpcdds = (LPREPCDDS)lpparameters;
            wsprintf(connectname,"%s::%s",lpVirtNode,lpcdds->DBName);

            iret = Getsession(connectname, SESSION_TYPE_INDEPENDENT, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret = CDDSLoadAll(lpcdds,lpVirtNode);
         }
         break;
//JFS End

      case OT_GROUP :
         {
            LPGROUPPARAMS pgrpprm=(LPGROUPPARAMS) lpparameters;

            if (!*(pgrpprm->ObjectName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            FreeAttachedPointers(lpparameters, iobjecttype);

            wsprintf(connectname,"%s::iidbdb",lpVirtNode);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfGrp(pgrpprm);

         }
         break;

      case OT_INTEGRITY:
         {
            LPINTEGRITYPARAMS pintegrityprm=(LPINTEGRITYPARAMS) lpparameters;


            if (!*(pintegrityprm->DBName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            wsprintf(connectname,"%s::%s",lpVirtNode, pintegrityprm->DBName);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfIntegrity(pintegrityprm);

         }
         break;

      case OT_LOCATION:
         {
            LPLOCATIONPARAMS plocprm=(LPLOCATIONPARAMS) lpparameters;

            if (!*(plocprm->objectname)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            wsprintf(connectname,"%s::iidbdb",lpVirtNode);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfLoc(plocprm);

         }
         break;
         
      case OT_PROCEDURE:
         {
            LPPROCEDUREPARAMS pprocprm=(LPPROCEDUREPARAMS) lpparameters;

            if (!*(pprocprm->objectname)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            if (!*(pprocprm->DBName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            wsprintf(connectname,"%s::%s",lpVirtNode, pprocprm->DBName);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfProcedure(pprocprm);

         }
         break;

      case OT_RULE:
         {
            LPRULEPARAMS pruleprm=(LPRULEPARAMS) lpparameters;

            if (!*(pruleprm->RuleName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            if (!*(pruleprm->DBName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            wsprintf(connectname,"%s::%s",lpVirtNode, pruleprm->DBName);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfRule(pruleprm);

         }
         break;

      case OT_USER :
         {
            LPUSERPARAMS pusrprm=(LPUSERPARAMS) lpparameters;

            if (!*(pusrprm->ObjectName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            FreeAttachedPointers(lpparameters, iobjecttype);

            wsprintf(connectname,"%s::iidbdb",lpVirtNode);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfUsr(pusrprm);

         }
         break;
         
      case OT_PROFILE :
         {
            LPPROFILEPARAMS pprofprm=(LPPROFILEPARAMS) lpparameters;

            if (!*(pprofprm->ObjectName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            FreeAttachedPointers(lpparameters, iobjecttype);

            wsprintf(connectname,"%s::iidbdb",lpVirtNode);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfProf(pprofprm);

         }
         break;
         
      case OT_VIEW:
         {
            LPVIEWPARAMS pviewprm=(LPVIEWPARAMS) lpparameters;

            if (!*(pviewprm->objectname)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            if (!*(pviewprm->DBName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            wsprintf(connectname,"%s::%s",lpVirtNode, pviewprm->DBName);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfView(pviewprm);

         }
         break;

      case OT_INDEX:
         {
            LPINDEXPARAMS pindexprm=(LPINDEXPARAMS) lpparameters;

            if (!*(pindexprm->objectname)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            if (!*(pindexprm->DBName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            FreeAttachedPointers(lpparameters, iobjecttype);

            wsprintf(connectname,"%s::%s",lpVirtNode, pindexprm->DBName);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            x_strcpy(pindexprm->szNodeName, lpVirtNode);
            iret=GetInfIndex(pindexprm);
         }
         break;

      case OT_TABLE:
         {
            LPTABLEPARAMS ptableprm=(LPTABLEPARAMS) lpparameters;

            if (!*(ptableprm->objectname)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            if (!*(ptableprm->DBName)) {
               myerror(ERR_INVPARAMS);
               return RES_ERR;
            }

            FreeAttachedPointers(lpparameters, iobjecttype);

            wsprintf(connectname,"%s::%s",lpVirtNode, ptableprm->DBName);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            x_strcpy(ptableprm->szNodeName, lpVirtNode);
            iret=GetInfTable(ptableprm);

         }
         break;

      case OT_DATABASE:
         {
            LPDATABASEPARAMS pbaseprm=(LPDATABASEPARAMS) lpparameters;

            wsprintf(connectname,"%s::%s",lpVirtNode,pbaseprm->objectname);
            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;
            iret=GetInfBaseExtend(pbaseprm);
            // retrieve UNICODE information
            pbaseprm->bUnicodeDBNFD = 0;
            pbaseprm->bUnicodeDBNFC = 0;
            if (iret==RES_SUCCESS && GetOIVers() >= OIVERS_26)
            {
                TCHAR tcVersion[40];
	TCHAR tcNormalization[40];
                INGRESII_llDBMSInfo(_T("unicode_level"),tcVersion);
	INGRESII_llDBMSInfo(_T("unicode_normalization"), tcNormalization);
                if (tcVersion[0] != '0' && (x_strcmp(tcNormalization, "NFD")==0)) 
                    pbaseprm->bUnicodeDBNFD = 1;
	if (tcVersion[0]!='0' && (x_strcmp(tcNormalization, "NFC")==0))
	    pbaseprm->bUnicodeDBNFC = 1;
            }
            // Retrieve the current Catalog Page Size
            if (iret==RES_SUCCESS && GetOIVers() >= OIVERS_30)
               iret = GetCatalogPageSize(pbaseprm);

            if (iret==RES_SUCCESS)
               iret=ReleaseSession(*ilocsession, RELEASE_COMMIT);
            else
               ReleaseSession(*ilocsession, RELEASE_ROLLBACK);

            wsprintf(connectname,"%s::iidbdb",lpVirtNode);

            iret = Getsession(connectname, SessType, ilocsession);
            if (iret !=RES_SUCCESS)
               return RES_ERR;

            iret=GetInfBase(pbaseprm);
         }
         break;

      default :
         iret=RES_ERR;
   }

   if (bRetainSessForLock)  // The session was asked to be retained for...
      return iret;          // ... locking purposes, return without releasing.

   if (iret==RES_SUCCESS)
     iret=ReleaseSession(*ilocsession, RELEASE_COMMIT);
   else 
     ReleaseSession(*ilocsession, RELEASE_ROLLBACK);
   return iret;
}
Esempio n. 12
0
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
	LPTABLEPARAMS lptbl = (LPTABLEPARAMS)lParam;

	if (!AllocDlgProp(hwnd, lptbl))
		return FALSE;
    //
    // OpenIngres Version 2.0 only
    // Initialize the Combobox of page_size.
    ComboBox_InitPageSize (hwnd, lptbl->uPage_size);

    if (GetOIVers() == OIVERS_12)
    {
        ShowWindow (GetDlgItem (hwnd, IDC_STATIC_PS), SW_HIDE);
        ShowWindow (GetDlgItem (hwnd, IDC_COMBOPAGESIZE), SW_HIDE);
    }
    else
    {
        ShowWindow (GetDlgItem (hwnd, IDC_STATIC_PS), SW_SHOW);
        ShowWindow (GetDlgItem (hwnd, IDC_COMBOPAGESIZE), SW_SHOW);
    }

	if (GetOIVers() >= OIVERS_30)
	{
		HWND hwndC = GetDlgItem(hwnd, IDC_STATIC1);
		if (hwndC)
			ShowWindow (hwndC, SW_HIDE);
		hwndC = GetDlgItem(hwnd, IDC_LABEL_GRAN);
		if (hwndC)
			ShowWindow (hwndC, SW_HIDE);
	}
	if (!OccupyLabelControl(hwnd)
	 || !OccupyAuditOptionControl(hwnd)
	 || !OccupyAuditKeyControl(hwnd)
	 || !OccupyLocationControl(hwnd))
	{
		ASSERT(NULL);
		return FALSE;
	}

   CheckDlgButton(hwnd, IDC_JOURNALING, lptbl->bJournaling);
   CheckDlgButton(hwnd, IDC_DUPLICATES, lptbl->bDuplicates);

   if (lptbl->nSecAudit != USE_DEFAULT)
   {
      SelectComboBoxItem(GetDlgItem(hwnd, IDC_SEC_AUDIT_OPTION),
                         auditTypes,
                         lptbl->nSecAudit);
   }

   if (lptbl->nLabelGran != USE_DEFAULT)
   {
      SelectComboBoxItem(GetDlgItem(hwnd, IDC_LABEL_GRAN),
                         labelTypes,
                         lptbl->nLabelGran);
   }

   if (*lptbl->szSecAuditKey)
   {
      ComboBox_SelectString(GetDlgItem(hwnd, IDC_SEC_AUDIT_KEY),
                            -1,
                            lptbl->szSecAuditKey);
   }

   if (lptbl->lpLocations)
   {
      LPOBJECTLIST lplist = lptbl->lpLocations;

      while (lplist)
      {
         LPCHECKEDOBJECTS lpObj = (LPCHECKEDOBJECTS)lplist->lpObject;

         CAListBox_SelectString(GetDlgItem(hwnd, IDC_LOCATIONS),
                                -1,
                                lpObj->dbname);

         lplist = lplist->lpNext;
      }
   }
   if (GetOIVers() != OIVERS_12)
     lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_OIV2_TABLESTRUCT));
   else
     lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_TABLESTRUCT));
	richCenterDialog(hwnd);

	return TRUE;
}