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

Quick Search    Search Deep

javatools.db
Class DbExpr  view DbExpr download DbExpr.java

java.lang.Object
  extended byjavatools.db.DbExpr
All Implemented Interfaces:
DbTableUser
Direct Known Subclasses:
DbColumn, DbCriterion, DbExprFuncDef, DbLiteral, DbMiscExpr, DbParenthesis, DbSelector, DbValueList

public abstract class DbExpr
extends java.lang.Object
implements DbTableUser

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

Version:
0.7

Field Summary
(package private)  DbDatabase db
          The database to be used to represent this expression.
 
Constructor Summary
DbExpr(DbDatabase db)
          Constructor for the DbExpr object
 
Method Summary
 DbExpr and(DbExpr e)
          Returns an expression created as an "and" between the current expression and another expression.
 DbExpr containsAllStrings(java.util.List values)
          Creates an expression to be used to search in char columns containing one of the specified strings.
 DbExpr containsAllStrings(java.lang.String[] values)
          Creates an expression to be used to search in char columns containing one of the specified strings.
 DbExpr count()
          Returns the count expression for the current expression.
 DbExpr dateTrunc()
          Truncs the date? Obscure.
 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.util.Collection valueList)
          Returns an expression that means "IN (value1, value2, ..., valuen)"
 DbCriterion in(java.lang.Object o)
          Returns an expression to represent the "in" clause.
 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()
          Returns an expression in which it will take the lowercase value for current expression.
 DbExpr max()
          Returns an expression in which it will take the max value for current expression.
 DbExpr min()
          Returns an expression in which it will take the max value for current expression.
 DbCriterion notEqual(java.lang.Object o)
          Return an expression representing this column being equal to another value.
 DbCriterion notIn(java.util.Collection valueList)
          Returns an expression that means "NOT IN (value1, value2, ..., valuen)"
 DbCriterion notIn(java.lang.Object o)
          Returns an expression to represent the "not in" clause.
 DbExpr or(DbExpr e)
          Returns an expression created as an "or" between the current expression and another expression.
(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()
          Returns an expression in which it will take the uppercase value for current expression.
 void usesTables(java.util.Set c)
          Adds to the passed set all the tables used by this expression.
static void usesTables(java.util.Set c, java.lang.Object o)
          Adds to the passed set all the tables used by an expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db

DbDatabase db
The database to be used to represent this expression.

Constructor Detail

DbExpr

public DbExpr(DbDatabase db)
Constructor for the DbExpr object

Method Detail

usesTables

public static void usesTables(java.util.Set c,
                              java.lang.Object o)
Adds to the passed set all the tables used by an expression.


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.


getString

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


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.


getQueryString

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


isNull

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


isNotNull

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


usesTables

public void usesTables(java.util.Set c)
Adds to the passed set all the tables used by this expression.

Specified by:
usesTables in interface DbTableUser

and

public DbExpr and(DbExpr e)
Returns an expression created as an "and" between the current expression and another expression.


or

public DbExpr or(DbExpr e)
Returns an expression created as an "or" between the current expression and another expression.


max

public DbExpr max()
Returns an expression in which it will take the max value for current expression.


min

public DbExpr min()
Returns an expression in which it will take the max value for current expression.


upper

public DbExpr upper()
Returns an expression in which it will take the uppercase value for current expression.


lower

public DbExpr lower()
Returns an expression in which it will take the lowercase value for current expression.


count

public DbExpr count()
Returns the count expression for the current expression. It is effective only with a DbLiteral expression, containing "*".


dateTrunc

public DbExpr dateTrunc()
                 throws DbException
Truncs the date? Obscure.


equal

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


notEqual

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


like

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


containsAllStrings

public DbExpr containsAllStrings(java.lang.String[] values)
Creates an expression to be used to search in char columns containing one of the specified strings.


containsAllStrings

public DbExpr containsAllStrings(java.util.List values)
Creates an expression to be used to search in char columns containing one of the specified strings.


greaterThan

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


greaterThanOrEqual

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


lessThan

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


lessThanOrEqual

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


in

public DbCriterion in(java.lang.Object o)
Returns an expression to represent the "in" clause.


in

public DbCriterion in(java.util.Collection valueList)
Returns an expression that means "IN (value1, value2, ..., valuen)"


notIn

public DbCriterion notIn(java.lang.Object o)
Returns an expression to represent the "not in" clause.


notIn

public DbCriterion notIn(java.util.Collection valueList)
Returns an expression that means "NOT IN (value1, value2, ..., valuen)"