com.triactive.jdo.store.sql.expr
Class SimulatedBooleanColumnExpression

java.lang.Object
  extended bycom.triactive.jdo.store.sql.expr.AbstractSqlExpression
      extended bycom.triactive.jdo.store.sql.expr.BooleanExpression
          extended bycom.triactive.jdo.store.sql.expr.ComparisonExpression
              extended bycom.triactive.jdo.store.sql.expr.SimulatedBooleanColumnExpression
All Implemented Interfaces:
SqlExpression, StatementTextGenerator
Direct Known Subclasses:
BooleanBitColumnExpression, BooleanCharColumnExpression

public abstract class SimulatedBooleanColumnExpression
extends com.triactive.jdo.store.sql.expr.ComparisonExpression

A boolean SQL expression referencing a database column that is treated as a boolean but whose real SQL type is not boolean.

The column is restricted to one of two values used to represent true and false. When referencing the column we construct a larger expression that compares the column with one of those two values. The database effectively treats the comparison as boolean, at least in certain contexts such as a WHERE clause.

Author:
Mike Martin

Nested Class Summary
 
Nested classes inherited from class com.triactive.jdo.store.sql.expr.AbstractSqlExpression
AbstractSqlExpression.Body, AbstractSqlExpression.CompoundExpression, AbstractSqlExpression.SimpleColumnReference, AbstractSqlExpression.SubqueryExpression
 
Field Summary
protected  SqlExpression qscExpr
           
protected  boolean truthTest
           
 
Fields inherited from class com.triactive.jdo.store.sql.expr.AbstractSqlExpression
body, qs
 
Constructor Summary
protected SimulatedBooleanColumnExpression(SqlExpression qscExpr, boolean truthTest, SqlExpression falseValue)
           
 
Method Summary
 BooleanExpression eq(SqlExpression expr)
          Returns a new expression representing "this == expr".
 boolean getTruthTest()
          Represents the sense of the boolean expression.
 SqlExpression getUnderlyingColumn()
          Returns an SQL expression representing an unadorned reference to the underlying non-boolean column.
 BooleanExpression not()
          
 BooleanExpression noteq(SqlExpression expr)
          Returns a new expression representing "this != expr".
 int select()
          Adds this expression to the list of those SELECTed in its surrounding query statement.
 
Methods inherited from class com.triactive.jdo.store.sql.expr.BooleanExpression
and, eor, ior, protectOuterJoins, unprotectedOuterJoins, unprotectedOuterJoins
 
Methods inherited from class com.triactive.jdo.store.sql.expr.AbstractSqlExpression
accessField, add, callMethod, cast, com, div, getColumnMapping, getJavaType, getMapping, getQueryStatement, getReferencedColumns, gt, gteq, innermostQuery, innermostQuery, lt, lteq, mod, mul, neg, newBody, newBody, newBody, newBody, newBody, newBody, newResultExpression, newSubqueryBody, setMapping, sub, toStatementText, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

qscExpr

protected final SqlExpression qscExpr

truthTest

protected final boolean truthTest
Constructor Detail

SimulatedBooleanColumnExpression

protected SimulatedBooleanColumnExpression(SqlExpression qscExpr,
                                           boolean truthTest,
                                           SqlExpression falseValue)
Method Detail

getUnderlyingColumn

public SqlExpression getUnderlyingColumn()
Returns an SQL expression representing an unadorned reference to the underlying non-boolean column.


getTruthTest

public final boolean getTruthTest()
Represents the sense of the boolean expression.

Returns:
true if testing the column for boolean true, false if testing it for false (e.g. if the expression has been negated).

select

public int select()
Description copied from interface: SqlExpression
Adds this expression to the list of those SELECTed in its surrounding query statement.

Specified by:
select in interface SqlExpression
Overrides:
select in class AbstractSqlExpression

eq

public BooleanExpression eq(SqlExpression expr)
Description copied from interface: SqlExpression
Returns a new expression representing "this == expr".

Specified by:
eq in interface SqlExpression
Overrides:
eq in class BooleanExpression

noteq

public BooleanExpression noteq(SqlExpression expr)
Description copied from interface: SqlExpression
Returns a new expression representing "this != expr".

Specified by:
noteq in interface SqlExpression
Overrides:
noteq in class BooleanExpression

not

public BooleanExpression not()

Specified by:
not in interface SqlExpression
Overrides:
not in class BooleanExpression


Copyright 2001-2007 The TJDO Project All Rights Reserved.