Beispiel #1
0
        internal override IExp RemoveExpIfNull(ICaster caster)
        {
            IExp exp = _operand.RemoveExpIfNull(caster);

            if (exp == null)
            {
                return(null);
            }
            else
            {
                return(new NotExp(exp));
            }
        }
Beispiel #2
0
        internal override IExp RemoveExp(PropertyInfo[] matchProperties)
        {
            IExp exp = _operand.RemoveExp(matchProperties);

            if (exp == null)
            {
                return(null);
            }
            else
            {
                return(new NotExp(exp));
            }
        }
Beispiel #3
0
        /// <summary>
        /// 条件を追加する
        /// </summary>
        /// <param name="aBoolean">条件</param>
        /// <remarks></remarks>
        public void And(bool aBoolean)
        {
            IExp aExp = null;

            if (aBoolean)
            {
                aExp = new EqualExp(new Literal(1), new Literal(1));
            }
            else
            {
                aExp = new NotEqualExp(new Literal(1), new Literal(1));
            }
            _criteria.Add(aExp);
        }
Beispiel #4
0
        internal void RemoveEqualExp(Tuple <string, string> match)
        {
            EqualExp matchEqExp = new EqualExp(val.of(match.Item1), new Literal(match.Item2));

            List <IExp> newCriteria = new List <IExp>();

            foreach (IExp aExp in this._criteria)
            {
                IExp replacedExp = aExp.RemoveEqualExp(matchEqExp);
                if (replacedExp != null)
                {
                    newCriteria.Add(replacedExp);
                }
            }

            _criteria = newCriteria;
        }
Beispiel #5
0
        public Query <toRecord> CastTo <toRecord>() where toRecord : class, IRecord, new()
        {
            //キャスト先Queryオブジェクト
            Query <toRecord> ret = new Query <toRecord>();

            //無条件にキャスト先Queryオブジェクトにコピーできる値をコピーする
            ret._maxRows = _maxRows;
            if (_rowRange != null)
            {
                ret._rowRange = new Tuple <int, int>(_rowRange.Item1, _rowRange.Item2);
            }

            //キャスト先レコードのプロパティ情報の取得
            PropertyInfo[] toProperties = (new toRecord()).GetType().GetProperties();

            //キャスト先レコードに存在しないプロパティを含んでいる抽出条件は除外する
            foreach (IExp exp in _criteria)
            {
                IExp toExp = exp.RemoveExp(toProperties);
                if (toExp != null)
                {
                    ret._criteria.Add(toExp);
                }
            }

            //キャスト先レコードに存在しないソートキー(プロパティ)は除外する
            foreach (Tuple <string, bool> kv in _orderExp)
            {
                string propertyName = kv.Item1;
                bool   asc          = kv.Item2;
                foreach (PropertyInfo aPropertyInfo in toProperties)
                {
                    if (aPropertyInfo.Name == propertyName)
                    {
                        ret._orderExp.Add(new Tuple <string, bool>(propertyName, asc));
                    }
                }
            }

            return(ret);
        }
Beispiel #6
0
        internal override IExp RemoveExp(PropertyInfo[] matchProperties)
        {
            IExp lExp = _lOperand.RemoveExp(matchProperties);
            IExp rExp = _rOperand.RemoveExp(matchProperties);

            if (lExp == null && rExp == null)
            {
                return(null);
            }
            else if (lExp == null)
            {
                return(rExp);
            }
            else if (rExp == null)
            {
                return(lExp);
            }
            else
            {
                return(new XOrExp(lExp, rExp));
            }
        }
Beispiel #7
0
        internal override IExp RemoveEqualExp(EqualExp match)
        {
            IExp lExp = _lOperand.RemoveEqualExp(match);
            IExp rExp = _rOperand.RemoveEqualExp(match);

            if (lExp == null && rExp == null)
            {
                return(null);
            }
            else if (lExp == null)
            {
                return(rExp);
            }
            else if (rExp == null)
            {
                return(lExp);
            }
            else
            {
                return(new XOrExp(lExp, rExp));
            }
        }
Beispiel #8
0
        internal override IExp RemoveExpIfNull(ICaster caster)
        {
            IExp lExp = _lOperand.RemoveExpIfNull(caster);
            IExp rExp = _rOperand.RemoveExpIfNull(caster);

            if (lExp == null && rExp == null)
            {
                return(null);
            }
            else if (lExp == null)
            {
                return(rExp);
            }
            else if (rExp == null)
            {
                return(lExp);
            }
            else
            {
                return(new XOrExp(lExp, rExp));
            }
        }
Beispiel #9
0
 public XOrExp(IExp lOperand, IExp rOperand)
 {
     _lOperand = lOperand;
     _rOperand = rOperand;
 }
Beispiel #10
0
 /// <summary>
 /// 条件を追加する
 /// </summary>
 /// <param name="aExp">条件</param>
 /// <remarks></remarks>
 public void And(IExp aExp)
 {
     _criteria.Add(aExp);
 }
Beispiel #11
0
 public AndExp(IExp lOperand, IExp rOperand)
 {
     _lOperand = lOperand;
     _rOperand = rOperand;
 }
Beispiel #12
0
 public NotExp(IExp operand)
 {
     _operand = operand;
 }