Class ComparisonOperatorStatement
java.lang.Object
com.invirgance.convirgance.jdbc.sql.ComparisonOperatorStatement
- All Implemented Interfaces:
ComparisonStatement,SQLStatement
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 Summary
ConstructorsConstructorDescriptionCreates an empty comparison statement with just the database layout.ComparisonOperatorStatement(DatabaseSchemaLayout layout, ExpressionStatement left, ComparisonOperator operator, ExpressionStatement right) Creates a complete comparison statement ready for use in WHERE clauses. -
Method Summary
Modifier and TypeMethodDescriptiongetLeft()Returns the left expression.Returns the operator that will be used in for the comparison.If this statement is part of a larger statement, this returns the parent statement.getRight()Returns the right expression.render(SQLRenderer renderer) voidsetLeft(ExpressionStatement left) Sets the left expression to use in the comparison.voidsetOperator(ComparisonOperator operator) Sets the comparison operator that will be used in the query when comparing the expressions.voidsetParent(SQLStatement parent) voidsetRight(ExpressionStatement right) Sets the right expression that will be used in the comparison.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.invirgance.convirgance.jdbc.sql.SQLStatement
query, query
-
Constructor Details
-
ComparisonOperatorStatement
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 typeComparisonOperatorright- The right side of the comparison (value, variable, or another column)
-
-
Method Details
-
getParent
Description copied from interface:SQLStatementIf this statement is part of a larger statement, this returns the parent statement.- Specified by:
getParentin interfaceSQLStatement- Returns:
- the parent statement
-
setParent
- Specified by:
setParentin interfaceSQLStatement
-
getLeft
Returns the left expression.- Returns:
- ExpressionStatement.
-
setLeft
Sets the left expression to use in the comparison.- Parameters:
left- ExpressionStatement.
-
getRight
Returns the right expression.- Returns:
- ExpressionStatement.
-
setRight
Sets the right expression that will be used in the comparison.- Parameters:
right- ExpressionStatement.
-
getOperator
Returns the operator that will be used in for the comparison.- Returns:
- ComparisonOperator.
-
setOperator
Sets the comparison operator that will be used in the query when comparing the expressions.- Parameters:
operator- ComparisonOperator.
-
render
- Specified by:
renderin interfaceSQLStatement
-