javatools.db
Class DbExpr

java.lang.Object
  |
  +--javatools.db.DbExpr
Direct Known Subclasses:
DbColumn, DbCriterion, DbExprFuncDef, DbLiteral, DbMiscExpr, DbParenthesis, DbSelector

public abstract class DbExpr
extends java.lang.Object

An sql expression class. This is the abstract base class for any type of SQL expression.


Field Summary
(package private)  DbDatabase db
           
 
Constructor Summary
DbExpr(DbDatabase db)
          Constructor for the DbExpr object
 
Method Summary
 DbExpr and(DbExpr e)
          Description of the Method
 DbExpr dateTrunc()
          Description of the Method
 DbCriterion equal(java.lang.Object o)
          Return an expression representing this column being equal to another value.
abstract  java.lang.String getQueryString()
          Any DbExpr needs to be able to convert into the SQL string equivilent.
(package private) static java.lang.String getString(java.lang.Object o)
          Utility function to turn o into an SQL expression.
 DbCriterion greaterThan(java.lang.Object o)
          Return an expression representing this column being greater than another value.
 DbCriterion greaterThanOrEqual(java.lang.Object o)
          Return an expression representing this column being greater than or equal to another value.
 DbCriterion in(java.lang.Object o)
          Description of the Method
 DbCriterion isNotNull()
          Gets the notNull attribute of the DbExpr object
 DbCriterion isNull()
          Gets the null attribute of the DbExpr object
 DbCriterion lessThan(java.lang.Object o)
          Return an expression representing this column being less than another value.
 DbCriterion lessThanOrEqual(java.lang.Object o)
          Return an expression representing this column being less than or equal to another value.
 DbCriterion like(java.lang.Object o)
          Return an expression representing this column being LIKE another value.
 DbExpr lower()
          Description of the Method
 DbExpr max()
          Description of the Method
 DbExpr min()
          Description of the Method
 DbCriterion notEqual(java.lang.Object o)
          Description of the Method
 DbCriterion notIn(java.lang.Object o)
          Description of the Method
 DbExpr or(DbExpr e)
          Description of the Method
(package private) static int setSqlValue(java.sql.PreparedStatement stmt, int i, java.lang.Object col, DbColumn intocol)
          Substitute the literal value in the Prepared Statement.
abstract  int setSqlValues(java.sql.PreparedStatement ps, int i)
          Any DbExpr needs to be able to substitute any parameters as per JDBC "?" substitutions.
 DbExpr upper()
          Description of the Method
 void usesTables(java.util.Set c)
          Description of the Method
static void usesTables(java.util.Set c, java.lang.Object o)
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db

DbDatabase db
Constructor Detail

DbExpr

public DbExpr(DbDatabase db)
Constructor for the DbExpr object

Parameters:
db - Description of Parameter
Method Detail

usesTables

public static void usesTables(java.util.Set c,
                              java.lang.Object o)
Description of the Method

Parameters:
c - Description of Parameter
o - Description of Parameter

setSqlValue

static int setSqlValue(java.sql.PreparedStatement stmt,
                       int i,
                       java.lang.Object col,
                       DbColumn intocol)
                throws DbException,
                       java.sql.SQLException
Substitute the literal value in the Prepared Statement. This is a utility method used by several other classes.

Parameters:
stmt - the PreparedStatement
i - the parameter number we are up to
intocol - optional list of columns the result will be selected into
col - The new sqlValue value
Returns:
Description of the Returned Value
Throws:
java.sql.SQLException - Description of Exception
DbException - Description of Exception

getString

static java.lang.String getString(java.lang.Object o)
                           throws DbException
Utility function to turn o into an SQL expression.

Parameters:
o - Description of Parameter
Returns:
The string value
Throws:
DbException - Description of Exception

setSqlValues

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

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

getQueryString

public abstract java.lang.String getQueryString()
                                         throws DbException
Any DbExpr needs to be able to convert into the SQL string equivilent.

Returns:
The queryString value
Throws:
DbException - Description of Exception

isNull

public DbCriterion isNull()
Gets the null attribute of the DbExpr object

Returns:
The null value

isNotNull

public DbCriterion isNotNull()
Gets the notNull attribute of the DbExpr object

Returns:
The notNull value

usesTables

public void usesTables(java.util.Set c)
Description of the Method

Parameters:
c - Description of Parameter

and

public DbExpr and(DbExpr e)
Description of the Method

Parameters:
e - Description of Parameter
Returns:
Description of the Returned Value

or

public DbExpr or(DbExpr e)
Description of the Method

Parameters:
e - Description of Parameter
Returns:
Description of the Returned Value

max

public DbExpr max()
Description of the Method

Returns:
Description of the Returned Value

min

public DbExpr min()
Description of the Method

Returns:
Description of the Returned Value

upper

public DbExpr upper()
Description of the Method

Returns:
Description of the Returned Value

lower

public DbExpr lower()
Description of the Method

Returns:
Description of the Returned Value

dateTrunc

public DbExpr dateTrunc()
                 throws DbException
Description of the Method

Returns:
Description of the Returned Value
Throws:
DbException - Description of Exception

equal

public DbCriterion equal(java.lang.Object o)
Return an expression representing this column being equal to another value.

Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value

notEqual

public DbCriterion notEqual(java.lang.Object o)
Description of the Method

Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value

like

public DbCriterion like(java.lang.Object o)
Return an expression representing this column being LIKE another value.

Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value

greaterThan

public DbCriterion greaterThan(java.lang.Object o)
Return an expression representing this column being greater than another value.

Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value

greaterThanOrEqual

public DbCriterion greaterThanOrEqual(java.lang.Object o)
Return an expression representing this column being greater than or equal to another value.

Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value

lessThan

public DbCriterion lessThan(java.lang.Object o)
Return an expression representing this column being less than another value.

Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value

lessThanOrEqual

public DbCriterion lessThanOrEqual(java.lang.Object o)
Return an expression representing this column being less than or equal to another value.

Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value

in

public DbCriterion in(java.lang.Object o)
Description of the Method

Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value

notIn

public DbCriterion notIn(java.lang.Object o)
Description of the Method

Parameters:
o - Description of Parameter
Returns:
Description of the Returned Value