Class FromAdapter
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.query.FromAdapter
-
public class FromAdapter extends java.lang.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 Select
build()
Provide the select statement we've been buildingWhereClause
establishWhereClause()
Adds a where clause if one does not yet existFromAdapter
from(java.lang.String tableName)
Add a table to the from clause returning thisFromAdapter
ready for the next itemFromAdapter
from(java.lang.String tableName, Alias alias)
Add a table with an alias (tab AS foo) to the from clause returning thisFromAdapter
ready for the next itemGroupByAdapter
groupBy(java.lang.String... expressions)
Start a group by expressionFromAdapter
innerJoin(java.lang.String tableName, Alias alias, WhereFragment joinOnPredicate)
Add an INNER JOIN for the given tableFromAdapter
innerJoin(Select sub, Alias alias, WhereFragment joinOnPredicate)
Add an INNER JOIN for the given sub selectFromAdapter
leftOuterJoin(java.lang.String tableName, Alias alias, WhereFragment joinOnPredicate)
Add a LEFT OUTER JOIN for the given tableOrderByAdapter
orderBy(java.lang.String... expressions)
Start an ORDER BY expressionFromSubQueryAdapter
subStart()
Start building a sub-query.WhereAdapter
where()
Starts building a WHERE clause without any predicate nodesWhereAdapter
where(java.lang.String predicate)
Start building the "WHERE" clause for the statementWhereAdapter
where(java.lang.String tableAlias, java.lang.String columnName)
Starts building a WHERE clause with the {tableAlias}.{columnName}WhereAdapter
where(ExpNode predicate)
Builds a WHERE clause starting with the given predicate node
-
-
-
Constructor Detail
-
FromAdapter
public FromAdapter(Select select)
Model the "from" part of the select statement- Parameters:
select
-
-
-
Method Detail
-
from
public FromAdapter from(java.lang.String tableName)
Add a table to the from clause returning thisFromAdapter
ready for the next item- Parameters:
tableName
-- Returns:
-
from
public FromAdapter from(java.lang.String tableName, Alias alias)
Add a table with an alias (tab AS foo) to the from clause returning thisFromAdapter
ready for the next item- Parameters:
tableName
-alias
-- Returns:
-
innerJoin
public FromAdapter innerJoin(java.lang.String tableName, Alias alias, WhereFragment joinOnPredicate)
Add an INNER JOIN for the given table- Parameters:
tableName
-alias
-joinOnPredicate
-- Returns:
-
innerJoin
public FromAdapter innerJoin(Select sub, Alias alias, WhereFragment joinOnPredicate)
Add an INNER JOIN for the given sub select- Parameters:
sub
-alias
-joinOnPredicate
-- Returns:
-
leftOuterJoin
public FromAdapter leftOuterJoin(java.lang.String tableName, Alias alias, WhereFragment joinOnPredicate)
Add a LEFT OUTER JOIN for the given table- Parameters:
tableName
-alias
-joinOnPredicate
-- Returns:
-
where
public WhereAdapter where(java.lang.String predicate)
Start building the "WHERE" clause for the statement- Parameters:
predicate
-- Returns:
-
where
public WhereAdapter where(java.lang.String tableAlias, java.lang.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(java.lang.String... expressions)
Start a group by expression- Parameters:
expressions
-- Returns:
-
orderBy
public OrderByAdapter orderBy(java.lang.String... expressions)
Start an ORDER BY expression- Parameters:
expressions
-- Returns:
-
-