コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public SqlQueryOrderAttribute(SqlQuerySource source, SqlQuerySourceAttribute attribute, bool asc) : base(source, attribute)
 {
     Asc = asc;
 }
コード例 #4
0
 protected SqlQueryAttribute(SqlQuerySource source, SqlQuerySourceAttribute attribute)
 {
     _attributes.Add(new SqlQuerySourceAttributeRef(source, attribute));
 }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
 public SqlQuerySourceAttributeRef(SqlQuerySource source, SystemIdent attrIdent)
 {
     Source    = source;
     Attribute = source.GetAttribute(attrIdent);
 }
コード例 #7
0
 public SqlQuerySourceAttributeRef(SqlQuerySource source, string attrDefName)
 {
     Source    = source;
     Attribute = source.GetAttribute(attrDefName);
 }
コード例 #8
0
 public SqlQuerySourceAttributeRef(SqlQuerySource source, Guid attrDefId)
 {
     Source    = source;
     Attribute = source.GetAttribute(attrDefId);
 }
コード例 #9
0
 public SqlQuerySourceAttributeRef(SqlQuerySource source, SqlQuerySourceAttribute attribute)
 {
     Source    = source;
     Attribute = attribute;
 }
コード例 #10
0
 public SqlQueryGroupAttribute(SqlQuerySource source, SqlQuerySourceAttribute attribute)
     : base(source, attribute)
 {
 }