OmniSciDB  c07336695a
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 1690 of file ParserNode.h.

Constructor & Destructor Documentation

◆ DropViewStmt()

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

Definition at line 1692 of file ParserNode.h.

1692 : view_name(v), if_exists(i) {}
std::unique_ptr< std::string > view_name
Definition: ParserNode.h:1697
T v(const TargetValue &r)

Member Function Documentation

◆ execute()

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

Implements Parser::DDLStmt.

Definition at line 4363 of file ParserNode.cpp.

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

4363  {
4364  auto& catalog = session.getCatalog();
4365  const TableDescriptor* td = catalog.getMetadataForTable(*view_name);
4366  if (td == nullptr) {
4367  if (if_exists) {
4368  return;
4369  }
4370  throw std::runtime_error("View " + *view_name + " does not exist.");
4371  }
4372 
4373  if (!session.checkDBAccessPrivileges(
4375  throw std::runtime_error("View " + *view_name +
4376  " will not be dropped. User has no drop view privileges.");
4377  }
4378 
4379  if (!td->isView) {
4380  throw std::runtime_error(*view_name + " is a table. Use DROP TABLE.");
4381  }
4382  catalog.dropTable(td);
4383 }
std::unique_ptr< std::string > view_name
Definition: ParserNode.h:1697
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 1693 of file ParserNode.h.

References session.

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

Member Data Documentation

◆ if_exists

bool Parser::DropViewStmt::if_exists
private

Definition at line 1698 of file ParserNode.h.

◆ view_name

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

Definition at line 1697 of file ParserNode.h.


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