[libgda/LIBGDA_5.2: 1/2] Minor improvements for MySQL(libGDA 5.2.10): 1. Add flag CLIENT_INTERACTIVE to make a long connectio




commit 6700997e9190cb69bf0fc44995b8e77718fb54c0
Author: taozuhong <taozuhong gmail com>
Date:   Mon Apr 12 17:40:02 2021 +0800

    Minor improvements for MySQL(libGDA 5.2.10):
    1. Add flag CLIENT_INTERACTIVE to make a long connection;
    2. Improve support for type GEOMETRY

 providers/mysql/gda-mysql-provider.c  | 14 ++++++++++++--
 providers/mysql/gda-mysql-recordset.c |  2 ++
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index 8d08aa100..203419daa 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -496,6 +496,7 @@ real_open_connection (const gchar  *host,
                      const gchar  *password,
                      gboolean      use_ssl,
                      gboolean      compress,
+                     gboolean      interactive,
                      const gchar  *proto,
                      GError      **error)
 {
@@ -529,6 +530,8 @@ real_open_connection (const gchar  *host,
                flags |= CLIENT_SSL;
        if (compress)
                flags |= CLIENT_COMPRESS;
+       if (interactive)
+               flags |= CLIENT_INTERACTIVE;
        
        MYSQL *mysql = NULL;
        mysql = mysql_init (NULL);
@@ -664,11 +667,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");
        
        /* open the real connection to the database */
@@ -682,6 +686,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) {
@@ -1024,6 +1029,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");
@@ -1041,6 +1047,10 @@ gda_mysql_provider_perform_operation (GdaServerProvider               *provider,
                value = gda_server_operation_get_value_at (op, "/SERVER_CNX_P/USE_SSL");
                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))
@@ -1055,7 +1065,7 @@ gda_mysql_provider_perform_operation (GdaServerProvider               *provider,
                        proto = g_value_get_string (value);
 
                mysql = real_open_connection (host, port, socket,
-                                              "mysql", login, password, usessl, FALSE, proto, error);
+                                              "mysql", login, password, usessl, FALSE, interactive, proto, 
error);
                 if (!mysql)
                         return FALSE;
                else {
diff --git a/providers/mysql/gda-mysql-recordset.c b/providers/mysql/gda-mysql-recordset.c
index e47b69661..6043922a3 100644
--- a/providers/mysql/gda-mysql-recordset.c
+++ b/providers/mysql/gda-mysql-recordset.c
@@ -664,6 +664,7 @@ gda_mysql_recordset_new (GdaConnection            *cnc,
                case MYSQL_TYPE_LONG_BLOB:
                case MYSQL_TYPE_DECIMAL:
                case MYSQL_TYPE_NEWDECIMAL:
+               case MYSQL_TYPE_GEOMETRY:
                case MYSQL_TYPE_BIT:
                        mysql_bind_result[i].buffer = g_malloc0 (field->max_length + 1);
                        mysql_bind_result[i].buffer_length = field->max_length + 1;
@@ -937,6 +938,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                case MYSQL_TYPE_LONG_BLOB:
                case MYSQL_TYPE_NEWDECIMAL:
                case MYSQL_TYPE_DECIMAL:
+               case MYSQL_TYPE_GEOMETRY:
                case MYSQL_TYPE_BIT: {
                        char *bvalue = NULL;
                        memmove (&length, mysql_bind_result[i].length, sizeof (unsigned long));


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