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


##########
cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc:
##########
@@ -0,0 +1,170 @@
+// 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"
+
+#ifdef _WIN32
+#  include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace arrow::flight::sql::odbc {
+
+TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
+  // ODBC Environment
+  SQLHENV env;
+
+  // Allocate an environment handle
+  SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+
+  EXPECT_THAT(env, ::testing::NotNull());
+}
+
+TEST(SQLAllocEnv, TestSQLAllocEnv) {
+  // ODBC Environment
+  SQLHENV env;

Review Comment:
   added calls to free the result



##########
cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc:
##########
@@ -0,0 +1,170 @@
+// 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"
+
+#ifdef _WIN32
+#  include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace arrow::flight::sql::odbc {
+
+TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
+  // ODBC Environment
+  SQLHENV env;
+
+  // Allocate an environment handle
+  SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+
+  EXPECT_THAT(env, ::testing::NotNull());

Review Comment:
   sure, changed to use `ASSERT_NE`



##########
cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc:
##########
@@ -0,0 +1,170 @@
+// 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"
+
+#ifdef _WIN32
+#  include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include "gmock/gmock.h"

Review Comment:
   fixed



##########
cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc:
##########
@@ -0,0 +1,170 @@
+// 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"
+
+#ifdef _WIN32
+#  include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace arrow::flight::sql::odbc {
+
+TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
+  // ODBC Environment
+  SQLHENV env;
+
+  // Allocate an environment handle
+  SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+
+  EXPECT_THAT(env, ::testing::NotNull());
+}
+
+TEST(SQLAllocEnv, TestSQLAllocEnv) {
+  // ODBC Environment
+  SQLHENV env;
+
+  // Allocate an environment handle
+  SQLRETURN return_value = SQLAllocEnv(&env);
+
+  EXPECT_EQ(SQL_SUCCESS, return_value);
+}
+
+TEST(SQLAllocHandle, TestSQLAllocHandleConnect) {
+  // ODBC Environment
+  SQLHENV env;
+  SQLHDBC conn;
+
+  // Allocate an environment handle
+  SQLRETURN return_value = SQLAllocEnv(&env);
+
+  EXPECT_EQ(SQL_SUCCESS, return_value);
+
+  // Allocate a connection using alloc handle
+  SQLRETURN return_alloc_handle = SQLAllocHandle(SQL_HANDLE_DBC, env, &conn);
+
+  EXPECT_EQ(SQL_SUCCESS, return_alloc_handle);
+}
+
+TEST(SQLAllocConnect, TestSQLAllocHandleConnect) {
+  // ODBC Environment
+  SQLHENV env;
+  SQLHDBC conn;
+
+  // Allocate an environment handle
+  SQLRETURN return_value = SQLAllocEnv(&env);
+
+  EXPECT_EQ(SQL_SUCCESS, return_value);
+
+  // Allocate a connection using alloc handle
+  SQLRETURN return_alloc_connect = SQLAllocConnect(env, &conn);

Review Comment:
   added call to free result



##########
cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc:
##########
@@ -0,0 +1,170 @@
+// 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"
+
+#ifdef _WIN32
+#  include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace arrow::flight::sql::odbc {
+
+TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
+  // ODBC Environment
+  SQLHENV env;
+
+  // Allocate an environment handle
+  SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+
+  EXPECT_THAT(env, ::testing::NotNull());
+}
+
+TEST(SQLAllocEnv, TestSQLAllocEnv) {
+  // ODBC Environment
+  SQLHENV env;
+
+  // Allocate an environment handle
+  SQLRETURN return_value = SQLAllocEnv(&env);
+
+  EXPECT_EQ(SQL_SUCCESS, return_value);
+}
+
+TEST(SQLAllocHandle, TestSQLAllocHandleConnect) {
+  // ODBC Environment
+  SQLHENV env;
+  SQLHDBC conn;
+
+  // Allocate an environment handle
+  SQLRETURN return_value = SQLAllocEnv(&env);
+
+  EXPECT_EQ(SQL_SUCCESS, return_value);
+
+  // Allocate a connection using alloc handle
+  SQLRETURN return_alloc_handle = SQLAllocHandle(SQL_HANDLE_DBC, env, &conn);
+
+  EXPECT_EQ(SQL_SUCCESS, return_alloc_handle);
+}
+
+TEST(SQLAllocConnect, TestSQLAllocHandleConnect) {
+  // ODBC Environment
+  SQLHENV env;
+  SQLHDBC conn;
+
+  // Allocate an environment handle
+  SQLRETURN return_value = SQLAllocEnv(&env);

Review Comment:
   added call to free env. 



##########
cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc:
##########
@@ -0,0 +1,170 @@
+// 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"
+
+#ifdef _WIN32
+#  include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace arrow::flight::sql::odbc {
+
+TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
+  // ODBC Environment

Review Comment:
   remove `ODBC environment` comment



##########
cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc:
##########
@@ -0,0 +1,170 @@
+// 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"
+
+#ifdef _WIN32
+#  include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqltypes.h>
+#include <sqlucode.h>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace arrow::flight::sql::odbc {
+
+TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
+  // ODBC Environment
+  SQLHENV env;
+
+  // Allocate an environment handle
+  SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);

Review Comment:
   yup, added check and freed the result



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