[libgda] Move convenience functions to appropriate classes



commit a5a3d60ebcaa35fbe80a012aa204fab64db91d91
Author: David King <davidk openismus com>
Date:   Tue Nov 30 15:46:39 2010 +0100

    Move convenience functions to appropriate classes
    
    Move the convenience API in libgda/gda-easy.[c|h] to the appropriate
    classes. Fix all references in libgda to use the new API. Deprecate the
    old API. Add G_GNUC_NULL_TERMINATED to the changed functions that rely
    on a NULL sentinel to terminate varargs. Remove trailing whitespace from
    changed lines.

 control-center/gdaui-dsn-assistant.c               |    4 +-
 doc/C/tmpl/gda-batch.sgml                          |    3 -
 doc/C/tmpl/gda-column.sgml                         |    7 -
 doc/C/tmpl/gda-config.sgml                         |   12 -
 doc/C/tmpl/gda-connection.sgml                     |   13 -
 doc/C/tmpl/gda-data-handler.sgml                   |    2 +-
 doc/C/tmpl/gda-data-model-iter.sgml                |    5 -
 doc/C/tmpl/gda-data-proxy.sgml                     |   21 -
 doc/C/tmpl/gda-sql-parser.sgml                     |    5 -
 .../gdaui-data-cell-renderer-textual.c             |    2 +-
 libgda-ui/gdaui-combo.c                            |    8 +-
 libgda-ui/gdaui-init.c                             |    4 +-
 libgda-ui/internal/gdaui-provider-auth-editor.c    |    2 +-
 libgda-ui/internal/gdaui-provider-spec-editor.c    |    2 +-
 libgda/gda-connection.c                            |  576 +++++++++++++++++++
 libgda/gda-connection.h                            |   30 +
 libgda/gda-data-handler.c                          |   70 +++
 libgda/gda-data-handler.h                          |    1 +
 libgda/gda-easy.c                                  |  600 +++-----------------
 libgda/gda-easy.h                                  |   20 +-
 libgda/gda-holder.c                                |    4 +-
 libgda/gda-server-operation.c                      |  428 ++++++++++++++
 libgda/gda-server-operation.h                      |   37 ++
 libgda/gda-sql-builder.c                           |    3 +-
 libgda/gda-statement.c                             |    2 +-
 libgda/sqlite/gda-sqlite-provider.c                |    4 +-
 providers/postgres/gda-postgres-ddl.c              |    4 +-
 tests/Makefile.am                                  |    4 +-
 tests/test-cnc-utils.c                             |   10 +-
 tests/test-input-parsers.c                         |    2 +-
 30 files changed, 1249 insertions(+), 636 deletions(-)
---
diff --git a/control-center/gdaui-dsn-assistant.c b/control-center/gdaui-dsn-assistant.c
index f4be97e..0fe390f 100644
--- a/control-center/gdaui-dsn-assistant.c
+++ b/control-center/gdaui-dsn-assistant.c
@@ -134,7 +134,7 @@ assistant_applied_cb (GtkAssistant *assist, G_GNUC_UNUSED gpointer data)
 			GSList *dsn_params;
 			GError *error = NULL;
 
-			allok = gda_perform_create_database (NULL, assistant->priv->create_db_op, &error);
+			allok = gda_server_operation_perform_create_database (assistant->priv->create_db_op, NULL, &error);
 			if (!allok) {
 				gchar *str;
 				str = g_strdup_printf (_("Error creating database: %s"), 
@@ -213,7 +213,7 @@ get_specs_database_creation (GdauiDsnAssistant *assistant)
 {
 	if (! assistant->priv->create_db_op) 
 		assistant->priv->create_db_op = 
-			gda_prepare_create_database (gdaui_provider_selector_get_provider (
+			gda_server_operation_prepare_create_database (gdaui_provider_selector_get_provider (
 						     GDAUI_PROVIDER_SELECTOR (assistant->priv->general_provider)),
 						     NULL, NULL);
 
diff --git a/doc/C/tmpl/gda-batch.sgml b/doc/C/tmpl/gda-batch.sgml
index 526add7..7c12079 100644
--- a/doc/C/tmpl/gda-batch.sgml
+++ b/doc/C/tmpl/gda-batch.sgml
@@ -35,9 +35,6 @@ a #GdaSqlParser object.
 
 </para>
 
-@: 
-@:
-
 @gdabatch: the object which received the signal.
 @arg1: 
 
diff --git a/doc/C/tmpl/gda-column.sgml b/doc/C/tmpl/gda-column.sgml
index 2673d9f..13be76a 100644
--- a/doc/C/tmpl/gda-column.sgml
+++ b/doc/C/tmpl/gda-column.sgml
@@ -32,10 +32,6 @@ Management of #GdaDataModel column attributes
 
 </para>
 
-@: 
-@: 
-@:
-
 @gdacolumn: the object which received the signal.
 @arg1: 
 @arg2: 
@@ -45,9 +41,6 @@ Management of #GdaDataModel column attributes
 
 </para>
 
-@: 
-@:
-
 @gdacolumn: the object which received the signal.
 @arg1: 
 
diff --git a/doc/C/tmpl/gda-config.sgml b/doc/C/tmpl/gda-config.sgml
index fc1d8d5..42b18d0 100644
--- a/doc/C/tmpl/gda-config.sgml
+++ b/doc/C/tmpl/gda-config.sgml
@@ -59,9 +59,6 @@ g_object_new (GDA_TYPE_CONFIG, "user-file", "my_file", NULL);
 
 </para>
 
-@: 
-@:
-
 @gdaconfig: the object which received the signal.
 @arg1: 
 
@@ -70,9 +67,6 @@ g_object_new (GDA_TYPE_CONFIG, "user-file", "my_file", NULL);
 
 </para>
 
-@: 
-@:
-
 @gdaconfig: the object which received the signal.
 @arg1: 
 
@@ -81,9 +75,6 @@ g_object_new (GDA_TYPE_CONFIG, "user-file", "my_file", NULL);
 
 </para>
 
-@: 
-@:
-
 @gdaconfig: the object which received the signal.
 @arg1: 
 
@@ -92,9 +83,6 @@ g_object_new (GDA_TYPE_CONFIG, "user-file", "my_file", NULL);
 
 </para>
 
-@: 
-@:
-
 @gdaconfig: the object which received the signal.
 @arg1: 
 
diff --git a/doc/C/tmpl/gda-connection.sgml b/doc/C/tmpl/gda-connection.sgml
index c69338d..8403be0 100644
--- a/doc/C/tmpl/gda-connection.sgml
+++ b/doc/C/tmpl/gda-connection.sgml
@@ -67,8 +67,6 @@ A connection to a database
 
 </para>
 
-@:
-
 @gdaconnection: the object which received the signal.
 
 <!-- ##### SIGNAL GdaConnection::conn-opened ##### -->
@@ -76,8 +74,6 @@ A connection to a database
 
 </para>
 
-@:
-
 @gdaconnection: the object which received the signal.
 
 <!-- ##### SIGNAL GdaConnection::conn-to-close ##### -->
@@ -85,8 +81,6 @@ A connection to a database
 
 </para>
 
-@:
-
 @gdaconnection: the object which received the signal.
 
 <!-- ##### SIGNAL GdaConnection::dsn-changed ##### -->
@@ -94,8 +88,6 @@ A connection to a database
 
 </para>
 
-@:
-
 @gdaconnection: the object which received the signal.
 
 <!-- ##### SIGNAL GdaConnection::error ##### -->
@@ -103,9 +95,6 @@ A connection to a database
 
 </para>
 
-@: 
-@:
-
 @gdaconnection: the object which received the signal.
 @arg1: 
 
@@ -114,8 +103,6 @@ A connection to a database
 
 </para>
 
-@:
-
 @gdaconnection: the object which received the signal.
 
 <!-- ##### ARG GdaConnection:auth-string ##### -->
diff --git a/doc/C/tmpl/gda-data-handler.sgml b/doc/C/tmpl/gda-data-handler.sgml
index 973a44f..37cd37d 100644
--- a/doc/C/tmpl/gda-data-handler.sgml
+++ b/doc/C/tmpl/gda-data-handler.sgml
@@ -16,7 +16,7 @@ Interface which provides data handling (conversions) capabilities
 </para>
 <para>
   For each data type, a corresponding #GdaDataHandler object can be requested using the
-  <link linkend="gda-get-default-handler">gda_get_default_handler()</link> function. However, when working
+  <link linkend="gda-data-handler-get-default-handler">gda_data_handler_get_default_handler()</link> function. However, when working
   with a specific database provider, it's better to use a #GdaDataHandler which may be specific to the
   database provider which will correctly handle each database specifics using
   <link linkend="gda-server-provider-get-data-handler-g-type">gda_server_provider_get_data_handler_g_type()</link> or
diff --git a/doc/C/tmpl/gda-data-model-iter.sgml b/doc/C/tmpl/gda-data-model-iter.sgml
index 748c66b..db61e18 100644
--- a/doc/C/tmpl/gda-data-model-iter.sgml
+++ b/doc/C/tmpl/gda-data-model-iter.sgml
@@ -70,8 +70,6 @@ Data model iterator
 
 </para>
 
-@:
-
 @gdadatamodeliter: the object which received the signal.
 
 <!-- ##### SIGNAL GdaDataModelIter::row-changed ##### -->
@@ -79,9 +77,6 @@ Data model iterator
 
 </para>
 
-@: 
-@:
-
 @gdadatamodeliter: the object which received the signal.
 @arg1: 
 
diff --git a/doc/C/tmpl/gda-data-proxy.sgml b/doc/C/tmpl/gda-data-proxy.sgml
index a997ca3..0db259f 100644
--- a/doc/C/tmpl/gda-data-proxy.sgml
+++ b/doc/C/tmpl/gda-data-proxy.sgml
@@ -130,8 +130,6 @@ Proxy to hold modifications for any #GdaDataModel, and provides the #GdaDataMode
 
 </para>
 
-@:
-
 @gdadataproxy: the object which received the signal.
 
 <!-- ##### SIGNAL GdaDataProxy::row-changes-applied ##### -->
@@ -139,10 +137,6 @@ Proxy to hold modifications for any #GdaDataModel, and provides the #GdaDataMode
 
 </para>
 
-@: 
-@: 
-@:
-
 @gdadataproxy: the object which received the signal.
 @arg1: 
 @arg2: 
@@ -152,10 +146,6 @@ Proxy to hold modifications for any #GdaDataModel, and provides the #GdaDataMode
 
 </para>
 
-@: 
-@: 
-@:
-
 @gdadataproxy: the object which received the signal.
 @arg1: 
 @arg2: 
@@ -165,10 +155,6 @@ Proxy to hold modifications for any #GdaDataModel, and provides the #GdaDataMode
 
 </para>
 
-@: 
-@: 
-@:
-
 @gdadataproxy: the object which received the signal.
 @arg1: 
 @arg2: 
@@ -178,9 +164,6 @@ Proxy to hold modifications for any #GdaDataModel, and provides the #GdaDataMode
 
 </para>
 
-@: 
-@:
-
 @gdadataproxy: the object which received the signal.
 @arg1: 
 
@@ -189,10 +172,6 @@ Proxy to hold modifications for any #GdaDataModel, and provides the #GdaDataMode
 
 </para>
 
-@: 
-@: 
-@:
-
 @Returns: 
 @Param2: 
 @Param3: 
diff --git a/doc/C/tmpl/gda-sql-parser.sgml b/doc/C/tmpl/gda-sql-parser.sgml
index 18c46b9..071a374 100644
--- a/doc/C/tmpl/gda-sql-parser.sgml
+++ b/doc/C/tmpl/gda-sql-parser.sgml
@@ -110,11 +110,6 @@ ALTER GROUP mygroup ADD USER ##name::gchararray;
 Internal usage only.
 </para>
 
-<!-- ##### ARG GdaSqlParser:debug ##### -->
-<para>
-
-</para>
-
 <!-- ##### ARG GdaSqlParser:line-error ##### -->
 <para>
 Internal usage only.
diff --git a/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c b/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
index 954e360..36f61df 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
@@ -454,7 +454,7 @@ gdaui_data_cell_renderer_textual_set_property (GObject *object,
 					datacell->priv->value = gda_value_copy (gval);
 
 				if (!datacell->priv->dh && (datacell->priv->type != G_TYPE_INVALID))
-					datacell->priv->dh = g_object_ref (gda_get_default_handler (datacell->priv->type));
+					datacell->priv->dh = g_object_ref (gda_data_handler_get_default_handler (datacell->priv->type));
 
 				if (datacell->priv->dh) {
 					str = gda_data_handler_get_str_from_value (datacell->priv->dh, gval);
diff --git a/libgda-ui/gdaui-combo.c b/libgda-ui/gdaui-combo.c
index 7dffeac..6dd9524 100644
--- a/libgda-ui/gdaui-combo.c
+++ b/libgda-ui/gdaui-combo.c
@@ -438,7 +438,7 @@ gdaui_combo_set_model (GdauiCombo *combo, GdaDataModel *model, gint n_cols, gint
 				if (cvalue && (G_VALUE_TYPE (cvalue) != GDA_TYPE_NULL)) {
 					gchar *str;
 					gint len;
-					dh = gda_get_default_handler (G_VALUE_TYPE (cvalue));
+					dh = gda_data_handler_get_default_handler (G_VALUE_TYPE (cvalue));
 					str = gda_data_handler_get_str_from_value (dh, cvalue);
 					len = strlen (str);
 					g_free (str);
@@ -457,7 +457,7 @@ gdaui_combo_set_model (GdauiCombo *combo, GdaDataModel *model, gint n_cols, gint
 
 			column = gda_data_model_describe_column (model, index);
 			type = gda_column_get_g_type (column);
-			dh = gda_get_default_handler (type);
+			dh = gda_data_handler_get_default_handler (type);
 			
 			renderer = gtk_cell_renderer_text_new ();
 			g_object_set_data (G_OBJECT (renderer), "data-handler", dh);
@@ -802,7 +802,7 @@ combo_selector_set_column_visible (GdauiDataSelector *iface, gint column, gboole
 			if (cvalue && (G_VALUE_TYPE (cvalue) != GDA_TYPE_NULL)) {
 				gchar *str;
 				gint len;
-				dh = gda_get_default_handler (G_VALUE_TYPE (cvalue));
+				dh = gda_data_handler_get_default_handler (G_VALUE_TYPE (cvalue));
 				str = gda_data_handler_get_str_from_value (dh, cvalue);
 				len = strlen (str);
 				g_free (str);
@@ -819,7 +819,7 @@ combo_selector_set_column_visible (GdauiDataSelector *iface, gint column, gboole
 
 	mcolumn = gda_data_model_describe_column (combo->priv->model, column);
 	type = gda_column_get_g_type (mcolumn);
-	dh = gda_get_default_handler (type);
+	dh = gda_data_handler_get_default_handler (type);
 	
 	renderer = gtk_cell_renderer_text_new ();
 	g_object_set_data (G_OBJECT (renderer), "data-handler", dh);
diff --git a/libgda-ui/gdaui-init.c b/libgda-ui/gdaui-init.c
index 195363e..51f3077 100644
--- a/libgda-ui/gdaui-init.c
+++ b/libgda-ui/gdaui-init.c
@@ -115,7 +115,7 @@ gdaui_new_data_entry (GType type, const gchar *plugin_name)
 	if (type == G_TYPE_INVALID)
 		return (GdauiDataEntry *) gdaui_entry_none_new (GDA_TYPE_NULL);
 
-	dh = gda_get_default_handler (type);
+	dh = gda_data_handler_get_default_handler (type);
 
 	if (plugin_name && *plugin_name) {
 		GdauiPlugin *plugin_struct;
@@ -213,7 +213,7 @@ _gdaui_new_cell_renderer (GType type, const gchar *plugin_name)
 	if (!gdaui_plugins_hash) 
 		gdaui_plugins_hash = init_plugins_hash ();
 
-	dh = gda_get_default_handler (type);
+	dh = gda_data_handler_get_default_handler (type);
 	
 	if (plugin_name && *plugin_name) {
 		GdauiPlugin *plugin_struct;
diff --git a/libgda-ui/internal/gdaui-provider-auth-editor.c b/libgda-ui/internal/gdaui-provider-auth-editor.c
index 3b2cb7b..b6cee99 100644
--- a/libgda-ui/internal/gdaui-provider-auth-editor.c
+++ b/libgda-ui/internal/gdaui-provider-auth-editor.c
@@ -340,7 +340,7 @@ params_to_string (GdauiProviderAuthEditor *auth)
 				GType dtype;
 
 				dtype = gda_holder_get_g_type (param);
-				dh = gda_get_default_handler (dtype);
+				dh = gda_data_handler_get_default_handler (dtype);
 				str = gda_data_handler_get_str_from_value (dh, value);
 			}
 			if (str && *str) {
diff --git a/libgda-ui/internal/gdaui-provider-spec-editor.c b/libgda-ui/internal/gdaui-provider-spec-editor.c
index 48aea64..b36c270 100644
--- a/libgda-ui/internal/gdaui-provider-spec-editor.c
+++ b/libgda-ui/internal/gdaui-provider-spec-editor.c
@@ -389,7 +389,7 @@ params_to_string (GdauiProviderSpecEditor *spec)
 				GType dtype;
 
 				dtype = gda_holder_get_g_type (param);
-				dh = gda_get_default_handler (dtype);
+				dh = gda_data_handler_get_default_handler (dtype);
 				str = gda_data_handler_get_str_from_value (dh, value);
 			}
 			if (str && *str) {
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index ab2c05e..39f3bde 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -53,6 +53,9 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+static GStaticMutex parser_mutex = G_STATIC_MUTEX_INIT;
+static GdaSqlParser *internal_parser = NULL;
+
 #define PROV_CLASS(provider) (GDA_SERVER_PROVIDER_CLASS (G_OBJECT_GET_CLASS (provider)))
 
 /* number of GdaConnectionEvent kept by each connection. Should be enough to avoid losing any
@@ -1743,6 +1746,509 @@ gda_connection_get_authentication (GdaConnection *cnc)
 }
 
 /**
+ * gda_connection_insert_row_into_table:
+ * @cnc: an opened connection
+ * @table: table's name to insert into
+ * @error: a place to store errors, or %NULL
+ * @...: a list of string/GValue pairs with the name of the column to use and the
+ * GValue pointer containing the value to insert for the column (value can be %NULL), finished by a %NULL. There must be
+ * at least one column name and value
+ *
+ * This is a convenience function, which creates an INSERT statement and executes it using the values
+ * provided. It internally relies on variables which makes it immune to SQL injection problems.
+ *
+ * The equivalent SQL command is: INSERT INTO &lt;table&gt; (&lt;column_name&gt; [,...]) VALUES (&lt;column_name&gt; = &lt;new_value&gt; [,...]).
+ *
+ * Returns: TRUE if no error occurred
+ */
+G_GNUC_NULL_TERMINATED
+gboolean
+gda_connection_insert_row_into_table (GdaConnection *cnc, const gchar *table, GError **error, ...)
+{
+	GSList *clist = NULL;
+	GSList *vlist = NULL;
+	gboolean retval;
+	va_list  args;
+	gchar *col_name;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (table && *table, FALSE);
+
+	va_start (args, error);
+	while ((col_name = va_arg (args, gchar*))) {
+		clist = g_slist_prepend (clist, col_name);
+		GValue *value;
+		value = va_arg (args, GValue *);
+		vlist = g_slist_prepend (vlist, value);
+	}
+
+	va_end (args);
+
+	if (!clist) {
+		g_warning ("No specified column or value");
+		return FALSE;
+	}
+
+	clist = g_slist_reverse (clist);
+	vlist = g_slist_reverse (vlist);
+	retval = gda_connection_insert_row_into_table_v (cnc, table, clist, vlist, error);
+	g_slist_free (clist);
+	g_slist_free (vlist);
+
+	return retval;
+}
+
+/**
+ * gda_connection_insert_row_into_table_v:
+ * @cnc: an opened connection
+ * @table: table's name to insert into
+ * @col_names: (element-type utf8): a list of column names (as const gchar *)
+ * @values: (element-type GValue): a list of values (as #GValue)
+ * @error: a place to store errors, or %NULL
+ *
+ * @col_names and @values must have length (&gt;= 1).
+ *
+ * This is a convenience function, which creates an INSERT statement and executes it using the values
+ * provided. It internally relies on variables which makes it immune to SQL injection problems.
+ *
+ * The equivalent SQL command is: INSERT INTO &lt;table&gt; (&lt;column_name&gt; [,...]) VALUES (&lt;column_name&gt; = &lt;new_value&gt; [,...]).
+ *
+ * Returns: TRUE if no error occurred, FALSE otherwise
+ */
+gboolean
+gda_connection_insert_row_into_table_v (GdaConnection *cnc, const gchar *table,
+			     GSList *col_names, GSList *values,
+			     GError **error)
+{
+	gboolean retval;
+	GSList *fields = NULL;
+	GSList *expr_values = NULL;
+	GdaSqlStatement *sql_stm;
+	GdaSqlStatementInsert *ssi;
+	GdaStatement *insert;
+	gint i;
+
+	GSList *holders = NULL;
+	GSList *l1, *l2;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (table && *table, FALSE);
+	g_return_val_if_fail (col_names, FALSE);
+	g_return_val_if_fail (g_slist_length (col_names) == g_slist_length (values), FALSE);
+
+	/* Construct insert query and list of GdaHolders */
+	sql_stm = gda_sql_statement_new (GDA_SQL_STATEMENT_INSERT);
+	ssi = (GdaSqlStatementInsert*) sql_stm->contents;
+	g_assert (GDA_SQL_ANY_PART (ssi)->type == GDA_SQL_ANY_STMT_INSERT);
+
+	ssi->table = gda_sql_table_new (GDA_SQL_ANY_PART (ssi));
+	ssi->table->table_name = gda_sql_identifier_quote (table, cnc, NULL, FALSE, FALSE);
+
+	i = 0;
+	for (l1 = col_names, l2 = values;
+	     l1;
+	     l1 = l1->next, l2 = l2->next) {
+		GdaSqlField *field;
+		GdaSqlExpr *expr;
+		GValue *value = (GValue *) l2->data;
+		const gchar *col_name = (const gchar*) l1->data;
+
+		/* field */
+		field = gda_sql_field_new (GDA_SQL_ANY_PART (ssi));
+		field->field_name = gda_sql_identifier_quote (col_name, cnc, NULL, FALSE, FALSE);
+		fields = g_slist_prepend (fields, field);
+
+		/* value */
+		expr = gda_sql_expr_new (GDA_SQL_ANY_PART (ssi));
+		if (value && (G_VALUE_TYPE (value) != GDA_TYPE_NULL)) {
+			/* create a GdaSqlExpr with a parameter */
+			GdaSqlParamSpec *param;
+			param = g_new0 (GdaSqlParamSpec, 1);
+			param->name = g_strdup_printf ("+%d", i);
+			param->g_type = G_VALUE_TYPE (value);
+			param->is_param = TRUE;
+			expr->param_spec = param;
+
+			GdaHolder *holder;
+			holder = (GdaHolder*)  g_object_new (GDA_TYPE_HOLDER, "g-type", G_VALUE_TYPE (value),
+							     "id", param->name, NULL);
+			g_assert (gda_holder_set_value (holder, value, NULL));
+			holders = g_slist_prepend (holders, holder);
+		}
+		else {
+			/* create a NULL GdaSqlExpr => nothing to do */
+		}
+		expr_values = g_slist_prepend (expr_values, expr);
+
+		i++;
+	}
+
+	ssi->fields_list = g_slist_reverse (fields);
+	ssi->values_list = g_slist_prepend (NULL, g_slist_reverse (expr_values));
+
+	insert = gda_statement_new ();
+	g_object_set (G_OBJECT (insert), "structure", sql_stm, NULL);
+	gda_sql_statement_free (sql_stm);
+
+	/* execute statement */
+	GdaSet *set = NULL;
+	if (holders) {
+		set = gda_set_new (holders);
+		g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
+		g_slist_free (holders);
+	}
+
+	retval = (gda_connection_statement_execute_non_select (cnc, insert, set, NULL, error) == -1) ? FALSE : TRUE;
+
+	if (set)
+		g_object_unref (set);
+	g_object_unref (insert);
+
+	return retval;
+}
+
+/**
+ * gda_connection_update_row_in_table:
+ * @cnc: an opened connection
+ * @table: the table's name with the row's values to be updated
+ * @condition_column_name: the name of the column to used in the WHERE condition clause
+ * @condition_value: the @condition_column_type's GType
+ * @error: a place to store errors, or %NULL
+ * @...: a list of string/GValue pairs with the name of the column to use and the
+ * GValue pointer containing the value to update the column to (value can be %NULL), finished by a %NULL. There must be
+ * at least one column name and value
+ *
+ * This is a convenience function, which creates an UPDATE statement and executes it using the values
+ * provided. It internally relies on variables which makes it immune to SQL injection problems.
+ *
+ * The equivalent SQL command is: UPDATE &lt;table&gt; SET &lt;column_name&gt; = &lt;new_value&gt; [,...] WHERE &lt;condition_column_name&gt; = &lt;condition_value&gt;.
+ *
+ * Returns: TRUE if no error occurred, FALSE otherwise
+ */
+G_GNUC_NULL_TERMINATED
+gboolean
+gda_connection_update_row_in_table (GdaConnection *cnc, const gchar *table,
+			 const gchar *condition_column_name,
+			 GValue *condition_value, GError **error, ...)
+{
+	GSList *clist = NULL;
+	GSList *vlist = NULL;
+	gboolean retval;
+	va_list  args;
+	gchar *col_name;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (table && *table, FALSE);
+
+	va_start (args, error);
+	while ((col_name = va_arg (args, gchar*))) {
+		clist = g_slist_prepend (clist, col_name);
+		GValue *value;
+		value = va_arg (args, GValue *);
+		vlist = g_slist_prepend (vlist, value);
+	}
+
+	va_end (args);
+
+	if (!clist) {
+		g_warning ("No specified column or value");
+		return FALSE;
+	}
+
+	clist = g_slist_reverse (clist);
+	vlist = g_slist_reverse (vlist);
+	retval = gda_connection_update_row_in_table_v (cnc, table, condition_column_name, condition_value, clist, vlist, error);
+	g_slist_free (clist);
+	g_slist_free (vlist);
+
+	return retval;
+}
+
+/**
+ * gda_connection_update_row_in_table_v:
+ * @cnc: an opened connection
+ * @table: the table's name with the row's values to be updated
+ * @condition_column_name: the name of the column to used in the WHERE condition clause
+ * @condition_value: the @condition_column_type's GType
+ * @col_names: (element-type utf8): a list of column names (as const gchar *)
+ * @values: (element-type GValue): a list of values (as #GValue)
+ * @error: a place to store errors, or %NULL
+ *
+ * @col_names and @values must have length (&gt;= 1).
+ *
+ * This is a convenience function, which creates an UPDATE statement and executes it using the values
+ * provided. It internally relies on variables which makes it immune to SQL injection problems.
+ *
+ * The equivalent SQL command is: UPDATE &lt;table&gt; SET &lt;column_name&gt; = &lt;new_value&gt; [,...] WHERE &lt;condition_column_name&gt; = &lt;condition_value&gt;.
+ *
+ * Returns: TRUE if no error occurred, FALSE otherwise
+ */
+gboolean
+gda_connection_update_row_in_table_v (GdaConnection *cnc, const gchar *table,
+			   const gchar *condition_column_name,
+			   GValue *condition_value,
+			   GSList *col_names, GSList *values,
+			   GError **error)
+{
+	gboolean retval;
+	GSList *fields = NULL;
+	GSList *expr_values = NULL;
+	GdaSqlStatement *sql_stm;
+	GdaSqlStatementUpdate *ssu;
+	GdaStatement *update;
+	gint i;
+
+	GSList *holders = NULL;
+	GSList *l1, *l2;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (table && *table, FALSE);
+	g_return_val_if_fail (col_names, FALSE);
+	g_return_val_if_fail (g_slist_length (col_names) == g_slist_length (values), FALSE);
+
+	/* Construct update query and list of GdaHolders */
+	sql_stm = gda_sql_statement_new (GDA_SQL_STATEMENT_UPDATE);
+	ssu = (GdaSqlStatementUpdate*) sql_stm->contents;
+	g_assert (GDA_SQL_ANY_PART (ssu)->type == GDA_SQL_ANY_STMT_UPDATE);
+
+	ssu->table = gda_sql_table_new (GDA_SQL_ANY_PART (ssu));
+	ssu->table->table_name = gda_sql_identifier_quote (table, cnc, NULL, FALSE, FALSE);
+
+	if (condition_column_name) {
+		GdaSqlExpr *where, *op;
+		where = gda_sql_expr_new (GDA_SQL_ANY_PART (ssu));
+		ssu->cond = where;
+
+		where->cond = gda_sql_operation_new (GDA_SQL_ANY_PART (where));
+		where->cond->operator_type = GDA_SQL_OPERATOR_TYPE_EQ;
+
+		op = gda_sql_expr_new (GDA_SQL_ANY_PART (where->cond));
+		where->cond->operands = g_slist_prepend (NULL, op);
+		op->value = gda_value_new (G_TYPE_STRING);
+		g_value_take_string (op->value, gda_sql_identifier_quote (condition_column_name, cnc, NULL,
+									  FALSE, FALSE));
+
+		op = gda_sql_expr_new (GDA_SQL_ANY_PART (where->cond));
+		where->cond->operands = g_slist_append (where->cond->operands, op);
+		if (condition_value) {
+			GdaSqlParamSpec *param;
+			param = g_new0 (GdaSqlParamSpec, 1);
+			param->name = g_strdup ("cond");
+			param->g_type = G_VALUE_TYPE (condition_value);
+			param->is_param = TRUE;
+			op->param_spec = param;
+
+			GdaHolder *holder;
+			holder = (GdaHolder*)  g_object_new (GDA_TYPE_HOLDER, "g-type", G_VALUE_TYPE (condition_value),
+							     "id", param->name, NULL);
+			g_assert (gda_holder_set_value (holder, condition_value, NULL));
+			holders = g_slist_prepend (holders, holder);
+		}
+		else {
+			/* nothing to do: NULL */
+		}
+	}
+
+	i = 0;
+	for (l1 = col_names, l2 = values;
+	     l1;
+	     l1 = l1->next, l2 = l2->next) {
+		GValue *value = (GValue *) l2->data;
+		const gchar *col_name = (const gchar*) l1->data;
+		GdaSqlField *field;
+		GdaSqlExpr *expr;
+
+		/* field */
+		field = gda_sql_field_new (GDA_SQL_ANY_PART (ssu));
+		field->field_name = gda_sql_identifier_quote (col_name, cnc, NULL, FALSE, FALSE);
+		fields = g_slist_prepend (fields, field);
+
+		/* value */
+		expr = gda_sql_expr_new (GDA_SQL_ANY_PART (ssu));
+		if (value && (G_VALUE_TYPE (value) != GDA_TYPE_NULL)) {
+			/* create a GdaSqlExpr with a parameter */
+			GdaSqlParamSpec *param;
+			param = g_new0 (GdaSqlParamSpec, 1);
+			param->name = g_strdup_printf ("+%d", i);
+			param->g_type = G_VALUE_TYPE (value);
+			param->is_param = TRUE;
+			expr->param_spec = param;
+
+			GdaHolder *holder;
+			holder = (GdaHolder*)  g_object_new (GDA_TYPE_HOLDER, "g-type", G_VALUE_TYPE (value),
+							     "id", param->name, NULL);
+			g_assert (gda_holder_set_value (holder, value, NULL));
+			holders = g_slist_prepend (holders, holder);
+		}
+		else {
+			/* create a NULL GdaSqlExpr => nothing to do */
+		}
+		expr_values = g_slist_prepend (expr_values, expr);
+
+		i++;
+	}
+
+	ssu->fields_list = g_slist_reverse (fields);
+	ssu->expr_list = g_slist_reverse (expr_values);
+
+	update = gda_statement_new ();
+	g_object_set (G_OBJECT (update), "structure", sql_stm, NULL);
+	gda_sql_statement_free (sql_stm);
+
+	/* execute statement */
+	GdaSet *set = NULL;
+	if (holders) {
+		set = gda_set_new (holders);
+		g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
+		g_slist_free (holders);
+	}
+
+	retval = (gda_connection_statement_execute_non_select (cnc, update, set, NULL, error) == -1) ? FALSE : TRUE;
+
+	if (set)
+		g_object_unref (set);
+	g_object_unref (update);
+
+	return retval;
+}
+
+/**
+ * gda_connection_delete_row_from_table:
+ * @cnc: an opened connection
+ * @table: the table's name with the row's values to be updated
+ * @condition_column_name: the name of the column to used in the WHERE condition clause
+ * @condition_value: the @condition_column_type's GType
+ * @error: a place to store errors, or %NULL
+ *
+ * This is a convenience function, which creates a DELETE statement and executes it using the values
+ * provided. It internally relies on variables which makes it immune to SQL injection problems.
+ *
+ * The equivalent SQL command is: DELETE FROM &lt;table&gt; WHERE &lt;condition_column_name&gt; = &lt;condition_value&gt;.
+ *
+ * Returns: TRUE if no error occurred, FALSE otherwise
+ */
+gboolean
+gda_connection_delete_row_from_table (GdaConnection *cnc, const gchar *table,
+			   const gchar *condition_column_name,
+			   GValue *condition_value, GError **error)
+{
+	gboolean retval;
+	GdaSqlStatement *sql_stm;
+	GdaSqlStatementDelete *ssd;
+	GdaStatement *delete;
+
+	GSList *holders = NULL;
+
+	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
+	g_return_val_if_fail (table && *table, FALSE);
+
+	/* Construct delete query and list of GdaHolders */
+	sql_stm = gda_sql_statement_new (GDA_SQL_STATEMENT_DELETE);
+	ssd = (GdaSqlStatementDelete*) sql_stm->contents;
+	g_assert (GDA_SQL_ANY_PART (ssd)->type == GDA_SQL_ANY_STMT_DELETE);
+
+	ssd->table = gda_sql_table_new (GDA_SQL_ANY_PART (ssd));
+	ssd->table->table_name = gda_sql_identifier_quote (table, cnc, NULL, FALSE, FALSE);
+
+	if (condition_column_name) {
+		GdaSqlExpr *where, *op;
+		where = gda_sql_expr_new (GDA_SQL_ANY_PART (ssd));
+		ssd->cond = where;
+
+		where->cond = gda_sql_operation_new (GDA_SQL_ANY_PART (where));
+		where->cond->operator_type = GDA_SQL_OPERATOR_TYPE_EQ;
+
+		op = gda_sql_expr_new (GDA_SQL_ANY_PART (where->cond));
+		where->cond->operands = g_slist_prepend (NULL, op);
+		op->value = gda_value_new (G_TYPE_STRING);
+		g_value_take_string (op->value, gda_sql_identifier_quote (condition_column_name, cnc, NULL,
+									  FALSE, FALSE));
+
+		op = gda_sql_expr_new (GDA_SQL_ANY_PART (where->cond));
+		where->cond->operands = g_slist_append (where->cond->operands, op);
+		if (condition_value) {
+			GdaSqlParamSpec *param;
+			param = g_new0 (GdaSqlParamSpec, 1);
+			param->name = g_strdup ("cond");
+			param->g_type = G_VALUE_TYPE (condition_value);
+			param->is_param = TRUE;
+			op->param_spec = param;
+
+			GdaHolder *holder;
+			holder = (GdaHolder*)  g_object_new (GDA_TYPE_HOLDER, "g-type", G_VALUE_TYPE (condition_value),
+							     "id", param->name, NULL);
+			g_assert (gda_holder_set_value (holder, condition_value, NULL));
+			holders = g_slist_prepend (holders, holder);
+		}
+		else {
+			/* nothing to do: NULL */
+		}
+	}
+
+	delete = gda_statement_new ();
+	g_object_set (G_OBJECT (delete), "structure", sql_stm, NULL);
+	gda_sql_statement_free (sql_stm);
+
+	/* execute statement */
+	GdaSet *set = NULL;
+	if (holders) {
+		set = gda_set_new (holders);
+		g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
+		g_slist_free (holders);
+	}
+
+	retval = (gda_connection_statement_execute_non_select (cnc, delete, set, NULL, error) == -1) ? FALSE : TRUE;
+
+	if (set)
+		g_object_unref (set);
+	g_object_unref (delete);
+
+	return retval;
+}
+
+/**
+ * gda_connection_parse_sql_string:
+ * @cnc: (allow-none): a #GdaConnection object, or %NULL
+ * @sql: an SQL command to parse, not %NULL
+ * @params: (out) (allow-none) (transfer full): a place to store a new #GdaSet, for parameters used in SQL command, or %NULL
+ * @error: a place to store errors, or %NULL
+ *
+ * This function helps to parse a SQL string which uses paramenters and store them at @params.
+ *
+ * Returns: (transfer full) (allow-none): a #GdaStatement representing the SQL command, or %NULL if an error occurred
+ *
+ * Since: 4.2
+ */
+GdaStatement*
+gda_connection_parse_sql_string (GdaConnection *cnc, const gchar *sql, GdaSet **params, GError **error)
+{
+	GdaStatement *stmt;
+	GdaSqlParser *parser = NULL;
+
+	g_return_val_if_fail (!cnc || GDA_IS_CONNECTION (cnc), NULL);
+	g_return_val_if_fail (sql, NULL);
+
+	if (params)
+		*params = NULL;
+	if (cnc)
+		parser = gda_connection_create_parser (cnc);
+	if (!parser)
+		parser = gda_sql_parser_new ();
+
+	stmt = gda_sql_parser_parse_string (parser, sql, NULL, error);
+	g_object_unref (parser);
+	if (! stmt)
+		return NULL;
+
+	if (params && !gda_statement_get_parameters (stmt, params, error)) {
+		g_object_unref (stmt);
+		return NULL;
+	}
+
+	return stmt;
+}
+
+/**
  * gda_connection_point_available_event:
  * @cnc: a #GdaConnection object
  * @type: a #GdaConnectionEventType
@@ -2626,6 +3132,76 @@ gda_connection_statement_execute_v (GdaConnection *cnc, GdaStatement *stmt, GdaS
 
 
 /**
+ * gda_connection_execute_select_command:
+ * @cnc: an opened connection
+ * @sql: a query statement that must begin with "SELECT"
+ * @error: a place to store errors, or %NULL
+ *
+ * Execute a SQL SELECT command over an opened connection.
+ *
+ * Returns: (transfer full) (allow-none): a new #GdaDataModel if successful, %NULL otherwise
+ */
+GdaDataModel *
+gda_connection_execute_select_command (GdaConnection *cnc, const gchar *sql, GError **error)
+{
+	GdaStatement *stmt;
+	GdaDataModel *model;
+
+	g_return_val_if_fail (sql != NULL
+			      || GDA_IS_CONNECTION (cnc)
+			      || !gda_connection_is_opened (cnc)
+			      || g_str_has_prefix (sql, "SELECT"),
+			      NULL);
+
+	g_static_mutex_lock (&parser_mutex);
+	if (!internal_parser)
+		internal_parser = gda_sql_parser_new ();
+	g_static_mutex_unlock (&parser_mutex);
+
+	stmt = gda_sql_parser_parse_string (internal_parser, sql, NULL, error);
+	if (!stmt)
+		return NULL;
+	model = gda_connection_statement_execute_select (cnc, stmt, NULL, error);
+	g_object_unref (stmt);
+
+	return model;
+}
+
+/**
+ * gda_connection_execute_non_select_command:
+ * @cnc: an opened connection
+ * @sql: a query statement that must not begin with "SELECT"
+ * @error: a place to store errors, or %NULL
+ *
+ * This is a convenience function to execute a SQL command over the opened connection.
+ *
+ * Returns: the number of rows affected or -1
+ */
+gint
+gda_connection_execute_non_select_command (GdaConnection *cnc, const gchar *sql, GError **error)
+{
+	GdaStatement *stmt;
+	gint retval;
+
+	g_return_val_if_fail (sql != NULL
+			      || GDA_IS_CONNECTION (cnc)
+			      || !gda_connection_is_opened (cnc), -1);
+
+	g_static_mutex_lock (&parser_mutex);
+	if (!internal_parser)
+		internal_parser = gda_sql_parser_new ();
+	g_static_mutex_unlock (&parser_mutex);
+
+	stmt = gda_sql_parser_parse_string (internal_parser, sql, NULL, error);
+	if (!stmt)
+		return -1;
+
+	retval = gda_connection_statement_execute_non_select (cnc, stmt, NULL, NULL, error);
+	g_object_unref (stmt);
+	return retval;
+}
+
+/**
  * gda_connection_statement_execute:
  * @cnc: a #GdaConnection
  * @stmt: a #GdaStatement object
diff --git a/libgda/gda-connection.h b/libgda/gda-connection.h
index e487491..d7ffacb 100644
--- a/libgda/gda-connection.h
+++ b/libgda/gda-connection.h
@@ -59,6 +59,7 @@ typedef enum {
 	GDA_CONNECTION_UNSUPPORTED_THREADS_ERROR,
 	GDA_CONNECTION_CLOSED_ERROR
 } GdaConnectionError;
+
 #define GDA_CONNECTION_NONEXIST_DSN_ERROR GDA_CONNECTION_DSN_NOT_FOUND_ERROR
 
 struct _GdaConnection {
@@ -268,6 +269,35 @@ const gchar         *gda_connection_get_dsn              (GdaConnection *cnc);
 const gchar         *gda_connection_get_cnc_string       (GdaConnection *cnc);
 const gchar         *gda_connection_get_authentication   (GdaConnection *cnc);
 
+GdaStatement        *gda_connection_parse_sql_string     (GdaConnection *cnc, const gchar *sql, GdaSet **params,
+                    GError **error);
+
+/*
+ * Quick commands execution
+ */
+GdaDataModel*       gda_connection_execute_select_command        (GdaConnection *cnc, const gchar *sql, GError **error);
+gint                gda_connection_execute_non_select_command    (GdaConnection *cnc, const gchar *sql, GError **error);
+
+/*
+ * Data in tables manipulation
+ */
+gboolean            gda_connection_insert_row_into_table        (GdaConnection *cnc, const gchar *table, GError **error, ...);
+gboolean            gda_connection_insert_row_into_table_v      (GdaConnection *cnc, const gchar *table,
+						      GSList *col_names, GSList *values,
+						      GError **error);
+
+gboolean            gda_connection_update_row_in_table          (GdaConnection *cnc, const gchar *table,
+						      const gchar *condition_column_name,
+						      GValue *condition_value, GError **error, ...);
+gboolean            gda_connection_update_row_in_table_v        (GdaConnection *cnc, const gchar *table,
+						      const gchar *condition_column_name,
+						      GValue *condition_value,
+						      GSList *col_names, GSList *values,
+						      GError **error);
+gboolean            gda_connection_delete_row_from_table        (GdaConnection *cnc, const gchar *table,
+						      const gchar *condition_column_name,
+						      GValue *condition_value, GError **error);
+
 const GList         *gda_connection_get_events           (GdaConnection *cnc);
 
 GdaSqlParser        *gda_connection_create_parser        (GdaConnection *cnc);
diff --git a/libgda/gda-data-handler.c b/libgda/gda-data-handler.c
index 11b7319..7a0a384 100644
--- a/libgda/gda-data-handler.c
+++ b/libgda/gda-data-handler.c
@@ -19,6 +19,12 @@
  */
 
 #include "gda-data-handler.h"
+#include "handlers/gda-handler-bin.h"
+#include "handlers/gda-handler-boolean.h"
+#include "handlers/gda-handler-numerical.h"
+#include "handlers/gda-handler-string.h"
+#include "handlers/gda-handler-time.h"
+#include "handlers/gda-handler-type.h"
 
 static GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
 static void gda_data_handler_iface_init (gpointer g_class);
@@ -252,3 +258,67 @@ gda_data_handler_get_descr (GdaDataHandler *dh)
 	
 	return NULL;
 }
+
+static guint
+gtype_hash (gconstpointer key)
+{
+        return GPOINTER_TO_UINT (key);
+}
+
+static gboolean
+gtype_equal (gconstpointer a, gconstpointer b)
+{
+        return (GType) a == (GType) b ? TRUE : FALSE;
+}
+
+/**
+ * gda_data_handler_get_default_handler:
+ * @for_type: a #GType type
+ *
+ * Obtain a pointer to a #GdaDataHandler which can manage #GValue values of type @for_type. The returned
+ * data handler will be adapted to use the current locale information (for example dates will be formatted
+ * taking into account the locale).
+ *
+ * The returned pointer is %NULL if there is no default data handler available for the @for_type data type
+ *
+ * Returns: (transfer none): a #GdaDataHandler which must not be modified or destroyed.
+ */
+GdaDataHandler *
+gda_data_handler_get_default_handler (GType for_type)
+{
+	static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+	static GHashTable *hash = NULL;
+	GdaDataHandler *dh;
+
+	g_static_mutex_lock (&mutex);
+	if (!hash) {
+		hash = g_hash_table_new_full (gtype_hash, gtype_equal,
+					      NULL, (GDestroyNotify) g_object_unref);
+
+                g_hash_table_insert (hash, (gpointer) G_TYPE_INT64, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_UINT64, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) GDA_TYPE_BINARY, gda_handler_bin_new ());
+                g_hash_table_insert (hash, (gpointer) GDA_TYPE_BLOB, gda_handler_bin_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_BOOLEAN, gda_handler_boolean_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_DATE, gda_handler_time_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_DOUBLE, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_INT, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) GDA_TYPE_NUMERIC, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_FLOAT, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) GDA_TYPE_SHORT, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) GDA_TYPE_USHORT, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_STRING, gda_handler_string_new ());
+                g_hash_table_insert (hash, (gpointer) GDA_TYPE_TIME, gda_handler_time_new ());
+                g_hash_table_insert (hash, (gpointer) GDA_TYPE_TIMESTAMP, gda_handler_time_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_CHAR, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_UCHAR, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_ULONG, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_LONG, gda_handler_numerical_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_GTYPE, gda_handler_type_new ());
+                g_hash_table_insert (hash, (gpointer) G_TYPE_UINT, gda_handler_numerical_new ());
+	}
+	g_static_mutex_unlock (&mutex);
+
+	dh = g_hash_table_lookup (hash, (gpointer) for_type);
+	return dh;
+}
diff --git a/libgda/gda-data-handler.h b/libgda/gda-data-handler.h
index 07d0226..4d57427 100644
--- a/libgda/gda-data-handler.h
+++ b/libgda/gda-data-handler.h
@@ -65,6 +65,7 @@ GValue        *gda_data_handler_get_sane_init_value    (GdaDataHandler *dh, GTyp
 /* information about the data handler itself */
 gboolean       gda_data_handler_accepts_g_type         (GdaDataHandler *dh, GType type);
 const gchar   *gda_data_handler_get_descr              (GdaDataHandler *dh);
+GdaDataHandler     *gda_data_handler_get_default_handler           (GType for_type);
 
 G_END_DECLS
 
diff --git a/libgda/gda-easy.c b/libgda/gda-easy.c
index f310286..e024348 100644
--- a/libgda/gda-easy.c
+++ b/libgda/gda-easy.c
@@ -18,17 +18,10 @@
  */
 
 #include <glib/gi18n-lib.h>
-#include <libgda/gda-easy.h>
-#include <libgda/gda-server-provider.h>
-#include <libgda/gda-config.h>
-#include <libgda/gda-set.h>
-#include <sql-parser/gda-sql-parser.h>
-#include <sql-parser/gda-sql-statement.h>
-#include <libgda/gda-holder.h>
-#include <libgda/gda-util.h>
-
-static GStaticMutex parser_mutex = G_STATIC_MUTEX_INIT;
-static GdaSqlParser *internal_parser = NULL;
+#include "gda-easy.h"
+#include "gda-server-operation.h"
+#include "gda-server-provider.h"
+#include "gda-data-handler.h"
 
 /* module error */
 GQuark gda_easy_error_quark (void)
@@ -47,65 +40,39 @@ GQuark gda_easy_error_quark (void)
  *
  * Creates a new #GdaServerOperation object which contains the specifications required
  * to create a database. Once these specifications provided, use 
- * gda_perform_create_database() to perform the database creation.
+ * gda_server_operation_perform_create_database() to perform the database creation.
  *
  * If @db_name is left %NULL, then the name of the database to create will have to be set in the
  * returned #GdaServerOperation using gda_server_operation_set_value_at().
  *
  * Returns: (transfer full) (allow-none): new #GdaServerOperation object, or %NULL if the provider does not support database
  * creation
+ *
+ * Deprecated: 4.2.3: Use gda_server_operation_prepare_create_database() instead.
  */
 GdaServerOperation *
 gda_prepare_create_database (const gchar *provider, const gchar *db_name, GError **error)
 {
-	GdaServerProvider *prov;
-
-	g_return_val_if_fail (provider && *provider, NULL);
-
-	prov = gda_config_get_provider (provider, error);
-	if (prov) {
-		GdaServerOperation *op;
-		op = gda_server_provider_create_operation (prov, NULL, GDA_SERVER_OPERATION_CREATE_DB, 
-							   NULL, error);
-		if (op) {
-			g_object_set_data_full (G_OBJECT (op), "_gda_provider_obj", g_object_ref (prov), g_object_unref);
-			if (db_name)
-				gda_server_operation_set_value_at (op, db_name, NULL, "/DB_DEF_P/DB_NAME");
-		}
-		return op;
-	}
-	else
-		return NULL;
+	return gda_server_operation_prepare_create_database(provider, db_name, error);
 }
 
 /**
  * gda_perform_create_database:
- * @provider: the database provider to use, or %NULL if @op has been created using gda_prepare_create_database()
+ * @provider: the database provider to use, or %NULL if @op has been created using gda_server_operation_prepare_create_database()
  * @op: a #GdaServerOperation object obtained using gda_prepare_create_database()
  * @error: a place to store en error, or %NULL
  *
  * Creates a new database using the specifications in @op. @op can be obtained using
  * gda_server_provider_create_operation(), or gda_prepare_create_database().
  *
- * Returns: TRUE if no error occurred and the database has been created
+ * Returns: TRUE if no error occurred and the database has been created, FALSE otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_server_operation_perform_create_database() instead.
  */
 gboolean
 gda_perform_create_database (const gchar *provider, GdaServerOperation *op, GError **error)
 {
-	GdaServerProvider *prov;
-
-	g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
-	if (provider)
-		prov = gda_config_get_provider (provider, error);
-	else
-		prov = g_object_get_data (G_OBJECT (op), "_gda_provider_obj");
-	if (prov) 
-		return gda_server_provider_perform_operation (prov, NULL, op, error);
-	else {
-		g_warning ("Could not find operation's associated provider, "
-			   "did you use gda_prepare_create_database() ?");
-		return FALSE;
-	}
+	return gda_server_operation_perform_create_database(op, provider, error);
 }
 
 /**
@@ -123,58 +90,32 @@ gda_perform_create_database (const gchar *provider, GdaServerOperation *op, GErr
  *
  * Returns: (transfer full) (allow-none): new #GdaServerOperation object, or %NULL if the provider does not support database
  * destruction
+ *
+ * Deprecated: 4.2.3: Use gda_server_operation_prepare_drop_database() instead.
  */
 GdaServerOperation *
 gda_prepare_drop_database (const gchar *provider, const gchar *db_name, GError **error)
 {
-	GdaServerProvider *prov;
-	
-	g_return_val_if_fail (provider && *provider, NULL);
-
-	prov = gda_config_get_provider (provider, error);
-	if (prov) {
-		GdaServerOperation *op;
-		op = gda_server_provider_create_operation (prov, NULL, GDA_SERVER_OPERATION_DROP_DB, 
-							   NULL, error);
-		if (op) {
-			g_object_set_data_full (G_OBJECT (op), "_gda_provider_obj", g_object_ref (prov), g_object_unref);
-			if (db_name)
-				gda_server_operation_set_value_at (op, db_name, NULL, "/DB_DESC_P/DB_NAME");
-		}
-		return op;
-	}
-	else
-		return NULL;
+	return gda_server_operation_prepare_drop_database(provider, db_name, error);
 }
 
 /**
  * gda_perform_drop_database:
- * @provider: the database provider to use, or %NULL if @op has been created using gda_prepare_drop_database()
- * @op: a #GdaServerOperation object obtained using gda_prepare_drop_database()
+ * @provider: the database provider to use, or %NULL if @op has been created using gda_server_operation_prepare_drop_database()
+ * @op: a #GdaServerOperation object obtained using gda_server_operation_prepare_drop_database()
  * @error: a place to store en error, or %NULL
  *
  * Destroys an existing database using the specifications in @op.  @op can be obtained using
- * gda_server_provider_create_operation(), or gda_prepare_drop_database().
+ * gda_server_provider_create_operation(), or gda_server_operation_prepare_drop_database().
  *
- * Returns: TRUE if no error occurred and the database has been destroyed
+ * Returns: TRUE if no error occurred and the database has been destroyed, FALSE otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_server_operation_perform_drop_database() instead.
  */
 gboolean
 gda_perform_drop_database (const gchar *provider, GdaServerOperation *op, GError **error)
 {
-	GdaServerProvider *prov;
-
-	g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
-	if (provider)
-		prov = gda_config_get_provider (provider, error);
-	else
-		prov = g_object_get_data (G_OBJECT (op), "_gda_provider_obj");
-	if (prov) 
-		return gda_server_provider_perform_operation (prov, NULL, op, error);
-	else {
-		g_warning ("Could not find operation's associated provider, "
-			   "did you use gda_prepare_drop_database() ?"); 
-		return FALSE;
-	}
+	return gda_server_operation_perform_drop_database(op, provider, error);
 }
 
 /**
@@ -186,35 +127,17 @@ gda_perform_drop_database (const gchar *provider, GdaServerOperation *op, GError
  * Execute a SQL SELECT command over an opened connection.
  *
  * Returns: (transfer full) (allow-none): a new #GdaDataModel if successful, NULL otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_connection_execute_select_command() instead.
  */
 GdaDataModel *          
 gda_execute_select_command (GdaConnection *cnc, const gchar *sql, GError **error)
 {
-	GdaStatement *stmt;
-	GdaDataModel *model;
-    
-	g_return_val_if_fail (sql != NULL 
-			      || GDA_IS_CONNECTION (cnc) 
-			      || !gda_connection_is_opened (cnc)
-			      || g_str_has_prefix (sql, "SELECT"),
-			      NULL);
-    
-	g_static_mutex_lock (&parser_mutex);
-	if (!internal_parser)
-		internal_parser = gda_sql_parser_new ();
-	g_static_mutex_unlock (&parser_mutex);
-
-	stmt = gda_sql_parser_parse_string (internal_parser, sql, NULL, error);
-	if (!stmt) 
-		return NULL;
-	model = gda_connection_statement_execute_select (cnc, stmt, NULL, error);
-	g_object_unref (stmt);
-
-	return model;
+	return gda_connection_execute_select_command(cnc, sql, error);
 }
 
 /**
- * gda_execute_sql_command:
+ * gda_execute_non_select_command:
  * @cnc: an opened connection
  * @sql: a query statement must begin with "SELECT"
  * @error: a place to store errors, or %NULL
@@ -222,29 +145,13 @@ gda_execute_select_command (GdaConnection *cnc, const gchar *sql, GError **error
  * This is a convenience function to execute a SQL command over the opened connection.
  *
  * Returns: the number of rows affected or -1.
+ *
+ * Deprecated: 4.2.3: Use gda_connection_execute_non_select_command() instead.
  */
 gint
 gda_execute_non_select_command (GdaConnection *cnc, const gchar *sql, GError **error)
 {
-	GdaStatement *stmt;
-	gint retval;
-
-	g_return_val_if_fail (sql != NULL 
-			      || GDA_IS_CONNECTION (cnc) 
-			      || !gda_connection_is_opened (cnc), -1);
-    
-	g_static_mutex_lock (&parser_mutex);
-	if (!internal_parser)
-		internal_parser = gda_sql_parser_new ();
-	g_static_mutex_unlock (&parser_mutex);
-
-	stmt = gda_sql_parser_parse_string (internal_parser, sql, NULL, error);
-	if (!stmt) 
-		return -1;
-    
-	retval = gda_connection_statement_execute_non_select (cnc, stmt, NULL, NULL, error);
-	g_object_unref (stmt);
-	return retval;
+	return gda_connection_execute_non_select_command(cnc, sql, error);
 }
 
 /**
@@ -279,7 +186,10 @@ gda_execute_non_select_command (GdaConnection *cnc, const gchar *sql, GError **e
  * in order to execute the operation.
  * 
  * Returns: (transfer full) (allow-none): a #GdaServerOperation if no errors; NULL and set @error otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_server_operation_prepare_create_table() instead.
  */
+G_GNUC_NULL_TERMINATED
 GdaServerOperation*
 gda_prepare_create_table (GdaConnection *cnc, const gchar *table_name, GError **error, ...)
 {
@@ -437,27 +347,17 @@ gda_prepare_create_table (GdaConnection *cnc, const gchar *table_name, GError **
  * @error: a place to store errors, or %NULL
  * 
  * Performs a prepared #GdaServerOperation to create a table. This could perform
- * an operation created by #gda_prepare_create_table or any other using the
+ * an operation created by gda_server_operation_prepare_create_table() or any other using the
  * the #GdaServerOperation API.
  *
  * Returns: TRUE if the table was created; FALSE and set @error otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_server_operation_perform_create_table() instead.
  */
 gboolean
 gda_perform_create_table (GdaServerOperation *op, GError **error)
 {
-	GdaConnection *cnc;
-	
-	g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);	
-	g_return_val_if_fail (gda_server_operation_get_op_type (op) == GDA_SERVER_OPERATION_CREATE_TABLE, FALSE);
-	
-	cnc = g_object_get_data (G_OBJECT (op), "_gda_connection");
-	if (cnc) 
-		return gda_server_provider_perform_operation (gda_connection_get_provider (cnc), cnc, op, error);
-	else {
-		g_warning ("Could not find operation's associated connection, "
-			   "did you use gda_prepare_create_table() ?"); 
-		return FALSE;
-	}
+	return gda_server_operation_perform_create_table(op, error);
 }
 
 /**
@@ -470,33 +370,13 @@ gda_perform_create_table (GdaServerOperation *op, GError **error)
  * table in an opened connection.
  *
  * Returns: (transfer full) (allow-none): a new #GdaServerOperation or NULL if couldn't create the opereration.
+ *
+ * Deprecated: 4.2.3: Use gda_server_operation_prepare_drop_table() instead.
  */
 GdaServerOperation*
 gda_prepare_drop_table (GdaConnection *cnc, const gchar *table_name, GError **error)
 {
-	GdaServerOperation *op;
-	GdaServerProvider *server;
-
-	server = gda_connection_get_provider (cnc);
-	
-	op = gda_server_provider_create_operation (server, cnc, 
-						   GDA_SERVER_OPERATION_DROP_TABLE, NULL, error);
-	
-	if (GDA_IS_SERVER_OPERATION (op)) {
-		g_return_val_if_fail (table_name != NULL 
-				      || GDA_IS_CONNECTION (cnc) 
-				      || !gda_connection_is_opened (cnc), NULL);
-		
-		if (gda_server_operation_set_value_at (op, table_name, 
-						       error, "/TABLE_DESC_P/TABLE_NAME")) {
-			g_object_set_data_full (G_OBJECT (op), "_gda_connection", g_object_ref (cnc), g_object_unref);
-			return op;
-		}
-		else 
-			return NULL;
-	}
-	else
-		return NULL;
+	gda_connection_prepare_drop_table(cnc, table_name, error);
 }
 
 /**
@@ -506,36 +386,14 @@ gda_prepare_drop_table (GdaConnection *cnc, const gchar *table_name, GError **er
  * 
  * This is just a convenient function to perform a drop a table operation.
  *
- * Returns: TRUE if the table was dropped
+ * Returns: TRUE if the table was dropped, FALSE otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_server_operation_perform_drop_table() instead.
  */
 gboolean
 gda_perform_drop_table (GdaServerOperation *op, GError **error)
 {
-	GdaConnection *cnc;
-	
-	g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);	
-	g_return_val_if_fail (gda_server_operation_get_op_type (op) == GDA_SERVER_OPERATION_DROP_TABLE, FALSE);
-	
-	cnc = g_object_get_data (G_OBJECT (op), "_gda_connection");
-	if (cnc) 
-		return gda_server_provider_perform_operation (gda_connection_get_provider (cnc), cnc, op, error);
-	else {
-		g_warning ("Could not find operation's associated connection, "
-			   "did you use gda_prepare_drop_table() ?"); 
-		return FALSE;
-	}
-}
-
-static guint
-gtype_hash (gconstpointer key)
-{
-        return GPOINTER_TO_UINT (key);
-}
-
-static gboolean 
-gtype_equal (gconstpointer a, gconstpointer b)
-{
-        return (GType) a == (GType) b ? TRUE : FALSE;
+	return gda_server_operation_perform_drop_table(op, error);
 }
 
 /**
@@ -549,45 +407,13 @@ gtype_equal (gconstpointer a, gconstpointer b)
  * The returned pointer is %NULL if there is no default data handler available for the @for_type data type
  *
  * Returns: (transfer none): a #GdaDataHandler which must not be modified or destroyed.
+ *
+ * Deprecated: 4.2.3: Use gda_data_handler_get_default_handler() instead.
  */
 GdaDataHandler *
 gda_get_default_handler (GType for_type)
 {
-	static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
-	static GHashTable *hash = NULL;
-	GdaDataHandler *dh;
-
-	g_static_mutex_lock (&mutex);
-	if (!hash) {
-		hash = g_hash_table_new_full (gtype_hash, gtype_equal,
-					      NULL, (GDestroyNotify) g_object_unref);
-
-                g_hash_table_insert (hash, (gpointer) G_TYPE_INT64, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_UINT64, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) GDA_TYPE_BINARY, gda_handler_bin_new ());
-                g_hash_table_insert (hash, (gpointer) GDA_TYPE_BLOB, gda_handler_bin_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_BOOLEAN, gda_handler_boolean_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_DATE, gda_handler_time_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_DOUBLE, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_INT, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) GDA_TYPE_NUMERIC, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_FLOAT, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) GDA_TYPE_SHORT, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) GDA_TYPE_USHORT, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_STRING, gda_handler_string_new ());
-                g_hash_table_insert (hash, (gpointer) GDA_TYPE_TIME, gda_handler_time_new ());
-                g_hash_table_insert (hash, (gpointer) GDA_TYPE_TIMESTAMP, gda_handler_time_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_CHAR, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_UCHAR, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_ULONG, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_LONG, gda_handler_numerical_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_GTYPE, gda_handler_type_new ());
-                g_hash_table_insert (hash, (gpointer) G_TYPE_UINT, gda_handler_numerical_new ());
-	}
-	g_static_mutex_unlock (&mutex);
-	
-	dh = g_hash_table_lookup (hash, (gpointer) for_type);
-	return dh;
+	return gda_data_handler_get_default_handler(for_type);
 }
 
 /**
@@ -604,8 +430,11 @@ gda_get_default_handler (GType for_type)
  *
  * The equivalent SQL command is: INSERT INTO &lt;table&gt; (&lt;column_name&gt; [,...]) VALUES (&lt;column_name&gt; = &lt;new_value&gt; [,...]).
  * 
- * Returns: TRUE if no error occurred
+ * Returns: TRUE if no error occurred, FALSE otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_connection_insert_row_into_table() instead.
  */
+G_GNUC_NULL_TERMINATED
 gboolean
 gda_insert_row_into_table (GdaConnection *cnc, const gchar *table, GError **error, ...)
 {
@@ -635,7 +464,7 @@ gda_insert_row_into_table (GdaConnection *cnc, const gchar *table, GError **erro
 
 	clist = g_slist_reverse (clist);
 	vlist = g_slist_reverse (vlist);
-	retval = gda_insert_row_into_table_v (cnc, table, clist, vlist, error);
+	retval = gda_connection_insert_row_into_table_v (cnc, table, clist, vlist, error);
 	g_slist_free (clist);
 	g_slist_free (vlist);
 
@@ -657,98 +486,16 @@ gda_insert_row_into_table (GdaConnection *cnc, const gchar *table, GError **erro
  *
  * The equivalent SQL command is: INSERT INTO &lt;table&gt; (&lt;column_name&gt; [,...]) VALUES (&lt;column_name&gt; = &lt;new_value&gt; [,...]).
  * 
- * Returns: TRUE if no error occurred
+ * Returns: TRUE if no error occurred, FALSE otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_connection_insert_row_into_table_v() instead.
  */
 gboolean
 gda_insert_row_into_table_v (GdaConnection *cnc, const gchar *table,
 			     GSList *col_names, GSList *values,
 			     GError **error)
 {
-	gboolean retval;
-	GSList *fields = NULL;
-	GSList *expr_values = NULL;
-	GdaSqlStatement *sql_stm;
-	GdaSqlStatementInsert *ssi;
-	GdaStatement *insert;
-	gint i;
-
-	GSList *holders = NULL;
-	GSList *l1, *l2;
-	
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (table && *table, FALSE);
-	g_return_val_if_fail (col_names, FALSE);
-	g_return_val_if_fail (g_slist_length (col_names) == g_slist_length (values), FALSE);
-	
-	/* Construct insert query and list of GdaHolders */
-	sql_stm = gda_sql_statement_new (GDA_SQL_STATEMENT_INSERT);
-	ssi = (GdaSqlStatementInsert*) sql_stm->contents;
-	g_assert (GDA_SQL_ANY_PART (ssi)->type == GDA_SQL_ANY_STMT_INSERT);
-
-	ssi->table = gda_sql_table_new (GDA_SQL_ANY_PART (ssi));
-	ssi->table->table_name = gda_sql_identifier_quote (table, cnc, NULL, FALSE, FALSE);
-
-	i = 0;
-	for (l1 = col_names, l2 = values;
-	     l1;
-	     l1 = l1->next, l2 = l2->next) {
-		GdaSqlField *field;
-		GdaSqlExpr *expr;
-		GValue *value = (GValue *) l2->data;
-		const gchar *col_name = (const gchar*) l1->data; 
-		
-		/* field */
-		field = gda_sql_field_new (GDA_SQL_ANY_PART (ssi));
-		field->field_name = gda_sql_identifier_quote (col_name, cnc, NULL, FALSE, FALSE);
-		fields = g_slist_prepend (fields, field);
-
-		/* value */
-		expr = gda_sql_expr_new (GDA_SQL_ANY_PART (ssi));
-		if (value && (G_VALUE_TYPE (value) != GDA_TYPE_NULL)) {
-			/* create a GdaSqlExpr with a parameter */
-			GdaSqlParamSpec *param;
-			param = g_new0 (GdaSqlParamSpec, 1);
-			param->name = g_strdup_printf ("+%d", i);
-			param->g_type = G_VALUE_TYPE (value);
-			param->is_param = TRUE;
-			expr->param_spec = param;
-
-			GdaHolder *holder;
-			holder = (GdaHolder*)  g_object_new (GDA_TYPE_HOLDER, "g-type", G_VALUE_TYPE (value),
-							     "id", param->name, NULL);
-			g_assert (gda_holder_set_value (holder, value, NULL));
-			holders = g_slist_prepend (holders, holder);
-		}
-		else {
-			/* create a NULL GdaSqlExpr => nothing to do */
-		}
-		expr_values = g_slist_prepend (expr_values, expr);
-		
-		i++;
-	}
-	
-	ssi->fields_list = g_slist_reverse (fields);
-	ssi->values_list = g_slist_prepend (NULL, g_slist_reverse (expr_values));
-	
-	insert = gda_statement_new ();
-	g_object_set (G_OBJECT (insert), "structure", sql_stm, NULL);
-	gda_sql_statement_free (sql_stm);
-
-	/* execute statement */
-	GdaSet *set = NULL;
-	if (holders) {
-		set = gda_set_new (holders);
-		g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
-		g_slist_free (holders);
-	}
-
-	retval = (gda_connection_statement_execute_non_select (cnc, insert, set, NULL, error) == -1) ? FALSE : TRUE;
-
-	if (set)
-		g_object_unref (set);
-	g_object_unref (insert);
-
-	return retval;	
+	return gda_connection_insert_row_into_table_v(cnc, table, col_names, values, error);
 }
 
 
@@ -768,8 +515,11 @@ gda_insert_row_into_table_v (GdaConnection *cnc, const gchar *table,
  *
  * The equivalent SQL command is: UPDATE &lt;table&gt; SET &lt;column_name&gt; = &lt;new_value&gt; [,...] WHERE &lt;condition_column_name&gt; = &lt;condition_value&gt;.
  *
- * Returns: TRUE if no error occurred
+ * Returns: TRUE if no error occurred, FALSE otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_connection_update_row_in_table() instead.
  */
+G_GNUC_NULL_TERMINATED
 gboolean
 gda_update_row_in_table (GdaConnection *cnc, const gchar *table, 
 			 const gchar *condition_column_name, 
@@ -801,7 +551,7 @@ gda_update_row_in_table (GdaConnection *cnc, const gchar *table,
 
 	clist = g_slist_reverse (clist);
 	vlist = g_slist_reverse (vlist);
-	retval = gda_update_row_in_table_v (cnc, table, condition_column_name, condition_value, clist, vlist, error);
+	retval = gda_connection_update_row_in_table_v (cnc, table, condition_column_name, condition_value, clist, vlist, error);
 	g_slist_free (clist);
 	g_slist_free (vlist);
 
@@ -826,6 +576,8 @@ gda_update_row_in_table (GdaConnection *cnc, const gchar *table,
  * The equivalent SQL command is: UPDATE &lt;table&gt; SET &lt;column_name&gt; = &lt;new_value&gt; [,...] WHERE &lt;condition_column_name&gt; = &lt;condition_value&gt;.
  *
  * Returns: TRUE if no error occurred
+ *
+ * Deprecated: 4.2.3: Use gda_connection_update_row_in_table_v() instead.
  */
 gboolean
 gda_update_row_in_table_v (GdaConnection *cnc, const gchar *table, 
@@ -834,126 +586,8 @@ gda_update_row_in_table_v (GdaConnection *cnc, const gchar *table,
 			   GSList *col_names, GSList *values,
 			   GError **error)
 {
-	gboolean retval;
-	GSList *fields = NULL;
-	GSList *expr_values = NULL;
-	GdaSqlStatement *sql_stm;
-	GdaSqlStatementUpdate *ssu;
-	GdaStatement *update;
-	gint i;
-
-	GSList *holders = NULL;
-	GSList *l1, *l2;
-
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (table && *table, FALSE);
-	g_return_val_if_fail (col_names, FALSE);
-	g_return_val_if_fail (g_slist_length (col_names) == g_slist_length (values), FALSE);
-	
-	/* Construct update query and list of GdaHolders */
-	sql_stm = gda_sql_statement_new (GDA_SQL_STATEMENT_UPDATE);
-	ssu = (GdaSqlStatementUpdate*) sql_stm->contents;
-	g_assert (GDA_SQL_ANY_PART (ssu)->type == GDA_SQL_ANY_STMT_UPDATE);
-
-	ssu->table = gda_sql_table_new (GDA_SQL_ANY_PART (ssu));
-	ssu->table->table_name = gda_sql_identifier_quote (table, cnc, NULL, FALSE, FALSE);
-
-	if (condition_column_name) {
-		GdaSqlExpr *where, *op;
-		where = gda_sql_expr_new (GDA_SQL_ANY_PART (ssu));
-		ssu->cond = where;
-
-		where->cond = gda_sql_operation_new (GDA_SQL_ANY_PART (where));
-		where->cond->operator_type = GDA_SQL_OPERATOR_TYPE_EQ;
-
-		op = gda_sql_expr_new (GDA_SQL_ANY_PART (where->cond));
-		where->cond->operands = g_slist_prepend (NULL, op);
-		op->value = gda_value_new (G_TYPE_STRING);
-		g_value_take_string (op->value, gda_sql_identifier_quote (condition_column_name, cnc, NULL,
-									  FALSE, FALSE));
-
-		op = gda_sql_expr_new (GDA_SQL_ANY_PART (where->cond));
-		where->cond->operands = g_slist_append (where->cond->operands, op);
-		if (condition_value) {
-			GdaSqlParamSpec *param;
-			param = g_new0 (GdaSqlParamSpec, 1);
-			param->name = g_strdup ("cond");
-			param->g_type = G_VALUE_TYPE (condition_value);
-			param->is_param = TRUE;
-			op->param_spec = param;
-
-			GdaHolder *holder;
-			holder = (GdaHolder*)  g_object_new (GDA_TYPE_HOLDER, "g-type", G_VALUE_TYPE (condition_value),
-							     "id", param->name, NULL);
-			g_assert (gda_holder_set_value (holder, condition_value, NULL));
-			holders = g_slist_prepend (holders, holder);
-		}
-		else {
-			/* nothing to do: NULL */
-		}
-	}
-
-	i = 0;
-	for (l1 = col_names, l2 = values;
-	     l1;
-	     l1 = l1->next, l2 = l2->next) {
-		GValue *value = (GValue *) l2->data;
-		const gchar *col_name = (const gchar*) l1->data;
-		GdaSqlField *field;
-		GdaSqlExpr *expr;
-		
-		/* field */
-		field = gda_sql_field_new (GDA_SQL_ANY_PART (ssu));
-		field->field_name = gda_sql_identifier_quote (col_name, cnc, NULL, FALSE, FALSE);
-		fields = g_slist_prepend (fields, field);
-
-		/* value */
-		expr = gda_sql_expr_new (GDA_SQL_ANY_PART (ssu));
-		if (value && (G_VALUE_TYPE (value) != GDA_TYPE_NULL)) {
-			/* create a GdaSqlExpr with a parameter */
-			GdaSqlParamSpec *param;
-			param = g_new0 (GdaSqlParamSpec, 1);
-			param->name = g_strdup_printf ("+%d", i);
-			param->g_type = G_VALUE_TYPE (value);
-			param->is_param = TRUE;
-			expr->param_spec = param;
-
-			GdaHolder *holder;
-			holder = (GdaHolder*)  g_object_new (GDA_TYPE_HOLDER, "g-type", G_VALUE_TYPE (value),
-							     "id", param->name, NULL);
-			g_assert (gda_holder_set_value (holder, value, NULL));
-			holders = g_slist_prepend (holders, holder);
-		}
-		else {
-			/* create a NULL GdaSqlExpr => nothing to do */
-		}
-		expr_values = g_slist_prepend (expr_values, expr);
-		
-		i++;
-	}
-
-	ssu->fields_list = g_slist_reverse (fields);
-	ssu->expr_list = g_slist_reverse (expr_values);
-	
-	update = gda_statement_new ();
-	g_object_set (G_OBJECT (update), "structure", sql_stm, NULL);
-	gda_sql_statement_free (sql_stm);
-
-	/* execute statement */
-	GdaSet *set = NULL;
-	if (holders) {
-		set = gda_set_new (holders);
-		g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
-		g_slist_free (holders);
-	}
-
-	retval = (gda_connection_statement_execute_non_select (cnc, update, set, NULL, error) == -1) ? FALSE : TRUE;
-
-	if (set)
-		g_object_unref (set);
-	g_object_unref (update);
-
-	return retval;
+	gda_connection_update_row_in_table_v(cnc, table, condition_column_name, condition_value,
+					     col_names, values, error);
 }
 
 /**
@@ -969,85 +603,16 @@ gda_update_row_in_table_v (GdaConnection *cnc, const gchar *table,
  *
  * The equivalent SQL command is: DELETE FROM &lt;table&gt; WHERE &lt;condition_column_name&gt; = &lt;condition_value&gt;.
  *
- * Returns: TRUE if no error occurred
+ * Returns: TRUE if no error occurred, FALSE otherwise
+ *
+ * Deprecated: 4.2.3: Use gda_connection_delete_row_from_table() instead.
  */
 gboolean
 gda_delete_row_from_table (GdaConnection *cnc, const gchar *table, 
 			   const gchar *condition_column_name, 
 			   GValue *condition_value, GError **error)
 {
-	gboolean retval;
-	GdaSqlStatement *sql_stm;
-	GdaSqlStatementDelete *ssd;
-	GdaStatement *delete;
-
-	GSList *holders = NULL;
-	
-	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-	g_return_val_if_fail (table && *table, FALSE);
-	
-	/* Construct delete query and list of GdaHolders */
-	sql_stm = gda_sql_statement_new (GDA_SQL_STATEMENT_DELETE);
-	ssd = (GdaSqlStatementDelete*) sql_stm->contents;
-	g_assert (GDA_SQL_ANY_PART (ssd)->type == GDA_SQL_ANY_STMT_DELETE);
-
-	ssd->table = gda_sql_table_new (GDA_SQL_ANY_PART (ssd));
-	ssd->table->table_name = gda_sql_identifier_quote (table, cnc, NULL, FALSE, FALSE);
-
-	if (condition_column_name) {
-		GdaSqlExpr *where, *op;
-		where = gda_sql_expr_new (GDA_SQL_ANY_PART (ssd));
-		ssd->cond = where;
-
-		where->cond = gda_sql_operation_new (GDA_SQL_ANY_PART (where));
-		where->cond->operator_type = GDA_SQL_OPERATOR_TYPE_EQ;
-
-		op = gda_sql_expr_new (GDA_SQL_ANY_PART (where->cond));
-		where->cond->operands = g_slist_prepend (NULL, op);
-		op->value = gda_value_new (G_TYPE_STRING);
-		g_value_take_string (op->value, gda_sql_identifier_quote (condition_column_name, cnc, NULL,
-									  FALSE, FALSE));
-
-		op = gda_sql_expr_new (GDA_SQL_ANY_PART (where->cond));
-		where->cond->operands = g_slist_append (where->cond->operands, op);
-		if (condition_value) {
-			GdaSqlParamSpec *param;
-			param = g_new0 (GdaSqlParamSpec, 1);
-			param->name = g_strdup ("cond");
-			param->g_type = G_VALUE_TYPE (condition_value);
-			param->is_param = TRUE;
-			op->param_spec = param;
-
-			GdaHolder *holder;
-			holder = (GdaHolder*)  g_object_new (GDA_TYPE_HOLDER, "g-type", G_VALUE_TYPE (condition_value),
-							     "id", param->name, NULL);
-			g_assert (gda_holder_set_value (holder, condition_value, NULL));
-			holders = g_slist_prepend (holders, holder);
-		}
-		else {
-			/* nothing to do: NULL */
-		}
-	}
-
-	delete = gda_statement_new ();
-	g_object_set (G_OBJECT (delete), "structure", sql_stm, NULL);
-	gda_sql_statement_free (sql_stm);
-
-	/* execute statement */
-	GdaSet *set = NULL;
-	if (holders) {
-		set = gda_set_new (holders);
-		g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
-		g_slist_free (holders);
-	}
-
-	retval = (gda_connection_statement_execute_non_select (cnc, delete, set, NULL, error) == -1) ? FALSE : TRUE;
-
-	if (set)
-		g_object_unref (set);
-	g_object_unref (delete);
-
-	return retval;
+	gda_connection_delete_row_from_table(cnc, table, condition_column_name, condition_value, error);
 }
 
 /**
@@ -1062,32 +627,11 @@ gda_delete_row_from_table (GdaConnection *cnc, const gchar *table,
  * Returns: (transfer full) (allow-none): a #GdaStatement representing the SQL command, or %NULL if an error occurred
  *
  * Since: 4.2
+ *
+ * Deprecated: 4.2.3: Use gda_connection_parse_sql_string() instead.
  */
 GdaStatement*
 gda_parse_sql_string (GdaConnection *cnc, const gchar *sql, GdaSet **params, GError **error)
 {
-	GdaStatement *stmt;
-	GdaSqlParser *parser = NULL;
-
-	g_return_val_if_fail (!cnc || GDA_IS_CONNECTION (cnc), NULL);
-	g_return_val_if_fail (sql, NULL);
-
-	if (params)
-		*params = NULL;
-	if (cnc)
-		parser = gda_connection_create_parser (cnc);
-	if (!parser)
-		parser = gda_sql_parser_new ();
-
-	stmt = gda_sql_parser_parse_string (parser, sql, NULL, error);
-	g_object_unref (parser);
-	if (! stmt)
-		return NULL;
-
-	if (params && !gda_statement_get_parameters (stmt, params, error)) {
-		g_object_unref (stmt);
-		return NULL;
-	}
-	
-	return stmt;
+	gda_connection_parse_sql_string(cnc, sql, params, error);
 }
diff --git a/libgda/gda-easy.h b/libgda/gda-easy.h
index a08f742..680ca2e 100644
--- a/libgda/gda-easy.h
+++ b/libgda/gda-easy.h
@@ -26,12 +26,6 @@
 
 #include <libgda/gda-connection.h>
 #include <libgda/gda-server-operation.h>
-#include <libgda/handlers/gda-handler-bin.h>
-#include <libgda/handlers/gda-handler-boolean.h>
-#include <libgda/handlers/gda-handler-numerical.h>
-#include <libgda/handlers/gda-handler-string.h>
-#include <libgda/handlers/gda-handler-time.h>
-#include <libgda/handlers/gda-handler-type.h>
 
 G_BEGIN_DECLS
 
@@ -46,14 +40,14 @@ typedef enum  {
 
 typedef enum
 {
-	GDA_EASY_CREATE_TABLE_NOTHING_FLAG   = 1 << 0,
-	GDA_EASY_CREATE_TABLE_PKEY_FLAG      = 1 << 1,
-	GDA_EASY_CREATE_TABLE_NOT_NULL_FLAG  = 1 << 2,
-	GDA_EASY_CREATE_TABLE_UNIQUE_FLAG    = 1 << 3,
-	GDA_EASY_CREATE_TABLE_AUTOINC_FLAG   = 1 << 4,
-	GDA_EASY_CREATE_TABLE_FKEY_FLAG      = 1 << 5,
+	GDA_EASY_CREATE_TABLE_NOTHING_FLAG   = GDA_SERVER_OPERATION_CREATE_TABLE_NOTHING_FLAG,
+	GDA_EASY_CREATE_TABLE_PKEY_FLAG      = GDA_SERVER_OPERATION_CREATE_TABLE_PKEY_FLAG,
+	GDA_EASY_CREATE_TABLE_NOT_NULL_FLAG  = GDA_SERVER_OPERATION_CREATE_TABLE_NOT_NULL_FLAG,
+	GDA_EASY_CREATE_TABLE_UNIQUE_FLAG    = GDA_SERVER_OPERATION_CREATE_TABLE_UNIQUE_FLAG,
+	GDA_EASY_CREATE_TABLE_AUTOINC_FLAG   = GDA_SERVER_OPERATION_CREATE_TABLE_AUTOINC_FLAG,
+	GDA_EASY_CREATE_TABLE_FKEY_FLAG      = GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG,
 	/* Flags combinations */
-	GDA_EASY_CREATE_TABLE_PKEY_AUTOINC_FLAG = GDA_EASY_CREATE_TABLE_PKEY_FLAG | GDA_EASY_CREATE_TABLE_AUTOINC_FLAG
+	GDA_EASY_CREATE_TABLE_PKEY_AUTOINC_FLAG = GDA_SERVER_OPERATION_CREATE_TABLE_PKEY_FLAG | GDA_SERVER_OPERATION_CREATE_TABLE_AUTOINC_FLAG
 } GdaEasyCreateTableFlag;
 
 /* 
diff --git a/libgda/gda-holder.c b/libgda/gda-holder.c
index e594d06..92a681b 100644
--- a/libgda/gda-holder.c
+++ b/libgda/gda-holder.c
@@ -776,7 +776,7 @@ gda_holder_get_value_str (GdaHolder *holder, GdaDataHandler *dh)
                 return NULL;
         else {
                 if (!dh)
-			dh = gda_get_default_handler (holder->priv->g_type);
+			dh = gda_data_handler_get_default_handler (holder->priv->g_type);
 		if (dh)
                         return gda_data_handler_get_str_from_value (dh, current_val);
                 else
@@ -851,7 +851,7 @@ gda_holder_set_value_str (GdaHolder *holder, GdaDataHandler *dh, const gchar *va
 		GValue *gdaval = NULL;
 
 		if (!dh)
-			dh = gda_get_default_handler (holder->priv->g_type);
+			dh = gda_data_handler_get_default_handler (holder->priv->g_type);
 		if (dh)
 			gdaval = gda_data_handler_get_value_from_str (dh, value, holder->priv->g_type);
 
diff --git a/libgda/gda-server-operation.c b/libgda/gda-server-operation.c
index 93da4ba..96e7db0 100644
--- a/libgda/gda-server-operation.c
+++ b/libgda/gda-server-operation.c
@@ -28,6 +28,7 @@
 #include <libgda/gda-set.h>
 #include <libgda/gda-holder.h>
 #include <libgda/gda-connection.h>
+#include <libgda/gda-config.h>
 #include <libgda/gda-data-model-private.h>
 #include <libgda/gda-data-model-import.h>
 #include <libgda/gda-data-model-array.h>
@@ -256,6 +257,15 @@ gda_server_operation_dispose (GObject *object)
 	parent_class->dispose (object);
 }
 
+/* module error */
+GQuark gda_server_operation_error_quark (void)
+{
+        static GQuark quark;
+        if (!quark)
+                quark = g_quark_from_static_string ("gda_server_operation_error");
+        return quark;
+}
+
 GType
 gda_server_operation_get_type (void)
 {
@@ -2367,3 +2377,421 @@ gda_server_operation_is_valid (GdaServerOperation *op, const gchar *xml_file, GE
 
 	return valid;
 }
+
+/**
+ * gda_server_operation_prepare_create_database:
+ * @provider: the database provider to use
+ * @db_name: the name of the database to create, or %NULL
+ * @error: a place to store errors, or %NULL
+ *
+ * Creates a new #GdaServerOperation object which contains the specifications required
+ * to create a database. Once these specifications provided, use
+ * gda_server_operation_perform_create_database() to perform the database creation.
+ *
+ * If @db_name is left %NULL, then the name of the database to create will have to be set in the
+ * returned #GdaServerOperation using gda_server_operation_set_value_at().
+ *
+ * Returns: (transfer full) (allow-none): new #GdaServerOperation object, or %NULL if the provider does not support database
+ * creation
+ */
+GdaServerOperation *
+gda_server_operation_prepare_create_database (const gchar *provider, const gchar *db_name, GError **error)
+{
+	GdaServerProvider *prov;
+
+	g_return_val_if_fail (provider && *provider, NULL);
+
+	prov = gda_config_get_provider (provider, error);
+	if (prov) {
+		GdaServerOperation *op;
+		op = gda_server_provider_create_operation (prov, NULL, GDA_SERVER_OPERATION_CREATE_DB,
+							   NULL, error);
+		if (op) {
+			g_object_set_data_full (G_OBJECT (op), "_gda_provider_obj", g_object_ref (prov), g_object_unref);
+			if (db_name)
+				gda_server_operation_set_value_at (op, db_name, NULL, "/DB_DEF_P/DB_NAME");
+		}
+		return op;
+	}
+	else
+		return NULL;
+}
+
+/**
+ * gda_server_operation_perform_create_database:
+ * @provider: the database provider to use, or %NULL if @op has been created using gda_server_operation_prepare_create_database()
+ * @op: a #GdaServerOperation object obtained using gda_server_operation_prepare_create_database()
+ * @error: a place to store en error, or %NULL
+ *
+ * Creates a new database using the specifications in @op. @op can be obtained using
+ * gda_server_provider_create_operation(), or gda_server_operation_prepare_create_database().
+ *
+ * Returns: TRUE if no error occurred and the database has been created, FALSE otherwise
+ */
+gboolean
+gda_server_operation_perform_create_database (GdaServerOperation *op, const gchar *provider, GError **error)
+{
+	GdaServerProvider *prov;
+
+	g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
+	if (provider)
+		prov = gda_config_get_provider (provider, error);
+	else
+		prov = g_object_get_data (G_OBJECT (op), "_gda_provider_obj");
+	if (prov)
+		return gda_server_provider_perform_operation (prov, NULL, op, error);
+	else {
+		g_warning ("Could not find operation's associated provider, "
+			   "did you use gda_server_operation_prepare_create_database() ?");
+		return FALSE;
+	}
+}
+
+/**
+ * gda_server_operation_prepare_drop_database:
+ * @provider: the database provider to use
+ * @db_name: the name of the database to drop, or %NULL
+ * @error: a place to store errors, or %NULL
+ *
+ * Creates a new #GdaServerOperation object which contains the specifications required
+ * to drop a database. Once these specifications provided, use
+ * gda_server_operation_perform_drop_database() to perform the database creation.
+ *
+ * If @db_name is left %NULL, then the name of the database to drop will have to be set in the
+ * returned #GdaServerOperation using gda_server_operation_set_value_at().
+ *
+ * Returns: (transfer full) (allow-none): new #GdaServerOperation object, or %NULL if the provider does not support database
+ * destruction
+ */
+GdaServerOperation *
+gda_server_operation_prepare_drop_database (const gchar *provider, const gchar *db_name, GError **error)
+{
+	GdaServerProvider *prov;
+
+	g_return_val_if_fail (provider && *provider, NULL);
+
+	prov = gda_config_get_provider (provider, error);
+	if (prov) {
+		GdaServerOperation *op;
+		op = gda_server_provider_create_operation (prov, NULL, GDA_SERVER_OPERATION_DROP_DB,
+							   NULL, error);
+		if (op) {
+			g_object_set_data_full (G_OBJECT (op), "_gda_provider_obj", g_object_ref (prov), g_object_unref);
+			if (db_name)
+				gda_server_operation_set_value_at (op, db_name, NULL, "/DB_DESC_P/DB_NAME");
+		}
+		return op;
+	}
+	else
+		return NULL;
+}
+
+/**
+ * gda_server_operation_perform_drop_database:
+ * @provider: the database provider to use, or %NULL if @op has been created using gda_server_operation_prepare_drop_database()
+ * @op: a #GdaServerOperation object obtained using gda_prepare_drop_database()
+ * @error: a place to store en error, or %NULL
+ *
+ * Destroys an existing database using the specifications in @op. @op can be obtained using
+ * gda_server_provider_create_operation(), or gda_server_operation_prepare_drop_database().
+ *
+ * Returns: TRUE if no error occurred and the database has been destroyed
+ */
+gboolean
+gda_server_operation_perform_drop_database (GdaServerOperation *op, const gchar *provider, GError **error)
+{
+	GdaServerProvider *prov;
+
+	g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
+	if (provider)
+		prov = gda_config_get_provider (provider, error);
+	else
+		prov = g_object_get_data (G_OBJECT (op), "_gda_provider_obj");
+	if (prov)
+		return gda_server_provider_perform_operation (prov, NULL, op, error);
+	else {
+		g_warning ("Could not find operation's associated provider, "
+			   "did you use gda_server_operation_prepare_drop_database() ?");
+		return FALSE;
+	}
+}
+
+/**
+ * gda_server_operation_prepare_create_table:
+ * @cnc: an opened connection
+ * @table_name: name of the table to create
+ * @error: a place to store errors, or %NULL
+ * @...: group of three arguments for column's name, column's #GType
+ * and a #GdaEasyCreateTableFlag flag, finished with %NULL
+ *
+ * Add more arguments if the flag needs them:
+ *
+ * GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG:
+ * <itemizedlist>
+ *   <listitem><para>string with the table's name referenced</para></listitem>
+ *   <listitem><para>an integer with the number pairs "local_field", "referenced_field"
+ *   used in the reference</para></listitem>
+ *   <listitem><para>Pairs of "local_field", "referenced_field" to use, must match
+ *    the number specified above.</para></listitem>
+ *   <listitem><para>a string with the action for ON DELETE; can be: "RESTRICT", "CASCADE",
+ *    "NO ACTION", "SET NULL" and "SET DEFAULT". Example: "ON UPDATE CASCADE".</para></listitem>
+ *   <listitem><para>a string with the action for ON UPDATE (see above).</para></listitem>
+ * </itemizedlist>
+ *
+ * Create a #GdaServerOperation object using an opened connection, taking three
+ * arguments, a column's name the column's GType and #GdaEasyCreateTableFlag
+ * flag, you need to finish the list using %NULL.
+ *
+ * You'll be able to modify the #GdaServerOperation object to add custom options * to the operation. When finished call #gda_server_operation_perform_create_table
+ * or #gda_server_provider_perform_operation
+ * in order to execute the operation.
+ *
+ * Returns: (transfer full) (allow-none): a #GdaServerOperation if no errors; NULL and set @error otherwise
+ */
+G_GNUC_NULL_TERMINATED
+GdaServerOperation*
+gda_server_operation_prepare_create_table (GdaConnection *cnc, const gchar *table_name, GError **error, ...)
+{
+	GdaServerOperation *op;
+	GdaServerProvider *server;
+
+	g_return_val_if_fail (gda_connection_is_opened (cnc), FALSE);
+
+	server = gda_connection_get_provider (cnc);
+
+	if (!table_name) {
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_OBJECT_NAME_ERROR,
+			     "%s", _("Unspecified table name"));
+		return NULL;
+	}
+
+	if (gda_server_provider_supports_operation (server, cnc, GDA_SERVER_OPERATION_CREATE_TABLE, NULL)) {
+		va_list  args;
+		gchar   *arg;
+		GType    type;
+		gchar   *dbms_type;
+		GdaServerOperationCreateTableFlag flag;
+		gint i;
+		gint refs;
+
+		op = gda_server_provider_create_operation (server, cnc,
+							   GDA_SERVER_OPERATION_CREATE_TABLE, NULL, error);
+		if (!GDA_IS_SERVER_OPERATION(op))
+			return NULL;
+		if(!gda_server_operation_set_value_at (op, table_name, error, "/TABLE_DEF_P/TABLE_NAME")) {
+			g_object_unref (op);
+			return NULL;
+		}
+
+		va_start (args, error);
+		type = 0;
+		arg = NULL;
+		i = 0;
+		refs = -1;
+
+		while ((arg = va_arg (args, gchar*))) {
+			/* First argument for Column's name */
+			if(!gda_server_operation_set_value_at (op, arg, error, "/FIELDS_A/@COLUMN_NAME/%d", i)){
+				g_object_unref (op);
+				return NULL;
+			}
+
+			/* Second to Define column's type */
+			type = va_arg (args, GType);
+			if (type == 0) {
+				g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+					     "%s", _("Invalid type"));
+				g_object_unref (op);
+				return NULL;
+			}
+			dbms_type = (gchar *) gda_server_provider_get_default_dbms_type (server,
+											 cnc, type);
+			if (!gda_server_operation_set_value_at (op, dbms_type, error, "/FIELDS_A/@COLUMN_TYPE/%d", i)){
+				g_object_unref (op);
+				return NULL;
+			}
+
+			/* Third for column's flags */
+			flag = va_arg (args, GdaServerOperationCreateTableFlag);
+			if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_PKEY_FLAG)
+				if(!gda_server_operation_set_value_at (op, "TRUE", error, "/FIELDS_A/@COLUMN_PKEY/%d", i)){
+					g_object_unref (op);
+					return NULL;
+				}
+			if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_NOT_NULL_FLAG)
+				if(!gda_server_operation_set_value_at (op, "TRUE", error, "/FIELDS_A/@COLUMN_NNUL/%d", i)){
+					g_object_unref (op);
+					return NULL;
+				}
+			if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_AUTOINC_FLAG)
+				if (!gda_server_operation_set_value_at (op, "TRUE", error, "/FIELDS_A/@COLUMN_AUTOINC/%d", i)){
+					g_object_unref (op);
+					return NULL;
+				}
+			if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_UNIQUE_FLAG)
+				if(!gda_server_operation_set_value_at (op, "TRUE", error, "/FIELDS_A/@COLUMN_UNIQUE/%d", i)){
+					g_object_unref (op);
+					return NULL;
+				}
+			if (flag & GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG) {
+				gint j;
+				gint fields;
+				gchar *fkey_table;
+				gchar *fkey_ondelete;
+				gchar *fkey_onupdate;
+
+				refs++;
+
+				fkey_table = va_arg (args, gchar*);
+				if (!gda_server_operation_set_value_at (op, fkey_table, error,
+								   "/FKEY_S/%d/FKEY_REF_TABLE", refs)){
+					g_object_unref (op);
+					return NULL;
+				}
+
+				fields = va_arg (args, gint);
+
+				for (j = 0; j < fields; j++) {
+					gchar *field, *rfield;
+
+					field = va_arg (args, gchar*);
+					if(!gda_server_operation_set_value_at (op, field, error,
+									   "/FKEY_S/%d/FKEY_FIELDS_A/@FK_FIELD/%d", refs, j)){
+						g_object_unref (op);
+						return NULL;
+					}
+
+					rfield = va_arg (args, gchar*);
+					if(!gda_server_operation_set_value_at (op, rfield, error,
+									   "/FKEY_S/%d/FKEY_FIELDS_A/@FK_REF_PK_FIELD/%d", refs, j)){
+						g_object_unref (op);
+						return NULL;
+					}
+				}
+
+				fkey_ondelete = va_arg (args, gchar*);
+				if (!gda_server_operation_set_value_at (op, fkey_ondelete, error,
+								   "/FKEY_S/%d/FKEY_ONDELETE", refs)){
+					g_object_unref (op);
+					return NULL;
+				}
+				fkey_onupdate = va_arg (args, gchar*);
+				if(!gda_server_operation_set_value_at (op, fkey_onupdate, error,
+								   "/FKEY_S/%d/FKEY_ONUPDATE", refs)){
+					g_object_unref (op);
+					return NULL;
+				}
+			}
+
+			i++;
+		}
+
+		va_end (args);
+
+		g_object_set_data_full (G_OBJECT (op), "_gda_connection", g_object_ref (cnc), g_object_unref);
+
+		return op;
+	}
+	else {
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR, GDA_SERVER_OPERATION_OBJECT_NAME_ERROR,
+			     "%s", _("CREATE TABLE operation is not supported by the database server"));
+		return NULL;
+	}
+}
+
+
+/**
+ * gda_server_operation_perform_create_table:
+ * @op: a valid #GdaServerOperation
+ * @error: a place to store errors, or %NULL
+ *
+ * Performs a prepared #GdaServerOperation to create a table. This could perform
+ * an operation created by #gda_server_operation_prepare_create_table or any other using the
+ * the #GdaServerOperation API.
+ *
+ * Returns: TRUE if the table was created; FALSE and set @error otherwise
+ */
+gboolean
+gda_server_operation_perform_create_table (GdaServerOperation *op, GError **error)
+{
+	GdaConnection *cnc;
+
+	g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
+	g_return_val_if_fail (gda_server_operation_get_op_type (op) == GDA_SERVER_OPERATION_CREATE_TABLE, FALSE);
+
+	cnc = g_object_get_data (G_OBJECT (op), "_gda_connection");
+	if (cnc)
+		return gda_server_provider_perform_operation (gda_connection_get_provider (cnc), cnc, op, error);
+	else {
+		g_warning ("Could not find operation's associated connection, "
+			   "did you use gda_connection_prepare_create_table() ?");
+		return FALSE;
+	}
+}
+
+/**
+ * gda_server_operation_prepare_drop_table:
+ * @cnc: an opened connection
+ * @table_name: name of the table to drop
+ * @error: a place to store errors, or %NULL
+ *
+ * This is just a convenient function to create a #GdaServerOperation to drop a
+ * table in an opened connection.
+ *
+ * Returns: (transfer full) (allow-none): a new #GdaServerOperation or %NULL if couldn't create the opereration.
+ */
+GdaServerOperation*
+gda_connection_prepare_drop_table (GdaConnection *cnc, const gchar *table_name, GError **error)
+{
+	GdaServerOperation *op;
+	GdaServerProvider *server;
+
+	server = gda_connection_get_provider (cnc);
+
+	op = gda_server_provider_create_operation (server, cnc,
+						   GDA_SERVER_OPERATION_DROP_TABLE, NULL, error);
+
+	if (GDA_IS_SERVER_OPERATION (op)) {
+		g_return_val_if_fail (table_name != NULL
+				      || GDA_IS_CONNECTION (cnc)
+				      || !gda_connection_is_opened (cnc), NULL);
+
+		if (gda_server_operation_set_value_at (op, table_name,
+						       error, "/TABLE_DESC_P/TABLE_NAME")) {
+			g_object_set_data_full (G_OBJECT (op), "_gda_connection", g_object_ref (cnc), g_object_unref);
+			return op;
+		}
+		else
+			return NULL;
+	}
+	else
+		return NULL;
+}
+
+
+/**
+ * gda_server_operation_perform_drop_table:
+ * @op: a #GdaServerOperation object
+ * @error: a place to store errors, or %NULL
+ *
+ * This is just a convenient function to perform a drop a table operation.
+ *
+ * Returns: TRUE if the table was dropped
+ */
+gboolean
+gda_server_operation_perform_drop_table (GdaServerOperation *op, GError **error)
+{
+	GdaConnection *cnc;
+
+	g_return_val_if_fail (GDA_IS_SERVER_OPERATION (op), FALSE);
+	g_return_val_if_fail (gda_server_operation_get_op_type (op) == GDA_SERVER_OPERATION_DROP_TABLE, FALSE);
+
+	cnc = g_object_get_data (G_OBJECT (op), "_gda_connection");
+	if (cnc)
+		return gda_server_provider_perform_operation (gda_connection_get_provider (cnc), cnc, op, error);
+	else {
+		g_warning ("Could not find operation's associated connection, "
+			   "did you use gda_server_operation_prepare_drop_table() ?");
+		return FALSE;
+	}
+}
diff --git a/libgda/gda-server-operation.h b/libgda/gda-server-operation.h
index eb39d1d..dc60304 100644
--- a/libgda/gda-server-operation.h
+++ b/libgda/gda-server-operation.h
@@ -66,6 +66,27 @@ typedef enum {
 	GDA_SERVER_OPERATION_LAST
 } GdaServerOperationType;
 
+/* error reporting */
+extern GQuark gda_server_operation_error_quark (void);
+#define GDA_SERVER_OPERATION_ERROR gda_server_operation_error_quark ()
+
+typedef enum {
+	GDA_SERVER_OPERATION_OBJECT_NAME_ERROR,
+	GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR
+} GdaServerOperationError;
+
+typedef enum
+{
+	GDA_SERVER_OPERATION_CREATE_TABLE_NOTHING_FLAG   = 1 << 0,
+	GDA_SERVER_OPERATION_CREATE_TABLE_PKEY_FLAG      = 1 << 1,
+	GDA_SERVER_OPERATION_CREATE_TABLE_NOT_NULL_FLAG  = 1 << 2,
+	GDA_SERVER_OPERATION_CREATE_TABLE_UNIQUE_FLAG    = 1 << 3,
+	GDA_SERVER_OPERATION_CREATE_TABLE_AUTOINC_FLAG   = 1 << 4,
+	GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG      = 1 << 5,
+	/* Flags combinations */
+	GDA_SERVER_OPERATION_CREATE_TABLE_PKEY_AUTOINC_FLAG = GDA_SERVER_OPERATION_CREATE_TABLE_PKEY_FLAG | GDA_SERVER_OPERATION_CREATE_TABLE_AUTOINC_FLAG
+} GdaServerOperationCreateTableFlag;
+
 typedef enum {
 	GDA_SERVER_OPERATION_NODE_PARAMLIST,
 	GDA_SERVER_OPERATION_NODE_DATA_MODEL,
@@ -148,6 +169,22 @@ gboolean                   gda_server_operation_del_item_from_sequence  (GdaServ
 
 gboolean                   gda_server_operation_is_valid                (GdaServerOperation *op, const gchar *xml_file, GError **error);
 
+/*
+ * Database creation and destruction
+ */
+GdaServerOperation *gda_server_operation_prepare_create_database       (const gchar *provider, const gchar *db_name, GError **error);
+gboolean            gda_server_operation_perform_create_database       (GdaServerOperation *op, const gchar *provider, GError **error);
+GdaServerOperation *gda_server_operation_prepare_drop_database         (const gchar *provider, const gchar *db_name, GError **error);
+gboolean            gda_server_operation_perform_drop_database         (GdaServerOperation *op, const gchar *provider, GError **error);
+
+/*
+ * Tables creation and destruction
+ */
+GdaServerOperation *gda_server_operation_prepare_create_table	      (GdaConnection *cnc, const gchar *table_name, GError **error, ...);
+gboolean            gda_server_operaton_perform_create_table          (GdaServerOperation *op, GError **error);
+GdaServerOperation *gda_server_operation_prepare_drop_table            (GdaConnection *cnc, const gchar *table_name, GError **error);
+gboolean            gda_server_operation_perform_drop_table            (GdaServerOperation *op, GError **error);
+
 G_END_DECLS
 
 #endif
diff --git a/libgda/gda-sql-builder.c b/libgda/gda-sql-builder.c
index 97cd129..c22ebbc 100644
--- a/libgda/gda-sql-builder.c
+++ b/libgda/gda-sql-builder.c
@@ -24,7 +24,6 @@
 #include <libgda/gda-sql-builder.h>
 #include <libgda/gda-statement.h>
 #include <libgda/gda-data-handler.h>
-#include <libgda/gda-easy.h>
 #include <sql-parser/gda-sql-parser-enum-types.h>
 
 /*
@@ -815,7 +814,7 @@ gda_sql_builder_add_expr_value (GdaSqlBuilder *builder, GdaDataHandler *dh, cons
 	if (value && (G_VALUE_TYPE (value) != GDA_TYPE_NULL)) {
 		GType type = G_VALUE_TYPE (value);
 		if (!dh)
-			dh = gda_get_default_handler (type);
+			dh = gda_data_handler_get_default_handler (type);
 		else {
 			if (! gda_data_handler_accepts_g_type (dh, type)) {
 				g_warning (_("Unhandled data type '%s'"), g_type_name (type));
diff --git a/libgda/gda-statement.c b/libgda/gda-statement.c
index b19e27b..85e0cab 100644
--- a/libgda/gda-statement.c
+++ b/libgda/gda-statement.c
@@ -694,7 +694,7 @@ default_render_value (const GValue *value, GdaSqlRenderingContext *context, GErr
 		if (context->provider)
 			dh = gda_server_provider_get_data_handler_g_type (context->provider, context->cnc, G_VALUE_TYPE (value));
 		else  			
-			dh = gda_get_default_handler (G_VALUE_TYPE (value));
+			dh = gda_data_handler_get_default_handler (G_VALUE_TYPE (value));
 
 		if (!dh) {
 			g_set_error (error, GDA_SQL_ERROR, GDA_SQL_STRUCTURE_CONTENTS_ERROR,
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 77d45d7..9a79577 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -3023,7 +3023,7 @@ scalar_gda_hex_print_func (sqlite3_context *context, int argc, sqlite3_value **a
 	}
 	bin->binary_length = SQLITE3_CALL (sqlite3_value_bytes) (argv [0]);
 	gda_value_take_binary ((value = gda_value_new (GDA_TYPE_BINARY)), bin);
-	dh = gda_get_default_handler (GDA_TYPE_BINARY);
+	dh = gda_data_handler_get_default_handler (GDA_TYPE_BINARY);
 	str = gda_data_handler_get_str_from_value (dh, value);
 
 	bin->data = NULL;
@@ -3055,7 +3055,7 @@ scalar_gda_hex_print_func2 (sqlite3_context *context, int argc, sqlite3_value **
 	}
 	bin->binary_length = SQLITE3_CALL (sqlite3_value_bytes) (argv [0]);
 	gda_value_take_binary ((value = gda_value_new (GDA_TYPE_BINARY)), bin);
-	dh = gda_get_default_handler (GDA_TYPE_BINARY);
+	dh = gda_data_handler_get_default_handler (GDA_TYPE_BINARY);
 	str = gda_data_handler_get_str_from_value (dh, value);
 
 	bin->data = NULL;
diff --git a/providers/postgres/gda-postgres-ddl.c b/providers/postgres/gda-postgres-ddl.c
index 3e29049..50d05a3 100644
--- a/providers/postgres/gda-postgres-ddl.c
+++ b/providers/postgres/gda-postgres-ddl.c
@@ -796,7 +796,7 @@ gda_postgres_render_CREATE_USER (GdaServerProvider *provider, GdaConnection *cnc
 		g_string_append (string, " PASSWORD ");
 		dh = gda_server_provider_get_data_handler_g_type (provider, cnc, G_TYPE_STRING);
 		if (!dh)
-			dh = gda_get_default_handler (G_TYPE_STRING);
+			dh = gda_data_handler_get_default_handler (G_TYPE_STRING);
 
 		tmp = gda_data_handler_get_sql_from_value (dh, value);
 		g_string_append (string, tmp);
@@ -945,7 +945,7 @@ gda_postgres_render_CREATE_USER (GdaServerProvider *provider, GdaConnection *cnc
 			}
 			dh = gda_server_provider_get_data_handler_g_type (provider, cnc, GDA_TYPE_TIMESTAMP);
 			if (!dh)
-				dh = gda_get_default_handler (GDA_TYPE_TIMESTAMP);
+				dh = gda_data_handler_get_default_handler (GDA_TYPE_TIMESTAMP);
 			
 			g_string_append (string, " VALID UNTIL ");
 			tmp = gda_data_handler_get_sql_from_value (dh, value);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1ba8ee4..b77934e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,7 +24,7 @@ libgda_test_4_0_la_SOURCES = \
 	data-model-errors.h \
 	data-model-errors.c
 
-libgda_test_4_0_la_LDFLAGS = -version-info $(GDA_CURRENT):$(GDA_REVISION):$(GDA_AGE) $(NO_UNDEFINED)
+libgda_test_4_0_la_LDFLAGS = $(NO_UNDEFINED)
 
 libgda_test_4_0_la_LIBADD = \
 	$(LIBGDA_LIBS) \
@@ -82,4 +82,4 @@ test_input_parsers_LDADD = \
         $(top_builddir)/libgda/libgda-4.0.la \
         $(LIBGDA_LIBS)
 
-EXTRA_DIST = dbstruct.xml
\ No newline at end of file
+EXTRA_DIST = dbstruct.xml
diff --git a/tests/test-cnc-utils.c b/tests/test-cnc-utils.c
index 7ef7da7..db5dd8e 100644
--- a/tests/test-cnc-utils.c
+++ b/tests/test-cnc-utils.c
@@ -114,12 +114,12 @@ test_cnc_setup_connection (const gchar *provider, const gchar *dbname, GError **
 		GdaServerOperation *op;
 
 		db_quark_list = gda_quark_list_new_from_string (db_params);
-		op = gda_prepare_drop_database (prov_info->id, dbname, NULL);
+		op = gda_server_operation_prepare_drop_database (prov_info->id, dbname, NULL);
 		gda_quark_list_foreach (db_quark_list, (GHFunc) db_create_quark_foreach_func, op);
-		gda_perform_drop_database (NULL, op, NULL);
+		gda_server_operation_perform_drop_database (op, NULL, NULL);
 		g_object_unref (op);
 
-		op = gda_prepare_create_database (prov_info->id, dbname, NULL);
+		op = gda_server_operation_prepare_create_database (prov_info->id, dbname, NULL);
 		gda_quark_list_foreach (db_quark_list, (GHFunc) db_create_quark_foreach_func, op);
 		if (!gda_perform_create_database (NULL, op, error)) 
 			goto out;
@@ -294,13 +294,13 @@ test_cnc_clean_connection (GdaConnection *cnc, GError **error)
 		g_free (str);
 		g_assert (db_params);
 
-		op = gda_prepare_drop_database (prov_id, dbname, NULL);
+		op = gda_server_operation_prepare_drop_database (prov_id, dbname, NULL);
 		g_free (dbname);
 		db_quark_list = gda_quark_list_new_from_string (db_params);
 		gda_quark_list_foreach (db_quark_list, (GHFunc) db_drop_quark_foreach_func, op);
 		gda_quark_list_free (db_quark_list);
 
-		if (!gda_perform_drop_database (NULL, op, error)) 
+		if (!gda_server_operation_perform_drop_database (op, NULL, error))
 			retval = FALSE;
 		g_object_unref (op);
 	}
diff --git a/tests/test-input-parsers.c b/tests/test-input-parsers.c
index cd26a5a..7b449d9 100644
--- a/tests/test-input-parsers.c
+++ b/tests/test-input-parsers.c
@@ -311,7 +311,7 @@ test_time_handler (void)
 {
 	GdaDataHandler *dh;
 	gint i, j;
-	dh = gda_get_default_handler (GDA_TYPE_TIME);
+	dh = gda_data_handler_get_default_handler (GDA_TYPE_TIME);
 	g_assert (dh);
 
 	for (i = 0; i < sizeof (timedata) / sizeof (TestTime); i++) {



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