// CASE 1
String content = "PARTID VARCHAR (255) NOT NULL DEFAULT '12345'";
DdlTokenStream tokens = getTokens(content);
AstNode tableNode = parser.nodeFactory().node("PARTID", rootNode, TYPE_CREATE_TABLE_STATEMENT, rootNode);
parser.setRootNode(rootNode);
parser.parseColumnDefinition(tokens, tableNode, false);
assertEquals(1, tableNode.getChildCount());
AstNode column = tableNode.getChildren().get(0);
assertEquals("VARCHAR", column.getProperty(DATATYPE_NAME));
assertEquals(255L, column.getProperty(DATATYPE_LENGTH));
assertTrue(column.getProperty(DATATYPE_PRECISION) == null);
assertEquals("NOT NULL", column.getProperty(NULLABLE));
assertEquals(DEFAULT_ID_LITERAL, column.getProperty(DEFAULT_OPTION));
assertEquals("12345", column.getProperty(DEFAULT_VALUE));
tableNode.removeAllChildren();
// CASE 2
content = "PARTID CHARACTER (255) NULL DEFAULT (12345)";
tokens = getTokens(content);
parser.parseColumnDefinition(tokens, tableNode, false);
assertEquals(1, tableNode.getChildCount());
column = tableNode.getChildren().get(0);
assertEquals("CHARACTER", column.getProperty(DATATYPE_NAME));
assertEquals(255L, column.getProperty(DATATYPE_LENGTH));
assertTrue(column.getProperty(DATATYPE_PRECISION) == null);
assertEquals("NULL", column.getProperty(NULLABLE));
assertEquals(DEFAULT_ID_LITERAL, column.getProperty(DEFAULT_OPTION));
assertEquals("12345", column.getProperty(DEFAULT_VALUE));
tableNode.removeAllChildren();
// CASE 3
content = "PARTID DECIMAL (6, 2) DEFAULT (6.213)";
tokens = getTokens(content);
parser.parseColumnDefinition(tokens, tableNode, false);
assertEquals(1, tableNode.getChildCount());
column = tableNode.getChildren().get(0);
assertEquals("DECIMAL", column.getProperty(DATATYPE_NAME));
assertEquals(6, column.getProperty(DATATYPE_PRECISION));
assertEquals(2, column.getProperty(DATATYPE_SCALE));
assertTrue(column.getProperty(DATATYPE_LENGTH) == null);
assertEquals(DEFAULT_ID_LITERAL, column.getProperty(DEFAULT_OPTION));
assertEquals("6.213", column.getProperty(DEFAULT_VALUE));
}