[libgda: 3/5] improve NULL and empty text/varchar type data support




commit ad1a7b34f65ed166dcd21ff97697e455011fd851
Author: taozuhong <taozuhong gmail com>
Date:   Thu Sep 30 17:08:33 2021 +0800

    improve NULL and empty text/varchar type data support

 providers/mysql/gda-mysql-recordset.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/providers/mysql/gda-mysql-recordset.c b/providers/mysql/gda-mysql-recordset.c
index 41917a544..d89fa5e61 100644
--- a/providers/mysql/gda-mysql-recordset.c
+++ b/providers/mysql/gda-mysql-recordset.c
@@ -972,12 +972,20 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                        }
                        
                        if (type == G_TYPE_STRING) {
+                               if (length == 0) {
+                                       bvalue = "\0";
+                               }
                                g_value_set_string (value, bvalue);
+                               bvalue = NULL;
                        }
                        else if (type == GDA_TYPE_TEXT) {
+                               if (length == 0) {
+                                       bvalue = "\0";
+                               }
                                GdaText *text = gda_text_new ();
                                gda_text_set_string (text, bvalue);
                                g_value_take_boxed (value, text);
+                               bvalue = NULL;
                        }
                        else if (type == GDA_TYPE_BINARY) {
                                GdaBinary *bin;


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