OmniSciDB  04ee39c94c
Parser::ValidateStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::ValidateStmt:
+ Collaboration diagram for Parser::ValidateStmt:

Public Member Functions

 ValidateStmt (std::string *type, std::list< NameValueAssign *> *with_opts)
 
bool isRepairTypeRemove () const
 
const std::string getType () 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 > type_
 
bool isRepairTypeRemove_ = false
 

Detailed Description

Definition at line 1153 of file ParserNode.h.

Constructor & Destructor Documentation

◆ ValidateStmt()

Parser::ValidateStmt::ValidateStmt ( std::string *  type,
std::list< NameValueAssign *> *  with_opts 
)
inline

Definition at line 1155 of file ParserNode.h.

References CHECK.

1155  : type_(type) {
1156  if (!type_) {
1157  throw std::runtime_error("Validation Type is required for VALIDATE command.");
1158  }
1159  std::list<std::unique_ptr<NameValueAssign>> options;
1160  if (with_opts) {
1161  for (const auto e : *with_opts) {
1162  options.emplace_back(e);
1163  }
1164  delete with_opts;
1165 
1166  for (const auto& opt : options) {
1167  if (boost::iequals(*opt->get_name(), "REPAIR_TYPE")) {
1168  const auto repair_type =
1169  static_cast<const StringLiteral*>(opt->get_value())->get_stringval();
1170  CHECK(repair_type);
1171  if (boost::iequals(*repair_type, "REMOVE")) {
1172  isRepairTypeRemove_ = true;
1173  } else {
1174  throw std::runtime_error("REPAIR_TYPE must be REMOVE.");
1175  }
1176  } else {
1177  throw std::runtime_error("The only VALIDATE WITH options is REPAIR_TYPE.");
1178  }
1179  }
1180  }
1181  }
std::unique_ptr< std::string > type_
Definition: ParserNode.h:1190
#define CHECK(condition)
Definition: Logger.h:187

Member Function Documentation

◆ execute()

void Parser::ValidateStmt::execute ( const Catalog_Namespace::SessionInfo session)
inlineoverridevirtual

Implements Parser::DDLStmt.

Definition at line 1187 of file ParserNode.h.

References UNREACHABLE.

1187 { UNREACHABLE(); }
#define UNREACHABLE()
Definition: Logger.h:231

◆ getType()

const std::string Parser::ValidateStmt::getType ( ) const
inline

Definition at line 1185 of file ParserNode.h.

1185 { return *(type_.get()); }
std::unique_ptr< std::string > type_
Definition: ParserNode.h:1190

◆ isRepairTypeRemove()

bool Parser::ValidateStmt::isRepairTypeRemove ( ) const
inline

Definition at line 1183 of file ParserNode.h.

1183 { return isRepairTypeRemove_; }

Member Data Documentation

◆ isRepairTypeRemove_

bool Parser::ValidateStmt::isRepairTypeRemove_ = false
private

Definition at line 1191 of file ParserNode.h.

◆ type_

std::unique_ptr<std::string> Parser::ValidateStmt::type_
private

Definition at line 1190 of file ParserNode.h.


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