javatools.db
Class DbAndExpr
java.lang.Object
|
+--javatools.db.DbExpr
|
+--javatools.db.DbCriterion
|
+--javatools.db.DbAndExpr
- All Implemented Interfaces:
- DbTableUser
- 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
Constructor Summary |
DbAndExpr(DbDatabase db,
java.lang.Object o1,
java.lang.Object o2)
Builds a new "and" expression in the form "o1 AND o2". |
Method Summary |
java.lang.String |
getQueryString()
Returns the query string related to this expression. |
int |
setSqlValues(java.sql.PreparedStatement ps,
int i)
Obscure... |
Methods inherited from class javatools.db.DbExpr |
and, containsAllStrings, containsAllStrings, count, dateTrunc, equal, greaterThan, greaterThanOrEqual, in, in, isNotNull, isNull, lessThan, lessThanOrEqual, like, lower, max, min, notEqual, notIn, notIn, or, upper, usesTables |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DbAndExpr
public DbAndExpr(DbDatabase db,
java.lang.Object o1,
java.lang.Object o2)
- Builds a new "and" expression in the form "o1 AND o2".
- Parameters:
db
- The database used to build this expression.o1
- The first term.o2
- The second term.
getQueryString
public java.lang.String getQueryString()
throws DbException
- Returns the query string related to this expression.
- Overrides:
getQueryString
in class DbCriterion
- Returns:
- The needed string.
- Throws:
DbException
- If something goes wrong.
setSqlValues
public int setSqlValues(java.sql.PreparedStatement ps,
int i)
throws java.sql.SQLException,
DbException
- Obscure... Talk to Chris.
- Overrides:
setSqlValues
in class DbCriterion
- Parameters:
ps
- The prepared statement.i
- The index.
- Returns:
- The return value
- Throws:
java.sql.SQLException
- If something goes wrong.
DbException
- If something goes wrong.