Class ComparisonOperatorStatement

java.lang.Object
com.invirgance.convirgance.jdbc.sql.ComparisonOperatorStatement
All Implemented Interfaces:
ComparisonStatement, SQLStatement

public class ComparisonOperatorStatement extends Object implements ComparisonStatement
Represents a binary comparison operation in SQL with a left expression, comparison operator, and right expression. Forms the foundation of conditional logic in WHERE clauses and other filter expressions.

 DatabaseSchemaLayout layout = new DatabaseSchemaLayout(driver, getHSQLDataSource());
 
 Table table = layout.getCurrentSchema().getTable("customer");
 
 ExpressionStatement left = new ColumnExpressionStatement(layout, table.getColumn("height"));
 ExpressionStatement right = new ColumnExpressionStatement(layout, table.getColumn("width"));
 
 ComparisonOperatorStatement statement = 
 new ComparisonOperatorStatement(layout, left, GREATER_THAN, right);
 
Author:
jbanes
  • Constructor Details

    • ComparisonOperatorStatement

      public ComparisonOperatorStatement(DatabaseSchemaLayout layout)
      Creates an empty comparison statement with just the database layout.
      Parameters:
      layout - The database layout.
    • ComparisonOperatorStatement

      public ComparisonOperatorStatement(DatabaseSchemaLayout layout, ExpressionStatement left, ComparisonOperator operator, ExpressionStatement right)
      Creates a complete comparison statement ready for use in WHERE clauses. This builds expressions like "column = value" or "price > :minPrice".
      Parameters:
      layout - The database layout.
      left - The left side of the comparison.
      operator - The comparison type ComparisonOperator
      right - The right side of the comparison (value, variable, or another column)
  • Method Details

    • getParent

      public SQLStatement getParent()
      Description copied from interface: SQLStatement
      If this statement is part of a larger statement, this returns the parent statement.
      Specified by:
      getParent in interface SQLStatement
      Returns:
      the parent statement
    • setParent

      public void setParent(SQLStatement parent)
      Specified by:
      setParent in interface SQLStatement
    • getLeft

      public ExpressionStatement getLeft()
      Returns the left expression.
      Returns:
      ExpressionStatement.
    • setLeft

      public void setLeft(ExpressionStatement left)
      Sets the left expression to use in the comparison.
      Parameters:
      left - ExpressionStatement.
    • getRight

      public ExpressionStatement getRight()
      Returns the right expression.
      Returns:
      ExpressionStatement.
    • setRight

      public void setRight(ExpressionStatement right)
      Sets the right expression that will be used in the comparison.
      Parameters:
      right - ExpressionStatement.
    • getOperator

      public ComparisonOperator getOperator()
      Returns the operator that will be used in for the comparison.
      Returns:
      ComparisonOperator.
    • setOperator

      public void setOperator(ComparisonOperator operator)
      Sets the comparison operator that will be used in the query when comparing the expressions.
      Parameters:
      operator - ComparisonOperator.
    • render

      public SQLRenderer render(SQLRenderer renderer)
      Specified by:
      render in interface SQLStatement