javatools.db
Class DbAndExpr

java.lang.Object
  |
  +--javatools.db.DbExpr
        |
        +--javatools.db.DbCriterion
              |
              +--javatools.db.DbAndExpr

public class DbAndExpr
extends DbCriterion

An expression of the form A AND B. The reason we have this class as well as DbCriterion, is that this class will optimise away unnecessary segments. i.e. A AND TRUE will be optimised to just A. The reason you may find a TRUE expression in your code is the use of DbDatabase.trueExpr(). Of course we could just leave the dummy true expressions in the final SQL and presumably the dbms can optimise it away fine, but it looks a bit ugly and nasty to have these dummy expressions in the result.

See Also:
DbTrueExpr

Field Summary
 
Fields inherited from class javatools.db.DbCriterion
c1, c2, op
 
Fields inherited from class javatools.db.DbExpr
db
 
Constructor Summary
DbAndExpr(DbDatabase db, java.lang.Object o1, java.lang.Object o2)
           
 
Method Summary
 java.lang.String getQueryString()
          Any DbExpr needs to be able to convert into the SQL string equivilent.
 int setSqlValues(java.sql.PreparedStatement ps, int i)
          Any DbExpr needs to be able to substitute any parameters as per JDBC "?" substitutions.
 
Methods inherited from class javatools.db.DbCriterion
usesTables
 
Methods inherited from class javatools.db.DbExpr
and, dateTrunc, equal, getString, greaterThan, greaterThanOrEqual, in, isNotNull, isNull, lessThan, lessThanOrEqual, like, lower, max, min, notEqual, notIn, or, setSqlValue, upper, usesTables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbAndExpr

public DbAndExpr(DbDatabase db,
                 java.lang.Object o1,
                 java.lang.Object o2)
Method Detail

getQueryString

public java.lang.String getQueryString()
                                throws DbException
Description copied from class: DbExpr
Any DbExpr needs to be able to convert into the SQL string equivilent.

Overrides:
getQueryString in class DbCriterion
Returns:
The queryString value
Throws:
DbException - Description of Exception

setSqlValues

public int setSqlValues(java.sql.PreparedStatement ps,
                        int i)
                 throws java.sql.SQLException,
                        DbException
Description copied from class: DbExpr
Any DbExpr needs to be able to substitute any parameters as per JDBC "?" substitutions.

Overrides:
setSqlValues in class DbCriterion
Parameters:
ps - The new sqlValues value
i - The new sqlValues value
Returns:
Description of the Returned Value
Throws:
DbException - Description of Exception
java.sql.SQLException - Description of Exception