Commit 2d44c863 authored by Steven Murray's avatar Steven Murray
Browse files

Added Rset::columnUint8()

parent a4116aa7
......@@ -94,6 +94,27 @@ std::string Rset::columnString(const std::string &colName) const {
}
}
//------------------------------------------------------------------------------
// columnUint8
//------------------------------------------------------------------------------
uint8_t Rset::columnUint8(const std::string &colName) const {
try {
if(nullptr == m_impl) {
throw InvalidResultSet("This result set is invalid");
}
const optional<uint8_t> col = columnOptionalUint8(colName);
if(col) {
return col.value();
} else {
throw NullDbValue(std::string("Database column ") + colName + " contains a null value");
}
} catch(exception::Exception &ex) {
ex.getMessage().str(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
throw;
}
}
//------------------------------------------------------------------------------
// columnUint16
//------------------------------------------------------------------------------
......
......@@ -141,6 +141,18 @@ public:
*/
optional<std::string> columnOptionalString(const std::string &colName) const;
/**
* Returns the value of the specified column as an integer.
*
* This method will throw an exception if the value of the specified column
* is nullptr.
*
* @param colName The name of the column.
* @return The value of the specified column.
* @throw InvalidResultSet if the result is invalid.
*/
uint8_t columnUint8(const std::string &colName) const;
/**
* Returns the value of the specified column as an integer.
*
......
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