Class FromAdapter
- java.lang.Object
-
- com.ibm.fhir.database.utils.query.FromAdapter
-
public class FromAdapter extends Object
Adapter for building the FROM clause of a SELECT statement
-
-
Constructor Summary
Constructors Constructor Description FromAdapter(Select select)Model the "from" part of the select statement
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Selectbuild()Provide the select statement we've been buildingWhereClauseestablishWhereClause()Adds a where clause if one does not yet existFromAdapterfrom(String tableName)Add a table to the from clause returning thisFromAdapterready for the next itemFromAdapterfrom(String tableName, Alias alias)Add a table with an alias (tab AS foo) to the from clause returning thisFromAdapterready for the next itemGroupByAdaptergroupBy(String... expressions)Start a group by expressionFromAdapterinnerJoin(String tableName, Alias alias, WhereFragment joinOnPredicate)Add an INNER JOIN for the given tableFromAdapterleftOuterJoin(String tableName, Alias alias, WhereFragment joinOnPredicate)Add a LEFT OUTER JOIN for the given tableOrderByAdapterorderBy(String... expressions)Start an ORDER BY expressionFromSubQueryAdaptersubStart()Start building a sub-query.WhereAdapterwhere()Starts building a WHERE clause without any predicate nodesWhereAdapterwhere(ExpNode predicate)Builds a WHERE clause starting with the given predicate nodeWhereAdapterwhere(String predicate)Start building the "WHERE" clause for the statementWhereAdapterwhere(String tableAlias, String columnName)Starts building a WHERE clause with the {tableAlias}.{columnName}
-
-
-
Constructor Detail
-
FromAdapter
public FromAdapter(Select select)
Model the "from" part of the select statement- Parameters:
select-
-
-
Method Detail
-
from
public FromAdapter from(String tableName)
Add a table to the from clause returning thisFromAdapterready for the next item- Parameters:
tableName-- Returns:
-
from
public FromAdapter from(String tableName, Alias alias)
Add a table with an alias (tab AS foo) to the from clause returning thisFromAdapterready for the next item- Parameters:
tableName-alias-- Returns:
-
innerJoin
public FromAdapter innerJoin(String tableName, Alias alias, WhereFragment joinOnPredicate)
Add an INNER JOIN for the given table- Parameters:
tableName-alias-joinOnPredicate-- Returns:
-
leftOuterJoin
public FromAdapter leftOuterJoin(String tableName, Alias alias, WhereFragment joinOnPredicate)
Add a LEFT OUTER JOIN for the given table- Parameters:
tableName-alias-joinOnPredicate-- Returns:
-
where
public WhereAdapter where(String predicate)
Start building the "WHERE" clause for the statement- Parameters:
predicate-- Returns:
-
where
public WhereAdapter where(String tableAlias, String columnName)
Starts building a WHERE clause with the {tableAlias}.{columnName}- Parameters:
tableAlias-columnName-- Returns:
-
where
public WhereAdapter where()
Starts building a WHERE clause without any predicate nodes- Returns:
-
where
public WhereAdapter where(ExpNode predicate)
Builds a WHERE clause starting with the given predicate node- Parameters:
predicate-- Returns:
-
establishWhereClause
public WhereClause establishWhereClause()
Adds a where clause if one does not yet exist- Returns:
-
subStart
public FromSubQueryAdapter subStart()
Start building a sub-query. This isn't added to the from untilFromSubQueryAdapter.subEnd(String)is called- Returns:
-
build
public Select build()
Provide the select statement we've been building- Returns:
-
groupBy
public GroupByAdapter groupBy(String... expressions)
Start a group by expression- Parameters:
expressions-- Returns:
-
orderBy
public OrderByAdapter orderBy(String... expressions)
Start an ORDER BY expression- Parameters:
expressions-- Returns:
-
-