[libgda/LIBGDA_4.2] gda_g_type_from_string(): handle more types



commit 0155deafcf80573b565facac0fbf2139016c0dc0
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Sep 28 21:38:16 2011 +0200

    gda_g_type_from_string(): handle more types

 libgda/gda-util.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/libgda/gda-util.c b/libgda/gda-util.c
index cbf1572..39ab8d9 100644
--- a/libgda/gda-util.c
+++ b/libgda/gda-util.c
@@ -112,6 +112,13 @@ gda_g_type_to_string (GType type)
  * some type synonyms such as:
  * <itemizedlist>
  *   <listitem><para>"int" for G_TYPE_INT</para></listitem>
+ *   <listitem><para>"uint" for G_TYPE_UINT</para></listitem>
+ *   <listitem><para>"int64" for G_TYPE_INT64</para></listitem>
+ *   <listitem><para>"uint64" for G_TYPE_UINT64</para></listitem>
+ *   <listitem><para>"char" for G_TYPE_CHAR</para></listitem>
+ *   <listitem><para>"uchar" for G_TYPE_UCHAR</para></listitem>
+ *   <listitem><para>"short" for GDA_TYPE_SHORT</para></listitem>
+ *   <listitem><para>"ushort" for GDA_TYPE_USHORT</para></listitem>
  *   <listitem><para>"string" for G_TYPE_STRING</para></listitem>
  *   <listitem><para>"date" for G_TYPE_DATE</para></listitem>
  *   <listitem><para>"time" for GDA_TYPE_TIME</para></listitem>
@@ -134,6 +141,8 @@ gda_g_type_from_string (const gchar *str)
 	if (type == 0) {
 		if (!g_ascii_strcasecmp (str, "int"))
 			type = G_TYPE_INT;
+		else if (!g_ascii_strcasecmp (str, "uint"))
+			type = G_TYPE_UINT;
 		else if (!g_ascii_strcasecmp (str, "string"))
 			type = G_TYPE_STRING;
 		else if (!g_ascii_strcasecmp (str, "date"))
@@ -150,6 +159,18 @@ gda_g_type_from_string (const gchar *str)
 			type = GDA_TYPE_BINARY;
 		else if (!strcmp (str, "null"))
 			type = GDA_TYPE_NULL;
+		else if (!strcmp (str, "short"))
+			type = GDA_TYPE_SHORT;
+		else if (!strcmp (str, "ushort"))
+			type = GDA_TYPE_USHORT;
+		else if (!g_ascii_strcasecmp (str, "int64"))
+			type = G_TYPE_INT64;
+		else if (!g_ascii_strcasecmp (str, "uint64"))
+			type = G_TYPE_UINT64;
+		else if (!g_ascii_strcasecmp (str, "char"))
+			type = G_TYPE_CHAR;
+		else if (!g_ascii_strcasecmp (str, "uchar"))
+			type = G_TYPE_UCHAR;
 		else
 			/* could not find a valid GType for @str */
 			type = G_TYPE_INVALID;



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