[libgda/LIBGDA_5.2] Value: return 'NULL' for null/invalid values
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/LIBGDA_5.2] Value: return 'NULL' for null/invalid values
- Date: Thu, 2 May 2019 16:06:12 +0000 (UTC)
commit 295fa78d29eee6dbbc5d07fd6884cb95f48d92e0
Author: Daniel Espinosa <esodan gmail com>
Date: Thu May 2 11:04:44 2019 -0500
Value: return 'NULL' for null/invalid values
GdaGeometric, short and Timestamp, when fail to get value, now
return 'NULL' string.
Fix https://gitlab.gnome.org/GNOME/libgda/issues/186
libgda/gda-value.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/libgda/gda-value.c b/libgda/gda-value.c
index 7ad7dcfad..ff1445ef5 100644
--- a/libgda/gda-value.c
+++ b/libgda/gda-value.c
@@ -634,9 +634,7 @@ geometric_point_to_string (const GValue *src, GValue *dest)
str = g_strdup_printf ("(%.*g,%.*g)", DBL_DIG, point->x,
DBL_DIG, point->y);
else
- str = g_strdup_printf ("(%.*g,%.*g)",
- DBL_DIG, 0.,
- DBL_DIG, 0.);
+ str = g_strdup ("NULL");
g_value_take_string (dest, str);
}
@@ -1342,7 +1340,7 @@ timestamp_to_string (const GValue *src, GValue *dest)
g_string_free (string, FALSE);
}
else
- g_value_set_string (dest, "0000-00-00 00:00:00");
+ g_value_set_string (dest, "NULL");
}
GType
@@ -2898,7 +2896,7 @@ short_to_string (const GValue *src, GValue *dest)
if (GDA_VALUE_HOLDS_SHORT (src))
str = g_strdup_printf ("%d", gda_value_get_short ((GValue *) src));
else
- str = g_strdup_printf ("%d", gda_value_get_ushort ((GValue *) src));
+ str = g_strdup ("NULL");
g_value_take_string (dest, str);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]