← Back to team overview

maria-developers team mailing list archive

Re: Freeing options & wrappers.

 

Hi, Kristian!

On 16.08.2016 13:22, Oleksandr Byelkin wrote:
[skip]
Hope this helps,

Thank you a lot that really helps.

So as I see it: bringing in act the wrappers makes it incompatible with the flag, but we need it to non-leaking slippery written code of connect in other cases. IMHO we just can enforce the flag in case of wrappers, so client either writes something on his knee or use async operation (where some rules must be obeyed).

Making something more I think do not worth it because:
1) in 10.2 C/C will replace the library and it has no the problem
2) we should no make huge changes before 10.2

So what do you think about the patch above implementing:

diff --git a/sql-common/mysql_async.c b/sql-common/mysql_async.c
index 80b4f39..decf48e 100644
--- a/sql-common/mysql_async.c
+++ b/sql-common/mysql_async.c
@@ -455,7 +455,11 @@ MK_ASYNC_START_BODY(
     parms.db= db;
     parms.port= port;
     parms.unix_socket= unix_socket;
-    parms.client_flags= client_flags;
+    /*
+      async wrapper enforce the CLIENT_REMEMBER_OPTIONS flag to be
+      functional (otherwise it can't operate)
+    */
+    parms.client_flags= client_flags | CLIENT_REMEMBER_OPTIONS;
   },
   NULL,
   r_ptr,
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 640ba29..2acec60 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -18443,7 +18443,7 @@ static void test_bug58036()

   if (mysql_real_connect(conn, opt_host, opt_user,
                          opt_password,  opt_db ? opt_db : "test",
- opt_port, opt_unix_socket, CLIENT_REMEMBER_OPTIONS))
+                         opt_port, opt_unix_socket, 0))
   {
     if (!opt_silent)
       printf("mysql_real_connect() succeeded (failure expected)\n");
@@ -18469,7 +18469,7 @@ static void test_bug58036()
   mysql_options(conn, MYSQL_SET_CHARSET_NAME, "latin1");
   if (!mysql_real_connect(conn, opt_host, opt_user,
                          opt_password, opt_db ? opt_db : "test",
- opt_port, opt_unix_socket, CLIENT_REMEMBER_OPTIONS))
+                         opt_port, opt_unix_socket, 0))
   {
     if (!opt_silent)
       printf("mysql_real_connect() failed: %s (%d)\n",
@@ -19344,7 +19344,7 @@ static void test_big_packet()

   if (!(mysql_real_connect(mysql_local, opt_host, opt_user,
                            opt_password, current_db, opt_port,
-                           opt_unix_socket, CLIENT_REMEMBER_OPTIONS)))
+                           opt_unix_socket, 0)))
   {
     mysql_close(mysql_local);
     fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local));



References