javatools.db
Class DbFalseExpr
java.lang.Object
|
+--javatools.db.DbExpr
|
+--javatools.db.DbCriterion
|
+--javatools.db.DbFalseExpr
- public class DbFalseExpr
- extends DbCriterion
An expression that always evaluates to false. If not optimised away by
DbTrueExpr, it will probably result in "0 = 1" in the SQL.
The use of false expressions makes it very convenient for dynamically
generated queries...
DbExpr e = db.falseExpr();
if (name != null) {
e = e.or(table.getColumn("NAME")).equals(name));
}
if (age != null) {
e = e.or(table.getColumn("AGE")).equals(age));
}
This gets converted to...
(0 = 1) OR ( NAME = ? ) OR ( AGE = ? )
and then DbOrExpr optimises this to...
( NAME = ? ) OR ( AGE = ? )
- See Also:
DbOrExpr
Fields inherited from class javatools.db.DbExpr |
db |
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 |
DbFalseExpr
public DbFalseExpr(DbDatabase db)