OmniSciDB  a5dc49c757
 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 3848 of file ParserNode.cpp.

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

3848  {
3849  CHECK(payload.HasMember("modelName"));
3850  model_name_ = json_str(payload["modelName"]);
3851 
3852  if_exists_ = false;
3853  if (payload.HasMember("ifExists")) {
3854  if_exists_ = json_bool(payload["ifExists"]);
3855  }
3856 }
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 3858 of file ParserNode.cpp.

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

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

3859  {
3860  if (read_only_mode) {
3861  throw std::runtime_error("DROP MODEL invalid in read only mode.");
3862  }
3863  try {
3865  } catch (std::runtime_error& e) {
3866  if (!if_exists_) {
3867  throw e;
3868  }
3869  // If NOT EXISTS is set, ignore the error
3870  }
3871 }
MLModelMap g_ml_models
Definition: MLModel.h:125
void deleteModel(const std::string &model_name)
Definition: MLModel.h:62
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: