 |
ATLAS Offline Software
|
Go to the documentation of this file.
29 throw std::runtime_error(
"SqliteRecordset::getData : db pointer is null");
32 throw std::runtime_error(
"SqliteRecordset::getData : nodeName is empty");
37 std::ostringstream
sql;
41 sqlite3_stmt* stTable{
nullptr};
42 int rc = sqlite3_prepare_v2(
db,
sql.str().c_str(), -1, &stTable, NULL);
49 sqlite3_stmt*
st{
nullptr};
50 rc = sqlite3_prepare_v2(
db,
sql.str().c_str(), -1, &
st, NULL);
56 int ctotal = sqlite3_column_count(
st);
61 rc = sqlite3_step(
st);
63 if(rc == SQLITE_ROW) {
68 for(
int i=0;
i<ctotal; ++
i) {
76 std::string columnName = sqlite3_column_name(
st,
i);
77 bool extendDef = (
m_def->find(columnName)==
m_def->end());
79 auto columnType = sqlite3_column_type(
st,
i);
86 val = sqlite3_column_int(
st,
i);
90 val = sqlite3_column_double(
st,
i);
94 val = std::string((
char*)(sqlite3_column_text(
st,
i)));
98 val = std::string((
char*)(sqlite3_column_blob(
st,
i)));
113 (*m_def)[columnName] = inpType;
119 else if(rc == SQLITE_DONE) {
std::variant< int, long, float, double, std::string > SqliteInp
Declaration of the SqliteRecordset class.
void getData(sqlite3 *db, const std::string &nodeName)
Constructs SQL query and retrieves data from the DB.
std::map< std::string, SqliteInpType > SqliteInpDef
std::string nodeName() const override
IRDBRecordset::const_iterator begin() const override
void addValue(const std::string &field, SqliteInp value)
Class to provide easy MsgStream access and capabilities.
IRDBRecordset::const_iterator end() const override
SqliteRecord is one record in the SqliteRecordset object.
IRDBRecord is one record in the IRDBRecordset object.
std::unique_ptr< IRDBRecord > IRDBRecord_ptr
unsigned int size() const override
const IRDBRecord * operator[](unsigned int index) const override
SqliteRecordset()
Construct empty recordset.
RecordsVector::const_iterator const_iterator