本文整理汇总了C++中CConstraint::PcrsUsed方法的典型用法代码示例。如果您正苦于以下问题:C++ CConstraint::PcrsUsed方法的具体用法?C++ CConstraint::PcrsUsed怎么用?C++ CConstraint::PcrsUsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConstraint
的用法示例。
在下文中一共展示了CConstraint::PcrsUsed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrgPcnstr
//---------------------------------------------------------------------------
// @function:
// CConstraint::PdrgpcnstrOnColumn
//
// @doc:
// Return a subset of the given constraints which reference the
// given column
//
//---------------------------------------------------------------------------
DrgPcnstr *
CConstraint::PdrgpcnstrOnColumn
(
IMemoryPool *pmp,
DrgPcnstr *pdrgpcnstr,
CColRef *pcr,
BOOL fExclusive // returned constraints must reference ONLY the given col
)
{
DrgPcnstr *pdrgpcnstrSubset = GPOS_NEW(pmp) DrgPcnstr(pmp);
const ULONG ulLen = pdrgpcnstr->UlLength();
for (ULONG ul = 0; ul < ulLen; ul++)
{
CConstraint *pcnstr = (*pdrgpcnstr)[ul];
CColRefSet *pcrs = pcnstr->PcrsUsed();
// if the fExclusive flag is true, then pcr must be the only column
if (pcrs->FMember(pcr) && (!fExclusive || 1 == pcrs->CElements()))
{
pcnstr->AddRef();
pdrgpcnstrSubset->Append(pcnstr);
}
}
return pdrgpcnstrSubset;
}
示例2: PdrgpcnstrFlatten
//---------------------------------------------------------------------------
// @function:
// CConstraintConjunction::CConstraintConjunction
//
// @doc:
// Ctor
//
//---------------------------------------------------------------------------
CConstraintConjunction::CConstraintConjunction
(
IMemoryPool *mp,
CConstraintArray *pdrgpcnstr
)
:
CConstraint(mp),
m_pdrgpcnstr(NULL)
{
GPOS_ASSERT(NULL != pdrgpcnstr);
m_pdrgpcnstr = PdrgpcnstrFlatten(mp, pdrgpcnstr, EctConjunction);
const ULONG length = m_pdrgpcnstr->Size();
GPOS_ASSERT(0 < length);
m_pcrsUsed = GPOS_NEW(mp) CColRefSet(mp);
for (ULONG ul = 0; ul < length; ul++)
{
CConstraint *pcnstr = (*m_pdrgpcnstr)[ul];
m_pcrsUsed->Include(pcnstr->PcrsUsed());
}
m_phmcolconstr = Phmcolconstr(mp, m_pcrsUsed, m_pdrgpcnstr);
}
示例3: arpdrgpcnstr
// mapping between columns and single column constraints in array of constraints
static
HMColConstr *
PhmcolconstrSingleColConstr
(
IMemoryPool *pmp,
DrgPcnstr *drgPcnstr
)
{
CAutoRef<DrgPcnstr> arpdrgpcnstr(drgPcnstr);
HMColConstr *phmcolconstr = GPOS_NEW(pmp) HMColConstr(pmp);
const ULONG ulLen = arpdrgpcnstr->UlLength();
for (ULONG ul = 0; ul < ulLen; ul++)
{
CConstraint *pcnstrChild = (*arpdrgpcnstr)[ul];
CColRefSet *pcrs = pcnstrChild->PcrsUsed();
if (1 == pcrs->CElements())
{
CColRef *pcr = pcrs->PcrFirst();
DrgPcnstr *pcnstrMapped = phmcolconstr->PtLookup(pcr);
if (NULL == pcnstrMapped)
{
pcnstrMapped = GPOS_NEW(pmp) DrgPcnstr(pmp);
phmcolconstr->FInsert(pcr, pcnstrMapped);
}
pcnstrChild->AddRef();
pcnstrMapped->Append(pcnstrChild);
}
}
return phmcolconstr;
}
示例4: PcnstrConjunction
//---------------------------------------------------------------------------
// @function:
// CConstraintConjunction::Pcnstr
//
// @doc:
// Return constraint on a given column set
//
//---------------------------------------------------------------------------
CConstraint *
CConstraintConjunction::Pcnstr
(
IMemoryPool *mp,
CColRefSet *pcrs
)
{
const ULONG length = m_pdrgpcnstr->Size();
CConstraintArray *pdrgpcnstr = GPOS_NEW(mp) CConstraintArray(mp);
for (ULONG ul = 0; ul < length; ul++)
{
CConstraint *pcnstr = (*m_pdrgpcnstr)[ul];
if (pcnstr->PcrsUsed()->IsDisjoint(pcrs))
{
continue;
}
// the part of the child that references these columns
CConstraint *pcnstrCol = pcnstr->Pcnstr(mp, pcrs);
if (NULL != pcnstrCol)
{
pdrgpcnstr->Append(pcnstrCol);
}
}
return CConstraint::PcnstrConjunction(mp, pdrgpcnstr);
}