OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser::DumpTableStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::DumpTableStmt:
+ Collaboration diagram for Parser::DumpTableStmt:

Public Member Functions

 DumpTableStmt (const rapidjson::Value &payload)
 
void execute (const Catalog_Namespace::SessionInfo &session, bool read_only_mode) override
 
- Public Member Functions inherited from Parser::DumpRestoreTableStmtBase
 DumpRestoreTableStmtBase (const rapidjson::Value &payload, const bool is_restore)
 
CompressionType defaultCompression (bool is_restore)
 
CompressionType validateCompression (const std::string &compression, const bool is_restore)
 
std::string tarCompressionStr (CompressionType compression, const bool is_restore)
 
const std::string * getTable () const
 
const std::string * getPath () const
 
const CompressionType getCompression () const
 
- Public Member Functions inherited from Parser::DDLStmt
void setColumnDescriptor (ColumnDescriptor &cd, const ColumnDef *coldef)
 
- Public Member Functions inherited from Parser::Node
virtual ~Node ()
 

Additional Inherited Members

- Public Types inherited from Parser::DumpRestoreTableStmtBase
enum  CompressionType { CompressionType::kGZIP, CompressionType::kLZ4, CompressionType::kNONE }
 
- Protected Attributes inherited from Parser::DumpRestoreTableStmtBase
std::unique_ptr< std::string > table_
 
std::unique_ptr< std::string > path_
 
CompressionType compression_
 
TableArchiverS3Options s3_options_
 

Detailed Description

Definition at line 1438 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::DumpTableStmt::DumpTableStmt ( const rapidjson::Value &  payload)

Definition at line 7208 of file ParserNode.cpp.

7209  : DumpRestoreTableStmtBase(payload, false) {}
DumpRestoreTableStmtBase(const rapidjson::Value &payload, const bool is_restore)

Member Function Documentation

void Parser::DumpTableStmt::execute ( const Catalog_Namespace::SessionInfo session,
bool  read_only_mode 
)
overridevirtual

Implements Parser::DDLStmt.

Definition at line 7211 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), Parser::DumpRestoreTableStmtBase::compression_, AccessPrivileges::CREATE_TABLE, TableArchiver::dumpTable(), Catalog_Namespace::SessionInfo::getCatalog(), legacylockmgr::getExecuteReadLock(), lockmgr::TableLockMgrImpl< TableSchemaLockMgr >::getReadLockForTable(), Parser::DumpRestoreTableStmtBase::path_, AccessPrivileges::SELECT_FROM_TABLE, Parser::DumpRestoreTableStmtBase::table_, TableDBObjectType, and Parser::DumpRestoreTableStmtBase::tarCompressionStr().

Referenced by heavydb.cursor.Cursor::executemany().

7212  {
7213  // valid in read_only_mode
7214  const auto execute_read_lock = legacylockmgr::getExecuteReadLock();
7215 
7216  auto& catalog = session.getCatalog();
7217  // Prevent modification of the table schema during a dump operation, while allowing
7218  // concurrent inserts.
7219  auto table_read_lock =
7221 
7222  // check access privileges
7225  *table_)) {
7226  throw std::runtime_error("Table " + *table_ +
7227  " will not be dumped. User has no select privileges.");
7228  }
7231  throw std::runtime_error("Table " + *table_ +
7232  " will not be dumped. User has no create privileges.");
7233  }
7234  const TableDescriptor* td = catalog.getMetadataForTable(*table_);
7235  TableArchiver table_archiver(&catalog);
7236  table_archiver.dumpTable(td, *path_, tarCompressionStr(compression_, false));
7237 }
auto getExecuteReadLock()
std::string tarCompressionStr(CompressionType compression, const bool is_restore)
static const AccessPrivileges SELECT_FROM_TABLE
Definition: DBObject.h:160
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1432
static const AccessPrivileges CREATE_TABLE
Definition: DBObject.h:158
std::unique_ptr< std::string > path_
Definition: ParserNode.h:1433
Catalog & getCatalog() const
Definition: SessionInfo.h:75
bool checkDBAccessPrivileges(const DBObjectType &permissionType, const AccessPrivileges &privs, const std::string &objectName="") const
Definition: SessionInfo.cpp:24
static ReadLock getReadLockForTable(Catalog_Namespace::Catalog &cat, const std::string &table_name)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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