OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Parser::RenameTableStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::RenameTableStmt:
+ Collaboration diagram for Parser::RenameTableStmt:

Public Member Functions

 RenameTableStmt (std::string *tab, std::string *new_tab_name)
 
const std::string * get_prev_table () const
 
const std::string * get_new_table () const
 
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 > table
 
std::unique_ptr< std::string > new_table_name
 

Detailed Description

Definition at line 1227 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::RenameTableStmt::RenameTableStmt ( std::string *  tab,
std::string *  new_tab_name 
)
inline

Definition at line 1229 of file ParserNode.h.

1230  : table(tab), new_table_name(new_tab_name) {}
std::unique_ptr< std::string > new_table_name
Definition: ParserNode.h:1238
std::unique_ptr< std::string > table
Definition: ParserNode.h:1237

Member Function Documentation

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

Implements Parser::DDLStmt.

Definition at line 2959 of file ParserNode.cpp.

References Parser::check_alter_table_privilege(), and Catalog_Namespace::SessionInfo::getCatalog().

2959  {
2960  auto& catalog = session.getCatalog();
2961  const TableDescriptor* td = catalog.getMetadataForTable(*table);
2962  if (td == nullptr) {
2963  throw std::runtime_error("Table " + *table + " does not exist.");
2964  }
2965  check_alter_table_privilege(session, td);
2966  if (catalog.getMetadataForTable(*new_table_name) != nullptr) {
2967  throw std::runtime_error("Table or View " + *new_table_name + " already exists.");
2968  }
2969  catalog.renameTable(td, *new_table_name);
2970 }
std::unique_ptr< std::string > new_table_name
Definition: ParserNode.h:1238
void check_alter_table_privilege(const Catalog_Namespace::SessionInfo &session, const TableDescriptor *td)
Catalog & getCatalog() const
Definition: SessionInfo.h:90
specifies the content in-memory of a row in the table metadata table
std::unique_ptr< std::string > table
Definition: ParserNode.h:1237

+ Here is the call graph for this function:

const std::string* Parser::RenameTableStmt::get_new_table ( ) const
inline

Definition at line 1233 of file ParserNode.h.

References new_table_name.

1233 { return new_table_name.get(); }
std::unique_ptr< std::string > new_table_name
Definition: ParserNode.h:1238
const std::string* Parser::RenameTableStmt::get_prev_table ( ) const
inline

Definition at line 1232 of file ParserNode.h.

References table.

1232 { return table.get(); }
std::unique_ptr< std::string > table
Definition: ParserNode.h:1237

Member Data Documentation

std::unique_ptr<std::string> Parser::RenameTableStmt::new_table_name
private

Definition at line 1238 of file ParserNode.h.

Referenced by get_new_table().

std::unique_ptr<std::string> Parser::RenameTableStmt::table
private

Definition at line 1237 of file ParserNode.h.

Referenced by get_prev_table().


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