Пример #1
0
        /// <summary>
        /// Builds a new <see cref="WhereClause"/> instance.
        /// </summary>
        /// <param name="column"><see cref="IColumn"/> where to apply the clause onto</param>
        /// <param name="operator"><see cref="ClauseOperator"/> to apply</param>
        /// <param name="constraint">constraint to apply to <paramref name="column"/>.</param>
        /// <exception cref="ArgumentNullException">if <paramref name="column"/> is <c>null</c>.</exception>
        public WhereClause(IColumn column, ClauseOperator @operator, IColumn constraint = null)
        {
            Column   = column ?? throw new ArgumentNullException(nameof(column));
            UniqueId = Guid.NewGuid();
            Operator = @operator;
            if (@operator != ClauseOperator.IsNull && @operator != ClauseOperator.IsNotNull)
            {
                if (@operator == ClauseOperator.In)
                {
                    switch (constraint)
                    {
                    case StringValues strings:
                        Constraint = strings;
                        break;

                    case null:
                        throw new ArgumentNullException(nameof(constraint),
                                                        $"{nameof(constraint)} cannot be null when {nameof(@operator)} is {nameof(ClauseOperator)}.{nameof(ClauseOperator.In)}");

                    default:

                        break;
                    }
                }
                Constraint = constraint;
            }
        }
Пример #2
0
 /// <summary>
 /// Join the two specified queries with the specified operator
 /// </summary>
 /// <param name="a">The first query to be joined</param>
 /// <param name="b">The second query to be joined</param>
 /// <param name="op">The operator</param>
 /// <returns>The joined query</returns>
 protected Query Join(Query a, Query b, ClauseOperator op)
 {
     return(new Query(string.Format("({0} {1} {2})", a.QueryClause, op.ToString().ToUpper(), b.QueryClause)));
 }
Пример #3
0
 public HavingClause(AggregateFunction column, ClauseOperator @operator, bool?constraint)
     : this(column, @operator, constraint?.Literal())
 {
 }
Пример #4
0
 /// <summary>
 /// Builds a new <see cref="HavingClause"/> instance.
 /// </summary>
 /// <param name="column">column the </param>
 /// <param name="operator"></param>
 /// <param name="constraint"></param>
 public HavingClause(AggregateFunction column, ClauseOperator @operator, IColumn constraint = null)
 {
     Column     = column ?? throw new ArgumentNullException(nameof(column));
     Operator   = @operator;
     Constraint = constraint;
 }
        private void AddParam(double fieldid, Operator @operator, string[] searchterms, ClauseOperator interclauseoperator, ClauseOperator clauseoperator)
        {
            if (searchterms == null || searchterms.Length == 0)
            {
                return;
            }

            this.groupparams.Add(new GroupFieldIDClause
            {
                ClauseOperator = clauseoperator,
                InterClauseOperator = interclauseoperator,
                Fieldid = fieldid,
                Operator = @operator,
                SearchTerms = searchterms
            });
        }
 private void AddParam(double fieldid, Operator @operator, string[] searchterms, ClauseOperator clauseoperator)
 {
     this.AddParam(@operator, searchterms, ClauseOperator.OR, clauseoperator);
 }
        private void AddParam(Operator @operator, string[] searchterms, ClauseOperator interclauseoperator, ClauseOperator clauseoperator)
        {
            if (SearchFieldIsPending)
            {
                AddParam(PendingSearchField, @operator, searchterms, interclauseoperator, clauseoperator);
                return;
            }

            AddParam(PendingFieldID, @operator, searchterms, interclauseoperator, clauseoperator);
        }
 private void AddParam(Operator @operator, string[] searchterms, ClauseOperator interclauseoperator)
 {
     this.AddParam(@operator, searchterms, interclauseoperator, ClauseOperator.AND);
 }
        private void AddParam(SearchField field, Operator @operator, string[] searchterms, ClauseOperator interclauseoperator, ClauseOperator clauseoperator)
        {
            if (field == SearchField.Status)
            {
                this.StatusClauseAdded = true;
            }

            this.groupparams.Add(new GroupClause
            {
                SearchField = field,
                ClauseOperator = clauseoperator,
                InterClauseOperator = interclauseoperator,
                Operator = @operator,
                SearchTerms = searchterms
            });
        }
Пример #10
0
 internal ValuePair(IValueClause first, ClauseOperator clauseoperator, IValueClause second)
 {
     this.First = first;
     this.Second = second;
     this.ClauseOperator = clauseoperator;
 }
Пример #11
0
 /// <summary>
 /// Join the two specified queries with the specified operator
 /// </summary>
 /// <param name="a">The first query to be joined</param>
 /// <param name="b">The second query to be joined</param>
 /// <param name="op">The operator</param>
 /// <returns>The joined query</returns>
 protected Query Join(Query a, Query b, ClauseOperator op)
 {
     return new Query(string.Format("({0} {1} {2})", a.QueryClause, op.ToString().ToUpper(), b.QueryClause));
 }
Пример #12
0
 /// <summary>
 /// Builds a new <see cref="WhereClause"/> instance with a <see cref="DateOnly"/> constraint.
 /// </summary>
 /// <param name="column"><see cref="IColumn"/> where to apply the clause onto</param>
 /// <param name="operator"><see cref="ClauseOperator"/> to apply</param>
 /// <param name="constraint">constraint to apply to <paramref name="column"/>.</param>
 /// <exception cref="ArgumentNullException">if <paramref name="column"/> is <c>null</c>.</exception>
 public WhereClause(IColumn column, ClauseOperator @operator, DateOnly?constraint) : this(column, @operator, constraint?.Literal())
 {
 }
Пример #13
0
 ///<inheritdoc/>
 public IWhereQuery <SelectQuery> Where(IColumn column, ClauseOperator @operator, string constraint)
 => Where(column, @operator, constraint?.Literal());
Пример #14
0
 ///<inheritdoc/>
 public IWhereQuery <SelectQuery> Where(IColumn column, ClauseOperator @operator, IColumn constraint)
 => Where(new WhereClause(column, @operator, constraint));