Re: [gnome-db] gda_xml_value_stringify problem



Hi again,

	attach a better patch with g_strdup and ChangeLog

regards, apg.

El mié, 28-04-2004 a las 14:03, Álvaro Peña González escribió:
> Hi all,
> 
> 	I have found a problem opening a xml database, the problem is that a
> boolean value is saved translated, for example a TRUE is turned to
> VERDADERO (spanish), and then the opening generate a error.
> 
> 	I have attachment a patch that don't use gda_xml_value_stringify if the
> value type is boolean, only for xml an txt databases.
> 
> 	What do you think?
> 
> regards, apg.
> 
> 
> Álvaro Peña
> http://blogs.esware.com/apg
apg esware com
Álvaro Peña
http://blogs.esware.com/apg
apg esware com

? prepare-ChangeLog.pl
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgda/ChangeLog,v
retrieving revision 1.649
diff -u -r1.649 ChangeLog
--- ChangeLog	26 Apr 2004 11:22:50 -0000	1.649
+++ ChangeLog	28 Apr 2004 14:45:10 -0000
@@ -1,3 +1,9 @@
+2004-04-28  Álvaro Peña  <apg esware com>
+
+	* libgda/gda-data-model.c: (export_to_separated),
+	(gda_data_model_to_xml_node): don't use gda_value_stringify
+	for boolean values
+
 2004-04-26  Rodrigo Moya <rodrigo gnome-db org>
 
 	Released 1.1.2
Index: libgda/gda-data-model.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-data-model.c,v
retrieving revision 1.44
diff -u -r1.44 gda-data-model.c
--- libgda/gda-data-model.c	20 Apr 2004 15:55:36 -0000	1.44
+++ libgda/gda-data-model.c	28 Apr 2004 14:45:11 -0000
@@ -962,7 +962,10 @@
 			gchar *txt;
 
 			value = gda_data_model_get_value_at (model, c, r);
-			txt = gda_value_stringify ((GdaValue *) value);
+			if (gda_value_get_type (value) == GDA_VALUE_TYPE_BOOLEAN)
+				txt = g_strdup (gda_value_get_boolean (value) ? "TRUE" : "FALSE");
+			else
+				txt = gda_value_stringify (value);
 			if (c > 0)
 				str = g_string_append_c (str, sep);
 			str = g_string_append_c (str, '"');
@@ -1137,7 +1140,10 @@
 				gchar *str;
 
 				value = gda_data_model_get_value_at (model, c, r);
-				str = gda_value_stringify (value);
+				if (gda_value_get_type (value) == GDA_VALUE_TYPE_BOOLEAN)
+					str = g_strdup (gda_value_get_boolean (value) ? "TRUE" : "FALSE");
+				else
+					str = gda_value_stringify (value);
 				field = xmlNewChild (row, NULL, "value", str);
 				xml_set_int (field, "position", c);
 				xmlSetProp (field, "gdatype", gda_type_to_string (gda_value_get_type (value)));


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