Search in sources :

Example 1 with AlterSchemaRename

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

the class Parser method parseAlterSchema.

private Prepared parseAlterSchema() {
    boolean ifExists = readIfExists(false);
    String schemaName = readIdentifierWithSchema();
    Schema old = getSchema();
    read("RENAME");
    read("TO");
    String newName = readIdentifierWithSchema(old.getName());
    Schema schema = findSchema(schemaName);
    if (schema == null) {
        if (ifExists) {
            return new NoOperation(session);
        }
        throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);
    }
    AlterSchemaRename command = new AlterSchemaRename(session);
    command.setOldSchema(schema);
    checkSchema(old);
    command.setNewName(newName);
    return command;
}
Also used : NoOperation(org.h2.command.dml.NoOperation) DropSchema(org.h2.command.ddl.DropSchema) CreateSchema(org.h2.command.ddl.CreateSchema) Schema(org.h2.schema.Schema) AlterSchemaRename(org.h2.command.ddl.AlterSchemaRename) ValueString(org.h2.value.ValueString)

Aggregations

AlterSchemaRename (org.h2.command.ddl.AlterSchemaRename)1 CreateSchema (org.h2.command.ddl.CreateSchema)1 DropSchema (org.h2.command.ddl.DropSchema)1 NoOperation (org.h2.command.dml.NoOperation)1 Schema (org.h2.schema.Schema)1 ValueString (org.h2.value.ValueString)1