2024-06-23 00:08:28 -07:00
|
|
|
From 4e1a78cfdba25f67e93f40ce9d4881cd15abf180 Mon Sep 17 00:00:00 2001
|
2023-02-16 15:44:46 -08:00
|
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
|
|
Date: Fri, 3 Feb 2023 14:16:21 +1100
|
2024-01-13 11:33:21 -08:00
|
|
|
Subject: [PATCH] odbc32: Add initial tests
|
2023-02-16 15:44:46 -08:00
|
|
|
|
|
|
|
---
|
2024-05-14 15:24:14 -07:00
|
|
|
dlls/odbc32/tests/odbc32.c | 52 +++++++++++++++++++++++++++++++++++++-
|
|
|
|
1 file changed, 51 insertions(+), 1 deletion(-)
|
2023-02-16 15:44:46 -08:00
|
|
|
|
2024-05-14 15:24:14 -07:00
|
|
|
diff --git a/dlls/odbc32/tests/odbc32.c b/dlls/odbc32/tests/odbc32.c
|
2024-06-23 00:08:28 -07:00
|
|
|
index 57bb17ef617..fa877c295d1 100644
|
2024-05-14 15:24:14 -07:00
|
|
|
--- a/dlls/odbc32/tests/odbc32.c
|
|
|
|
+++ b/dlls/odbc32/tests/odbc32.c
|
|
|
|
@@ -28,7 +28,7 @@
|
|
|
|
static void test_SQLAllocHandle( void )
|
|
|
|
{
|
|
|
|
SQLHANDLE handle;
|
|
|
|
- SQLHENV env;
|
|
|
|
+ SQLHENV env, env2;
|
|
|
|
SQLHDBC con;
|
|
|
|
SQLRETURN ret;
|
|
|
|
|
|
|
|
@@ -46,6 +46,12 @@ static void test_SQLAllocHandle( void )
|
|
|
|
ok( ret == SQL_SUCCESS, "got %d\n", ret );
|
|
|
|
ok( env != (void *)0xdeadbeef, "env not set\n" );
|
|
|
|
|
|
|
|
+ env2 = (void *)0xdeadbeef;
|
|
|
|
+ ret = SQLAllocEnv( &env2 );
|
|
|
|
+ ok( ret == SQL_SUCCESS, "got %d\n", ret );
|
|
|
|
+ ok( env2 != (void *)0xdeadbeef, "env2 not set\n" );
|
|
|
|
+ ok( env2 != env, "environment is the same\n" );
|
|
|
|
+
|
|
|
|
con = (void *)0xdeadbeef;
|
|
|
|
ret = SQLAllocConnect( env, &con );
|
|
|
|
ok( ret == SQL_SUCCESS, "got %d\n", ret );
|
|
|
|
@@ -57,6 +63,8 @@ static void test_SQLAllocHandle( void )
|
|
|
|
ok( ret == SQL_INVALID_HANDLE, "got %d\n", ret );
|
|
|
|
ret = SQLFreeEnv( env );
|
|
|
|
ok( ret == SQL_SUCCESS, "got %d\n", ret );
|
|
|
|
+ ret = SQLFreeEnv( env2 );
|
|
|
|
+ ok( ret == SQL_SUCCESS, "got %d\n", ret );
|
|
|
|
ret = SQLFreeEnv( 0 );
|
|
|
|
ok( ret == SQL_INVALID_HANDLE, "got %d\n", ret );
|
|
|
|
}
|
2024-06-23 00:08:28 -07:00
|
|
|
@@ -393,6 +401,47 @@ static void test_SQLExecDirect( void )
|
2024-05-14 15:24:14 -07:00
|
|
|
ok( ret == SQL_SUCCESS, "got %d\n", ret );
|
|
|
|
}
|
|
|
|
|
2023-02-16 15:44:46 -08:00
|
|
|
+void test_SQLGetEnvAttr(void)
|
|
|
|
+{
|
|
|
|
+ SQLRETURN ret;
|
|
|
|
+ SQLHENV sqlenv;
|
|
|
|
+ SQLINTEGER value, length;
|
|
|
|
+
|
|
|
|
+ ret = SQLAllocEnv(&sqlenv);
|
|
|
|
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
|
|
|
|
+
|
|
|
|
+ value = 5;
|
|
|
|
+ length = 12;
|
|
|
|
+ ret = SQLGetEnvAttr(SQL_NULL_HENV, SQL_ATTR_CONNECTION_POOLING, &value, sizeof(SQLINTEGER), &length);
|
|
|
|
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
|
|
|
|
+ ok(value == 0, "got %d\n", value);
|
|
|
|
+ todo_wine ok(length == 12, "got %d\n", length);
|
|
|
|
+
|
|
|
|
+ value = 5;
|
|
|
|
+ length = 13;
|
|
|
|
+ ret = SQLGetEnvAttr(SQL_NULL_HENV, SQL_ATTR_CONNECTION_POOLING, &value, 0, &length);
|
|
|
|
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
|
|
|
|
+ ok(value == 0, "got %d\n", value);
|
|
|
|
+ todo_wine ok(length == 13, "got %d\n", length);
|
|
|
|
+
|
|
|
|
+ value = 5;
|
|
|
|
+ length = 12;
|
|
|
|
+ ret = SQLGetEnvAttr(sqlenv, SQL_ATTR_CONNECTION_POOLING, &value, sizeof(SQLINTEGER), &length);
|
|
|
|
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
|
|
|
|
+ ok(value == 0, "got %d\n", value);
|
|
|
|
+ ok(length == 12, "got %d\n", length);
|
|
|
|
+
|
|
|
|
+ value = 5;
|
|
|
|
+ length = 12;
|
|
|
|
+ ret = SQLGetEnvAttr(sqlenv, SQL_ATTR_CONNECTION_POOLING, &value, 2, &length);
|
|
|
|
+ todo_wine ok(ret == SQL_SUCCESS, "got %d\n", ret);
|
|
|
|
+ todo_wine ok(value == 0, "got %d\n", value);
|
|
|
|
+ ok(length == 12, "got %d\n", length);
|
|
|
|
+
|
|
|
|
+ ret = SQLFreeEnv(sqlenv);
|
|
|
|
+ ok(ret == SQL_SUCCESS, "got %d\n", ret);
|
|
|
|
+}
|
|
|
|
+
|
2024-05-14 15:24:14 -07:00
|
|
|
START_TEST(odbc32)
|
|
|
|
{
|
|
|
|
test_SQLAllocHandle();
|
2024-06-23 00:08:28 -07:00
|
|
|
@@ -400,4 +449,5 @@ START_TEST(odbc32)
|
2024-05-14 15:24:14 -07:00
|
|
|
test_SQLDataSources();
|
|
|
|
test_SQLDrivers();
|
|
|
|
test_SQLExecDirect();
|
2023-02-16 15:44:46 -08:00
|
|
|
+ test_SQLGetEnvAttr();
|
2024-05-14 15:24:14 -07:00
|
|
|
}
|
2023-02-16 15:44:46 -08:00
|
|
|
--
|
2024-01-13 11:33:21 -08:00
|
|
|
2.43.0
|
2023-02-16 15:44:46 -08:00
|
|
|
|