[libgda] Added gda_server_operation_string_to_op_type()
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Added gda_server_operation_string_to_op_type()
- Date: Mon, 5 Jul 2010 19:35:06 +0000 (UTC)
commit f63965266f1e60426571346ba661db993bc5b6be
Author: Vivien Malerba <malerba gnome-db org>
Date: Mon Jul 5 21:14:33 2010 +0200
Added gda_server_operation_string_to_op_type()
doc/C/libgda-sections.txt | 1 +
doc/C/tmpl/gda-server-operation.sgml | 9 ++++++
libgda/gda-server-operation.c | 53 ++++++++++++++++++++++++++++++++++
libgda/gda-server-operation.h | 1 +
libgda/libgda.symbols | 1 +
5 files changed, 65 insertions(+), 0 deletions(-)
---
diff --git a/doc/C/libgda-sections.txt b/doc/C/libgda-sections.txt
index 903a055..fd21f96 100644
--- a/doc/C/libgda-sections.txt
+++ b/doc/C/libgda-sections.txt
@@ -438,6 +438,7 @@ GdaServerOperation
GdaServerOperationType
gda_server_operation_get_op_type
gda_server_operation_op_type_to_string
+gda_server_operation_string_to_op_type
<SUBSECTION>
gda_server_operation_get_value_at
gda_server_operation_get_sql_identifier_at
diff --git a/doc/C/tmpl/gda-server-operation.sgml b/doc/C/tmpl/gda-server-operation.sgml
index 7de4655..7ceb675 100644
--- a/doc/C/tmpl/gda-server-operation.sgml
+++ b/doc/C/tmpl/gda-server-operation.sgml
@@ -127,6 +127,15 @@ Handles any DDL query in an abstract way
@Returns:
+<!-- ##### FUNCTION gda_server_operation_string_to_op_type ##### -->
+<para>
+
+</para>
+
+ str:
+ Returns:
+
+
<!-- ##### FUNCTION gda_server_operation_get_value_at ##### -->
<para>
diff --git a/libgda/gda-server-operation.c b/libgda/gda-server-operation.c
index b5d8090..1091c5a 100644
--- a/libgda/gda-server-operation.c
+++ b/libgda/gda-server-operation.c
@@ -1236,6 +1236,59 @@ gda_server_operation_op_type_to_string (GdaServerOperationType type)
}
}
+/**
+ * gda_server_operation_string_to_op_type
+ * @str: a string
+ *
+ * Performs the reverse of gda_server_operation_op_type_to_string()
+ *
+ * Returns: the #GdaServerOperationType represented by @str, or #G_MAXINT if @str is not a valid representation
+ * of a #GdaServerOperationType
+ *
+ * Since: 4.2
+ */
+GdaServerOperationType
+gda_server_operation_string_to_op_type (const gchar *str)
+{
+ GdaServerOperationType operation_type = G_MAXINT;
+ g_return_val_if_fail (str && *str, G_MAXINT);
+
+ if (! g_ascii_strcasecmp (str, "CREATE_DB"))
+ operation_type = GDA_SERVER_OPERATION_CREATE_DB;
+ else if (! g_ascii_strcasecmp (str, "DROP_DB"))
+ operation_type = GDA_SERVER_OPERATION_DROP_DB;
+ else if (! g_ascii_strcasecmp (str, "CREATE_TABLE"))
+ operation_type = GDA_SERVER_OPERATION_CREATE_TABLE;
+ else if (! g_ascii_strcasecmp (str, "DROP_TABLE"))
+ operation_type = GDA_SERVER_OPERATION_DROP_TABLE;
+ else if (! g_ascii_strcasecmp (str, "CREATE_INDEX"))
+ operation_type = GDA_SERVER_OPERATION_CREATE_INDEX;
+ else if (! g_ascii_strcasecmp (str, "DROP_INDEX"))
+ operation_type = GDA_SERVER_OPERATION_DROP_INDEX;
+ else if (! g_ascii_strcasecmp (str, "RENAME_TABLE"))
+ operation_type = GDA_SERVER_OPERATION_RENAME_TABLE;
+ else if (! g_ascii_strcasecmp (str, "COMMENT_TABLE"))
+ operation_type = GDA_SERVER_OPERATION_COMMENT_TABLE;
+ else if (! g_ascii_strcasecmp (str, "ADD_COLUMN"))
+ operation_type = GDA_SERVER_OPERATION_ADD_COLUMN;
+ else if (! g_ascii_strcasecmp (str, "DROP_COLUMN"))
+ operation_type = GDA_SERVER_OPERATION_DROP_COLUMN;
+ else if (! g_ascii_strcasecmp (str, "COMMENT_COLUMN"))
+ operation_type = GDA_SERVER_OPERATION_COMMENT_COLUMN;
+ else if (! g_ascii_strcasecmp (str, "CREATE_VIEW"))
+ operation_type = GDA_SERVER_OPERATION_CREATE_VIEW;
+ else if (! g_ascii_strcasecmp (str, "DROP_VIEW"))
+ operation_type = GDA_SERVER_OPERATION_DROP_VIEW;
+ else if (! g_ascii_strcasecmp (str, "CREATE_USER"))
+ operation_type = GDA_SERVER_OPERATION_CREATE_USER;
+ else if (! g_ascii_strcasecmp (str, "DROP_USER"))
+ operation_type = GDA_SERVER_OPERATION_DROP_USER;
+ else if (! g_ascii_strcasecmp (str, "ALTER_USER"))
+ operation_type = GDA_SERVER_OPERATION_ALTER_USER;
+
+ return operation_type;
+}
+
static gboolean node_save (GdaServerOperation *op, Node *opnode, xmlNodePtr parent);
/**
diff --git a/libgda/gda-server-operation.h b/libgda/gda-server-operation.h
index 440e386..42ce83f 100644
--- a/libgda/gda-server-operation.h
+++ b/libgda/gda-server-operation.h
@@ -117,6 +117,7 @@ GType gda_server_operation_get_type (void) G
GdaServerOperation *gda_server_operation_new (GdaServerOperationType op_type, const gchar *xml_file);
GdaServerOperationType gda_server_operation_get_op_type (GdaServerOperation *op);
const gchar *gda_server_operation_op_type_to_string (GdaServerOperationType type);
+GdaServerOperationType gda_server_operation_string_to_op_type (const gchar *str);
GdaServerOperationNode *gda_server_operation_get_node_info (GdaServerOperation *op, const gchar *path_format, ...);
const GValue *gda_server_operation_get_value_at (GdaServerOperation *op, const gchar *path_format, ...);
diff --git a/libgda/libgda.symbols b/libgda/libgda.symbols
index 5c7d94c..15db331 100644
--- a/libgda/libgda.symbols
+++ b/libgda/libgda.symbols
@@ -519,6 +519,7 @@
gda_server_operation_op_type_to_string
gda_server_operation_save_data_to_xml
gda_server_operation_set_value_at
+ gda_server_operation_string_to_op_type
gda_server_operation_type_get_type
gda_server_provider_create_operation
gda_server_provider_create_parser
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]