OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Parser::RenameUserStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::RenameUserStmt:
+ Collaboration diagram for Parser::RenameUserStmt:

Public Member Functions

 RenameUserStmt (std::string *username, std::string *new_username)
 
auto const & getOldUserName ()
 
auto const & getNewUserName ()
 
void execute (const Catalog_Namespace::SessionInfo &session) 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 > username_
 
std::unique_ptr< std::string > new_username_
 

Detailed Description

Definition at line 1254 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::RenameUserStmt::RenameUserStmt ( std::string *  username,
std::string *  new_username 
)
inline

Definition at line 1256 of file ParserNode.h.

1257  : username_(username), new_username_(new_username) {}
std::unique_ptr< std::string > username_
Definition: ParserNode.h:1263
std::unique_ptr< std::string > new_username_
Definition: ParserNode.h:1264

Member Function Documentation

void Parser::RenameUserStmt::execute ( const Catalog_Namespace::SessionInfo session)
overridevirtual

Implements Parser::DDLStmt.

Definition at line 3211 of file ParserNode.cpp.

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

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

3211  {
3212  if (!session.get_currentUser().isSuper) {
3213  throw std::runtime_error("Only a super user can rename users.");
3214  }
3215 
3217  if (!SysCatalog::instance().getMetadataForUser(*username_, user)) {
3218  throw std::runtime_error("User " + *username_ + " does not exist.");
3219  }
3220 
3221  SysCatalog::instance().renameUser(*username_, *new_username_);
3222 }
std::unique_ptr< std::string > username_
Definition: ParserNode.h:1263
std::unique_ptr< std::string > new_username_
Definition: ParserNode.h:1264
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:68
std::atomic< bool > isSuper
Definition: SysCatalog.h:94

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

auto const& Parser::RenameUserStmt::getNewUserName ( )
inline

Definition at line 1259 of file ParserNode.h.

References new_username_.

1259 { return new_username_; }
std::unique_ptr< std::string > new_username_
Definition: ParserNode.h:1264
auto const& Parser::RenameUserStmt::getOldUserName ( )
inline

Definition at line 1258 of file ParserNode.h.

References username_.

1258 { return username_; }
std::unique_ptr< std::string > username_
Definition: ParserNode.h:1263

Member Data Documentation

std::unique_ptr<std::string> Parser::RenameUserStmt::new_username_
private

Definition at line 1264 of file ParserNode.h.

Referenced by getNewUserName().

std::unique_ptr<std::string> Parser::RenameUserStmt::username_
private

Definition at line 1263 of file ParserNode.h.

Referenced by getOldUserName().


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