mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser. for issue #1780
This commit is contained in:
@@ -1844,8 +1844,10 @@ public class SQLExprParser extends SQLParser {
|
||||
typeName += ' ' + lexer.stringVal();
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
|
||||
SQLDataType dataType = new SQLDataTypeImpl(typeName);
|
||||
|
||||
|
||||
return parseDataTypeRest(dataType);
|
||||
}
|
||||
|
||||
@@ -1861,6 +1863,20 @@ public class SQLExprParser extends SQLParser {
|
||||
dataType.setName("DOUBLE PRECISION");
|
||||
}
|
||||
|
||||
if ("timestamp".equalsIgnoreCase(dataType.getName())) {
|
||||
if (identifierEquals("WITHOUT")) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("TIME");
|
||||
acceptIdentifier("ZONE");
|
||||
dataType.setWithTimeZone(false);
|
||||
} else if (lexer.token() == Token.WITH) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("TIME");
|
||||
acceptIdentifier("ZONE");
|
||||
dataType.setWithTimeZone(true);
|
||||
}
|
||||
}
|
||||
|
||||
return dataType;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user