OmniSciDB  c0231cc57d
 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 2061 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 6719 of file ParserNode.cpp.

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

6719  {
6720  CHECK(payload.HasMember("name"));
6721  user_name_ = std::make_unique<std::string>(json_str(payload["name"]));
6723  if_exists_ = false;
6724  if (payload.HasMember("ifExists")) {
6725  if_exists_ = json_bool(payload["ifExists"]);
6726  }
6727 }
const bool json_bool(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:49
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2070
#define CHECK(condition)
Definition: Logger.h:222

+ Here is the call graph for this function:

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

Definition at line 2064 of file ParserNode.h.

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

Member Function Documentation

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

Implements Parser::DDLStmt.

Definition at line 6729 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().

6730  {
6731  if (read_only_mode) {
6732  throw std::runtime_error("DROP USER invalid in read only mode.");
6733  }
6734  if (!session.get_currentUser().isSuper) {
6735  throw std::runtime_error("Only super user can drop users.");
6736  }
6738  // Test to see if the user does not exist *and* if_exists_ flag set
6740  if (if_exists_ && !SysCatalog::instance().getMetadataForUser(*user_name_, user))
6741  return;
6743  SysCatalog::instance().dropUser(*user_name_);
6744 }
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2070
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 ( )

Definition at line 2065 of file ParserNode.h.

References user_name_.

2065 { return user_name_; }
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2070

Member Data Documentation

bool Parser::DropUserStmt::if_exists_

Definition at line 2071 of file ParserNode.h.

Referenced by DropUserStmt(), and execute().

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

Definition at line 2070 of file ParserNode.h.

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

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