libgda r3242 - in trunk: . doc/C doc/C/tmpl libgda libgda/sqlite providers/mysql tests/value-holders



Author: vivien
Date: Sat Oct 18 13:02:18 2008
New Revision: 3242
URL: http://svn.gnome.org/viewvc/libgda?rev=3242&view=rev

Log:
2008-10-18  Vivien Malerba <malerba gnome-db org>

	* libgda/gda-data-select.[ch]: added gda_data_select_compute_columns_attributes()
	which implements what was in gda_data_model_iter_compute_attributes(), better to
	make it there since it was specific to the GdaDataSelect object
	* libgda/gda-data-model-iter.[ch]: removed gda_data_model_iter_compute_attributes()
	* libgda/sqlite/gda-sqlite-provider.c:
	* providers/mysql/gda-mysql-provider.c:
	* libgda/gda-data-proxy.c:
	* libgda/gda-holder.c:
	* tests/value-holders/check_holder.c:
	* libgda/gda-easy.c: minor bug fixes
	* libgda/gda-set.[ch]: removed dead code and declarations


Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/doc/C/libgda-4.0-sections.txt
   trunk/doc/C/tmpl/gda-data-model-iter.sgml
   trunk/doc/C/tmpl/gda-data-select.sgml
   trunk/doc/C/tmpl/gda-set.sgml
   trunk/libgda/gda-data-model-iter.c
   trunk/libgda/gda-data-model-iter.h
   trunk/libgda/gda-data-proxy.c
   trunk/libgda/gda-data-select.c
   trunk/libgda/gda-data-select.h
   trunk/libgda/gda-easy.c
   trunk/libgda/gda-holder.c
   trunk/libgda/gda-set.c
   trunk/libgda/gda-set.h
   trunk/libgda/sqlite/gda-sqlite-provider.c
   trunk/providers/mysql/gda-mysql-provider.c
   trunk/tests/value-holders/check_holder.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Sat Oct 18 13:02:18 2008
@@ -1,3 +1,8 @@
+libgda 3.99.6, 
+
+ - bug fixes: #541991
+ - Translations:
+
 libgda 3.99.5, 2008-10-09
 
 This version includes:

Modified: trunk/doc/C/libgda-4.0-sections.txt
==============================================================================
--- trunk/doc/C/libgda-4.0-sections.txt	(original)
+++ trunk/doc/C/libgda-4.0-sections.txt	Sat Oct 18 13:02:18 2008
@@ -371,7 +371,6 @@
 gda_data_model_iter_get_row
 gda_data_model_iter_get_holder_for_field
 gda_data_model_iter_invalidate_contents
-gda_data_model_iter_compute_attributes
 <SUBSECTION Standard>
 GDA_DATA_MODEL_ITER
 GDA_DATA_MODEL_ITER_CLASS
@@ -1380,6 +1379,7 @@
 gda_data_select_set_modification_statement
 gda_data_select_set_modification_statement_sql
 gda_data_select_compute_modification_statements
+gda_data_select_compute_columns_attributes
 <SUBSECTION Standard>
 GDA_IS_DATA_SELECT
 GDA_DATA_SELECT

Modified: trunk/doc/C/tmpl/gda-data-model-iter.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-data-model-iter.sgml	(original)
+++ trunk/doc/C/tmpl/gda-data-model-iter.sgml	Sat Oct 18 13:02:18 2008
@@ -193,13 +193,3 @@
 @iter: 
 
 
-<!-- ##### FUNCTION gda_data_model_iter_compute_attributes ##### -->
-<para>
-
-</para>
-
- iter: 
- error: 
- Returns: 
-
-

Modified: trunk/doc/C/tmpl/gda-data-select.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-data-select.sgml	(original)
+++ trunk/doc/C/tmpl/gda-data-select.sgml	Sat Oct 18 13:02:18 2008
@@ -162,3 +162,13 @@
 @Returns: 
 
 
+<!-- ##### FUNCTION gda_data_select_compute_columns_attributes ##### -->
+<para>
+
+</para>
+
+ model: 
+ error: 
+ Returns: 
+
+

Modified: trunk/doc/C/tmpl/gda-set.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-set.sgml	(original)
+++ trunk/doc/C/tmpl/gda-set.sgml	Sat Oct 18 13:02:18 2008
@@ -218,15 +218,6 @@
 @holder: 
 @source_model: 
 @source_column: 
- hint: 
-
-<!-- ##### ENUM GdaSetHint ##### -->
-<para>
-
-</para>
-
- GDA_SET_HOLDER_READ_ONLY: 
- GDA_SET_HOLDER_HIDE: 
 
 <!-- ##### FUNCTION gda_set_get_node ##### -->
 <para>

Modified: trunk/libgda/gda-data-model-iter.c
==============================================================================
--- trunk/libgda/gda-data-model-iter.c	(original)
+++ trunk/libgda/gda-data-model-iter.c	Sat Oct 18 13:02:18 2008
@@ -971,113 +971,3 @@
 	else
 		return NULL;
 }
-
-static void
-set_holders_properties_from_select_stmt (GdaDataModelIter *iter, GdaConnection *cnc, GdaStatement *sel_stmt)
-{
-	GdaSqlStatement *sqlst = NULL;
-	GdaSqlStatementSelect *select;
-	GdaSqlSelectTarget *target;
-	GSList *fields, *holders;
-
-	g_object_get (G_OBJECT (sel_stmt), "structure", &sqlst, NULL);
-	g_assert (sqlst->stmt_type == GDA_SQL_STATEMENT_SELECT);
-	select = (GdaSqlStatementSelect*) sqlst->contents;
-
-	/* we only want a single target */
-	if (!select->from || !select->from->targets || select->from->targets->next)
-		goto out;
-	
-	target = (GdaSqlSelectTarget *) select->from->targets->data;
-	if (!target || !target->table_name)
-		goto out;
-
-	if (! gda_sql_statement_check_validity (sqlst, cnc, NULL))
-		goto out;
-
-	if (!target->validity_meta_object) {
-		g_warning ("Internal gda_sql_statement_check_validity() error: target->validity_meta_object is not set");
-		goto out;
-	}
-
-	/* FIXME: also set some column attributes using gda_column_set_attribute() */
-
-	for (fields = select->expr_list, holders = GDA_SET (iter)->holders; 
-	     fields && holders; 
-	     fields = fields->next) {
-		GdaSqlSelectField *selfield = (GdaSqlSelectField*) fields->data;
-		if (selfield->validity_meta_table_column) {
-			GdaMetaTableColumn *tcol = selfield->validity_meta_table_column;
-
-			/*g_print ("==> %s\n", tcol->column_name);*/
-			gda_holder_set_not_null (GDA_HOLDER (holders->data), ! tcol->nullok);
-			if (tcol->default_value) {
-				GValue *dvalue;
-				g_value_set_string ((dvalue = gda_value_new (G_TYPE_STRING)), tcol->default_value);
-				gda_holder_set_default_value (GDA_HOLDER (holders->data), dvalue);
-				gda_value_free (dvalue);
-			}
-			holders = holders->next;
-		}
-		else if (selfield->validity_meta_object && 
-			 (selfield->validity_meta_object->obj_type == GDA_META_DB_TABLE) &&
-			 selfield->expr && selfield->expr->value && !selfield->expr->param_spec && 
-			 (G_VALUE_TYPE (selfield->expr->value) == G_TYPE_STRING) &&
-			 !strcmp (g_value_get_string (selfield->expr->value), "*")) {
-			/* expand all the fields */
-			GdaMetaTable *mtable = GDA_META_TABLE (selfield->validity_meta_object);
-			GSList *tmplist;
-			for (tmplist = mtable->columns; tmplist; tmplist = tmplist->next) {
-				GdaMetaTableColumn *tcol = (GdaMetaTableColumn*) tmplist->data;
-				/*g_print ("*==> %s\n", tcol->column_name);*/
-				gda_holder_set_not_null (GDA_HOLDER (holders->data), ! tcol->nullok);
-				if (tcol->default_value) {
-					GValue *dvalue;
-					g_value_set_string ((dvalue = gda_value_new (G_TYPE_STRING)), tcol->default_value);
-					gda_holder_set_default_value (GDA_HOLDER (holders->data), dvalue);
-					gda_value_free (dvalue);
-				}
-				if (tmplist)
-					holders = holders->next;
-			}
-		}
-		else
-			holders = holders->next;
-	}
-	if (fields || holders)
-		g_warning ("Internal error: GdaDataModelIter has %d GdaHolders, and SELECT statement has %d expressions",
-			   g_slist_length (GDA_SET (iter)->holders), g_slist_length (select->expr_list));
-
- out:
-	gda_sql_statement_free (sqlst);
-}
-
-/**
- * gda_data_model_iter_compute_attributes
- * @iter: a #GdaDataModelIter object
- * @error: a place to store errors, or %NULL
- *
- * Requests that @iter compute the attributes of each of its #GdaHolder value holders.
- *
- * Returns: TRUE if no error occurred
- */
-gboolean
-gda_data_model_iter_compute_attributes (GdaDataModelIter *iter, GError **error)
-{
-	g_return_val_if_fail (GDA_IS_DATA_MODEL_ITER (iter), FALSE);
-	g_return_val_if_fail (iter->priv, FALSE);
-
-	if (GDA_IS_DATA_SELECT (iter->priv->data_model)) {
-		GdaStatement *sel_stmt;
-		GdaConnection *cnc;
-		g_object_get (G_OBJECT (iter->priv->data_model), "connection", &cnc, 
-			      "select-stmt", &sel_stmt, NULL);
-		if (sel_stmt && cnc) 
-			set_holders_properties_from_select_stmt (iter, cnc, sel_stmt);
-		if (sel_stmt)
-			g_object_unref (sel_stmt);
-		if (cnc)
-			g_object_unref (cnc);
-	}
-	return TRUE;
-}

Modified: trunk/libgda/gda-data-model-iter.h
==============================================================================
--- trunk/libgda/gda-data-model-iter.h	(original)
+++ trunk/libgda/gda-data-model-iter.h	Sat Oct 18 13:02:18 2008
@@ -76,8 +76,6 @@
 
 GdaHolder        *gda_data_model_iter_get_holder_for_field (GdaDataModelIter *iter, gint col);
 
-gboolean          gda_data_model_iter_compute_attributes   (GdaDataModelIter *iter, GError **error);
-
 G_END_DECLS
 
 #endif

Modified: trunk/libgda/gda-data-proxy.c
==============================================================================
--- trunk/libgda/gda-data-proxy.c	(original)
+++ trunk/libgda/gda-data-proxy.c	Sat Oct 18 13:02:18 2008
@@ -3307,8 +3307,8 @@
 	gint current_nb_rows;
 	GdaDataProxy *proxy;
 
-	g_return_val_if_fail (GDA_IS_DATA_PROXY (proxy), FALSE);
 	proxy = (GdaDataProxy*) model;
+	g_return_val_if_fail (GDA_IS_DATA_PROXY (proxy), FALSE);
 	g_return_val_if_fail (proxy->priv, FALSE);
 	g_return_val_if_fail (values, FALSE);
 

Modified: trunk/libgda/gda-data-select.c
==============================================================================
--- trunk/libgda/gda-data-select.c	(original)
+++ trunk/libgda/gda-data-select.c	Sat Oct 18 13:02:18 2008
@@ -3106,3 +3106,117 @@
 	}
 	return TRUE;
 }
+
+static void
+set_column_properties_from_select_stmt (GdaDataSelect *model, GdaConnection *cnc, GdaStatement *sel_stmt)
+{
+	GdaSqlStatement *sqlst = NULL;
+	GdaSqlStatementSelect *select;
+	GdaSqlSelectTarget *target;
+	GSList *fields, *columns;
+
+	g_object_get (G_OBJECT (sel_stmt), "structure", &sqlst, NULL);
+	g_assert (sqlst->stmt_type == GDA_SQL_STATEMENT_SELECT);
+	select = (GdaSqlStatementSelect*) sqlst->contents;
+
+	/* we only want a single target */
+	if (!select->from || !select->from->targets || select->from->targets->next)
+		goto out;
+	
+	target = (GdaSqlSelectTarget *) select->from->targets->data;
+	if (!target || !target->table_name)
+		goto out;
+
+	if (! gda_sql_statement_check_validity (sqlst, cnc, NULL))
+		goto out;
+
+	if (!target->validity_meta_object) {
+		g_warning ("Internal gda_sql_statement_check_validity() error: target->validity_meta_object is not set");
+		goto out;
+	}
+
+	/* FIXME: also set some column attributes using gda_column_set_attribute() */
+
+	for (fields = select->expr_list, columns = model->priv->columns; 
+	     fields && columns; 
+	     fields = fields->next) {
+		GdaSqlSelectField *selfield = (GdaSqlSelectField*) fields->data;
+		if (selfield->validity_meta_table_column) {
+			GdaMetaTableColumn *tcol = selfield->validity_meta_table_column;
+
+			/*g_print ("==> %s\n", tcol->column_name);*/
+			gda_column_set_allow_null (GDA_COLUMN (columns->data), tcol->nullok);
+			if (tcol->default_value) {
+				GValue *dvalue;
+				g_value_set_string ((dvalue = gda_value_new (G_TYPE_STRING)), tcol->default_value);
+				gda_column_set_default_value (GDA_COLUMN (columns->data), dvalue);
+				gda_value_free (dvalue);
+			}
+			columns = columns->next;
+		}
+		else if (selfield->validity_meta_object && 
+			 (selfield->validity_meta_object->obj_type == GDA_META_DB_TABLE) &&
+			 selfield->expr && selfield->expr->value && !selfield->expr->param_spec && 
+			 (G_VALUE_TYPE (selfield->expr->value) == G_TYPE_STRING) &&
+			 !strcmp (g_value_get_string (selfield->expr->value), "*")) {
+			/* expand all the fields */
+			GdaMetaTable *mtable = GDA_META_TABLE (selfield->validity_meta_object);
+			GSList *tmplist;
+			for (tmplist = mtable->columns; tmplist; tmplist = tmplist->next) {
+				GdaMetaTableColumn *tcol = (GdaMetaTableColumn*) tmplist->data;
+				/*g_print ("*==> %s\n", tcol->column_name);*/
+				gda_column_set_allow_null (GDA_COLUMN (columns->data), tcol->nullok);
+				if (tcol->default_value) {
+					GValue *dvalue;
+					g_value_set_string ((dvalue = gda_value_new (G_TYPE_STRING)), tcol->default_value);
+					gda_column_set_default_value (GDA_COLUMN (columns->data), dvalue);
+					gda_value_free (dvalue);
+				}
+				if (tmplist)
+					columns = columns->next;
+			}
+		}
+		else
+			columns = columns->next;
+	}
+	if (fields || columns)
+		g_warning ("Internal error: GdaDataSelect has %d GdaColumns, and SELECT statement has %d expressions",
+			   g_slist_length (model->priv->columns), g_slist_length (select->expr_list));
+
+ out:
+	gda_sql_statement_free (sqlst);
+}
+
+
+/**
+ * gda_data_select_compute_columns_attributes
+ * @model: a #GdaDataSelect data model
+ * @error: a place to store errors, or %NULL
+ *
+ * Computes correct attributes for each of @model's columns, which includes the "NOT NULL" attribute, the
+ * default value, the precision and scale for numeric values.
+ *
+ * Returns: TRUE if no error occurred
+ */
+gboolean
+gda_data_select_compute_columns_attributes (GdaDataSelect *model, GError **error)
+{
+	GdaStatement *sel_stmt;
+
+	g_return_val_if_fail (GDA_IS_DATA_SELECT (model), FALSE);
+	g_return_val_if_fail (model->priv, FALSE);
+
+	sel_stmt = check_acceptable_statement (model, error);
+	if (! sel_stmt)
+		return FALSE;
+
+	if (!model->priv->cnc) {
+		g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_CONNECTION_ERROR,
+			     _("No connection to use"));
+		return FALSE;
+	}
+
+	set_column_properties_from_select_stmt (model, model->priv->cnc, sel_stmt);
+
+	return TRUE;
+}

Modified: trunk/libgda/gda-data-select.h
==============================================================================
--- trunk/libgda/gda-data-select.h	(original)
+++ trunk/libgda/gda-data-select.h	Sat Oct 18 13:02:18 2008
@@ -99,6 +99,8 @@
 gboolean       gda_data_select_set_modification_statement_sql  (GdaDataSelect *model, const gchar *sql, GError **error);
 gboolean       gda_data_select_compute_modification_statements (GdaDataSelect *model, GError **error);
 
+gboolean       gda_data_select_compute_columns_attributes      (GdaDataSelect *model, GError **error);
+
 G_END_DECLS
 
 #endif

Modified: trunk/libgda/gda-easy.c
==============================================================================
--- trunk/libgda/gda-easy.c	(original)
+++ trunk/libgda/gda-easy.c	Sat Oct 18 13:02:18 2008
@@ -441,7 +441,9 @@
  * gda_get_default_handler
  * @for_type: a #GType type
  * 
- * Obtain a pointer to a #GdaDataHandler which can manage #GValue values of type @for_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 accoutn the locale).
  *
  * The returned pointer is %NULL if there is no default data handler available for the @for_type data type
  *
@@ -464,7 +466,7 @@
                 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_no_locale ());
+                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 ());
@@ -472,8 +474,8 @@
                 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_no_locale ());
-                g_hash_table_insert (hash, (gpointer) GDA_TYPE_TIMESTAMP, gda_handler_time_new_no_locale ());
+                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 ());

Modified: trunk/libgda/gda-holder.c
==============================================================================
--- trunk/libgda/gda-holder.c	(original)
+++ trunk/libgda/gda-holder.c	Sat Oct 18 13:02:18 2008
@@ -691,7 +691,7 @@
 	g_return_val_if_fail (holder->priv, NULL);
 
 	if (!holder->priv->full_bind) {
-		/* return default value is possible */
+		/* return default value if possible */
 		if (holder->priv->default_forced) {
 			g_assert (holder->priv->default_value);
 			if (G_VALUE_TYPE (holder->priv->default_value) == holder->priv->g_type) 
@@ -730,10 +730,9 @@
         if (!current_val || gda_value_is_null (current_val))
                 return NULL;
         else {
-                GdaDataHandler *dh;
-
-                dh = gda_get_default_handler (holder->priv->g_type);
-                if (dh)
+                if (!dh)
+			dh = gda_get_default_handler (holder->priv->g_type);
+		if (dh)
                         return gda_data_handler_get_str_from_value (dh, current_val);
                 else
                         return NULL;
@@ -809,7 +808,7 @@
 		if (!dh)
 			dh = gda_get_default_handler (holder->priv->g_type);
 		if (dh)
-        	gdaval = gda_data_handler_get_value_from_str (dh, value, holder->priv->g_type);
+			gdaval = gda_data_handler_get_value_from_str (dh, value, holder->priv->g_type);
 
 		if (gdaval)
 			return real_gda_holder_set_value (holder, gdaval, FALSE, error);
@@ -1605,7 +1604,19 @@
 static void
 full_bind_changed_cb (GdaHolder *alias_of, GdaHolder *holder)
 {
-	g_signal_emit (holder, gda_holder_signals[CHANGED], 0);
+	if (alias_of == holder->priv->simple_bind) {
+		const GValue *cvalue;
+		GError *error = NULL;
+		cvalue = gda_holder_get_value (alias_of);
+		if (! gda_holder_set_value (holder, cvalue, &error)) {
+			g_warning (_("Could not change GdaHolder to match value change in bound GdaHolder: %s"),
+				   error && error->message ? error->message : _("No detail"));
+			if (error)
+				g_error_free (error);
+		}
+	}
+	else
+		g_signal_emit (holder, gda_holder_signals[CHANGED], 0);
 }
 
 /**
@@ -1660,6 +1671,8 @@
 gda_holder_get_attribute (GdaHolder *holder, const gchar *attribute)
 {
 	g_return_val_if_fail (GDA_IS_HOLDER (holder), NULL);
+	/*g_print ("GdaHolder %p ATTR '%s' get => '%s'\n", holder, attribute, 
+	  gda_value_stringify (gda_attributes_manager_get (gda_holder_attributes_manager, holder, attribute))); */
 	return gda_attributes_manager_get (gda_holder_attributes_manager, holder, attribute);
 }
 
@@ -1689,4 +1702,5 @@
 		return;
 
 	gda_attributes_manager_set (gda_holder_attributes_manager, holder, attribute, value);
+	//g_print ("GdaHolder %p ATTR '%s' set to '%s'\n", holder, attribute, gda_value_stringify (value)); 
 }

Modified: trunk/libgda/gda-set.c
==============================================================================
--- trunk/libgda/gda-set.c	(original)
+++ trunk/libgda/gda-set.c	Sat Oct 18 13:02:18 2008
@@ -491,7 +491,7 @@
  * @set: a #GdaSet object
  * @error: a place to store errors, or %NULL
  * @holder_id: the ID of the holder to set the value
- * @...: value, of the correct type, depending on the requested holder's type
+ * @...: value, of the correct type, depending on the requested holder's type (not NULL)
  *
  * Set the value of the #GdaHolder which ID is @holder_id to a specified value
  *

Modified: trunk/libgda/gda-set.h
==============================================================================
--- trunk/libgda/gda-set.h	(original)
+++ trunk/libgda/gda-set.h	Sat Oct 18 13:02:18 2008
@@ -44,12 +44,6 @@
 	GDA_SET_INVALID_ERROR
 } GdaSetError;
 
-typedef enum {
-	GDA_SET_HOLDER_READ_ONLY = 1 << 0, /* holder should not be affected by user modifications */
-	GDA_SET_HOLDER_HIDE      = 1 << 1  /* holder should not be shown to the user */
-} GdaSetHint;
-
-
 /**
  * GdaSetNode:
  *
@@ -58,10 +52,9 @@
  * each GdaHolder.
  */
 struct _GdaSetNode {
-	GdaHolder    *holder;         /* Can't be NULL */
+	GdaHolder    *holder;        /* Can't be NULL */
 	GdaDataModel *source_model;  /* may be NULL if @holder does not have any source */
 	gint          source_column; /* unused is @source_model is NULL */
-	GdaSetHint    hint;
 };
 
 /**

Modified: trunk/libgda/sqlite/gda-sqlite-provider.c
==============================================================================
--- trunk/libgda/sqlite/gda-sqlite-provider.c	(original)
+++ trunk/libgda/sqlite/gda-sqlite-provider.c	Sat Oct 18 13:02:18 2008
@@ -2122,6 +2122,8 @@
 		gda_connection_internal_statement_executed (cnc, stmt, params, NULL);
 		if (new_ps)
 			g_object_unref (ps);
+		if (allow_noparam)
+			g_object_set (data_model, "auto-reset", TRUE, NULL);
 		return data_model;
         }
 	else {

Modified: trunk/providers/mysql/gda-mysql-provider.c
==============================================================================
--- trunk/providers/mysql/gda-mysql-provider.c	(original)
+++ trunk/providers/mysql/gda-mysql-provider.c	Sat Oct 18 13:02:18 2008
@@ -1546,6 +1546,9 @@
 					flags = GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD;
 
 				return_value = (GObject *) gda_mysql_recordset_new (cnc, ps, params, flags, col_types);
+				if (allow_noparam)
+					g_object_set (return_value, "auto-reset", TRUE, NULL);
+
 				gda_connection_internal_statement_executed (cnc, stmt, params, NULL); /* required: help @cnc keep some stats */
 			}
 			

Modified: trunk/tests/value-holders/check_holder.c
==============================================================================
--- trunk/tests/value-holders/check_holder.c	(original)
+++ trunk/tests/value-holders/check_holder.c	Sat Oct 18 13:02:18 2008
@@ -622,7 +622,7 @@
 	gda_value_free (value);
 
 	/***/
-	value = gda_value_new_from_string ("A string", G_TYPE_STRING);
+	value = gda_value_new_from_string ("A string 2", G_TYPE_STRING);
 	if (!gda_holder_set_value (h2, value, error))
 		return FALSE;
 	if (!emitted_signals_find (h1, "changed", error))



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