javatools.db
Class DbOrExpr
java.lang.Object
|
+--javatools.db.DbExpr
|
+--javatools.db.DbCriterion
|
+--javatools.db.DbOrExpr
- public class DbOrExpr
- extends DbCriterion
An expression of the form A OR B. The reason we have this class as well as
DbCriterion, is that this class will optimise away unnecessary segments.
i.e. A OR FALSE will be optimised to just A. The reason you may find a FALSE
expression in your code is the use of DbDatabase.falseExpr(). This is a very
convenient thing for dynamically generated queries.
Of course we could just leave the dummy false 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:
DbFalseExpr.
Fields inherited from class javatools.db.DbExpr |
db |
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.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 |
DbOrExpr
public DbOrExpr(DbDatabase db,
java.lang.Object o1,
java.lang.Object o2)
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 valuei
- The new sqlValues value
- Returns:
- Description of the Returned Value
- Throws:
DbException
- Description of Exception
java.sql.SQLException
- Description of Exception
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