Search in sources :

Example 1 with GrantRevoke

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

the class Parser method parseGrantRevoke.

private GrantRevoke parseGrantRevoke(int operationType) {
    GrantRevoke command = new GrantRevoke(session);
    command.setOperationType(operationType);
    boolean tableClauseExpected = addRoleOrRight(command);
    while (readIf(",")) {
        addRoleOrRight(command);
        if (command.isRightMode() && command.isRoleMode()) {
            throw DbException.get(ErrorCode.ROLES_AND_RIGHT_CANNOT_BE_MIXED);
        }
    }
    if (tableClauseExpected) {
        if (readIf("ON")) {
            if (readIf("SCHEMA")) {
                Schema schema = database.getSchema(readAliasIdentifier());
                command.setSchema(schema);
            } else {
                do {
                    Table table = readTableOrView();
                    command.addTable(table);
                } while (readIf(","));
            }
        }
    }
    if (operationType == CommandInterface.GRANT) {
        read("TO");
    } else {
        read("FROM");
    }
    command.setGranteeName(readUniqueIdentifier());
    return command;
}
Also used : RangeTable(org.h2.table.RangeTable) TruncateTable(org.h2.command.ddl.TruncateTable) CreateTable(org.h2.command.ddl.CreateTable) FunctionTable(org.h2.table.FunctionTable) CreateLinkedTable(org.h2.command.ddl.CreateLinkedTable) Table(org.h2.table.Table) DropTable(org.h2.command.ddl.DropTable) DropSchema(org.h2.command.ddl.DropSchema) CreateSchema(org.h2.command.ddl.CreateSchema) Schema(org.h2.schema.Schema) GrantRevoke(org.h2.command.ddl.GrantRevoke)

Aggregations

CreateLinkedTable (org.h2.command.ddl.CreateLinkedTable)1 CreateSchema (org.h2.command.ddl.CreateSchema)1 CreateTable (org.h2.command.ddl.CreateTable)1 DropSchema (org.h2.command.ddl.DropSchema)1 DropTable (org.h2.command.ddl.DropTable)1 GrantRevoke (org.h2.command.ddl.GrantRevoke)1 TruncateTable (org.h2.command.ddl.TruncateTable)1 Schema (org.h2.schema.Schema)1 FunctionTable (org.h2.table.FunctionTable)1 RangeTable (org.h2.table.RangeTable)1 Table (org.h2.table.Table)1