OmniSciDB  c1a53651b2
 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 2017 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 6746 of file ParserNode.cpp.

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

6746  {
6747  CHECK(payload.HasMember("name"));
6748  user_name_ = std::make_unique<std::string>(json_str(payload["name"]));
6750  if_exists_ = false;
6751  if (payload.HasMember("ifExists")) {
6752  if_exists_ = json_bool(payload["ifExists"]);
6753  }
6754 }
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:2026
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

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

Definition at line 2020 of file ParserNode.h.

2020 : user_name_(n), if_exists_(e) {}
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2026
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 6756 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().

6757  {
6758  if (read_only_mode) {
6759  throw std::runtime_error("DROP USER invalid in read only mode.");
6760  }
6761  if (!session.get_currentUser().isSuper) {
6762  throw std::runtime_error("Only super user can drop users.");
6763  }
6765  // Test to see if the user does not exist *and* if_exists_ flag set
6767  if (if_exists_ && !SysCatalog::instance().getMetadataForUser(*user_name_, user))
6768  return;
6770  SysCatalog::instance().dropUser(*user_name_);
6771 }
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2026
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 2021 of file ParserNode.h.

References user_name_.

2021 { return user_name_; }
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2026

Member Data Documentation

bool Parser::DropUserStmt::if_exists_

Definition at line 2027 of file ParserNode.h.

Referenced by DropUserStmt(), and execute().

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

Definition at line 2026 of file ParserNode.h.

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

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