Search in sources :

Example 1 with CreateConstant

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

the class Parser method parseCreateConstant.

private CreateConstant parseCreateConstant() {
    boolean ifNotExists = readIfNotExists();
    String constantName = readIdentifierWithSchema();
    Schema schema = getSchema();
    if (isKeyword(constantName)) {
        throw DbException.get(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName);
    }
    read("VALUE");
    Expression expr = readExpression();
    CreateConstant command = new CreateConstant(session, schema);
    command.setConstantName(constantName);
    command.setExpression(expr);
    command.setIfNotExists(ifNotExists);
    return command;
}
Also used : Expression(org.h2.expression.Expression) ValueExpression(org.h2.expression.ValueExpression) DropSchema(org.h2.command.ddl.DropSchema) CreateSchema(org.h2.command.ddl.CreateSchema) Schema(org.h2.schema.Schema) ValueString(org.h2.value.ValueString) CreateConstant(org.h2.command.ddl.CreateConstant)

Aggregations

CreateConstant (org.h2.command.ddl.CreateConstant)1 CreateSchema (org.h2.command.ddl.CreateSchema)1 DropSchema (org.h2.command.ddl.DropSchema)1 Expression (org.h2.expression.Expression)1 ValueExpression (org.h2.expression.ValueExpression)1 Schema (org.h2.schema.Schema)1 ValueString (org.h2.value.ValueString)1