OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
foreign_storage::Csv::anonymous_namespace{CsvShared.cpp} Namespace Reference

Functions

std::string validate_and_get_string_with_length (const ForeignTable *foreign_table, const std::string &option_name, const size_t expected_num_chars)
 
std::optional< bool > validate_and_get_bool_value (const ForeignTable *foreign_table, const std::string &option_name)
 

Function Documentation

std::optional<bool> foreign_storage::Csv::anonymous_namespace{CsvShared.cpp}::validate_and_get_bool_value ( const ForeignTable *  foreign_table,
const std::string &  option_name 
)

Definition at line 75 of file CsvShared.cpp.

References foreign_storage::OptionsContainer::options.

Referenced by foreign_storage::Csv::validate_and_get_copy_params().

76  {
77  if (auto it = foreign_table->options.find(option_name);
78  it != foreign_table->options.end()) {
79  if (boost::iequals(it->second, "TRUE")) {
80  return true;
81  } else if (boost::iequals(it->second, "FALSE")) {
82  return false;
83  } else {
84  throw std::runtime_error{"Invalid boolean value specified for \"" + option_name +
85  "\" foreign table option. "
86  "Value must be either 'true' or 'false'."};
87  }
88  }
89  return std::nullopt;
90 }

+ Here is the caller graph for this function:

std::string foreign_storage::Csv::anonymous_namespace{CsvShared.cpp}::validate_and_get_string_with_length ( const ForeignTable *  foreign_table,
const std::string &  option_name,
const size_t  expected_num_chars 
)

Definition at line 59 of file CsvShared.cpp.

References foreign_storage::OptionsContainer::options, and to_string().

Referenced by foreign_storage::Csv::validate_and_get_copy_params().

61  {
62  if (auto it = foreign_table->options.find(option_name);
63  it != foreign_table->options.end()) {
64  if (it->second.length() != expected_num_chars) {
65  throw std::runtime_error{"Value of \"" + option_name +
66  "\" foreign table option has the wrong number of "
67  "characters. Expected " +
68  std::to_string(expected_num_chars) + " character(s)."};
69  }
70  return it->second;
71  }
72  return "";
73 }
std::string to_string(char const *&&v)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: