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;
}
Aggregations