OmniSciDB  06b3bd477c
 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 1861 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 1863 of file ParserNode.h.

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

Member Function Documentation

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

Implements Parser::DDLStmt.

Definition at line 4646 of file ParserNode.cpp.

References CHECK(), Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), AccessPrivileges::DROP_VIEW, Catalog_Namespace::SessionInfo::getCatalog(), ddl_utils::validate_drop_table_type(), ddl_utils::VIEW, and ViewDBObjectType.

4646  {
4647  auto& catalog = session.getCatalog();
4648 
4649  const TableDescriptor* td{nullptr};
4650  std::unique_ptr<lockmgr::TableSchemaLockContainer<lockmgr::WriteLock>> td_with_lock;
4651 
4652  try {
4653  td_with_lock =
4654  std::make_unique<lockmgr::TableSchemaLockContainer<lockmgr::WriteLock>>(
4656  catalog, *view_name, false));
4657  td = (*td_with_lock)();
4658  } catch (const std::runtime_error& e) {
4659  if (if_exists) {
4660  return;
4661  } else {
4662  throw e;
4663  }
4664  }
4665 
4666  CHECK(td);
4667  CHECK(td_with_lock);
4668 
4669  if (!session.checkDBAccessPrivileges(
4671  throw std::runtime_error("View " + *view_name +
4672  " will not be dropped. User has no drop view privileges.");
4673  }
4674 
4676  catalog.dropTable(td);
4677 }
std::unique_ptr< std::string > view_name
Definition: ParserNode.h:1868
CHECK(cgen_state)
void validate_drop_table_type(const TableDescriptor *td, const TableType expected_table_type)
Definition: DdlUtils.cpp:537
Catalog & getCatalog() const
Definition: SessionInfo.h:65
static const AccessPrivileges DROP_VIEW
Definition: DBObject.h:180
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 1864 of file ParserNode.h.

References view_name.

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

Member Data Documentation

bool Parser::DropViewStmt::if_exists
private

Definition at line 1869 of file ParserNode.h.

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

Definition at line 1868 of file ParserNode.h.

Referenced by get_view_name().


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