Commit 4a7a722f authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'master-sqlitesvc-error' into 'master'

Improved error handling and reporting in RDBAccessSvc/SqliteRecordset

See merge request atlas/athena!42864
parents 8be5f5a5 7ee2dda4
......@@ -40,6 +40,11 @@ void SqliteRecordset::getData(sqlite3* db, const std::string& nodeName)
sql << "select * from " << m_nodeName << " order by " << m_nodeName << "_data_id";
sqlite3_stmt* st{nullptr};
int rc = sqlite3_prepare_v2(db, sql.str().c_str(), -1, &st, NULL);
if(rc!=SQLITE_OK) {
ATH_MSG_ERROR("Error occurred when preparing to fetch data for " << m_nodeName);
ATH_MSG_ERROR("SQLite Error: " << sqlite3_errmsg(db));
return;
}
int ctotal = sqlite3_column_count(st);
bool all_ok{true};
......@@ -98,16 +103,12 @@ void SqliteRecordset::getData(sqlite3* db, const std::string& nodeName)
}
m_records.push_back(record);
}
else if(rc == SQLITE_ERROR) {
ATH_MSG_ERROR(sqlite3_errmsg(db));
all_ok = false;
break;
}
else if(rc == SQLITE_DONE) {
break;
}
else {
ATH_MSG_ERROR("Unexpected error occurred while fetching " << m_nodeName);
ATH_MSG_ERROR("Error occurred when fetching data for " << m_nodeName);
ATH_MSG_ERROR("SQLite Error: " << sqlite3_errmsg(db));
all_ok = false;
break;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment