Changeset: 62dcc4ffffc2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/62dcc4ffffc2
Modified Files:
        clients/odbc/tests/odbcconnect.c
Branch: Aug2024
Log Message:

Close connection handles after use


diffs (55 lines):

diff --git a/clients/odbc/tests/odbcconnect.c b/clients/odbc/tests/odbcconnect.c
--- a/clients/odbc/tests/odbcconnect.c
+++ b/clients/odbc/tests/odbcconnect.c
@@ -71,6 +71,8 @@ SQLCHAR attrbuf[4096];
 static void
 cleanup(void)
 {
+       free(user);
+       free(password);
        if (conn) {
                SQLDisconnect(conn);
                SQLFreeHandle(SQL_HANDLE_DBC, conn);
@@ -145,8 +147,6 @@ main(int argc, char **argv)
        }
 
 end:
-       free(user);
-       free(password);
        for (int i = 0; i < ntargets; i++)
                free(targets[i]);
        free(targets);
@@ -235,6 +235,10 @@ do_sqlconnect(SQLCHAR *target)
                SQLConnect(conn, target, target_len, user, user_len, password, 
password_len));
        printf("OK\n");
 
+       ensure_ok(
+               SQL_HANDLE_DBC, conn, "Banana",
+               SQLDisconnect(conn));
+
        return 0;
 }
 
@@ -256,6 +260,11 @@ do_sqldriverconnect(SQLCHAR *target)
                ));
 
        printf("OK %s\n", outbuf);
+
+       ensure_ok(
+               SQL_HANDLE_DBC, conn, "Banana",
+               SQLDisconnect(conn));
+
        return 0;
 }
 
@@ -277,6 +286,10 @@ do_sqlbrowseconnect(SQLCHAR *target)
                ret == SQL_NEED_DATA ? "BROWSE" : "OK",
                outbuf
        );
+
+       // Do not call SQLDisconnect, SQLBrowseConnect is intended to
+       // be invoked multiple times without disconnecting inbetween
+
        return 0;
 }
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to