OmniSciDB  04ee39c94c
ImportHelpers Namespace Reference

Functions

bool is_reserved_name (const std::string &name)
 
std::string sanitize_name (const std::string &name)
 

Function Documentation

◆ is_reserved_name()

bool ImportHelpers::is_reserved_name ( const std::string &  name)
inline

Definition at line 27 of file import_helpers.h.

References reserved_keywords.

Referenced by MapDHandler::create_table(), MapDHandler::detect_column_types(), MapDHandler::populateThriftColumnType(), and sanitize_name().

27  {
28  return reserved_keywords.find(boost::to_upper_copy<std::string>(name)) !=
29  reserved_keywords.end();
30 }
static std::set< std::string > reserved_keywords
+ Here is the caller graph for this function:

◆ sanitize_name()

std::string ImportHelpers::sanitize_name ( const std::string &  name)
inline

Definition at line 32 of file import_helpers.h.

References is_reserved_name().

Referenced by MapDHandler::create_table(), MapDHandler::detect_column_types(), MapDHandler::import_geo_table(), and Importer_NS::ImportDriver::importGeoTable().

32  {
33  boost::regex invalid_chars{R"([^0-9a-z_])",
34  boost::regex::extended | boost::regex::icase};
35  std::string sanitized_name = boost::regex_replace(name, invalid_chars, "");
36  if (is_reserved_name(sanitized_name)) {
37  sanitized_name += "_";
38  }
39  return sanitized_name;
40 }
bool is_reserved_name(const std::string &name)
+ Here is the call graph for this function:
+ Here is the caller graph for this function: