Пример #1
0
 public void OrTest()
 {
     Predicate target = new Predicate(Sql.Integer(1)); // TODO: Initialize to an appropriate value
     Expression expression = null; // TODO: Initialize to an appropriate value
     Predicate expected = null; // TODO: Initialize to an appropriate value
     Predicate actual;
     actual = target.Or(expression);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Пример #2
0
 private void GenerateCodeFromPredicate(Predicate expression, TextWriter writer, CodeGeneratorOptions options)
 {
     if (expression is Exists)
     {
         writer.Write("EXISTS (");
         GenerateCodeFromExpression(expression.Left, writer, options);
         writer.Write(")");
     }
     else if (expression is Between)
     {
         writer.Write("(");
         GenerateCodeFromExpression(expression.Left, writer, options);
         writer.Write(") BETWEEN ");
         GenerateCodeFromExpression(((Between)expression).Begin, writer, options);
         writer.Write(" AND ");
         GenerateCodeFromExpression(((Between)expression).End, writer, options);
     }
     else if (expression is Null)
     {
         GenerateCodeFromExpression(expression.Left, writer, options);
         writer.Write(string.Concat(" IS ", ((Null)expression).Not ? "NOT " : string.Empty, "NULL"));
     }
     else if (expression is SubQueryComparison)
     {
         GenerateCodeFromSubQueryComparison(((SubQueryComparison)expression), writer, options);
     }
     else if (expression is Like)
     {
         GenerateCodeFromExpression(expression.Left, writer, options);
         writer.Write(" LIKE ");
         GenerateCodeFromExpression(((Like)expression).Right, writer, options);
         if (((Like)expression).Escape != null)
         {
             writer.Write(" ESCAPE ");
             GenerateCodeFromExpression(((Like)expression).Escape, writer, options);
         }
     }
     else if (expression is In)
     {
         writer.Write("(");
         GenerateCodeFromExpression(((In)expression).Right, writer, options, (exp, w, o) => w.Write(", "));
         writer.Write(")");
     }
     else if (expression is Comparison)
     {
         GenerateCodeFromExpression(expression.Left, writer, options);
         writer.Write(GetOperatorStringFromComparison((Comparison)expression));
         GenerateCodeFromExpression(((Comparison)expression).Right, writer, options);
     }
     else if (expression is Not)
     {
         writer.Write("NOT ");
         GenerateCodeFromExpression(expression.Left, writer, options);
     }
     else
     {
         GenerateCodeFromExpression(expression.Left, writer, options);
     }
 }
Пример #3
0
 public SearchedCaseExpression(Predicate booleanExpression, Expression resultExpression)
 {
     BooleanExpression = booleanExpression;
     ResultExpression = resultExpression;
 }
Пример #4
0
 public void PredicateConstructorTest()
 {
     Expression left = null; // TODO: Initialize to an appropriate value
     Predicate target = new Predicate(left);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Пример #5
0
 public If(Predicate predicate, List<Statements.Statement> statements, List<Statements.Statement> elseStatements)
     : this(predicate, statements)
 {
     ElseStatements = elseStatements;
 }
Пример #6
0
 public If(Predicate predicate, List<Statements.Statement> statements, Statements.Statement elseStatement)
     : this(predicate, statements)
 {
     ElseStatements = new List<Statements.Statement> { elseStatement };
 }
Пример #7
0
 public If(Predicate predicate, List<Statements.Statement> statements)
 {
     Predicate = predicate;
     Statements = statements;
 }
Пример #8
0
 /*
     IF Boolean_expression
          { sql_statement | statement_block }
     [ ELSE
          { sql_statement | statement_block } ]
  */
 public If(Predicate predicate, Statements.Statement statement)
 {
     Predicate = predicate;
     Statements = new List<Statements.Statement> { statement };
 }
Пример #9
0
 public Not(Predicate predicate)
 {
     Left = predicate;
 }