org.eigenbase.sql.fun
Class SqlExtractFunction
java.lang.Object
org.eigenbase.sql.SqlOperator
org.eigenbase.sql.SqlFunction
org.eigenbase.sql.fun.SqlExtractFunction
public class SqlExtractFunction
- extends SqlFunction
The SQL EXTRACT
operator. Extracts a specified field value from
a DATETIME or an INTERVAL. E.g.
EXTRACT(HOUR FROM INTERVAL '364 23:59:59')
returns
23
- Version:
- $Id: //open/dev/farrago/src/org/eigenbase/sql/fun/SqlExtractFunction.java#9 $
- Author:
- Wael Chatila
Method Summary |
String |
getSignatureTemplate(int operandsCount)
Returns a template describing how the operator signature is to be built. |
void |
unparse(SqlWriter writer,
SqlNode[] operands,
int leftPrec,
int rightPrec)
Writes a SQL representation of a call to this operator to a writer,
including parentheses if the operators on either side are of greater
precedence. |
Methods inherited from class org.eigenbase.sql.SqlOperator |
acceptCall, acceptCall, adjustType, argumentMustBeScalar, checkOperandCount, checkOperandTypes, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isName, leftPrec, preValidateCall, requiresDecimalExpansion, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands |
SqlExtractFunction
public SqlExtractFunction()
getSignatureTemplate
public String getSignatureTemplate(int operandsCount)
- Description copied from class:
SqlOperator
- Returns a template describing how the operator signature is to be built.
E.g for the binary + operator the template looks like "{1} {0} {2}" {0}
is the operator, subsequent numbers are operands.
- Overrides:
getSignatureTemplate
in class SqlOperator
- Parameters:
operandsCount
- is used with functions that can take a variable
number of operands
- Returns:
- signature template, or null to indicate that a default template
will suffice
unparse
public void unparse(SqlWriter writer,
SqlNode[] operands,
int leftPrec,
int rightPrec)
- Description copied from class:
SqlOperator
- Writes a SQL representation of a call to this operator to a writer,
including parentheses if the operators on either side are of greater
precedence.
The default implementation of this method delegates to SqlSyntax.unparse(org.eigenbase.sql.SqlWriter, org.eigenbase.sql.SqlOperator, org.eigenbase.sql.SqlNode[], int, int)
.
- Overrides:
unparse
in class SqlFunction