alinaliBQ commented on code in PR #48021:
URL: https://github.com/apache/arrow/pull/48021#discussion_r2599940819


##########
cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc:
##########
@@ -0,0 +1,489 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+#include "arrow/flight/sql/odbc/tests/odbc_test_suite.h"
+
+#include "arrow/flight/sql/odbc/odbc_impl/platform.h"
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include <gtest/gtest.h>
+
+namespace arrow::flight::sql::odbc {
+
+template <typename T>
+class TablesTest : public T {};
+
+class TablesMockTest : public FlightSQLODBCMockTestBase {};
+class TablesRemoteTest : public FlightSQLODBCRemoteTestBase {};
+using TestTypes = ::testing::Types<TablesRemoteTest, TablesMockTest>;
+TYPED_TEST_SUITE(TablesTest, TestTypes);
+
+template <typename T>
+class TablesOdbcV2Test : public T {};
+
+using TestTypesOdbcV2 =
+    ::testing::Types<FlightSQLOdbcV2MockTestBase, 
FlightSQLOdbcV2RemoteTestBase>;
+TYPED_TEST_SUITE(TablesOdbcV2Test, TestTypesOdbcV2);
+
+// Test Cases
+
+TYPED_TEST(TablesTest, SQLTablesTestInputData) {
+  SQLWCHAR catalog_name[] = L"";
+  SQLWCHAR schema_name[] = L"";
+  SQLWCHAR table_name[] = L"";
+  SQLWCHAR table_type[] = L"";
+
+  // All values populated
+  EXPECT_EQ(SQL_SUCCESS, SQLTables(this->stmt, catalog_name, 
sizeof(catalog_name),
+                                   schema_name, sizeof(schema_name), 
table_name,
+                                   sizeof(table_name), table_type, 
sizeof(table_type)));
+
+  ValidateFetch(this->stmt, SQL_NO_DATA);
+
+  // Sizes are nulls
+  EXPECT_EQ(SQL_SUCCESS, SQLTables(this->stmt, catalog_name, 0, schema_name, 0,
+                                   table_name, 0, table_type, 0));
+
+  ValidateFetch(this->stmt, SQL_NO_DATA);
+
+  // Values are nulls
+  EXPECT_EQ(SQL_SUCCESS,
+            SQLTables(this->stmt, 0, sizeof(catalog_name), 0, 
sizeof(schema_name), 0,
+                      sizeof(table_name), 0, sizeof(table_type)));
+
+  ValidateFetch(this->stmt, SQL_SUCCESS);
+  // Close statement cursor to avoid leaving in an invalid state
+  SQLFreeStmt(this->stmt, SQL_CLOSE);
+
+  // All values and sizes are nulls
+  EXPECT_EQ(SQL_SUCCESS, SQLTables(this->stmt, 0, 0, 0, 0, 0, 0, 0, 0));

Review Comment:
   fixed. Btw the sizes are supposed to be zeros instead of nulls, I have fixed 
the comment also



##########
cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc:
##########
@@ -0,0 +1,489 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+#include "arrow/flight/sql/odbc/tests/odbc_test_suite.h"
+
+#include "arrow/flight/sql/odbc/odbc_impl/platform.h"
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include <gtest/gtest.h>
+
+namespace arrow::flight::sql::odbc {
+
+template <typename T>
+class TablesTest : public T {};
+
+class TablesMockTest : public FlightSQLODBCMockTestBase {};
+class TablesRemoteTest : public FlightSQLODBCRemoteTestBase {};
+using TestTypes = ::testing::Types<TablesRemoteTest, TablesMockTest>;
+TYPED_TEST_SUITE(TablesTest, TestTypes);
+
+template <typename T>
+class TablesOdbcV2Test : public T {};
+
+using TestTypesOdbcV2 =
+    ::testing::Types<FlightSQLOdbcV2MockTestBase, 
FlightSQLOdbcV2RemoteTestBase>;
+TYPED_TEST_SUITE(TablesOdbcV2Test, TestTypesOdbcV2);
+
+// Test Cases
+
+TYPED_TEST(TablesTest, SQLTablesTestInputData) {
+  SQLWCHAR catalog_name[] = L"";
+  SQLWCHAR schema_name[] = L"";
+  SQLWCHAR table_name[] = L"";
+  SQLWCHAR table_type[] = L"";
+
+  // All values populated
+  EXPECT_EQ(SQL_SUCCESS, SQLTables(this->stmt, catalog_name, 
sizeof(catalog_name),
+                                   schema_name, sizeof(schema_name), 
table_name,
+                                   sizeof(table_name), table_type, 
sizeof(table_type)));
+
+  ValidateFetch(this->stmt, SQL_NO_DATA);
+
+  // Sizes are nulls
+  EXPECT_EQ(SQL_SUCCESS, SQLTables(this->stmt, catalog_name, 0, schema_name, 0,
+                                   table_name, 0, table_type, 0));
+
+  ValidateFetch(this->stmt, SQL_NO_DATA);
+
+  // Values are nulls
+  EXPECT_EQ(SQL_SUCCESS,
+            SQLTables(this->stmt, 0, sizeof(catalog_name), 0, 
sizeof(schema_name), 0,
+                      sizeof(table_name), 0, sizeof(table_type)));

Review Comment:
   Yup, fixed



-- 
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]

Reply via email to