com.wm.app.tn.db
Class TableExpression

java.lang.Object
  extended by com.wm.app.tn.util.TNFixedData
      extended by com.wm.app.tn.db.TableExpression
All Implemented Interfaces:
com.wm.data.IData, java.io.Serializable, java.lang.Cloneable

public class TableExpression
extends com.wm.app.tn.util.TNFixedData

This represents the table expression in a SELECT statement. It's represented in this way so that ISQLHelper implementations can generate join statements in a database-specific way. This isn't too big a deal for single-table selects and simple joins, but the SQL for (e.g.) a left outer join can be ugly and DB-dependent.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.wm.app.tn.util.TNFixedData
com.wm.app.tn.util.TNFixedData.TreeCursor
 
Field Summary
static java.lang.String J_FULL_OUTER
           
static java.lang.String J_INNER
           
static java.lang.String J_LEFT_OUTER
           
static java.lang.String J_RIGHT_OUTER
           
 
Constructor Summary
TableExpression()
          Create a new TableExpression.
 
Method Summary
 void addJoin(java.lang.String[] join)
          Add a table join.
 void addJoin(java.lang.String type, java.lang.String table, java.lang.String alias, java.lang.String on)
          Add a table join.
 java.lang.String[] getBaseTable()
          Get stored information about the base table.
 java.util.Enumeration getJoins()
          Get the list of joined-in tables.
 void setBaseTable(java.lang.String table, java.lang.String alias)
          Set the base table for this select.
 
Methods inherited from class com.wm.app.tn.util.TNFixedData
clone, dataSize, get, get, getCursor, getHashCursor, getIndexCursor, getKey, getSharedCursor, getTreeCursor, indexOf, merge, set, set, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

J_INNER

public static final java.lang.String J_INNER
See Also:
Constant Field Values

J_LEFT_OUTER

public static final java.lang.String J_LEFT_OUTER
See Also:
Constant Field Values

J_RIGHT_OUTER

public static final java.lang.String J_RIGHT_OUTER
See Also:
Constant Field Values

J_FULL_OUTER

public static final java.lang.String J_FULL_OUTER
See Also:
Constant Field Values
Constructor Detail

TableExpression

public TableExpression()
Create a new TableExpression.

Method Detail

setBaseTable

public void setBaseTable(java.lang.String table,
                         java.lang.String alias)
Set the base table for this select. This can be aliased, as in the following simple SQL: SELECT d.DocID FROM BizDoc d

Parameters:
table - the name of the table (e.g. "BizDoc")
alias - the alias to use (e.g. "d")

getBaseTable

public java.lang.String[] getBaseTable()
Get stored information about the base table.

Returns:
{ table, alias }

addJoin

public void addJoin(java.lang.String type,
                    java.lang.String table,
                    java.lang.String alias,
                    java.lang.String on)
Add a table join.

Parameters:
type - the type of join (e.g. J_INNER)
table - the name of the table to join in (e.g. "BizDocAttribute")
alias - the alias of the table in the stmt (e.g. "bda0")
on - a SQL expression describing the criteria on which to join

addJoin

public void addJoin(java.lang.String[] join)
Add a table join.

Parameters:
join - the join as { type, table, alias, on }

getJoins

public java.util.Enumeration getJoins()
Get the list of joined-in tables.

Returns:
an enumeration of String[] representing the joins (null if there are none)