|
ATLAS Offline Software
|
Go to the documentation of this file.
31 if(
m_def->find(
field)==
m_def->end())
throw std::runtime_error(
"Wrong name for the field "+
field);
39 return std::get<int>(recIt->second);
55 return std::get<double>(recIt->second);
71 return std::get<std::string>(recIt->second);
74 throw std::runtime_error(
"Unexpected error in SqliteRecord::getString()");
106 if(!
result)
throw std::runtime_error(
"Unexpected error when adding new value for the field " +
107 field +
". Duplicate field name?");
113 for(
const auto& [colName,colType] : *
m_def) {
120 auto recIt =
m_record.find(colName);
121 bool fieldNull = (recIt==
m_record.end());
122 std::cout <<
"[" << colName <<
" (";
125 std::cout <<
"int) : " << (fieldNull?
"NULL" :
std::to_string(std::get<int>(recIt->second))) <<
"]";
128 std::cout <<
"long) : " << (fieldNull?
"NULL" :
std::to_string(std::get<long>(recIt->second))) <<
"]";
131 std::cout <<
"float) : ";
136 std::cout << std::setprecision(10) << std::get<float>(recIt->second) <<
"]";
140 std::cout <<
"double) : ";
145 std::cout << std::setprecision(10) << std::get<double>(recIt->second) <<
"]";
149 std::cout <<
"string) : " << (fieldNull?
"NULL" : (
"\"" + std::get<std::string>(recIt->second)) +
"\"") <<
"]";
152 std::cout <<
"ERROR) : ]";
155 std::cout << std::endl;
std::variant< int, long, float, double, std::string > SqliteInp
~SqliteRecord() override
Destructor.
Declaration of the SqliteRecord class.
float getFloat(const std::string &field) const override
Get float field value.
int getInt(const std::string &field) const override
Get int field value.
void addValue(const std::string &field, SqliteInp value)
void handleError(const std::string &field, FieldCheckCode checkCode) const
void dump() const
Dump to cout.
std::string to_string(const DetectorType &type)
long getLong(const std::string &field) const override
Get long field value.
FieldCheckResult checkField(const std::string &field, SqliteInpType fieldType) const
virtual const std::string & getString(const std::string &field) const override
Get string field value.
bool isFieldNull(const std::string &field) const override
Check if the field value is NULL.
std::shared_ptr< SqliteInpDef > SqliteInpDef_ptr
double getDouble(const std::string &field) const override
Get double field value.