diff --git a/src/odbc-test/src/api_robustness_test.cpp b/src/odbc-test/src/api_robustness_test.cpp index 5f93d712c..7d53877e6 100644 --- a/src/odbc-test/src/api_robustness_test.cpp +++ b/src/odbc-test/src/api_robustness_test.cpp @@ -52,7 +52,7 @@ struct ApiRobustnessTestSuiteFixture : public odbc::OdbcTestSuite { * Constructor. */ ApiRobustnessTestSuiteFixture() : testCache(0) { - // No-op + // No-op } /** @@ -166,6 +166,35 @@ BOOST_AUTO_TEST_CASE(TestSQLPrimaryKeysEmpty) { BOOST_CHECK_EQUAL(SQL_NO_DATA, ret); } +BOOST_AUTO_TEST_CASE(TestSQLSetStmtAttrGetStmtAttr) { + // check that statement array size is set correctly + + std::string dsnConnectionString; + CreateDsnConnectionStringForLocalServer(dsnConnectionString); + + Connect(dsnConnectionString); + + SQLINTEGER actual_row_array_size; + SQLINTEGER resLen = 0; + + // repeat test for different values + SQLULEN valList[5] = {10, 52, 81, 103, 304}; + for (SQLULEN val : valList) { + SQLRETURN ret = + SQLSetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, + reinterpret_cast< SQLPOINTER >(val), sizeof(val)); + + ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); + + ret = SQLGetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, &actual_row_array_size, + sizeof(actual_row_array_size), &resLen); + + ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); + + BOOST_CHECK_EQUAL(actual_row_array_size, val); + } +} + BOOST_AUTO_TEST_CASE(TestSQLDriverConnect, *disabled()) { // There are no checks because we do not really care what is the result of // these calls as long as they do not cause segmentation fault.