本文整理汇总了C#中VarVec.IsSet方法的典型用法代码示例。如果您正苦于以下问题:C# VarVec.IsSet方法的具体用法?C# VarVec.IsSet怎么用?C# VarVec.IsSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VarVec
的用法示例。
在下文中一共展示了VarVec.IsSet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasVarReferences
/// <summary>
/// Does the list of outputs of the given SetOp contain a var
/// from the given VarVec defined by the SetOp's child with the given index
/// </summary>
private static bool HasVarReferences(SetOp op, VarVec vars, int index)
{
foreach (var var in op.VarMap[index].Values)
{
if (vars.IsSet(var))
{
return true;
}
}
return false;
}
示例2: PreservesNulls
// <summary>
// Does this predicate preserve nulls on the specified columns of the table?
// If any of the columns participates in a comparison predicate, or in a
// not-null predicate, then, nulls are not preserved
// </summary>
// <param name="simplePredNode"> the "simple" predicate node </param>
// <param name="tableColumns"> list of table columns </param>
// <returns> true, if nulls are preserved </returns>
private static bool PreservesNulls(Node simplePredNode, VarVec tableColumns)
{
VarRefOp varRefOp;
switch (simplePredNode.Op.OpType)
{
case OpType.EQ:
case OpType.NE:
case OpType.GT:
case OpType.GE:
case OpType.LT:
case OpType.LE:
varRefOp = simplePredNode.Child0.Op as VarRefOp;
if (varRefOp != null
&& tableColumns.IsSet(varRefOp.Var))
{
return false;
}
varRefOp = simplePredNode.Child1.Op as VarRefOp;
if (varRefOp != null
&& tableColumns.IsSet(varRefOp.Var))
{
return false;
}
return true;
case OpType.Not:
if (simplePredNode.Child0.Op.OpType
!= OpType.IsNull)
{
return true;
}
varRefOp = simplePredNode.Child0.Child0.Op as VarRefOp;
return (varRefOp == null || !tableColumns.IsSet(varRefOp.Var));
case OpType.Like:
// If the predicate is "column LIKE constant ...", then the
// predicate does not preserve nulls
var constantOp = simplePredNode.Child1.Op as ConstantBaseOp;
if (constantOp == null
|| (constantOp.OpType == OpType.Null))
{
return true;
}
varRefOp = simplePredNode.Child0.Op as VarRefOp;
if (varRefOp != null
&& tableColumns.IsSet(varRefOp.Var))
{
return false;
}
return true;
default:
return true;
}
}
示例3: IsKeyPredicate
private bool IsKeyPredicate(Node left, Node right, VarVec keyVars, VarVec definitions, out Var keyVar)
{
keyVar = null;
// If the left-side is not a Var, then return false
if (left.Op.OpType
!= OpType.VarRef)
{
return false;
}
var varRefOp = (VarRefOp)left.Op;
keyVar = varRefOp.Var;
// Not a key of this table?
if (!keyVars.IsSet(keyVar))
{
return false;
}
// Make sure that the other side is either a constant, or has no
// references at all to us
var otherNodeInfo = m_command.GetNodeInfo(right);
var otherVarExternalReferences = otherNodeInfo.ExternalReferences.Clone();
otherVarExternalReferences.And(definitions);
return otherVarExternalReferences.IsEmpty;
}
示例4: IsEquiJoinPredicate
// <summary>
// Is this an equi-join predicate involving columns from the specified tables?
// On output, if this was indeed an equijoin predicate, "leftVar" is the
// column of the left table, while "rightVar" is the column of the right table
// and the predicate itself is of the form "leftVar = rightVar"
// </summary>
// <param name="simplePredicateNode"> the simple predicate node </param>
// <param name="leftTableDefinitions"> interesting columns of the left table </param>
// <param name="rightTableDefinitions"> interesting columns of the right table </param>
// <param name="leftVar"> join column of the left table </param>
// <param name="rightVar"> join column of the right table </param>
// <returns> true, if this is an equijoin predicate involving columns from the 2 tables </returns>
private static bool IsEquiJoinPredicate(
Node simplePredicateNode,
VarVec leftTableDefinitions, VarVec rightTableDefinitions,
out Var leftVar, out Var rightVar)
{
Var tempLeftVar;
Var tempRightVar;
leftVar = null;
rightVar = null;
if (!IsEquiJoinPredicate(simplePredicateNode, out tempLeftVar, out tempRightVar))
{
return false;
}
if (leftTableDefinitions.IsSet(tempLeftVar)
&&
rightTableDefinitions.IsSet(tempRightVar))
{
leftVar = tempLeftVar;
rightVar = tempRightVar;
}
else if (leftTableDefinitions.IsSet(tempRightVar)
&&
rightTableDefinitions.IsSet(tempLeftVar))
{
leftVar = tempRightVar;
rightVar = tempLeftVar;
}
else
{
return false;
}
return true;
}