internal Expression(Operator op, ScalarArgument arg1, ValueScalarArgument[] arguments) : this(null, true) { arg1 = arg1 ?? Designer.Null; CheckNullOrEmpty(Argc(() => arguments, arguments)); Arguments = new[] { arg1 }; TryStoreDbColumn(arg1); TryTake(arg1); Build = (buildContext, buildArgs) => { if (buildContext.TryTakeException(chainException)) { return(null); } if (!CheckConcatenator(buildContext, arg1)) { return(null); } arg1.RootSubject = ((ISemantic)this).RootSubject; Array.ForEach(arguments, a => a.RootSubject = ((ISemantic)this).RootSubject); var sql = BuildBinaryExpression( op, (arg1 as Chainer).Build(buildContext, buildArgs), ValueScalarArgument.Concatenate(arguments, buildContext, buildArgs)); buildContext.TryTakeException(chainException); return(sql); }; }
/// <summary> /// Specifies the additional search condition for the rows returned by the query based on the comparison between the two scalar arguments. /// </summary> /// <param name="prev">A predecessor object.</param> /// <param name="argument1">Is the first argument in the equality expression.</param> /// <param name="argument2">Is the second argument in the equality expression.</param> public static WhereOrChainer Or(this IWhereOr prev, ScalarArgument argument1, ValueScalarArgument argument2) { return(new WhereOrChainer((Chainer)prev, argument1, argument2, true)); }
/// <summary> /// Compares two expressions. When comparing non-null expressions, the result is TRUE if the left operand has a value higher than or equal to the right operand; otherwise, the result is FALSE. /// </summary> /// <param name="leftExpression">Is the left expression.</param> /// <param name="rightExpression">Is the right expression.</param> public static Expression GreaterOrEqualThan(this IScalar leftExpression, ValueScalarArgument rightExpression) { return(new Expression(Operator.GreaterOrEqualThan, new ScalarArgument(leftExpression), rightExpression)); }
/// <summary> /// Compares two expressions. When comparing non-null expressions, the result is TRUE if the left operand has a value lower than the right operand; otherwise, the result is FALSE. /// </summary> /// <param name="leftExpression">Is the left expression.</param> /// <param name="rightExpression">Is the right expression.</param> public static Expression NotGreaterThan(this string leftExpression, ValueScalarArgument rightExpression) { return(new Expression(Operator.NotGreaterThan, leftExpression, rightExpression)); }
/// <summary> /// Determines whether a specific character string does NOT match a specified pattern. /// </summary> /// <param name="matchExpression">Is a string identifier of a column.</param> /// <param name="pattern"> /// Is the specific string of characters to search for in match expression. /// </param> /// <param name="escapeCharacter">Is a character that is put in front of a wildcard character to indicate that the wildcard should be interpreted as a regular character and not as a wildcard.</param> public static Expression NotLike(this string matchExpression, ValueScalarArgument pattern, char escapeCharacter) { return(new Expression(Operator.NotLike, matchExpression, pattern, escapeCharacter.ToString())); }
/// <summary> /// <para>Provides a predicate of a subject. A subject with a predicate returns equal or less rows than a subject without a predicate.</para> /// <para>All predicate methods are logically identical.</para> /// </summary> /// <typeparam name="T">The type of the subject node.</typeparam> /// <param name="node">A subject node.</param> /// <param name="argument1">The first argument in the equality expression.</param> /// <param name="argument2">The second argument in the equality expression.</param> public static T BelongingTo <T>(this T node, ScalarArgument argument1, ValueScalarArgument argument2) where T : ISemantic { return(AddPredicate(node, argument1, argument2, true)); }
/// <summary> /// Determines whether a specific character string does NOT match a specified pattern. /// </summary> /// <param name="matchExpression">Is a string identifier of a column.</param> /// <param name="pattern"> /// Is the specific string of characters to search for in match expression. /// </param> public static Expression NotLike(this string matchExpression, ValueScalarArgument pattern) { return(new Expression(Operator.NotLike, matchExpression, pattern)); }
/// <summary> /// Determines whether a specific character string does NOT match a specified pattern. /// </summary> /// <param name="matchExpression">Is any valid expression of character data type.</param> /// <param name="pattern"> /// Is the specific string of characters to search for in match expression. /// </param> public static Expression NotLike(this IScalar matchExpression, ValueScalarArgument pattern) { return(new Expression(Operator.NotLike, new ScalarArgument(matchExpression), pattern)); }
/// <summary> /// Determines whether a specific character string matches a specified pattern. /// </summary> /// <param name="matchExpression">Is any valid expression of character data type.</param> /// <param name="pattern"> /// Is the specific string of characters to search for in match expression. /// </param> /// <param name="escapeCharacter">Is a character that is put in front of a wildcard character to indicate that the wildcard should be interpreted as a regular character and not as a wildcard.</param> public static Expression Like(this IScalar matchExpression, ValueScalarArgument pattern, char escapeCharacter) { return(new Expression(Operator.Like, new ScalarArgument(matchExpression), pattern, escapeCharacter.ToString())); }
/// <summary> /// Compares the non-equality of two expressions. /// </summary> /// <param name="leftExpression">Is the left expression.</param> /// <param name="rightExpression">Is the right expression.</param> public static Expression NotEqualTo(this string leftExpression, ValueScalarArgument rightExpression) { return(new Expression(Operator.NotEqual, leftExpression, rightExpression)); }
/// <summary> /// Compares the equality of two expressions. /// </summary> /// <param name="leftExpression">Is the left expression.</param> /// <param name="rightExpression">Is the right expression.</param> public static Expression EqualTo(this IScalar leftExpression, ValueScalarArgument rightExpression) { return(new Expression(Operator.Equal, new ScalarArgument(leftExpression), rightExpression)); }
/// <summary> /// Returns TRUE if the value of test expression is NOT greater than or equal to the value of begin expression and less than or equal to the value of end expression. /// </summary> /// <param name="test">Is the expression to test for NOT to be in the range defined by begin expression and end expression.</param> /// <param name="beginExpression">Is a begin expression.</param> /// <param name="endExpression">Is an end expression.</param> public static Expression NotBetween(this IScalar test, ValueScalarArgument beginExpression, ValueScalarArgument endExpression) { return(new Expression(Operator.NotBetween, new ScalarArgument(test), beginExpression, endExpression)); }
/// <summary> /// Returns TRUE if the value of test expression is greater than or equal to the value of begin expression and less than or equal to the value of end expression. /// </summary> /// <param name="test">Is the expression to test for in the range defined by begin expression and end expression.</param> /// <param name="beginExpression">Is a begin expression.</param> /// <param name="endExpression">Is an end expression.</param> public static Expression Between(this string test, ValueScalarArgument beginExpression, ValueScalarArgument endExpression) { return(new Expression(Operator.Between, test, beginExpression, endExpression)); }