OmniSciDB  a5dc49c757
 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 7054 of file ParserNode.cpp.

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

7054  {
7055  CHECK(payload.HasMember("name"));
7056  user_name_ = std::make_unique<std::string>(json_str(payload["name"]));
7057 
7058  if_exists_ = false;
7059  if (payload.HasMember("ifExists")) {
7060  if_exists_ = json_bool(payload["ifExists"]);
7061  }
7062 }
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 7064 of file ParserNode.cpp.

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

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

7065  {
7066  if (read_only_mode) {
7067  throw std::runtime_error("DROP USER invalid in read only mode.");
7068  }
7069 
7070  if (!session.get_currentUser().isSuper) {
7071  throw std::runtime_error("Only super user can drop users.");
7072  }
7073 
7075 }
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2066
T & instance()
Definition: LockMgr.cpp:101
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: