Ejemplo n.º 1
0
 /// <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;
 }
Ejemplo n.º 2
0
        /// <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);
            }
        }
Ejemplo n.º 3
0
 public void TestSqlExpressionString()
 {
     SqlStatement statement = new SqlStatement(DatabaseConnection.CurrentConnection);
     SqlOperator op = new SqlOperator("OR");
     op.SqlExpressionString(statement, "", "");
     op.SetParameterSqlInfo(null);  //for test coverage :)
 }
Ejemplo n.º 4
0
 public void TestSqlExpressionString()
 {
     SqlStatement statement = CreateSqlStatement();
     SqlOperator op = new SqlOperator("OR");
     op.SqlExpressionString(statement, "", "");
     op.SetParameterSqlInfo(null);  //for test coverage :)
 }
Ejemplo n.º 5
0
 /// <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);
 }