OmniSciDB  04ee39c94c
Parser::DropRoleStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::DropRoleStmt:
+ Collaboration diagram for Parser::DropRoleStmt:

Public Member Functions

 DropRoleStmt (std::string *r)
 
const std::string & get_role () const
 
void execute (const Catalog_Namespace::SessionInfo &session) override
 
- Public Member Functions inherited from Parser::DDLStmt
void setColumnDescriptor (ColumnDescriptor &cd, const ColumnDef *coldef)
 
- Public Member Functions inherited from Parser::Node
virtual ~Node ()
 

Private Attributes

std::unique_ptr< std::string > role
 

Detailed Description

Definition at line 1337 of file ParserNode.h.

Constructor & Destructor Documentation

◆ DropRoleStmt()

Parser::DropRoleStmt::DropRoleStmt ( std::string *  r)
inline

Definition at line 1339 of file ParserNode.h.

1339 : role(r) {}
std::unique_ptr< std::string > role
Definition: ParserNode.h:1344

Member Function Documentation

◆ execute()

void Parser::DropRoleStmt::execute ( const Catalog_Namespace::SessionInfo session)
overridevirtual

Implements Parser::DDLStmt.

Definition at line 3723 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::get_currentUser().

3723  {
3724  const auto& currentUser = session.get_currentUser();
3725  if (!currentUser.isSuper) {
3726  throw std::runtime_error("DROP ROLE " + get_role() +
3727  " failed. It can only be executed by super user.");
3728  }
3729  auto* rl = SysCatalog::instance().getRoleGrantee(get_role());
3730  if (!rl) {
3731  throw std::runtime_error("DROP ROLE " + get_role() +
3732  " failed because role with this name does not exist.");
3733  }
3734  SysCatalog::instance().dropRole(get_role());
3735 }
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:93
const std::string & get_role() const
Definition: ParserNode.h:1340
+ Here is the call graph for this function:

◆ get_role()

const std::string& Parser::DropRoleStmt::get_role ( ) const
inline

Definition at line 1340 of file ParserNode.h.

References session.

1340 { return *role; }
std::unique_ptr< std::string > role
Definition: ParserNode.h:1344

Member Data Documentation

◆ role

std::unique_ptr<std::string> Parser::DropRoleStmt::role
private

Definition at line 1344 of file ParserNode.h.


The documentation for this class was generated from the following files: