private static bool HasQuerySourceAttributeConditions(SqlQuerySourceAttribute attribute, IEnumerable <SqlQueryCondition> conditions) { if (conditions == null) { return(false); } foreach (var condition in conditions) { var b = false; if ((condition.Condition == ConditionOperation.Exp || condition.Condition == ConditionOperation.Include) && condition.Conditions != null) { b = condition.Conditions.All( c => c.Left.Attributes != null && c.Left.Attributes.All(a => a.Attribute == attribute) && (!c.Right.IsAttribute || c.Right.Attributes.All(a => a.Attribute == attribute))); } else if (condition.Attributes != null) { b = condition.Left.Attributes.All(attr => attr.Attribute == attribute) && (!condition.Right.IsAttribute || condition.Right.Attributes.All(a => a.Attribute == attribute)); } if (b) { return(true); } } return(false); }
private static object GetSubQueryAttrAlias(SqlQuerySourceAttribute attr) { var subQueryAttr = attr as SqlQuerySubSourceAttribute; if (subQueryAttr != null && subQueryAttr.Attribute != null) { return(String.IsNullOrEmpty(subQueryAttr.Attribute.Alias) ? subQueryAttr.Attribute.AliasName : subQueryAttr.Attribute.Alias); } return(attr.AliasName); }
public SqlQueryOrderAttribute(SqlQuerySource source, SqlQuerySourceAttribute attribute, bool asc) : base(source, attribute) { Asc = asc; }
protected SqlQueryAttribute(SqlQuerySource source, SqlQuerySourceAttribute attribute) { _attributes.Add(new SqlQuerySourceAttributeRef(source, attribute)); }
private static IEnumerable <SqlQueryCondition> GetQuerySourceAttributeConditions(SqlQuerySourceAttribute attribute, IEnumerable <SqlQueryCondition> conditions) { if (conditions == null) { yield break; } foreach (var condition in conditions) { var b = false; if ((condition.Condition == ConditionOperation.Exp || condition.Condition == ConditionOperation.Include) && condition.Conditions != null) { b = condition.Conditions.All( c => c.Condition != ConditionOperation.Exp && c.Condition != ConditionOperation.Include && c.Left.Attributes != null && c.Left.Attributes.All(a => a.Attribute == attribute) && (!c.Right.IsAttribute || c.Right.Attributes.All(a => a.Attribute == attribute))) && !condition.Conditions.Any( c => c.Condition == ConditionOperation.IsNull || c.Condition == ConditionOperation.IsNotNull); } else if (condition.Attributes != null) { b = condition.Left.Attributes.All(attr => attr.Attribute == attribute) && (!condition.Right.IsAttribute || condition.Right.Attributes.All(a => a.Attribute == attribute)) && !(condition.Condition == ConditionOperation.IsNull || condition.Condition == ConditionOperation.IsNotNull); } /* * if (condition.SubQuery != null) * { * //condition.Left.SubQuery.Attribute.Attributes * continue; * } */ if (b) { yield return(condition); } } }
public SqlQuerySourceAttributeRef(SqlQuerySource source, SystemIdent attrIdent) { Source = source; Attribute = source.GetAttribute(attrIdent); }
public SqlQuerySourceAttributeRef(SqlQuerySource source, string attrDefName) { Source = source; Attribute = source.GetAttribute(attrDefName); }
public SqlQuerySourceAttributeRef(SqlQuerySource source, Guid attrDefId) { Source = source; Attribute = source.GetAttribute(attrDefId); }
public SqlQuerySourceAttributeRef(SqlQuerySource source, SqlQuerySourceAttribute attribute) { Source = source; Attribute = attribute; }
public SqlQueryGroupAttribute(SqlQuerySource source, SqlQuerySourceAttribute attribute) : base(source, attribute) { }