mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
102 lines
3.1 KiB
Diff
102 lines
3.1 KiB
Diff
From b129fd1a7b4de4959f8929f03ece4688b3e1a6fd Mon Sep 17 00:00:00 2001
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
Date: Fri, 3 Feb 2023 14:16:21 +1100
|
|
Subject: [PATCH] odbc32: Add initial tests
|
|
|
|
---
|
|
dlls/odbc32/tests/odbc32.c | 52 +++++++++++++++++++++++++++++++++++++-
|
|
1 file changed, 51 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/dlls/odbc32/tests/odbc32.c b/dlls/odbc32/tests/odbc32.c
|
|
index 8a744f23834..7e1f62e559f 100644
|
|
--- 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 );
|
|
}
|
|
@@ -302,6 +310,47 @@ static void test_SQLExecDirect( void )
|
|
ok( ret == SQL_SUCCESS, "got %d\n", ret );
|
|
}
|
|
|
|
+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);
|
|
+}
|
|
+
|
|
START_TEST(odbc32)
|
|
{
|
|
test_SQLAllocHandle();
|
|
@@ -309,4 +358,5 @@ START_TEST(odbc32)
|
|
test_SQLDataSources();
|
|
test_SQLDrivers();
|
|
test_SQLExecDirect();
|
|
+ test_SQLGetEnvAttr();
|
|
}
|
|
--
|
|
2.43.0
|
|
|