org.eigenbase.sql
Class SqlTimestampLiteral
java.lang.Object
org.eigenbase.sql.SqlNode
org.eigenbase.sql.SqlLiteral
org.eigenbase.sql.SqlAbstractDateTimeLiteral
org.eigenbase.sql.SqlTimestampLiteral
- All Implemented Interfaces:
- Cloneable
public class SqlTimestampLiteral
- extends SqlAbstractDateTimeLiteral
A SQL literal representing a TIMESTAMP value, for example TIMESTAMP
'1969-07-21 03:15 GMT'
.
Create values using SqlLiteral.createTimestamp(java.util.Calendar, int, org.eigenbase.sql.parser.SqlParserPos)
.
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 |
SqlTimestampLiteral
public SqlTimestampLiteral(Calendar cal,
int precision,
boolean hasTimeZone,
SqlParserPos pos)
SqlTimestampLiteral
public SqlTimestampLiteral(Calendar cal,
int precision,
boolean hasTimeZone,
String format,
SqlParserPos pos)
clone
public SqlNode clone(SqlParserPos pos)
- Converts this literal to a
Time
object.
- 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. '03:05:67.456'.
- Specified by:
toFormattedString
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