OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Parser::DropViewStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::DropViewStmt:
+ Collaboration diagram for Parser::DropViewStmt:

Public Member Functions

 DropViewStmt (std::string *v, bool i)
 
const std::string * get_view_name () 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 > view_name
 
bool if_exists
 

Detailed Description

Definition at line 1791 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::DropViewStmt::DropViewStmt ( std::string *  v,
bool  i 
)
inline

Definition at line 1793 of file ParserNode.h.

1793 : view_name(v), if_exists(i) {}
std::unique_ptr< std::string > view_name
Definition: ParserNode.h:1798

Member Function Documentation

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

Implements Parser::DDLStmt.

Definition at line 4431 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), AccessPrivileges::DROP_VIEW, Catalog_Namespace::SessionInfo::getCatalog(), TableDescriptor::isView, and ViewDBObjectType.

4431  {
4432  auto& catalog = session.getCatalog();
4433  const TableDescriptor* td = catalog.getMetadataForTable(*view_name);
4434  if (td == nullptr) {
4435  if (if_exists) {
4436  return;
4437  }
4438  throw std::runtime_error("View " + *view_name + " does not exist.");
4439  }
4440 
4441  if (!session.checkDBAccessPrivileges(
4443  throw std::runtime_error("View " + *view_name +
4444  " will not be dropped. User has no drop view privileges.");
4445  }
4446 
4447  if (!td->isView) {
4448  throw std::runtime_error(*view_name + " is a table. Use DROP TABLE.");
4449  }
4450  catalog.dropTable(td);
4451 }
std::unique_ptr< std::string > view_name
Definition: ParserNode.h:1798
Catalog & getCatalog() const
Definition: SessionInfo.h:90
static const AccessPrivileges DROP_VIEW
Definition: DBObject.h:172
specifies the content in-memory of a row in the table metadata table
bool checkDBAccessPrivileges(const DBObjectType &permissionType, const AccessPrivileges &privs, const std::string &objectName="") const
Definition: SessionInfo.cpp:24

+ Here is the call graph for this function:

const std::string* Parser::DropViewStmt::get_view_name ( ) const
inline

Definition at line 1794 of file ParserNode.h.

References view_name.

1794 { return view_name.get(); }
std::unique_ptr< std::string > view_name
Definition: ParserNode.h:1798

Member Data Documentation

bool Parser::DropViewStmt::if_exists
private

Definition at line 1799 of file ParserNode.h.

std::unique_ptr<std::string> Parser::DropViewStmt::view_name
private

Definition at line 1798 of file ParserNode.h.

Referenced by get_view_name().


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