Class WindowFunctionRequiresOrderBy<A extends EqualExpression<?,?,?>>
- java.lang.Object
-
- nz.co.gregs.dbvolution.expressions.windows.WindowFunctionRequiresOrderBy<A>
-
- Type Parameters:
A
- the expression type returned by this windowing function, e.g. IntegerExpression
- All Implemented Interfaces:
DBExpression
,HasSQLString
,WindowingFunctionRequiresOrderByInterface<A>
- Direct Known Subclasses:
StringExpression.LagLeadWindow
public class WindowFunctionRequiresOrderBy<A extends EqualExpression<?,?,?>> extends Object implements WindowingFunctionRequiresOrderByInterface<A>
- Author:
- gregorygraham
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WindowFunctionRequiresOrderBy.Partitioned<A extends EqualExpression<?,?,?>>
static class
WindowFunctionRequiresOrderBy.Sorted<A extends EqualExpression<?,?,?>>
-
Nested classes/interfaces inherited from interface nz.co.gregs.dbvolution.expressions.windows.WindowingFunctionRequiresOrderByInterface
WindowingFunctionRequiresOrderByInterface.WindowEnd<A extends EqualExpression<?,?,?>>, WindowingFunctionRequiresOrderByInterface.WindowPart<A extends EqualExpression<?,?,?>>
-
-
Constructor Summary
Constructors Constructor Description WindowFunctionRequiresOrderBy(A expression)
-
Method Summary
-
-
-
Constructor Detail
-
WindowFunctionRequiresOrderBy
public WindowFunctionRequiresOrderBy(A expression)
-
-
Method Detail
-
partition
public WindowFunctionRequiresOrderBy.Partitioned<A> partition(ColumnProvider... cols)
- Specified by:
partition
in interfaceWindowingFunctionRequiresOrderByInterface<A extends EqualExpression<?,?,?>>
-
getInnerExpression
public A getInnerExpression()
-
AllRowsAndOrderBy
public A AllRowsAndOrderBy(SortProvider sort, SortProvider... sorts)
-
toSQLString
public String toSQLString(DBDefinition defn)
Description copied from interface:HasSQLString
Produces the snippet provided by this class.This is only used internally.
If you are extending DBvolution and adding a new function this is the place to format the information for use in SQL. A DBDefinition instance is provided to supply context and so your SQL can used on multiple database engines.
- Specified by:
toSQLString
in interfaceHasSQLString
- Parameters:
defn
- the target databaseSupport DBvolution at Patreon
- Returns:
- the DBValue formatted as a SQL snippet
-
getRequiredExpressionClass
public Class<A> getRequiredExpressionClass()
- Specified by:
getRequiredExpressionClass
in interfaceWindowingFunctionRequiresOrderByInterface<A extends EqualExpression<?,?,?>>
-
copy
public WindowFunctionRequiresOrderBy<A> copy()
Description copied from interface:DBExpression
A Complete Copy Of This DBValue.Immutability in DBvolution is maintain by internally copying objects.
This method enables immutability by performing a deep copy of the object.
Singletons may return themselves but all other objects must return a new instance with copies of all mutable fields.
Support DBvolution at Patreon
- Specified by:
copy
in interfaceDBExpression
- Returns:
- a copy of this
DBValue
-
getQueryableDatatypeForExpressionValue
public QueryableDatatype<?> getQueryableDatatypeForExpressionValue()
Description copied from interface:DBExpression
Provides a blank instance of theQueryableDatatype
used by this expression.You are probably looking for
ExpressionColumn.asExpressionColumn()
.Note that this method is not good for use in everyday DBvolution code and should probably be reserved for meta-programming.
Support DBvolution at Patreon
- Specified by:
getQueryableDatatypeForExpressionValue
in interfaceDBExpression
- Returns:
- the QueryableDatatype subclass that corresponds to the results of this expression
-
isAggregator
public boolean isAggregator()
Description copied from interface:DBExpression
Returns TRUE if this expression is an Aggregator like SUM() or LEAST().Subclasses must implement this method returning TRUE if the expression will combine the results of several rows to produce a result. If the expression relies on subexpressions, then the isAggregator method must return TRUE if the subexpressions include an aggregator.
Aggregators collect several rows together to produce a single result. Examples are MAX, MIN, and AVERAGE.
They are only appropriate in the SELECT clause and generally require the GROUP BY clause to be useful.
Aggregators are used with
DBReport
. Aggregator expressions are included in the SELECT clause but excluded from the GROUP BY clause.Support DBvolution at Patreon
- Specified by:
isAggregator
in interfaceDBExpression
- Returns:
- TRUE if this DBExpression represents an aggregating functions
-
getTablesInvolved
public Set<DBRow> getTablesInvolved()
Description copied from interface:DBExpression
Returns a Set of the DBRow instances involved in this expression.Used by QueryGraph to plot the connections between tables and avoid cartesian joins.
Support DBvolution at Patreon
- Specified by:
getTablesInvolved
in interfaceDBExpression
- Returns:
- a set of DBRow instances involved in this DBExpression.
-
isPurelyFunctional
public boolean isPurelyFunctional()
Description copied from interface:DBExpression
Indicates whether or not the expression includes table columns.Purely functional expressions use only in-built functions or literal values to produce results and do not require data from tables.
Some databases, notably MS SQLServer, can not group purely functional expressions.
Support DBvolution at Patreon
- Specified by:
isPurelyFunctional
in interfaceDBExpression
- Returns:
- TRUE if the expression does not access table data, otherwise FALSE.
-
isComplexExpression
public boolean isComplexExpression()
- Specified by:
isComplexExpression
in interfaceDBExpression
-
createSQLForFromClause
public String createSQLForFromClause(DBDatabase database)
- Specified by:
createSQLForFromClause
in interfaceDBExpression
-
createSQLForGroupByClause
public String createSQLForGroupByClause(DBDatabase database)
- Specified by:
createSQLForGroupByClause
in interfaceDBExpression
-
isWindowingFunction
public boolean isWindowingFunction()
- Specified by:
isWindowingFunction
in interfaceDBExpression
-
unpartitioned
public WindowFunctionRequiresOrderBy.Partitioned<A> unpartitioned()
-
allRows
public WindowFunctionRequiresOrderBy.Partitioned<A> allRows()
-
-