fix bug parsing date literals
and make related code more typesafe so this doesn't happen again Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
7f00e1a59d
commit
5220e82e83
|
@ -3513,44 +3513,44 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object visitDateLiteral(HqlParser.DateLiteralContext ctx) {
|
public Object visitDateLiteral(HqlParser.DateLiteralContext ctx) {
|
||||||
return ctx.getChild( 1 ).accept( this );
|
return ctx.date().accept( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object visitTimeLiteral(HqlParser.TimeLiteralContext ctx) {
|
public Object visitTimeLiteral(HqlParser.TimeLiteralContext ctx) {
|
||||||
return ctx.getChild( 1 ).accept( this );
|
return ctx.time().accept( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object visitJdbcTimestampLiteral(HqlParser.JdbcTimestampLiteralContext ctx) {
|
public Object visitJdbcTimestampLiteral(HqlParser.JdbcTimestampLiteralContext ctx) {
|
||||||
final ParseTree parseTree = ctx.getChild( 1 );
|
final HqlParser.DateTimeContext dateTime = ctx.dateTime();
|
||||||
if ( parseTree instanceof HqlParser.DateTimeContext ) {
|
if ( dateTime != null ) {
|
||||||
return parseTree.accept( this );
|
return dateTime.accept( this );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return sqlTimestampLiteralFrom( parseTree.getText() );
|
return sqlTimestampLiteralFrom( ctx.genericTemporalLiteralText().getText() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object visitJdbcDateLiteral(HqlParser.JdbcDateLiteralContext ctx) {
|
public Object visitJdbcDateLiteral(HqlParser.JdbcDateLiteralContext ctx) {
|
||||||
final ParseTree parseTree = ctx.getChild( 1 );
|
final HqlParser.DateContext date = ctx.date();
|
||||||
if ( parseTree instanceof HqlParser.DateContext ) {
|
if ( date != null ) {
|
||||||
return parseTree.accept( this );
|
return date.accept( this );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return sqlDateLiteralFrom( parseTree.getText() );
|
return sqlDateLiteralFrom( ctx.genericTemporalLiteralText().getText() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object visitJdbcTimeLiteral(HqlParser.JdbcTimeLiteralContext ctx) {
|
public Object visitJdbcTimeLiteral(HqlParser.JdbcTimeLiteralContext ctx) {
|
||||||
final ParseTree parseTree = ctx.getChild( 1 );
|
final HqlParser.TimeContext time = ctx.time();
|
||||||
if ( parseTree instanceof HqlParser.TimeContext ) {
|
if ( time != null ) {
|
||||||
return parseTree.accept( this );
|
return time.accept( this );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return sqlTimeLiteralFrom( parseTree.getText() );
|
return sqlTimeLiteralFrom( ctx.genericTemporalLiteralText().getText() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue