[libgda: 1/3] Add flag CLIENT_INTERACTIVE to make a long connection;




commit c89c61c90a80addc5f07178b71b4a3b1529c5d68
Author: taozuhong <taozuhong gmail com>
Date:   Thu Sep 30 16:37:14 2021 +0800

    Add flag CLIENT_INTERACTIVE to make a long connection;

 providers/mysql/gda-mysql-provider.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index 6eaee1c09..c27b204dc 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -437,6 +437,7 @@ real_open_connection (const gchar  *host,
                      const gchar  *password,
                      gboolean      use_ssl,
                      gboolean      compress,
+                         gboolean      interactive,
                      const gchar  *proto,
                      GError      **error)
 {
@@ -470,6 +471,8 @@ real_open_connection (const gchar  *host,
                flags |= CLIENT_SSL;
        if (compress)
                flags |= CLIENT_COMPRESS;
+       if (interactive)
+               flags |= CLIENT_INTERACTIVE;
        
        MYSQL *mysql;
        mysql = mysql_init (NULL);
@@ -596,11 +599,12 @@ gda_mysql_provider_open_connection (GdaServerProvider               *provider,
        if (!password)
                password = gda_quark_list_find (params, "PASSWORD");
 
-       const gchar *port, *unix_socket, *use_ssl, *compress, *proto;
+       const gchar *port, *unix_socket, *use_ssl, *compress, *interactive, *proto;
        port = gda_quark_list_find (params, "PORT");
        unix_socket = gda_quark_list_find (params, "UNIX_SOCKET");
        use_ssl = gda_quark_list_find (params, "USE_SSL");
        compress = gda_quark_list_find (params, "COMPRESS");
+       interactive = gda_quark_list_find (params, "INTERACTIVE");
        proto = gda_quark_list_find (params, "PROTOCOL");
                
        GError *error = NULL;
@@ -609,6 +613,7 @@ gda_mysql_provider_open_connection (GdaServerProvider               *provider,
                                             user, password,
                                             (use_ssl && ((*use_ssl == 't') || (*use_ssl == 'T'))) ? TRUE : 
FALSE,
                                             (compress && ((*compress == 't') || (*compress == 'T'))) ? TRUE 
: FALSE,
+                                                (interactive && ((*interactive == 't') || (*interactive == 
'T'))) ? TRUE : FALSE,
                                             proto,
                                             &error);
        if (!mysql) {
@@ -764,8 +769,8 @@ gda_mysql_provider_supports_operation (GdaServerProvider       *provider,
         case GDA_SERVER_OPERATION_RENAME_TABLE:
         case GDA_SERVER_OPERATION_COMMENT_TABLE:
         case GDA_SERVER_OPERATION_ADD_COLUMN:
-       case GDA_SERVER_OPERATION_DROP_COLUMN:
-       case GDA_SERVER_OPERATION_COMMENT_COLUMN:
+               case GDA_SERVER_OPERATION_DROP_COLUMN:
+               case GDA_SERVER_OPERATION_COMMENT_COLUMN:
         case GDA_SERVER_OPERATION_CREATE_INDEX:
         case GDA_SERVER_OPERATION_DROP_INDEX:
         case GDA_SERVER_OPERATION_CREATE_VIEW:
@@ -919,6 +924,7 @@ gda_mysql_provider_perform_operation (GdaServerProvider               *provider,
                gint         port = -1;
                const gchar *socket = NULL;
                gboolean     usessl = FALSE;
+               gboolean     interactive = FALSE;
                const gchar *proto = NULL;
 
                value = gda_server_operation_get_value_at (op, "/SERVER_CNX_P/HOST");
@@ -937,6 +943,10 @@ gda_mysql_provider_perform_operation (GdaServerProvider               *provider,
                if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
                        usessl = TRUE;
 
+               value = gda_server_operation_get_value_at (op, "/SERVER_CNX_P/INTERACTIVE");
+               if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
+                       interactive = TRUE;
+
                value = gda_server_operation_get_value_at (op, "/SERVER_CNX_P/ADM_LOGIN");
                if (value && G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value))
                        login = g_value_get_string (value);
@@ -949,10 +959,10 @@ gda_mysql_provider_perform_operation (GdaServerProvider               *provider,
                if (value && G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value))
                        proto = g_value_get_string (value);
 
-               mysql = real_open_connection (host, port, socket,
-                                              "mysql", login, password, usessl, FALSE, proto, error);
-                if (!mysql)
-                        return FALSE;
+               mysql = real_open_connection (host, port, socket, "mysql", login, password, 
+                                                   usessl, FALSE, interactive, proto, error);
+        if (!mysql)
+            return FALSE;
                else {
                        gchar *sql;
                        int res;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]