예제 #1
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerQueryOutput::EndElement
//
//	@doc:
//		Invoked by Xerces to process a closing tag
//
//---------------------------------------------------------------------------
void
CParseHandlerQueryOutput::EndElement
	(
	const XMLCh* const, // element_uri,
	const XMLCh* const element_local_name,
	const XMLCh* const // element_qname
	)
{
	if(0 != XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenQueryOutput), element_local_name))
	{
		CWStringDynamic *str = CDXLUtils::CreateDynamicStringFromXMLChArray(m_parse_handler_mgr->GetDXLMemoryManager(), element_local_name);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, str->GetBuffer());
	}

	const ULONG size = this->Length();
	for (ULONG ul = 0; ul < size; ul++)
	{
		CParseHandlerScalarIdent *child_parse_handler = dynamic_cast<CParseHandlerScalarIdent *>((*this)[ul]);

		GPOS_ASSERT(NULL != child_parse_handler);

		CDXLNode *pdxlnIdent = child_parse_handler->CreateDXLNode();
		pdxlnIdent->AddRef();
		m_dxl_array->Append(pdxlnIdent);
	}

	// deactivate handler
	m_parse_handler_mgr->DeactivateHandler();
}
예제 #2
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerOp::AddChildFromParseHandler
//
//	@doc:
//		Extracts the node constructed from the given parse handler and adds it
//		to children array of the current node. Child nodes are ref-counted before
//		being added to the array.
//
//---------------------------------------------------------------------------
void
CParseHandlerOp::AddChildFromParseHandler
	(
	const CParseHandlerOp *pph
	)
{
	GPOS_ASSERT(NULL != m_pdxln);
	GPOS_ASSERT(NULL != pph);
	
	// extract constructed element
	CDXLNode *pdxlnChild = pph->Pdxln();
	GPOS_ASSERT(NULL != pdxlnChild);
	
	pdxlnChild->AddRef();
	m_pdxln->AddChild(pdxlnChild);
}
예제 #3
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerMDRelation::EndElement
//
//	@doc:
//		Invoked by Xerces to process a closing tag
//
//---------------------------------------------------------------------------
void
CParseHandlerMDRelation::EndElement
	(
	const XMLCh* const, // xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const // xmlszQname
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenPartConstraint), xmlszLocalname))
	{
		CParseHandlerScalarOp *pphPartCnstr = dynamic_cast<CParseHandlerScalarOp *>((*this)[UlLength() - 1]);
		CDXLNode *pdxlnPartConstraint = pphPartCnstr->Pdxln();
		pdxlnPartConstraint->AddRef();
		m_ppartcnstr = GPOS_NEW(m_pmp) CMDPartConstraintGPDB(m_pmp, pdxlnPartConstraint, m_pdrgpulDefaultParts, m_fPartConstraintUnbounded);
		return;
	}

	if (0 != XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenRelation), xmlszLocalname))
	{
		CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
	}
	
	// construct metadata object from the created child elements
	CParseHandlerMetadataColumns *pphMdCol = dynamic_cast<CParseHandlerMetadataColumns *>((*this)[0]);
	CParseHandlerMetadataIdList *pphMdidlIndices = dynamic_cast<CParseHandlerMetadataIdList*>((*this)[1]);
	CParseHandlerMetadataIdList *pphMdidlTriggers = dynamic_cast<CParseHandlerMetadataIdList*>((*this)[2]);
	CParseHandlerMetadataIdList *pphMdidlCheckConstraints = dynamic_cast<CParseHandlerMetadataIdList*>((*this)[3]);

	GPOS_ASSERT(NULL != pphMdCol->Pdrgpmdcol());
	GPOS_ASSERT(NULL != pphMdidlIndices->Pdrgpmdid());
	GPOS_ASSERT(NULL != pphMdidlCheckConstraints->Pdrgpmdid());

	// refcount child objects
	DrgPmdcol *pdrgpmdcol = pphMdCol->Pdrgpmdcol();
	DrgPmdid *pdrgpmdidIndices = pphMdidlIndices->Pdrgpmdid();
	DrgPmdid *pdrgpmdidTriggers = pphMdidlTriggers->Pdrgpmdid();
	DrgPmdid *pdrgpmdidCheckConstraint = pphMdidlCheckConstraints->Pdrgpmdid();
 
	pdrgpmdcol->AddRef();
	pdrgpmdidIndices->AddRef();
 	pdrgpmdidTriggers->AddRef();
 	pdrgpmdidCheckConstraint->AddRef();

	m_pimdobj = GPOS_NEW(m_pmp) CMDRelationGPDB
								(
									m_pmp,
									m_pmdid,
									m_pmdname,
									m_fTemporary,
									m_erelstorage,
									m_ereldistrpolicy,
									pdrgpmdcol,
									m_pdrgpulDistrColumns,
									m_pdrgpulPartColumns,
									m_fConvertHashToRandom,
									m_pdrgpdrgpulKeys,
									pdrgpmdidIndices,
									pdrgpmdidTriggers,
									pdrgpmdidCheckConstraint,
									m_ppartcnstr,
									m_fHasOids
								);

	// deactivate handler
	m_pphm->DeactivateHandler();
}