예제 #1
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;
}
예제 #2
0
BOOL CxDlgObjectComment::FillListColumnWithComment( void )
{
	//
	// Get Session
	int hdl, nRes = RES_ERR ;
	TCHAR tcDBName      [MAXOBJECTNAME];
	TCHAR tcObjectName  [MAXOBJECTNAME];
	TCHAR tcObjectOwner [MAXOBJECTNAME];
	CString strSess;
	m_tcObjComment = NULL;
	CString strVNodeName = (LPTSTR)GetVirtNodeName(m_nNodeHandle);

	x_strcpy(tcDBName,m_csDBName);
	x_strcpy(tcObjectName, m_csObjectName );
	x_strcpy(tcObjectOwner,m_csObjectOwner);

	strSess.Format (_T("%s::%s"), 
	(LPTSTR)(LPCTSTR)strVNodeName, 
	(LPTSTR)(LPCTSTR)m_csDBName);
	nRes = Getsession ((LPUCHAR)(LPCTSTR)strSess, SESSION_TYPE_CACHEREADLOCK, &hdl);
	if (nRes != RES_SUCCESS)
	{
		TRACE0 (_T("CxDlgObjectComment::FillListColumnWithComment(): Fail to Get the session\n"));
		return FALSE;
	}

	nRes = SQLGetComment( (LPTSTR)(LPCTSTR)strVNodeName, tcDBName, tcObjectName, tcObjectOwner,
	                      &m_tcObjComment, m_ListColumn);

	ReleaseSession (hdl, RELEASE_COMMIT);

	if (nRes != RES_SUCCESS)
	{
		CString csMsg;
		csMsg.LoadString(IDS_E_COMMENTS_FAILED);
		MessageWithHistoryButton(m_hWnd,csMsg);
		return FALSE;
	}

	if (m_tcObjComment)
		SetCommentObject(m_tcObjComment);

	return TRUE;
}
예제 #3
0
int VDBAGetCommentInfo ( LPTSTR lpNodeName,LPTSTR lpDBName, LPTSTR lpObjName,
                         LPTSTR lpObjOwner,LPTSTR *lpObjComment, LPOBJECTLIST lpObjColumn)
{
    int ires, hdl;
    TCHAR tchszConnection [MAXOBJECTNAME*2];
    wsprintf (tchszConnection,"%s::%s", lpNodeName, lpDBName);
    ires = Getsession (tchszConnection, SESSION_TYPE_CACHENOREADLOCK, &hdl);
    if (ires != RES_SUCCESS)
        return RES_ERR;

    ires = SQLGetComment( lpNodeName, lpDBName, lpObjName, lpObjOwner,
                          lpObjComment, lpObjColumn);

   if (ires==RES_SUCCESS)
     ires=ReleaseSession(hdl, RELEASE_COMMIT);
   else 
     ReleaseSession(hdl, RELEASE_ROLLBACK);

    return ires;
}
예제 #4
0
BOOL VDBA20xGetDetailUKeyInfo (LPTABLEPARAMS lpTS, LPTSTR lpVnode)
{
    int ires, hdl;
    TCHAR tchszConnection [100];
    wsprintf (tchszConnection,"%s::%s", lpVnode, lpTS->DBName);
    ires = Getsession (tchszConnection, SESSION_TYPE_CACHENOREADLOCK, &hdl);
    if (ires != RES_SUCCESS)
    {
        ires = ReleaseSession(hdl, RELEASE_COMMIT);
        return FALSE;
    }
    lpTS->lpUnique = VDBA20xTableUniqueKey_Done (lpTS->lpUnique);
    ires = VDBA2xGetTableUniqueKeyInfo (lpTS);
    if (ires != RES_SUCCESS)
    {
        ires = ReleaseSession(hdl, RELEASE_COMMIT);
        return FALSE;
    }
    ires = ReleaseSession(hdl, RELEASE_COMMIT);
    return TRUE;
}
예제 #5
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;
}