OmniSciDB  29e35f4d58
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

◆ DropViewStmt()

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

◆ execute()

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

Implements Parser::DDLStmt.

Definition at line 4430 of file ParserNode.cpp.

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

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

◆ get_view_name()

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

Definition at line 1794 of file ParserNode.h.

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

Member Data Documentation

◆ if_exists

bool Parser::DropViewStmt::if_exists
private

Definition at line 1799 of file ParserNode.h.

◆ view_name

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

Definition at line 1798 of file ParserNode.h.


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