Beispiel #1
0
IMPLEMENT_DEBUG_FUNCENTRY_4(CGDODatabase,get_ObjectsDef,VARIANT, vIndex, VARIANT_BOOL, fCreate, BSTR, Type, ITRiASObjects**, ppIObjectsDef) 
{
	CHECKOUTPOINTER(ppIObjectsDef);
	COM_TRY {
		CHECK_INITIALIZED();

	WTRiASObjects	pTRiASObjects;
	CComVariant	vItem;

		RETURN_FAILED_HRESULT(EnsureObjectsColl());
	
	HRESULT hr = m_pGDOObjectsCollection -> Item (vIndex, CLEARED(vItem));

		if (SUCCEEDED(hr)) 
			pTRiASObjects = V_DISPATCH(&vItem);
		else if (TRIASDB_E_UNKNOWN_OBJECTS == hr && fCreate) {
		WTRiASObjectsCollection	pTRiASObjectsCollection;
		
			ERROR_FAILED_HRESULT(m_pGDOObjectsCollection -> QueryInterface (pTRiASObjectsCollection.ppi()), E_FAIL);
			ERROR_FAILED_HRESULT(pTRiASObjectsCollection -> Add (V_BSTR(&vIndex), Type, pTRiASObjects.ppi()), E_FAIL);
		} else 
			return hr;

		*ppIObjectsDef = pTRiASObjects.detach();
	} COM_CATCH;
	return S_OK;
}
Beispiel #2
0
HRESULT DatenBasisObjekt::DelPBDDataIdent (HPROJECT hPr, PBDDATA *pData)
{
	TX_ASSERT(IsTRiASDBBased());

// Tabelle liegt in einer Datenquelle 
	if (HACTPROJECT != hPr) {
	ErrCode RC = DB(GetIdentDBHandle (pData -> pbdCode, hPr)).DelPBDDataIdent (pData);

		if (EC_OKAY != RC)
			return HRESULT_FROM_ERRCODE(RC);

	// Notifikation rumschicken
		DEXN_FeatureSetModified(pData -> pbdCode);
	} 
	else {
	// KurzText muß gegeben sein
		TX_ASSERT(pData -> pbdKTextLen > 0 && NULL != pData -> pbdKText);

	// übergreifende Objektmenge löschen
	WTRiASObjectsCollection ObjsDefs;

		RETURN_FAILED_HRESULT(m_Prj -> get_ObjectsDefs (ObjsDefs.ppi()));
		RETURN_FAILED_HRESULT(ObjsDefs -> Remove (CComVariant(pData -> pbdKText)));
	}
	return S_OK;
}
Beispiel #3
0
BOOL DatenBasisObjekt::EnumPBDDataIdent (HPROJECT hPr, ENUMLONGKEYPROC pFcn, void *pData)
{
	TX_ASSERT(IsTRiASDBBased());

BOOL iRC = TRUE;

	COM_TRY {
	// Enumerieren aller Objektklassen einer Datenquelle
		if (HACTPROJECT != hPr) {
			if (HACTCONNECTION != hPr)	// eine bestimmte Datenquelle auswerten
				return DB(hPr).EnumPBDDataIdent (pFcn, pData);

		// _alle_ Datenquellen auswerten
		CRing r (*m_pGeoDBs);

			for (r.First(); r.Valid(); r.Next()) {
			GeoDBLock l(r);

				TX_ASSERT(NULL != (GeoDB *)l);
				if (l -> isOpened()) {
					if (!l -> EnumPBDDataIdent (pFcn, pData))
						return FALSE;
				}
			}
			return TRUE;
		}

	// Objektmengen (Tabellen) enumerieren
	WTRiASObjectsCollection ObjsDefs;

		THROW_FAILED_HRESULT(m_Prj -> get_ObjectsDefs (ObjsDefs.ppi()));

	WEnumVARIANT Enum;
	CComVariant v;

		THROW_FAILED_HRESULT(ObjsDefs -> _NewEnum (Enum.ppu()));
		for (Enum -> Reset(); S_OK == Enum -> Next (1, CLEARED(&v), NULL); /**/) 
		{
			if (FAILED(v.ChangeType (VT_DISPATCH)))
				continue;

		WTRiASObjects Item (V_DISPATCH(&v));
		INT_PTR lHandle = 0L;

			if (SUCCEEDED(Item -> get_Handle (&lHandle))) {
				iRC = EnumIdentsCallback (pFcn, lHandle, TRUE, pData);
				if (!iRC) break;	// Enumeration abgebrochen
			}
		}

	} COM_CATCH_RETURN(FALSE);
	return iRC;
}
Beispiel #4
0
HRESULT CTRiASMIObjectsCollection::CreateObject (
	VARIANT NameOrHandle, DWORD dwType, const CLSID *pClsId, ITRiASObjects **ppIObjs)
{
	_ASSERTE(NULL != pClsId);
	if (NULL == pClsId) 
		return E_POINTER;

// diverse Vorbereitungen treffen
WDispatch App;
WDispatch Parent;
WTRiASObjectsCollection BaseObjs;

	RETURN_FAILED_HRESULT(m_BaseUnk -> QueryInterface (BaseObjs.ppi()));

	RETURN_FAILED_HRESULT(BaseObjs -> get_Application (App.ppi()));		// für neue Objektklasse
	RETURN_FAILED_HRESULT(BaseObjs -> get_Parent(Parent.ppi()));

// ZugriffsHandle/Namen oder OKS aus NameOrHandle bestimmen
LONG lHandle = 0;
CComVariant v;
bool fHasName = false;
bool fHasOKS = false;
CComBSTR bstrApp, bstrOKS;

	if (VT_BSTR != V_VT(&NameOrHandle) && SUCCEEDED(v.ChangeType (VT_I4, &NameOrHandle)))
		lHandle = V_I4(&v);
	else if (SUCCEEDED(v.ChangeType(VT_BSTR, &NameOrHandle))) {
	// feststellen, ob es ein OKS ist, evtl. Namen isolieren
		if (StringIsOKS(V_BSTR(&v), CLEARED(&bstrOKS), CLEARED(&bstrApp))) {
			if (bstrOKS.Length() > 0)
				fHasOKS = true;
		} else 
			bstrApp = V_BSTR(&v);

		if (bstrApp.Length() > 0)
			fHasName = true;
	} else
		return E_INVALIDARG;

// Objektklasse aus Handle/Name/OKS erzeugen
HRESULT hr = S_OK;

	COM_TRY {
	WTRiASObjects Objs (*pClsId);		// zu liefernde Objektklasse erzeugen

		THROW_FAILED_HRESULT(Objs -> put_Parent (Parent));

#pragma TODO("Neue Objektklasse in Datenbank erzeugen.")

		if (fHasName) 	// S_FALSE heißt: Objekt existiert bereits
			RETURN_FAILED_HRESULT(Objs -> put_Name (bstrApp));
		if (fHasOKS)
			RETURN_FAILED_HRESULT(Objs -> put_OKS (bstrOKS));

	// wenn Objektklasse bereits zu dieser Menge von Objektklassen gehört, dann liefert _Add den Wert S_FALSE
		hr = BaseObjs -> _Add (Objs, VARIANT_TRUE);
		if (SUCCEEDED(hr) && NULL != ppIObjs)
			*ppIObjs = Objs.detach();			// evtl. neue/gefundene Objektklasse liefern

	} COM_CATCH;
	return hr;
}