OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Parser::RestoreTableStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::RestoreTableStmt:
+ Collaboration diagram for Parser::RestoreTableStmt:

Public Member Functions

 RestoreTableStmt (std::string *tab, std::string *path, std::list< NameValueAssign * > *options)
 
void execute (const Catalog_Namespace::SessionInfo &session) override
 
- Public Member Functions inherited from Parser::DumpRestoreTableStmtBase
 DumpRestoreTableStmtBase (std::string *tab, std::string *path, std::list< NameValueAssign * > *options, const bool is_restore)
 
const std::string * getTable () const
 
const std::string * getPath () const
 
const std::string 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

- Protected Attributes inherited from Parser::DumpRestoreTableStmtBase
std::unique_ptr< std::string > table
 
std::unique_ptr< std::string > path
 
std::string compression
 

Detailed Description

Definition at line 1415 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::RestoreTableStmt::RestoreTableStmt ( std::string *  tab,
std::string *  path,
std::list< NameValueAssign * > *  options 
)
inline

Definition at line 1417 of file ParserNode.h.

1420  : DumpRestoreTableStmtBase(tab, path, options, true) {}
DumpRestoreTableStmtBase(std::string *tab, std::string *path, std::list< NameValueAssign * > *options, const bool is_restore)
Definition: ParserNode.h:1335
std::unique_ptr< std::string > path
Definition: ParserNode.h:1400

Member Function Documentation

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

Implements Parser::DDLStmt.

Definition at line 4876 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), AccessPrivileges::CREATE_TABLE, Catalog_Namespace::SessionInfo::getCatalog(), TableArchiver::restoreTable(), and TableDBObjectType.

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

4876  {
4877  auto& catalog = session.getCatalog();
4878  const TableDescriptor* td = catalog.getMetadataForTable(*table, false);
4879  if (td) {
4880  // TODO: v1.0 simply throws to avoid accidentally overwrite target table.
4881  // Will add a REPLACE TABLE to explictly replace target table.
4882  // catalog.restoreTable(session, td, *path, compression);
4883  throw std::runtime_error("Table " + *table + " exists.");
4884  } else {
4885  // check access privileges
4888  throw std::runtime_error("Table " + *table +
4889  " will not be restored. User has no create privileges.");
4890  }
4891  TableArchiver table_archiver(&catalog);
4892  table_archiver.restoreTable(session, *table, *path, compression);
4893  }
4894 }
std::unique_ptr< std::string > path
Definition: ParserNode.h:1400
std::unique_ptr< std::string > table
Definition: ParserNode.h:1399
static const AccessPrivileges CREATE_TABLE
Definition: DBObject.h:159
Catalog & getCatalog() const
Definition: SessionInfo.h:65
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:

+ Here is the caller graph for this function:


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