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

Added the new method Rset::isEmpty() - I am guessing that the migration work...

Added the new method Rset::isEmpty() - I am guessing that the migration work of Michael would have loved to have had this method
parent 28d8ed35
No related branches found
No related tags found
No related merge requests found
......@@ -176,6 +176,14 @@ bool Rset::next() {
return aRowHasBeenRetrieved;
}
//------------------------------------------------------------------------------
// isEmpty
//------------------------------------------------------------------------------
bool Rset::isEmpty() const
{
return nullptr == m_impl;
}
//------------------------------------------------------------------------------
// columnIsNull
//------------------------------------------------------------------------------
......
......@@ -91,6 +91,12 @@ public:
*/
bool next();
/**
* Returns true if the result set does not contain any more rows.
* @return True if the result set does not contain any more rows.
*/
bool isEmpty() const;
/**
* Returns true if the specified column contains a null value.
*
......
......@@ -36,6 +36,14 @@ protected:
}
};
TEST_F(cta_rdbms_RsetTest, constructor) {
using namespace cta::rdbms;
Rset rset;
ASSERT_TRUE(rset.isEmpty());
}
TEST_F(cta_rdbms_RsetTest, next) {
using namespace cta::rdbms;
......@@ -60,12 +68,15 @@ TEST_F(cta_rdbms_RsetTest, next) {
Stmt stmt = pool.getStmt(*conn, sql);
auto rset = stmt.executeQuery();
ASSERT_FALSE(rset.isEmpty());
ASSERT_TRUE(rset.next());
ASSERT_EQ(1, rset.columnUint64("ID"));
ASSERT_FALSE(rset.next());
ASSERT_THROW(rset.next(), InvalidResultSet);
ASSERT_TRUE(rset.isEmpty());
}
}
......
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