Search in sources :

Example 1 with CreateUserDataType

use of org.h2.command.ddl.CreateUserDataType in project h2database by h2database.

the class Parser method parseCreateUserDataType.

private CreateUserDataType parseCreateUserDataType() {
    boolean ifNotExists = readIfNotExists();
    CreateUserDataType command = new CreateUserDataType(session);
    command.setTypeName(readUniqueIdentifier());
    read("AS");
    Column col = parseColumnForTable("VALUE", true);
    if (readIf("CHECK")) {
        Expression expr = readExpression();
        col.addCheckConstraint(session, expr);
    }
    col.rename(null);
    command.setColumn(col);
    command.setIfNotExists(ifNotExists);
    return command;
}
Also used : AlterTableRenameColumn(org.h2.command.ddl.AlterTableRenameColumn) AlterTableAlterColumn(org.h2.command.ddl.AlterTableAlterColumn) Column(org.h2.table.Column) ExpressionColumn(org.h2.expression.ExpressionColumn) IndexColumn(org.h2.table.IndexColumn) Expression(org.h2.expression.Expression) ValueExpression(org.h2.expression.ValueExpression) CreateUserDataType(org.h2.command.ddl.CreateUserDataType)

Aggregations

AlterTableAlterColumn (org.h2.command.ddl.AlterTableAlterColumn)1 AlterTableRenameColumn (org.h2.command.ddl.AlterTableRenameColumn)1 CreateUserDataType (org.h2.command.ddl.CreateUserDataType)1 Expression (org.h2.expression.Expression)1 ExpressionColumn (org.h2.expression.ExpressionColumn)1 ValueExpression (org.h2.expression.ValueExpression)1 Column (org.h2.table.Column)1 IndexColumn (org.h2.table.IndexColumn)1