improved sql parser. for issue #1780

This commit is contained in:
wenshao
2017-07-13 12:22:51 +08:00
parent 4a88007ea2
commit 66f3ffcc67
14 changed files with 189 additions and 142 deletions
@@ -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;
}