/// <summary> /// Constructor to create a new expression. If this is part of a linked /// list of expressions that make up a complete expression, then the /// expressions to the left and/or right can also be specified. /// </summary> /// <param name="leftExpression">The left expression if available</param> /// <param name="expressionSqlOperator">The sql operator between expressions</param> /// <param name="rightExpression">The right expression if available</param> public Expression(IExpression leftExpression, SqlOperator expressionSqlOperator, IExpression rightExpression) { //TODO: Error check valid inputs _leftExpression = leftExpression; _sqlOperator = expressionSqlOperator; _rightExpression = rightExpression; }
/// <summary> /// Private constructor to create a new expression using the /// expression string provided /// </summary> /// <param name="expressionString">The expression string</param> private Expression(string expressionString) { //TODO: Error check valid inputs CriteriaExpression c = new CriteriaExpression(expressionString, _operators); //Create left expression if (c.IsLeaf()) { } if (c.Left.IsLeaf()) { _leftExpression = new Parameter(c.Left.CompleteExpression); } else { _leftExpression = new Expression(c.Left.CompleteExpression); } //Create operator _sqlOperator = new SqlOperator(c.Expression); //Create right expression if (c.Right.IsLeaf()) { _rightExpression = new Parameter(c.Right.CompleteExpression); } else { _rightExpression = new Expression(c.Right.CompleteExpression); } }
public void TestSqlExpressionString() { SqlStatement statement = new SqlStatement(DatabaseConnection.CurrentConnection); SqlOperator op = new SqlOperator("OR"); op.SqlExpressionString(statement, "", ""); op.SetParameterSqlInfo(null); //for test coverage :) }
public void TestSqlExpressionString() { SqlStatement statement = CreateSqlStatement(); SqlOperator op = new SqlOperator("OR"); op.SqlExpressionString(statement, "", ""); op.SetParameterSqlInfo(null); //for test coverage :) }
/// <summary> /// Appends a given expression string to the end of a given expression, /// separated by the given sql operator. /// </summary> /// <param name="leftExpression">The expression object to append to</param> /// <param name="expressionSqlOperator">The sql operator</param> /// <param name="expressionClause">The new expression clause</param> /// <returns>Returns the full expression object with the newly /// attached expression</returns> public static IExpression AppendExpression(IExpression leftExpression, SqlOperator expressionSqlOperator, string expressionClause) { IExpression expr = CreateExpression(expressionClause); return new Expression(leftExpression, expressionSqlOperator, expr); }