Пример #1
0
StatusCode QueryOperatorImpl::LoadCollectionQuery(QueryNodeImpl* target)
{
#if 0
	ClearMCATScratch();
	m_selval[DATA_GRP_NAME] = 1;

	INode* ptr = target;
	IMetadataNode* ptr_meta;

	int count = 0;

	StatusCode status;

	while(WINI_QUERY == ptr->GetType())
	{
		ptr_meta = (IMetadataNode*)ptr->GetChild(0);

		status = LoadCollectionQuery2(ptr_meta, count);

		if(!status.isOk())
			break;

		ptr = ptr->GetParent();

		if(NULL == ptr)
			break;
	}

	return status;
#endif
	return WINI_ERROR;
}
Пример #2
0
StatusCode QueryOperatorImpl::Delete(IQueryNode* query)
{
	if(NULL == query)
		return WINI_ERROR_INVALID_PARAMETER;

	INode* parent = query->GetParent();

	if(parent)
	{
		//parent can be binding of a root query or parent of a nested query
		//in case of root query, the collection, resource, etc, does not know that
		//a query references it as its parent.
		//remove query from parent query
		if(WINI_QUERY == parent->GetType())
			((QueryNodeImpl*)parent)->RemoveChild(query);
	};

	//can also be referenced in session if it is a root query in the list
	//should call on session to remove from its list as well.

	//cam also be in m_nodes check there as well

	delete query;	//this should delete all child query nodes but not other nodes

	return WINI_OK;
}
Пример #3
0
StatusCode QueryOperatorImpl::Remove(IMetadataNode* expression)
{
	if(NULL == expression)
		return WINI_ERROR_INVALID_PARAMETER;

	INode* parent = expression->GetParent();

	StatusCode status = WINI_OK;

	if(parent)
	{
		switch(parent->GetType())
		{
		case WINI_QUERY:			//is root expression. delete from query, query is now invalid
			status = ((QueryNodeImpl*)parent)->RemoveChild(expression);
			break;
		case WINI_METADATA:		//delete from metadata, metadata must be fixed
			status = ((MetadataNodeImpl*)parent)->DeleteChild2(expression);
			break;
		default:				//do not remove nodes of collections, datasets, etc.
			return WINI_ERROR;
		}
		//remove query from parent
	};

	if(status.isOk())
		delete expression;

	return status;
}
Пример #4
0
StatusCode QueryOperatorImpl::Fetch(QueryNodeImpl* target)
{
	return WINI_ERROR;
#if 0
	//the equal thing will only ever return either 1 or 0 so it should have special instance
	//also because when you subtract the collection name from itself it's null

	m_binding = NULL; //reset in case the same operator is used to perform different queries

	if(NULL == target)
		return WINI_ERROR;

	INode* blah = target->GetParent();

	while(NULL != blah)
	{
		if(WINI_QUERY == blah->GetType())
		{
			blah = blah->GetParent();
		}else
		{
			m_binding = blah;
			blah = NULL;
		}
	}

	if(NULL == m_binding)
		return WINI_ERROR;

	if(WINI_COLLECTION != m_binding->GetType())
		return WINI_ERROR;

	StatusCode status = FetchCollections(target);

	//if(status.isOk())
	//	FetchDatasets(QueryNodeImpl* target);

	return status;
#endif
}