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

Added unit-test cta_rdbms_StmtTest.insert_with_bindUint64

parent 53ebe033
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@ void cta_rdbms_StmtTest::SetUp() {
// Do nothing
}
m_conn.executeNonQuery("CREATE TABLE STMT_TEST(DOUBLE_COL FLOAT)");
m_conn.executeNonQuery("CREATE TABLE STMT_TEST(DOUBLE_COL FLOAT, UINT64_COL NUMERIC(20, 0))");
}
//------------------------------------------------------------------------------
......@@ -100,4 +100,42 @@ TEST_P(cta_rdbms_StmtTest, insert_with_bindDouble) {
}
}
TEST_P(cta_rdbms_StmtTest, insert_with_bindUint64) {
using namespace cta::rdbms;
const uint64_t insertValue = 1234;
// Insert a row into the test table
{
const char *const sql =
"INSERT INTO STMT_TEST("
"UINT64_COL) "
"VALUES("
":UINT64_COL)";
auto stmt = m_conn.createStmt(sql);
stmt.bindDouble(":UINT64_COL", insertValue);
stmt.executeNonQuery();
}
// Select the row back from the table
{
const char *const sql =
"SELECT "
"UINT64_COL AS UINT64_COL "
"FROM "
"STMT_TEST";
auto stmt = m_conn.createStmt(sql);
auto rset = stmt.executeQuery();
ASSERT_TRUE(rset.next());
const auto selectValue = rset.columnOptionalDouble("UINT64_COL");
ASSERT_TRUE((bool)selectValue);
ASSERT_EQ(insertValue,selectValue.value());
ASSERT_FALSE(rset.next());
}
}
} // namespace unitTests
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