OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser::DropUserStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::DropUserStmt:
+ Collaboration diagram for Parser::DropUserStmt:

Public Member Functions

 DropUserStmt (const rapidjson::Value &payload)
 
 DropUserStmt (std::string *n, bool e)
 
auto const & getUserName ()
 
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 > user_name_
 
bool if_exists_
 

Detailed Description

Definition at line 2057 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::DropUserStmt::DropUserStmt ( const rapidjson::Value &  payload)

Definition at line 7033 of file ParserNode.cpp.

References CHECK, if_exists_, json_bool(), json_str(), and user_name_.

7033  {
7034  CHECK(payload.HasMember("name"));
7035  user_name_ = std::make_unique<std::string>(json_str(payload["name"]));
7036 
7037  if_exists_ = false;
7038  if (payload.HasMember("ifExists")) {
7039  if_exists_ = json_bool(payload["ifExists"]);
7040  }
7041 }
const bool json_bool(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:51
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:46
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2066
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

Parser::DropUserStmt::DropUserStmt ( std::string *  n,
bool  e 
)
inline

Definition at line 2060 of file ParserNode.h.

2060 : user_name_(n), if_exists_(e) {}
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2066
constexpr double n
Definition: Utm.h:38

Member Function Documentation

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

Implements Parser::DDLStmt.

Definition at line 7043 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::get_currentUser(), if_exists_, Catalog_Namespace::UserMetadata::isSuper, and user_name_.

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

7044  {
7045  if (read_only_mode) {
7046  throw std::runtime_error("DROP USER invalid in read only mode.");
7047  }
7048 
7049  if (!session.get_currentUser().isSuper) {
7050  throw std::runtime_error("Only super user can drop users.");
7051  }
7052 
7053  SysCatalog::instance().dropUser(*user_name_, if_exists_);
7054 }
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2066
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:88
std::atomic< bool > isSuper
Definition: SysCatalog.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

auto const& Parser::DropUserStmt::getUserName ( )
inline

Definition at line 2061 of file ParserNode.h.

References user_name_.

2061 { return user_name_; }
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2066

Member Data Documentation

bool Parser::DropUserStmt::if_exists_
private

Definition at line 2067 of file ParserNode.h.

Referenced by DropUserStmt(), and execute().

std::unique_ptr<std::string> Parser::DropUserStmt::user_name_
private

Definition at line 2066 of file ParserNode.h.

Referenced by DropUserStmt(), execute(), and getUserName().


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