org.eigenbase.sql
Class SqlDateLiteral
java.lang.Object
org.eigenbase.sql.SqlNode
org.eigenbase.sql.SqlLiteral
org.eigenbase.sql.SqlAbstractDateTimeLiteral
org.eigenbase.sql.SqlDateLiteral
- All Implemented Interfaces:
- Cloneable
public class SqlDateLiteral
- extends SqlAbstractDateTimeLiteral
A SQL literal representing a DATE value, such as DATE
'2004-10-22'
.
Create values using SqlLiteral.createDate(java.util.Calendar, org.eigenbase.sql.parser.SqlParserPos)
.
- Version:
- $Id: //open/dev/farrago/src/org/eigenbase/sql/SqlDateLiteral.java#15 $
- Author:
- jhyde
Methods inherited from class org.eigenbase.sql.SqlLiteral |
accept, bigDecimalValue, booleanValue, createApproxNumeric, createBinaryString, createBinaryString, createBoolean, createCharString, createCharString, createDate, createExactNumeric, createInterval, createNegative, createNull, createSample, createSymbol, createTime, createTimestamp, createUnknown, equals, equalsDeep, getKind, getMonotonicity, getStringValue, getTypeName, getValue, hashCode, intValue, longValue, sampleValue, stringValue, symbolValue, unescapeUnicode, validate, valueMatchesType |
SqlDateLiteral
SqlDateLiteral(Calendar d,
SqlParserPos pos)
SqlDateLiteral
SqlDateLiteral(Calendar d,
String format,
SqlParserPos pos)
clone
public SqlNode clone(SqlParserPos pos)
- Description copied from class:
SqlNode
- Clones a SqlNode with a different position.
- Overrides:
clone
in class SqlLiteral
toString
public String toString()
- Description copied from class:
SqlAbstractDateTimeLiteral
- Returns e.g.
DATE '1969-07-21'
.
- Specified by:
toString
in class SqlAbstractDateTimeLiteral
toFormattedString
public String toFormattedString()
- Returns e.g. '1969-07-21'.
- Specified by:
toFormattedString
in class SqlAbstractDateTimeLiteral
createSqlType
public RelDataType createSqlType(RelDataTypeFactory typeFactory)
- Overrides:
createSqlType
in class SqlAbstractDateTimeLiteral
unparse
public void unparse(SqlWriter writer,
int leftPrec,
int rightPrec)
- Description copied from class:
SqlNode
- Writes a SQL representation of this node to a writer.
The leftPrec
and rightPrec
parameters give
us enough context to decide whether we need to enclose the expression in
parentheses. For example, we need parentheses around "2 + 3" if preceded
by "5 *". This is because the precedence of the "*" operator is greater
than the precedence of the "+" operator.
The algorithm handles left- and right-associative operators by giving
them slightly different left- and right-precedence.
If SqlWriter.isAlwaysUseParentheses()
is true, we use
parentheses even when they are not required by the precedence rules.
For the details of this algorithm, see SqlCall.unparse(org.eigenbase.sql.SqlWriter, int, int)
.
- Overrides:
unparse
in class SqlAbstractDateTimeLiteral
- Parameters:
writer
- Target writerleftPrec
- The precedence of the SqlNode
immediately
preceding this node in a depth-first scan of the parse treerightPrec
- The precedence of the SqlNode
immediately