Class DateColumn
- java.lang.Object
-
- nz.co.gregs.dbvolution.expressions.AnyExpression<B,R,D>
-
- nz.co.gregs.dbvolution.expressions.EqualExpression<B,R,D>
-
- nz.co.gregs.dbvolution.expressions.InExpression<B,R,D>
-
- nz.co.gregs.dbvolution.expressions.RangeExpression<Date,DateResult,DBDate>
-
- nz.co.gregs.dbvolution.expressions.DateExpression
-
- nz.co.gregs.dbvolution.columns.DateColumn
-
- All Implemented Interfaces:
Serializable
,ColumnProvider
,DBExpression
,ExpressionColumn<DBDate>
,HasSQLString
,AnyComparable<Date,DateResult>
,AnyResult<Date>
,DateResult
,EqualComparable<Date,DateResult>
,EqualResult<Date>
,ExpressionCanHaveNullValues
,ExpressionHasStandardStringResult
,InComparable<Date,DateResult>
,InResult<Date>
,NullCapableResult<Date>
,RangeComparable<Date,DateResult>
,RangeResult<Date>
public class DateColumn extends DateExpression implements ColumnProvider
Represents a database column storing a date value.This class adds the necessary methods to use a date column like a date expression.
Internally the class uses an AbsractColumn to store the column and overrides methods in DateExpression to insert the column into the expression.
Generally you get a DateColumn using
RowDefinition.column(DBDate)
.Support DBvolution at Patreon
- Author:
- Gregory Graham
- See Also:
RowDefinition
,AbstractColumn
,DateExpression
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class nz.co.gregs.dbvolution.expressions.AnyExpression
AnyExpression.CountAllExpression, AnyExpression.CountDistinctExpression, AnyExpression.CountExpression, AnyExpression.NTileExpression, AnyExpression.PercentageExpression, AnyExpression.RankExpression
-
Nested classes/interfaces inherited from class nz.co.gregs.dbvolution.expressions.DateExpression
DateExpression.DateAddDaysExpression, DateExpression.DateAddIntegerDaysExpression, DateExpression.DateAddIntegerHoursExpression, DateExpression.DateAddIntegerMinutesExpression, DateExpression.DateAddIntegerMonthsExpression, DateExpression.DateAddIntegerSecondsExpression, DateExpression.DateAddIntegerWeeksExpression, DateExpression.DateAddIntegerYearsExpression, DateExpression.DateAddMonthsExpression, DateExpression.DateAddSecondsExpression, DateExpression.DateCurrentDateExpression, DateExpression.DateCurrentTimeExpression, DateExpression.DateDayExpression, DateExpression.DateDayOfWeekExpression, DateExpression.DateDaysFromExpression, DateExpression.DateEndOfMonthExpression, DateExpression.DateGetDateRepeatFromExpression, DateExpression.DateGetDurationFromExpression, DateExpression.DateGreatestOfExpression, DateExpression.DateHourExpression, DateExpression.DateHoursFromExpression, DateExpression.DateIfDBNullExpression, DateExpression.DateIsExpression, DateExpression.DateIsGreaterThanExpression, DateExpression.DateIsGreaterThanOrEqualExpression, DateExpression.DateIsInExpression, DateExpression.DateIsLessThanExpression, DateExpression.DateIsLessThanOrEqualExpression, DateExpression.DateIsNotExpression, DateExpression.DateIsNotInExpression, DateExpression.DateLeastOfExpression, DateExpression.DateMaxExpression, DateExpression.DateMinExpression, DateExpression.DateMinusDateRepeatExpression, DateExpression.DateMinusDurationExpression, DateExpression.DateMinuteExpression, DateExpression.DateMinutesFromExpression, DateExpression.DateMonthExpression, DateExpression.DateMonthsFromExpression, DateExpression.DateOnlyCurrentDateExpression, DateExpression.DatePlusDateRepeatExpression, DateExpression.DatePlusDurationExpression, DateExpression.DateSecondAndSubsecondExpression, DateExpression.DateSecondExpression, DateExpression.DateSecondsFromExpression, DateExpression.DateSubsecondExpression, DateExpression.DateWeeksFromExpression, DateExpression.DateYearExpression, DateExpression.DateYearsFromExpression, DateExpression.FirstValueExpression, DateExpression.LastValueExpression, DateExpression.NthValueExpression
-
Nested classes/interfaces inherited from class nz.co.gregs.dbvolution.expressions.EqualExpression
EqualExpression.DBUnaryFunction<B,R extends EqualResult<B>,D extends QueryableDatatype<B>,X extends EqualExpression<B,R,D>>, EqualExpression.ModeSimpleExpression<B,R extends EqualResult<B>,D extends QueryableDatatype<B>,X extends EqualExpression<B,R,D>>, EqualExpression.ModeStrictExpression<B,R extends EqualResult<B>,D extends QueryableDatatype<B>,X extends EqualExpression<B,R,D>>
-
Nested classes/interfaces inherited from class nz.co.gregs.dbvolution.expressions.RangeExpression
RangeExpression.MedianExpression<B,R extends EqualResult<B>,D extends QueryableDatatype<B>,X extends EqualExpression<B,R,D>>, RangeExpression.UniqueRankingExpression<B,R extends EqualResult<B>,D extends QueryableDatatype<B>,X extends EqualExpression<B,R,D>>
-
-
Constructor Summary
Constructors Constructor Description DateColumn(RowDefinition row, Date field)
Create a DateColumn for the supplied field of the supplied rowDateColumn(RowDefinition row, DBDate field)
Create a DateColumn for the supplied field of the supplied row
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DateColumn
copy()
A Complete Copy Of This DBValue.AbstractColumn
getColumn()
Returns the AbstractColumn from this ColumnProvider.SortProvider.Column
getSortProvider()
Provides the sorting for this column as defined by the methodsQueryableDatatype.setSortOrder(java.lang.Boolean)
,QueryableDatatype.setSortOrderAscending()
, andQueryableDatatype.setSortOrderDescending()
on the QDT.Set<DBRow>
getTablesInvolved()
Returns a Set of the DBRow instances involved in this expression.BooleanExpression
is(DBDate dateColumn)
Create an expression to compare this column to the other column using EQUALS.boolean
isAggregator()
Returns TRUE if this expression is an Aggregator like SUM() or LEAST().boolean
isPurelyFunctional()
Indicates whether or not the expression includes table columns.void
setUseTableAlias(boolean useTableAlias)
Indicates whether the ColumnProvider should use the table alias during query creation.String
toSQLString(DBDefinition db)
Produces the snippet provided by this class.-
Methods inherited from class nz.co.gregs.dbvolution.expressions.AnyExpression
ascending, asResult, count, countAll, countDistinctValues, countNotNull, createSQLForFromClause, createSQLForGroupByClause, denseRank, descending, getIncludesNull, getInnerResult, highestFirst, highestLast, isComplexExpression, isNullSafetyTerminator, isWindowingFunction, lowestFirst, lowestLast, nTile, nTile, nTile, nullBoolean, nullDate, nullDateRepeat, nullDuration, nullInstant, nullInteger, nullLine2D, nullLineSegment2D, nullLocalDate, nullLocalDateTime, nullMultiPoint2D, nullNumber, nullPoint2D, nullPolygon2D, nullString, percentageRank, rank, rowNumber, runningCount, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value, value
-
Methods inherited from interface nz.co.gregs.dbvolution.columns.ColumnProvider
ascending, descending
-
Methods inherited from class nz.co.gregs.dbvolution.expressions.DateExpression
addDays, addDays, addDays, addDays, addDays, addHours, addHours, addMinutes, addMinutes, addMonths, addMonths, addMonths, addMonths, addMonths, addSeconds, addSeconds, addSeconds, addWeeks, addWeeks, addYears, addYears, asExpressionColumn, currentDate, currentDateOnly, currentTime, day, dayIs, dayIs, dayIs, dayIs, dayIs, dayOfWeek, daysFrom, daysFrom, endOfMonth, expression, expression, expression, firstOfMonth, firstValue, getDateRepeatFrom, getDateRepeatFrom, getDurationFrom, getDurationFrom, getQueryableDatatypeForExpressionValue, greatestOf, greatestOf, greatestOf, hour, hourIs, hourIs, hourIs, hourIs, hourIs, hoursFrom, hoursFrom, ifDBNull, ifDBNull, is, is, isBetween, isBetween, isBetween, isBetween, isBetweenExclusive, isBetweenExclusive, isBetweenExclusive, isBetweenExclusive, isBetweenInclusive, isBetweenInclusive, isBetweenInclusive, isBetweenInclusive, isEarlierThan, isEarlierThan, isGreaterThan, isGreaterThan, isGreaterThan, isGreaterThan, isGreaterThanOrEqual, isGreaterThanOrEqual, isIn, isInCollection, isLaterThan, isLaterThan, isLessThan, isLessThan, isLessThan, isLessThan, isLessThanOrEqual, isLessThanOrEqual, isNot, isNot, isNotInCollection, isNotNull, isNull, lastValue, leastOf, leastOf, leastOf, max, min, minus, minus, minus, minus, minute, minuteIs, minuteIs, minuteIs, minuteIs, minuteIs, minutesFrom, minutesFrom, month, monthIs, monthIs, monthIs, monthIs, monthIs, monthsFrom, monthsFrom, nthValue, nullExpression, overlaps, overlaps, overlaps, plus, plus, plus, plus, second, secondAndSubsecond, secondIs, secondIs, secondIs, secondIs, secondIs, secondsFrom, secondsFrom, stringResult, stringResultCommonFormat, stringResultISOFormat, stringResultUSAFormat, subsecond, toInstant, toLocalDate, toLocalDateTime, weeksFrom, weeksFrom, year, yearIs, yearIs, yearIs, yearIs, yearIs, yearsFrom, yearsFrom
-
Methods inherited from interface nz.co.gregs.dbvolution.expressions.DBExpression
createSQLForFromClause, createSQLForGroupByClause, getQueryableDatatypeForExpressionValue, isComplexExpression, isWindowingFunction
-
Methods inherited from class nz.co.gregs.dbvolution.expressions.EqualExpression
countIf, isNot
-
Methods inherited from interface nz.co.gregs.dbvolution.results.ExpressionCanHaveNullValues
getIncludesNull
-
Methods inherited from interface nz.co.gregs.dbvolution.expressions.ExpressionColumn
toExpressionColumn
-
Methods inherited from interface nz.co.gregs.dbvolution.results.InComparable
isIn
-
Methods inherited from class nz.co.gregs.dbvolution.expressions.InExpression
isIn, isIn, isIn, isNotIn, isNotIn, isNotIn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class nz.co.gregs.dbvolution.expressions.RangeExpression
isBetween, isBetween, isBetween, isBetween, isBetween, isBetweenExclusive, isBetweenExclusive, isBetweenExclusive, isBetweenExclusive, isBetweenExclusive, isBetweenInclusive, isBetweenInclusive, isBetweenInclusive, isBetweenInclusive, isBetweenInclusive, isGreaterThan, isGreaterThan, isGreaterThanOrEqual, isLessThan, isLessThan, isLessThanOrEqual
-
-
-
-
Constructor Detail
-
DateColumn
public DateColumn(RowDefinition row, Date field)
Create a DateColumn for the supplied field of the supplied row- Parameters:
row
- the row containing the fieldfield
- the field defining the column
-
DateColumn
public DateColumn(RowDefinition row, DBDate field)
Create a DateColumn for the supplied field of the supplied row- Parameters:
row
- the row containing the fieldfield
- the field defining the column
-
-
Method Detail
-
toSQLString
public String toSQLString(DBDefinition db)
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
- Overrides:
toSQLString
in classDateExpression
- Parameters:
db
- the target databaseSupport DBvolution at Patreon
- Returns:
- the DBValue formatted as a SQL snippet
-
copy
public DateColumn 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 interfaceDateResult
- Specified by:
copy
in interfaceDBExpression
- Overrides:
copy
in classDateExpression
- Returns:
- a copy of this
DBValue
-
getColumn
public AbstractColumn getColumn()
Description copied from interface:ColumnProvider
Returns the AbstractColumn from this ColumnProvider.Support DBvolution at Patreon
- Specified by:
getColumn
in interfaceColumnProvider
- Returns:
- the column that this provider supplies.
-
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
- Overrides:
getTablesInvolved
in classAnyExpression<Date,DateResult,DBDate>
- Returns:
- a set of DBRow instances involved in this DBExpression.
-
setUseTableAlias
public void setUseTableAlias(boolean useTableAlias)
Description copied from interface:ColumnProvider
Indicates whether the ColumnProvider should use the table alias during query creation.the standard implementation is
this.column.setUseTableAlias(useTableAlias);
and passes the boolean along to the underlying AbstractColumn- Specified by:
setUseTableAlias
in interfaceColumnProvider
- Parameters:
useTableAlias
- true or false
-
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
- Overrides:
isPurelyFunctional
in classAnyExpression<Date,DateResult,DBDate>
- Returns:
- TRUE if the expression does not access table data, otherwise FALSE.
-
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
- Overrides:
isAggregator
in classAnyExpression<Date,DateResult,DBDate>
- Returns:
- TRUE if this DBExpression represents an aggregating functions
-
is
public BooleanExpression is(DBDate dateColumn)
Create an expression to compare this column to the other column using EQUALS.- Overrides:
is
in classEqualExpression<Date,DateResult,DBDate>
- Parameters:
dateColumn
- an instance to compare toSupport DBvolution at Patreon
- Returns:
- a BooleanExpression
-
getSortProvider
public SortProvider.Column getSortProvider()
Description copied from interface:ColumnProvider
Provides the sorting for this column as defined by the methodsQueryableDatatype.setSortOrder(java.lang.Boolean)
,QueryableDatatype.setSortOrderAscending()
, andQueryableDatatype.setSortOrderDescending()
on the QDT.At the time of querying the sort order defined on the original QDT field provided is add to the query, with ASCENDING being used as the default ordering.
To be certain of the ordering use the
AnyExpression.ascending()
andAnyExpression.descending()
methods.- Specified by:
getSortProvider
in interfaceColumnProvider
- Returns:
- a SortProvider configured to use the sorting defined on original QDT or ASCENDING.
-
-