Package com.github.eikecochu.sqlbuilder
Class Join
- java.lang.Object
-
- com.github.eikecochu.sqlbuilder.QueryPartImpl<T>
-
- com.github.eikecochu.sqlbuilder.Conditionable<Join>
-
- com.github.eikecochu.sqlbuilder.Join
-
- All Implemented Interfaces:
BeforeGroupBy<Join>,BeforeJoin<Join>,BeforeOrderBy<Join>,BeforeUnion<Join>,BeforeWhere<Join>,QueryBuilder<Join>,QueryPart,QueryPartLinked<Join>,QueryPartSQL<Join>
public class Join extends Conditionable<Join> implements QueryBuilder<Join>, BeforeJoin<Join>, BeforeWhere<Join>, BeforeGroupBy<Join>, BeforeOrderBy<Join>, BeforeUnion<Join>
The JOIN expression. Joins two tables or subqueries together into the current selection to select from both. Elements are joined through some conditions.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJoin(BeforeJoin<?> parent)protectedJoin(BeforeJoin<?> parent, JoinMode joinMode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Conditionable<Join>on()Set join conditionsJoinonColsEq(java.lang.String col1, java.lang.String col2)Set join conditions to join on two equal columnsjava.lang.Stringstring(QueryOptions options)Transforms this statement into an SQL stringJoinsubquery(QueryBuilder<?> subquery, java.lang.String name)Add a subquery as join targetJointable(java.lang.String name)Join to a table by name-
Methods inherited from class com.github.eikecochu.sqlbuilder.Conditionable
and, col, col, col, col, col, colsEq, group, groupStart, or, values, values
-
Methods inherited from class com.github.eikecochu.sqlbuilder.QueryPartImpl
parent, sql
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.BeforeGroupBy
groupBy, groupBy, groupBy, groupBySQL
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.BeforeJoin
crossJoin, crossJoin, crossJoin, fullOuterJoin, fullOuterJoin, fullOuterJoin, innerJoin, innerJoin, innerJoin, innerJoinOnColsEq, innerJoinOnColsEq, join, join, join, join, join, joinSQL, leftJoin, leftJoin, leftJoin, leftOuterJoin, leftOuterJoin, leftOuterJoin, outerJoin, outerJoin, outerJoin, rightJoin, rightJoin, rightJoin, rightOuterJoin, rightOuterJoin, rightOuterJoin
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.BeforeOrderBy
orderBy, orderBy, orderBy, orderBySQL
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.BeforeUnion
union, union, unionAll, unionSQL
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.BeforeWhere
where, where, where, where, whereSQL
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.QueryBuilder
query, query
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.QueryPartLinked
ext, parent, parent
-
Methods inherited from interface com.github.eikecochu.sqlbuilder.QueryPartSQL
sql
-
-
-
-
Constructor Detail
-
Join
protected Join(BeforeJoin<?> parent)
-
Join
protected Join(BeforeJoin<?> parent, JoinMode joinMode)
-
-
Method Detail
-
subquery
public Join subquery(QueryBuilder<?> subquery, java.lang.String name)
Add a subquery as join target- Parameters:
subquery- The subquery to join toname- The name of the subquery- Returns:
- This JOIN statement
-
table
public Join table(java.lang.String name)
Join to a table by name- Parameters:
name- The name of the table to join to- Returns:
- This JOIN statement
-
on
public Conditionable<Join> on()
Set join conditions- Returns:
- The ON statement
-
onColsEq
public Join onColsEq(java.lang.String col1, java.lang.String col2)
Set join conditions to join on two equal columns- Parameters:
col1- The left columncol2- The right column, equal to left- Returns:
- This instance
-
string
public java.lang.String string(QueryOptions options)
Description copied from interface:QueryPartTransforms this statement into an SQL string- Specified by:
stringin interfaceQueryPart- Overrides:
stringin classConditionable<Join>- Parameters:
options- The QueryOptions to apply for transformation- Returns:
- The created SQL string
-
-