OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser::DropModelStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::DropModelStmt:
+ Collaboration diagram for Parser::DropModelStmt:

Public Member Functions

 DropModelStmt (const rapidjson::Value &payload)
 
auto const & getModelName ()
 
void execute (const Catalog_Namespace::SessionInfo &session, bool read_only_mode) 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::string model_name_
 
bool if_exists_
 

Detailed Description

Definition at line 1995 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 3832 of file ParserNode.cpp.

References CHECK, if_exists_, json_bool(), json_str(), and model_name_.

3832  {
3833  CHECK(payload.HasMember("modelName"));
3834  model_name_ = json_str(payload["modelName"]);
3835 
3836  if_exists_ = false;
3837  if (payload.HasMember("ifExists")) {
3838  if_exists_ = json_bool(payload["ifExists"]);
3839  }
3840 }
const bool json_bool(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:51
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:46
#define CHECK(condition)
Definition: Logger.h:291
std::string model_name_
Definition: ParserNode.h:2003

+ Here is the call graph for this function:

Member Function Documentation

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

Implements Parser::DDLStmt.

Definition at line 3842 of file ParserNode.cpp.

References MLModelMap::deleteModel(), g_ml_models, if_exists_, and model_name_.

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

3843  {
3844  if (read_only_mode) {
3845  throw std::runtime_error("DROP MODEL invalid in read only mode.");
3846  }
3847  try {
3849  } catch (std::runtime_error& e) {
3850  if (!if_exists_) {
3851  throw e;
3852  }
3853  // If NOT EXISTS is set, ignore the error
3854  }
3855 }
MLModelMap g_ml_models
Definition: MLModel.h:124
void deleteModel(const std::string &model_name)
Definition: MLModel.h:61
std::string model_name_
Definition: ParserNode.h:2003

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

auto const& Parser::DropModelStmt::getModelName ( )
inline

Definition at line 1998 of file ParserNode.h.

References model_name_.

1998 { return model_name_; }
std::string model_name_
Definition: ParserNode.h:2003

Member Data Documentation

bool Parser::DropModelStmt::if_exists_
private

Definition at line 2004 of file ParserNode.h.

Referenced by DropModelStmt(), and execute().

std::string Parser::DropModelStmt::model_name_
private

Definition at line 2003 of file ParserNode.h.

Referenced by DropModelStmt(), execute(), and getModelName().


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