Class SelectStatement
java.lang.Object
io.github.torand.fastersql.statement.SelectStatement
- All Implemented Interfaces:
Sql,PreparableStatement
Implements a SELECT statement.
-
Method Summary
Modifier and TypeMethodDescriptionexcept(SelectStatement other) Creates an EXCEPT set operation between this and the specified statement.exceptAll(SelectStatement other) Creates an EXCEPT ALL set operation between this and the specified statement.Adds a FOR UPDATE clause.fullOuterJoin(Join join) Adds a FULL OUTER JOIN clause.Adds one or more columns as groups to the GROUP BY clause.final SelectStatementhaving(OptionalPredicate... maybePredicates) Adds optional predicates to the HAVING clause if the wrapped predicates are present.Adds one or more predicates to the HAVING clause.final SelectStatementAdds one or more predicates to the HAVING clause, if the condition is true.intersect(SelectStatement other) Creates an INTERSECT set operation between this and the specified statement.intersectAll(SelectStatement other) Creates an INTERSECT ALL set operation between this and the specified statement.Adds one or more JOIN clauses.final SelectStatementAdds one or more JOIN clauses, if the condition is true.leftOuterJoin(Join join) Adds a LEFT OUTER JOIN clause.limit(long limit) Adds a LIMIT clause.offset(long offset) Adds a OFFSET clause.Adds one or more ORDER clauses.Gets the statement parameters introduced by this fragment.rightOuterJoin(Join join) Adds a RIGHT OUTER JOIN clause.Formats object as an SQL fragment.toString()union(SelectStatement other) Creates a UNION set operation between this and the specified statement.unionAll(SelectStatement other) Creates a UNION ALL set operation between this and the specified statement.final SelectStatementwhere(OptionalPredicate... maybePredicates) Adds optional predicates to the WHERE clause if the wrapped predicates are present.Adds one or more predicates to the WHERE clause.final SelectStatementAdds supplied predicates to the WHERE clause, if the condition is true.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.torand.fastersql.statement.PreparableStatement
toStringMethods inherited from interface io.github.torand.fastersql.sql.Sql
aliasRefs, columnRefs
-
Method Details
-
join
Adds one or more JOIN clauses.- Parameters:
joins- the JOIN clauses.- Returns:
- the modified statement.
-
leftOuterJoin
Adds a LEFT OUTER JOIN clause.- Parameters:
join- the JOIN clause.- Returns:
- the modified statement.
-
rightOuterJoin
Adds a RIGHT OUTER JOIN clause.- Parameters:
join- the JOIN clause.- Returns:
- the modified statement.
-
fullOuterJoin
Adds a FULL OUTER JOIN clause.- Parameters:
join- the JOIN clause.- Returns:
- the modified statement.
-
joinIf
@SafeVarargs public final SelectStatement joinIf(boolean condition, Supplier<Join>... joinSuppliers) Adds one or more JOIN clauses, if the condition is true.- Parameters:
condition- the condition.joinSuppliers- the suppliers of JOIN clauses.- Returns:
- the modified statement.
-
where
Adds one or more predicates to the WHERE clause.- Parameters:
predicates- the predicates.- Returns:
- the modified statement.
-
where
Adds optional predicates to the WHERE clause if the wrapped predicates are present.- Parameters:
maybePredicates- the optional predicates.- Returns:
- the modified statement.
-
whereIf
@SafeVarargs public final SelectStatement whereIf(boolean condition, Supplier<Predicate>... predicateSuppliers) Adds supplied predicates to the WHERE clause, if the condition is true.- Parameters:
condition- the condition.predicateSuppliers- the suppliers providing predicates- Returns:
- the modified statement.
-
groupBy
Adds one or more columns as groups to the GROUP BY clause.- Parameters:
groups- the groups- Returns:
- the modified statement.
-
having
Adds one or more predicates to the HAVING clause.- Parameters:
predicates- the predicates.- Returns:
- the modified statement.
-
having
Adds optional predicates to the HAVING clause if the wrapped predicates are present.- Parameters:
maybePredicates- the optional predicates.- Returns:
- the modified statement.
-
havingIf
@SafeVarargs public final SelectStatement havingIf(boolean condition, Supplier<Predicate>... predicateSuppliers) Adds one or more predicates to the HAVING clause, if the condition is true.- Parameters:
condition- the condition.predicateSuppliers- the suppliers providing predicates.- Returns:
- the modified statement.
-
orderBy
Adds one or more ORDER clauses.- Parameters:
orders- the ORDER clauses.- Returns:
- the modified statement.
-
limit
Adds a LIMIT clause.- Parameters:
limit- the limit.- Returns:
- the modified statement.
-
offset
Adds a OFFSET clause.- Parameters:
offset- the offset.- Returns:
- the modified statement.
-
forUpdate
Adds a FOR UPDATE clause.- Returns:
- the modified statement.
-
union
Creates a UNION set operation between this and the specified statement.- Parameters:
other- the other SELECT statement- Returns:
- the SELECT set operation statement.
-
unionAll
Creates a UNION ALL set operation between this and the specified statement.- Parameters:
other- the other SELECT statement- Returns:
- the SELECT set operation statement.
-
intersect
Creates an INTERSECT set operation between this and the specified statement. Note that INTERSECT has precedence over UNION and EXCEPT.- Parameters:
other- the other SELECT statement- Returns:
- the SELECT set operation statement.
-
intersectAll
Creates an INTERSECT ALL set operation between this and the specified statement. Note that INTERSECT has precedence over UNION and EXCEPT.- Parameters:
other- the other SELECT statement- Returns:
- the SELECT set operation statement.
-
except
Creates an EXCEPT set operation between this and the specified statement.- Parameters:
other- the other SELECT statement- Returns:
- the SELECT set operation statement.
-
exceptAll
Creates an EXCEPT ALL set operation between this and the specified statement.- Parameters:
other- the other SELECT statement- Returns:
- the SELECT set operation statement.
-
sql
Description copied from interface:SqlFormats object as an SQL fragment. -
params
Description copied from interface:SqlGets the statement parameters introduced by this fragment. -
toString
-