MCPcopy Create free account
hub / github.com/ByConity/ByConity / execute

Method execute

src/Interpreters/InterpreterDropAccessEntityQuery.cpp:25–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25BlockIO InterpreterDropAccessEntityQuery::execute()
26{
27 auto & query = query_ptr->as<ASTDropAccessEntityQuery &>();
28 auto & access_control = getContext()->getAccessControlManager();
29 getContext()->checkAccess(getRequiredAccess());
30
31 if (!query.cluster.empty())
32 return executeDDLQueryOnCluster(query_ptr, getContext());
33
34 query.replaceEmptyDatabase(getContext()->getCurrentDatabase());
35
36 auto do_drop = [&](const Strings & names)
37 {
38 if (query.if_exists)
39 access_control.tryRemove(access_control.find(query.type, names));
40 else
41 access_control.remove(access_control.getIDs(query.type, names));
42 };
43
44 if (query.type == EntityType::ROW_POLICY)
45 do_drop(query.row_policy_names->toStrings());
46 else
47 do_drop(query.names);
48
49 return {};
50}
51
52
53AccessRightsElements InterpreterDropAccessEntityQuery::getRequiredAccess() const

Callers

nothing calls this directly

Calls 10

executeDDLQueryOnClusterFunction · 0.85
getCurrentDatabaseMethod · 0.80
checkAccessMethod · 0.45
emptyMethod · 0.45
replaceEmptyDatabaseMethod · 0.45
tryRemoveMethod · 0.45
findMethod · 0.45
removeMethod · 0.45
getIDsMethod · 0.45
toStringsMethod · 0.45

Tested by

no test coverage detected