YEAR, MONTH, DAY, HOUR, MINUTE,
SECOND. Some databases may support other parts.
extract_expression ::= EXTRACT(date_part_literal [FROM] scalar_expression)date_part_literal ::= { MICROSECOND | SECOND | MINUTE | HOUR | DAY | WEEK | MONTH | QUARTER | YEAR | SECOND_MICROSECOND | MINUTE_MICROSECOND | MINUTE_SECOND | HOUR_MICROSECOND | HOUR_SECOND | HOUR_MINUTE | DAY_MICROSECOND | DAY_SECOND | DAY_MINUTE | DAY_HOUR | YEAR_MONTH, etc }
| Modifier and Type | Field and Description |
|---|---|
| private String | datePart
The date part to extract from the date/time. |
| private String | fromIdentifier
The actual FROM identifier found in the string representation of the JPQL query. |
| private boolean | hasSpaceAfterDatePart
Determines whether a space was parsed after the date part. |
| private boolean | hasSpaceAfterFrom
Determines whether a space was parsed after the identifier FROM. |
| Access | Constructor and Description |
|---|---|
| public | ExtractExpression(AbstractExpression
The parent of this expression parent)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public void | accept(ExpressionVisitor
The visitor)ExpressionVisitor to visit this objectImplements org. Expression by the given visitor.
|
| protected void | addOrderedEncapsulatedExpressionTo(List<Expression>
The list used to store the string representation of the encapsulated children)
Adds the ExpressionExpressions representing the encapsulated Expression.
|
| public String | Returns: The FROM identifier that was actually parsed, or an empty string if it was not parsedReturns the actual FROM identifier found in the string representation of the JPQL query, which has the actual case that was used. |
| public String | Returns: The part of the date/time to retrieveReturns the date part that was parsed, it is used to extract a single part of a date/time, such as year, month, day, your, etc. |
| public String | getEncapsulatedExpressionQueryBNFId()
Implements abstract org. |
| public JPQLQueryBNF | getQueryBNF()
Implements org. Expression.
|
| public boolean | Returns: true if the date part literal was parsed; false otherwiseDetermines whether the date part literal was parsed or not. |
| public boolean | hasEncapsulatedExpression()
Determines whether something was parsed after the left parenthesis.
|
| public boolean | Returns: true if the identifier FROM was parsed; false otherwiseDetermines whether the identifier FROM was part of the query. |
| public boolean | Returns: true if there was a whitespace after the date part literal;
false otherwiseDetermines whether a whitespace was found after the date part literal. |
| public boolean | Returns: true if there was a whitespace after FROM; false otherwiseDetermines whether a whitespace was found after FROM. |
| protected boolean | isParsingComplete(WordParser
The text to parse based on the current position of the cursor wordParser, String The word that was retrieved from the given text, which is the first word in the text word, Expression The expression)Expression that has already been parsedOverrides org. |
| protected void | parseEncapsulatedExpression(WordParser
The text to parse based on the current position of the cursor wordParser, int The number of whitespace characters that were parsed after '(' whitespaceCount, boolean Determines whether the parsing system should be tolerant, meaning if it should
try to parse invalid or incomplete queries tolerant)
Parses the encapsulated expression by starting at the current position, which is part of the
given WordParser.
|
| protected void | removeEncapsulatedExpression()
Removes the encapsulated
Expression that was parsed, it should not be part of this one.
|
| protected void | toParsedTextEncapsulatedExpression(StringBuilder
The buffer used to append the encapsulated writer, boolean Expression's string
representationDetermines whether to include any characters that are considered
virtual, i.e. that was parsed when the query is incomplete and is needed for functionality
like content assist actual)
Generates a string representation of the encapsulated Expression.
|
| datePart | back to summary |
|---|---|
| private String datePart The date part to extract from the date/time. | |
| fromIdentifier | back to summary |
|---|---|
| private String fromIdentifier The actual FROM identifier found in the string representation of the JPQL query. | |
| hasSpaceAfterDatePart | back to summary |
|---|---|
| private boolean hasSpaceAfterDatePart Determines whether a space was parsed after the date part. | |
| hasSpaceAfterFrom | back to summary |
|---|---|
| private boolean hasSpaceAfterFrom Determines whether a space was parsed after the identifier FROM. | |
| ExtractExpression | back to summary |
|---|---|
| public ExtractExpression(AbstractExpression parent) Creates a new
| |
| accept | back to summary |
|---|---|
| public void accept(ExpressionVisitor visitor) Implements org. Doc from org. Visits this
| |
| addOrderedEncapsulatedExpressionTo | back to summary |
|---|---|
| protected void addOrderedEncapsulatedExpressionTo(List<Expression> children) Adds the
| |
| getActualFromIdentifier | back to summary |
|---|---|
| public String getActualFromIdentifier() Returns the actual FROM identifier found in the string representation of the JPQL query, which has the actual case that was used.
| |
| getDatePart | back to summary |
|---|---|
| public String getDatePart() Returns the date part that was parsed, it is used to extract a single part of a date/time, such as year, month, day, your, etc.
| |
| getEncapsulatedExpressionQueryBNFId | back to summary |
|---|---|
| public String getEncapsulatedExpressionQueryBNFId() Implements abstract org. Returns the BNF used to parse the encapsulated expression. | |
| getQueryBNF | back to summary |
|---|---|
| public JPQLQueryBNF getQueryBNF() Implements org. Doc from org. Returns the BNF of this
| |
| hasDatePart | back to summary |
|---|---|
| public boolean hasDatePart() Determines whether the date part literal was parsed or not.
| |
| hasEncapsulatedExpression | back to summary |
|---|---|
| public boolean hasEncapsulatedExpression() Doc from org. Determines whether something was parsed after the left parenthesis.
| |
| hasFrom | back to summary |
|---|---|
| public boolean hasFrom() Determines whether the identifier FROM was part of the query.
| |
| hasSpaceAfterDatePart | back to summary |
|---|---|
| public boolean hasSpaceAfterDatePart() Determines whether a whitespace was found after the date part literal.
| |
| hasSpaceAfterFrom | back to summary |
|---|---|
| public boolean hasSpaceAfterFrom() Determines whether a whitespace was found after FROM.
| |
| isParsingComplete | back to summary |
|---|---|
| protected boolean isParsingComplete(WordParser wordParser, String word, Expression expression) Overrides org. Doc from org. Determines whether the parsing is complete based on what is left in the given text. The text is never empty.
| |
| parseEncapsulatedExpression | back to summary |
|---|---|
| protected void parseEncapsulatedExpression(WordParser wordParser, int whitespaceCount, boolean tolerant) Doc from org. Parses the encapsulated expression by starting at the current position, which is part of the
given
| |
| removeEncapsulatedExpression | back to summary |
|---|---|
| protected void removeEncapsulatedExpression() Doc from org. Removes the encapsulated
| |
| toParsedTextEncapsulatedExpression | back to summary |
|---|---|
| protected void toParsedTextEncapsulatedExpression(StringBuilder writer, boolean actual) Generates a string representation of the encapsulated
| |