Skip to content
Snippets Groups Projects
Commit 34f7de88 authored by Steven Murray's avatar Steven Murray
Browse files

OcciRset::columnUint64() now clearly reports unexpected NULL values

parent 4f9423e8
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@ set (CATALOGUE_LIB_SRC_FILES
InMemoryCatalogue.cpp
InMemoryCatalogueSchema.cpp
TapeFileWritten.cpp
NullDbValue.cpp
OcciConn.cpp
OcciEnv.cpp
OcciEnvSingleton.cpp
......
......@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/NullDbValue.hpp"
#include "catalogue/OcciRset.hpp"
#include "catalogue/OcciStmt.hpp"
#include "common/exception/Exception.hpp"
......@@ -163,6 +164,9 @@ uint64_t OcciRset::columnUint64(const std::string &colName) const {
const int colIdx = m_colNameToIdx.getIdx(colName);
const std::string stringValue = m_rset->getString(colIdx);
if(stringValue.empty()) {
throw NullDbValue(std::string("Database column ") + colName + " contains a NULL value");
}
if(!utils::isValidUInt(stringValue)) {
throw exception::Exception(std::string("Column ") + colName + " contains the value " + stringValue +
" which is not a valid unsigned integer");
......
......@@ -39,7 +39,7 @@ public:
*/
UserError(const std::string &context = "", const bool embedBacktrace = true);
}; // class DbLogin
}; // class UserError
} // namespace catalogue
} // namespace cta
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment