mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for mysql parser, support unsigned type.
This commit is contained in:
@@ -2505,21 +2505,29 @@ public class SQLExprParser extends SQLParser {
|
||||
}
|
||||
|
||||
SQLName typeExpr = name();
|
||||
final long typeNameHashCode = typeExpr.nameHashCode64();
|
||||
String typeName = typeExpr.toString();
|
||||
|
||||
if ("long".equalsIgnoreCase(typeName) //
|
||||
&& lexer.identifierEquals("byte") //
|
||||
|
||||
if (typeNameHashCode == FnvHash.Constants.LONG
|
||||
&& lexer.identifierEquals(FnvHash.Constants.BYTE)
|
||||
&& JdbcConstants.MYSQL.equals(getDbType()) //
|
||||
) {
|
||||
typeName += (' ' + lexer.stringVal());
|
||||
lexer.nextToken();
|
||||
} else if ("double".equalsIgnoreCase(typeName)
|
||||
} else if (typeNameHashCode == FnvHash.Constants.DOUBLE
|
||||
&& JdbcConstants.POSTGRESQL.equals(getDbType()) //
|
||||
) {
|
||||
typeName += (' ' + lexer.stringVal());
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (typeNameHashCode == FnvHash.Constants.UNSIGNED) {
|
||||
if (lexer.token == Token.IDENTIFIER) {
|
||||
typeName += (' ' + lexer.stringVal());
|
||||
lexer.nextToken();
|
||||
}
|
||||
}
|
||||
|
||||
if (isCharType(typeName)) {
|
||||
SQLCharacterDataType charType = new SQLCharacterDataType(typeName);
|
||||
|
||||
|
||||
@@ -447,6 +447,7 @@ public final class FnvHash {
|
||||
long RAW = fnv1a_64_lower("RAW");
|
||||
long LONG_RAW = fnv1a_64_lower("LONG RAW");
|
||||
long LONG = fnv1a_64_lower("LONG");
|
||||
long BYTE = fnv1a_64_lower("BYTE");
|
||||
long ROWNUM = fnv1a_64_lower("ROWNUM");
|
||||
long SYSDATE = fnv1a_64_lower("SYSDATE");
|
||||
long SQLCODE = fnv1a_64_lower("SQLCODE");
|
||||
|
||||
Reference in New Issue
Block a user