예제 #1
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerMDRelationCtas::EndElement
//
//	@doc:
//		Invoked by Xerces to process a closing tag
//
//---------------------------------------------------------------------------
void
CParseHandlerMDRelationCtas::EndElement
(
    const XMLCh* const, // xmlszUri,
    const XMLCh* const xmlszLocalname,
    const XMLCh* const // xmlszQname
)
{
    if (0 != XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenRelationCTAS), xmlszLocalname))
    {
        CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
        GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
    }

    CParseHandlerMetadataColumns *pphMdCol = dynamic_cast<CParseHandlerMetadataColumns *>((*this)[0]);
    CParseHandlerCtasStorageOptions *pphCTASOptions = dynamic_cast<CParseHandlerCtasStorageOptions *>((*this)[1]);

    GPOS_ASSERT(NULL != pphMdCol->Pdrgpmdcol());
    GPOS_ASSERT(NULL != pphCTASOptions->Pdxlctasopt());

    DrgPmdcol *pdrgpmdcol = pphMdCol->Pdrgpmdcol();
    CDXLCtasStorageOptions *pdxlctasopt = pphCTASOptions->Pdxlctasopt();

    pdrgpmdcol->AddRef();
    pdxlctasopt->AddRef();

    m_pimdobj = GPOS_NEW(m_pmp) CMDRelationCtasGPDB
                (
                    m_pmp,
                    m_pmdid,
                    m_pmdnameSchema,
                    m_pmdname,
                    m_fTemporary,
                    m_fHasOids,
                    m_erelstorage,
                    m_ereldistrpolicy,
                    pdrgpmdcol,
                    m_pdrgpulDistrColumns,
                    m_pdrgpdrgpulKeys,
                    pdxlctasopt,
                    m_pdrgpiVarTypeMod
                );

    // deactivate handler
    m_pphm->DeactivateHandler();
}
예제 #2
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();
}