OmniSciDB  94e8789169
 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 41 of file CsvShared.cpp.

References foreign_storage::OptionsContainer::options.

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

42  {
43  if (auto it = foreign_table->options.find(option_name);
44  it != foreign_table->options.end()) {
45  if (boost::iequals(it->second, "TRUE")) {
46  return true;
47  } else if (boost::iequals(it->second, "FALSE")) {
48  return false;
49  } else {
50  throw std::runtime_error{"Invalid boolean value specified for \"" + option_name +
51  "\" foreign table option. "
52  "Value must be either 'true' or 'false'."};
53  }
54  }
55  return std::nullopt;
56 }

+ 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 25 of file CsvShared.cpp.

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

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

27  {
28  if (auto it = foreign_table->options.find(option_name);
29  it != foreign_table->options.end()) {
30  if (it->second.length() != expected_num_chars) {
31  throw std::runtime_error{"Value of \"" + option_name +
32  "\" foreign table option has the wrong number of "
33  "characters. Expected " +
34  std::to_string(expected_num_chars) + " character(s)."};
35  }
36  return it->second;
37  }
38  return "";
39 }
std::string to_string(char const *&&v)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: