Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javatools.db
Class DbOrExpr  view DbOrExpr download DbOrExpr.java

java.lang.Object
  extended byjavatools.db.DbExpr
      extended byjavatools.db.DbCriterion
          extended byjavatools.db.DbOrExpr
All Implemented Interfaces:
DbTableUser

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.

Version:
0.7

Field Summary
 
Fields inherited from class javatools.db.DbCriterion
c1, c2, op
 
Fields inherited from class javatools.db.DbExpr
db
 
Constructor Summary
DbOrExpr(DbDatabase db, java.lang.Object o1, java.lang.Object o2)
          Creates a new OR expression.
 
Method Summary
 java.lang.String getQueryString()
          Returns the query string related to this expression.
 int setSqlValues(java.sql.PreparedStatement ps, int i)
          Puts data into a statement.
 
Methods inherited from class javatools.db.DbCriterion
usesTables
 
Methods inherited from class javatools.db.DbExpr
and, containsAllStrings, containsAllStrings, count, dateTrunc, equal, getString, greaterThan, greaterThanOrEqual, in, in, isNotNull, isNull, lessThan, lessThanOrEqual, like, lower, max, min, notEqual, notIn, 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

DbOrExpr

public DbOrExpr(DbDatabase db,
                java.lang.Object o1,
                java.lang.Object o2)
Creates a new OR expression.

Method Detail

setSqlValues

public int setSqlValues(java.sql.PreparedStatement ps,
                        int i)
                 throws java.sql.SQLException,
                        DbException
Puts data into a statement.

Overrides:
setSqlValues in class DbCriterion

getQueryString

public java.lang.String getQueryString()
                                throws DbException
Returns the query string related to this expression.

Overrides:
getQueryString in class DbCriterion