OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser::CreateRoleStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::CreateRoleStmt:
+ Collaboration diagram for Parser::CreateRoleStmt:

Public Member Functions

 CreateRoleStmt (std::string *r)
 
 CreateRoleStmt (const rapidjson::Value &payload)
 
const std::string & get_role () const
 
void execute (const Catalog_Namespace::SessionInfo &session, bool read_only_mode) 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 1512 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 1514 of file ParserNode.h.

1514 : role_(r) {}
std::unique_ptr< std::string > role_
Definition: ParserNode.h:1521
Parser::CreateRoleStmt::CreateRoleStmt ( const rapidjson::Value &  payload)

Definition at line 5921 of file ParserNode.cpp.

References CHECK, json_str(), and role_.

5921  {
5922  CHECK(payload.HasMember("role"));
5923  role_ = std::make_unique<std::string>(json_str(payload["role"]));
5924 }
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:46
std::unique_ptr< std::string > role_
Definition: ParserNode.h:1521
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

Member Function Documentation

void Parser::CreateRoleStmt::execute ( const Catalog_Namespace::SessionInfo session,
bool  read_only_mode 
)
overridevirtual

Implements Parser::DDLStmt.

Definition at line 5926 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::get_currentUser(), get_role(), and lockmgr::instance().

Referenced by heavydb.cursor.Cursor::executemany().

5927  {
5928  if (read_only_mode) {
5929  throw std::runtime_error("CREATE ROLE invalid in read only mode.");
5930  }
5931  const auto& currentUser = session.get_currentUser();
5932  if (!currentUser.isSuper) {
5933  throw std::runtime_error("CREATE ROLE " + get_role() +
5934  " failed. It can only be executed by super user.");
5935  }
5936  SysCatalog::instance().createRole(
5937  get_role(), /*user_private_role=*/false, /*is_temporary=*/false);
5938 }
const std::string & get_role() const
Definition: ParserNode.h:1516
T & instance()
Definition: LockMgr.cpp:101
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:88

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1516 of file ParserNode.h.

References role_.

Referenced by execute().

1516 { return *role_; }
std::unique_ptr< std::string > role_
Definition: ParserNode.h:1521

+ Here is the caller graph for this function:

Member Data Documentation

std::unique_ptr<std::string> Parser::CreateRoleStmt::role_
private

Definition at line 1521 of file ParserNode.h.

Referenced by CreateRoleStmt(), and get_role().


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