public class FromClause extends Object
Represents a generic SQL from clause.
The from clause can either be:
from [table_name] [alias] [joins to other tables or sub-queries]*Or
from ( [sub-query SQL select statement] ) [alias] [joins to other tables or sub-queries]*
The isSubQueryClause()
method indicates whether one should get
information from either getTableName()
or from
getSubQuerySQL()
Constructor and Description |
---|
FromClause(boolean pSubQueryClause)
Creates a from clause (either based on a table or based on a sub query)
|
Modifier and Type | Method and Description |
---|---|
void |
addJoinClause(JoinClause pJoinClause)
adds a join clause to the base driving table
|
List<JoinClause> |
getJoinClauses() |
String |
getSubQuerySQL() |
String |
getTableAlias() |
String |
getTableName() |
boolean |
isSubQueryClause() |
static FromClause |
query(String sqlQuery,
String alias) |
void |
setSubQuerySQL(String pSubQuerySQL)
Sets the sub query Select statement clause.
|
void |
setTableAlias(String pTableAlias)
Sets the table alias
|
void |
setTableName(String pTableName)
Set the table name of this from clause
|
static FromClause |
table(String tableName,
String tableAlias) |
String |
toSql() |
String |
toString() |
public FromClause(boolean pSubQueryClause)
pSubQueryClause
- if set to true, indicates that this from clause is based on a
sub-querypublic String getTableName()
public String getTableAlias()
public List<JoinClause> getJoinClauses()
public void addJoinClause(JoinClause pJoinClause)
pJoinClause
- public boolean isSubQueryClause()
public String getSubQuerySQL()
isSubQueryClause()
to figure out)public void setSubQuerySQL(String pSubQuerySQL)
pSubQuerySQL
- select statement to setRuntimeException
- a runtime exception if the from clause was not built with
isSubQueryClause()
set to truepublic void setTableName(String pTableName)
pTableName
- table name to setRuntimeException
- a runtime exception if the from clause was not built with
isSubQueryClause()
set to falsepublic void setTableAlias(String pTableAlias)
pTableAlias
- table alias to use for the sub-query or table in this from
clausepublic static FromClause table(String tableName, String tableAlias)
public static FromClause query(String sqlQuery, String alias)
public String toSql()
Copyright © 2016. All Rights Reserved.