return result;
}
@Override
protected DataType parseCustomType( DdlTokenStream tokens ) throws ParsingException {
DataType dataType = null;
if (tokens.matches(DTYPE_FIXED) || tokens.matches(DTYPE_DOUBLE)) {
dataType = new DataType();
String typeName = tokens.consume();
dataType.setName(typeName);
int precision = 0;
int scale = 0;
if (tokens.matches(L_PAREN)) {
consume(tokens, dataType, false, L_PAREN);
precision = (int)parseLong(tokens, dataType);
if (tokens.canConsume(COMMA)) {
scale = (int)parseLong(tokens, dataType);
} else {
scale = getDefaultScale();
}
tokens.consume(R_PAREN);
} else {
precision = getDefaultPrecision();
scale = getDefaultScale();
}
dataType.setPrecision(precision);
dataType.setScale(scale);
} else if (tokens.matches(DTYPE_MEDIUMBLOB) || tokens.matches(DTYPE_LONGBLOB) || tokens.matches(DTYPE_BLOB)
|| tokens.matches(DTYPE_TINYBLOB) || tokens.matches(DTYPE_YEAR) || tokens.matches(DTYPE_DATETIME)
|| tokens.matches(DTYPE_BOOLEAN) || tokens.matches(DTYPE_BOOL)) {
String typeName = tokens.consume();
dataType = new DataType(typeName);
} else if (tokens.matches(DTYPE_MEDIUMINT) || tokens.matches(DTYPE_TINYINT) || tokens.matches(DTYPE_VARBINARY)
|| tokens.matches(DTYPE_BINARY) || tokens.matches(DTYPE_BIGINT)) {
String typeName = tokens.consume();
dataType = new DataType(typeName);
long length = getDefaultLength();
if (tokens.matches(L_PAREN)) {
length = parseBracketedLong(tokens, dataType);
}
dataType.setLength(length);
} else if (tokens.matches(DTYPE_NATIONAL_VARCHAR)) {
String typeName = getStatementTypeName(DTYPE_NATIONAL_VARCHAR);
dataType = new DataType(typeName);
tokens.consume(DTYPE_NATIONAL_VARCHAR);
long length = getDefaultLength();
if (tokens.matches(L_PAREN)) {
length = parseBracketedLong(tokens, dataType);
}
dataType.setLength(length);
} else if (tokens.matches(DTYPE_MEDIUMTEXT) || tokens.matches(DTYPE_TEXT) || tokens.matches(DTYPE_LONGTEXT)
|| tokens.matches(DTYPE_TINYTEXT)) {
String typeName = tokens.consume();
dataType = new DataType(typeName);
tokens.canConsume("BINARY");
tokens.canConsume("COLLATE", TokenStream.ANY_VALUE);
tokens.canConsume("CHARACTER", "SET", TokenStream.ANY_VALUE);
tokens.canConsume("COLLATE", TokenStream.ANY_VALUE);
} else if (tokens.matches(DTYPE_SET)) {
// SET(value1,value2,value3,...) [CHARACTER SET charset_name] [COLLATE collation_name]
String typeName = tokens.consume();
dataType = new DataType(typeName);
tokens.consume(L_PAREN);
do {
tokens.consume();
} while (tokens.canConsume(COMMA));
tokens.consume(R_PAREN);
tokens.canConsume("COLLATE", TokenStream.ANY_VALUE);
tokens.canConsume("CHARACTER", "SET", TokenStream.ANY_VALUE);
tokens.canConsume("COLLATE", TokenStream.ANY_VALUE);
} else if (tokens.matches(DTYPE_ENUM)) {
// ENUM(value1,value2,value3,...) [CHARACTER SET charset_name] [COLLATE collation_name]
String typeName = tokens.consume();
dataType = new DataType(typeName);
tokens.consume(L_PAREN);
do {
tokens.consume();
} while (tokens.canConsume(COMMA));