From 4e1a78cfdba25f67e93f40ce9d4881cd15abf180 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes 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 57bb17ef617..fa877c295d1 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 ); } @@ -393,6 +401,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(); @@ -400,4 +449,5 @@ START_TEST(odbc32) test_SQLDataSources(); test_SQLDrivers(); test_SQLExecDirect(); + test_SQLGetEnvAttr(); } -- 2.43.0