lidavidm commented on code in PR #48037:
URL: https://github.com/apache/arrow/pull/48037#discussion_r2589100468
##########
cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc:
##########
@@ -140,4 +140,48 @@ TYPED_TEST(StatementTest,
TestSQLNativeSqlReturnsErrorOnBadInputs) {
VerifyOdbcErrorState(SQL_HANDLE_DBC, this->conn, kErrorStateHY090);
}
+TYPED_TEST(StatementTest, SQLRowCountReturnsNegativeOneOnSelect) {
+ SQLLEN row_count = 0;
+ SQLLEN expected_value = -1;
+ SQLWCHAR sql_query[] = L"SELECT 1 AS col1, 'One' AS col2, 3 AS col3";
+ SQLINTEGER query_length = static_cast<SQLINTEGER>(wcslen(sql_query));
+
+ ASSERT_EQ(SQL_SUCCESS, SQLExecDirect(this->stmt, sql_query, query_length));
+
+ ASSERT_EQ(SQL_SUCCESS, SQLFetch(this->stmt));
+
+ CheckIntColumn(this->stmt, 1, 1);
+ CheckStringColumnW(this->stmt, 2, L"One");
+ CheckIntColumn(this->stmt, 3, 3);
+
+ ASSERT_EQ(SQL_SUCCESS, SQLRowCount(this->stmt, &row_count));
+
+ EXPECT_EQ(expected_value, row_count);
+}
+
+TYPED_TEST(StatementTest, SQLRowCountReturnsSuccessOnNullptr) {
+ SQLWCHAR sql_query[] = L"SELECT 1 AS col1, 'One' AS col2, 3 AS col3";
+ SQLINTEGER query_length = static_cast<SQLINTEGER>(wcslen(sql_query));
+
+ ASSERT_EQ(SQL_SUCCESS, SQLExecDirect(this->stmt, sql_query, query_length));
+
+ ASSERT_EQ(SQL_SUCCESS, SQLFetch(this->stmt));
+
+ CheckIntColumn(this->stmt, 1, 1);
+ CheckStringColumnW(this->stmt, 2, L"One");
+ CheckIntColumn(this->stmt, 3, 3);
+
+ ASSERT_EQ(SQL_SUCCESS, SQLRowCount(this->stmt, 0));
Review Comment:
nit, but can we write `nullptr` for nullptr and not use 0?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]