use of org.jooq.GrantToStep in project jOOQ by jOOQ.
the class DefaultParseContext method parseGrant.
private final DDLQuery parseGrant() {
parseKeyword("GRANT");
Privilege privilege = parsePrivilege();
List<Privilege> privileges = null;
while (parseIf(',')) {
if (privileges == null) {
privileges = new ArrayList<>();
privileges.add(privilege);
}
privileges.add(parsePrivilege());
}
parseKeyword("ON");
parseKeywordIf("TABLE");
Table<?> table = parseTableName();
parseKeyword("TO");
User user = parseKeywordIf("PUBLIC") ? null : parseUser();
GrantOnStep s1 = privileges == null ? dsl.grant(privilege) : dsl.grant(privileges);
GrantToStep s2 = s1.on(table);
GrantWithGrantOptionStep s3 = user == null ? s2.toPublic() : s2.to(user);
return parseKeywordIf("WITH GRANT OPTION") ? s3.withGrantOption() : s3;
}
Aggregations