* (non-Javadoc)
* @see org.modeshape.sequencer.ddl.datatype.DataTypeParser#parseCustomType(org.modeshape.common.text.DdlTokenStream)
*/
@Override
protected DataType parseCustomType( DdlTokenStream tokens ) throws ParsingException {
DataType dataType = null;
String typeName = null;
if (tokens.matches(OracleDataTypes.DTYPE_BINARY_FLOAT)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_BINARY_FLOAT);
dataType.setName(typeName);
} else if (tokens.matches(OracleDataTypes.DTYPE_BINARY_DOUBLE)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_BINARY_DOUBLE);
dataType.setName(typeName);
} else if (tokens.matches(OracleDataTypes.DTYPE_LONG)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_LONG);
dataType.setName(typeName);
} else if (tokens.matches(OracleDataTypes.DTYPE_LONG_RAW)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_LONG_RAW);
dataType.setName(typeName);
} else if (tokens.matches(OracleDataTypes.DTYPE_BLOB)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_BLOB);
dataType.setName(typeName);
} else if (tokens.matches(OracleDataTypes.DTYPE_CLOB)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_CLOB);
dataType.setName(typeName);
} else if (tokens.matches(OracleDataTypes.DTYPE_NCLOB)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_NCLOB);
dataType.setName(typeName);
} else if (tokens.matches(OracleDataTypes.DTYPE_BFILE)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_BFILE);
dataType.setName(typeName);
} else if (tokens.matches(OracleDataTypes.DTYPE_VARCHAR2)) {
dataType = new DataType();
// VARCHAR2(size [BYTE | CHAR])
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_VARCHAR2); // VARCHAR2
consume(tokens, dataType, false, L_PAREN);
long length = parseLong(tokens, dataType);
canConsume(tokens, dataType, true, "BYTE");
canConsume(tokens, dataType, true, "CHAR");
consume(tokens, dataType, false, R_PAREN);
dataType.setName(typeName);
dataType.setLength(length);
} else if (tokens.matches(OracleDataTypes.DTYPE_RAW)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_RAW);
long length = parseBracketedLong(tokens, dataType);
dataType.setName(typeName);
dataType.setLength(length);
} else if (tokens.matches(OracleDataTypes.DTYPE_NVARCHAR2)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_NVARCHAR2);
long length = parseBracketedLong(tokens, dataType);
dataType.setName(typeName);
dataType.setLength(length);
} else if (tokens.matches(OracleDataTypes.DTYPE_NUMBER)) {
dataType = new DataType();
typeName = consume(tokens, dataType, true, OracleDataTypes.DTYPE_NUMBER);
int precision = 0;
int scale = 0;
if (tokens.matches(L_PAREN)) {
consume(tokens, dataType, false, L_PAREN);
precision = (int)parseLong(tokens, dataType);
if (canConsume(tokens, dataType, false, COMMA)) {
scale = (int)parseLong(tokens, dataType);
} else {
scale = getDefaultScale();
}
consume(tokens, dataType, false, R_PAREN);
} else {
precision = getDefaultPrecision();
scale = getDefaultScale();
}
dataType.setName(typeName);
dataType.setPrecision(precision);
dataType.setScale(scale);
} else if (tokens.matches(OracleDataTypes.DTYPE_INTERVAL_YEAR)) {
// INTERVAL YEAR (year_precision) TO MONTH
} else if (tokens.matches(OracleDataTypes.DTYPE_INTERVAL_DAY)) {
// INTERVAL DAY (day_precision) TO SECOND (fractional_seconds_precision)