libgda r3200 - in trunk: . doc/C doc/C/tmpl libgda libgda-report/engine libgda-xslt libgda/sqlite libgda/sqlite/virtual po providers/mysql providers/postgres providers/skel-implementation/capi samples/BDB samples/TableCopy testing tests tests/data-models tests/meta-store tests/multi-threading tests/parser tests/providers tests/value-holders tools



Author: vivien
Date: Thu Sep  4 20:08:38 2008
New Revision: 3200
URL: http://svn.gnome.org/viewvc/libgda?rev=3200&view=rev

Log:
2008-09-04  Vivien Malerba <malerba gnome-db org>

        API improvements and cleanups:

        * Utility functions changes:
          removed gda_value_compare_ext() as it has no real use and is confusing
          renamed gda_value_bcompare() gda_value_differ()
        * GdaDataModel interface changes:
          added a "GError **error" as last argument of gda_data_model_get_value_at () because it's
             the only way of reporting and correctly handling data access errors, and added
             gda_data_model_get_typed_value_at() which gives more control of the returned value
          renamed gda_data_model_get_column_index_by_name() to gda_data_model_get_column_index()
          renamed gda_data_model_get_value_at_col_name() to gda_data_model_get_value_at_column()
        * GdaHolder object changes: added a GError argument to:
          gda_holder_set_value()
          gda_holder_take_value()
          gda_holder_set_value_str()
          gda_holder_set_bind()
        * GdaSet object changes: added a GError argument to gda_set_set_holder_value()
        * GdaDataAccessWrapper changes: removed gda_data_access_wrapper_row_exists() as it was useless

        Misc doc improvements.


Modified:
   trunk/ChangeLog
   trunk/doc/C/howto.xml
   trunk/doc/C/libgda-4.0-sections.txt
   trunk/doc/C/migration2.xml
   trunk/doc/C/tmpl/gda-connection-event.sgml
   trunk/doc/C/tmpl/gda-data-access-wrapper.sgml
   trunk/doc/C/tmpl/gda-data-model.sgml
   trunk/doc/C/tmpl/gda-data-select.sgml
   trunk/doc/C/tmpl/gda-holder.sgml
   trunk/doc/C/tmpl/gda-set.sgml
   trunk/doc/C/tmpl/gda-value.sgml
   trunk/doc/C/tmpl/gda-vconnection-data-model.sgml
   trunk/libgda-report/engine/gda-report-engine.c
   trunk/libgda-xslt/sql_backend.c
   trunk/libgda/gda-connection.c
   trunk/libgda/gda-data-access-wrapper.c
   trunk/libgda/gda-data-access-wrapper.h
   trunk/libgda/gda-data-comparator.c
   trunk/libgda/gda-data-model-array.c
   trunk/libgda/gda-data-model-bdb.c
   trunk/libgda/gda-data-model-dir.c
   trunk/libgda/gda-data-model-import.c
   trunk/libgda/gda-data-model-iter.c
   trunk/libgda/gda-data-model-query.c
   trunk/libgda/gda-data-model.c
   trunk/libgda/gda-data-model.h
   trunk/libgda/gda-data-proxy.c
   trunk/libgda/gda-data-select.c
   trunk/libgda/gda-data-select.h
   trunk/libgda/gda-holder.c
   trunk/libgda/gda-holder.h
   trunk/libgda/gda-meta-store.c
   trunk/libgda/gda-meta-struct.c
   trunk/libgda/gda-server-operation.c
   trunk/libgda/gda-server-provider-extra.c
   trunk/libgda/gda-set.c
   trunk/libgda/gda-set.h
   trunk/libgda/gda-util.c
   trunk/libgda/gda-util.h
   trunk/libgda/gda-value.c
   trunk/libgda/gda-value.h
   trunk/libgda/sqlite/gda-sqlite-meta.c
   trunk/libgda/sqlite/gda-sqlite-provider.c
   trunk/libgda/sqlite/virtual/gda-vconnection-data-model.h
   trunk/libgda/sqlite/virtual/gda-vconnection-hub.c
   trunk/libgda/sqlite/virtual/gda-vprovider-data-model.c
   trunk/po/POTFILES.in
   trunk/providers/mysql/gda-mysql-meta.c
   trunk/providers/postgres/gda-postgres-meta.c
   trunk/providers/postgres/gda-postgres-provider.c
   trunk/providers/skel-implementation/capi/gda-capi-meta.c
   trunk/samples/BDB/access-raw.c
   trunk/samples/TableCopy/table-copy.c
   trunk/testing/gda-provider-status.c
   trunk/testing/gda-test-blob.c
   trunk/testing/html.c
   trunk/tests/data-models/check_data_proxy.c
   trunk/tests/data-models/check_model_copy.c
   trunk/tests/data-models/check_pmodel.c
   trunk/tests/data-models/data1.xml
   trunk/tests/meta-store/common.c
   trunk/tests/multi-threading/check_parser.c
   trunk/tests/parser/check_parser.c
   trunk/tests/providers/prov-test-util.c
   trunk/tests/test-cnc-utils.c
   trunk/tests/value-holders/check_holder.c
   trunk/tests/value-holders/check_statement.c
   trunk/tools/command-exec.c
   trunk/tools/gda-sql.c

Modified: trunk/doc/C/howto.xml
==============================================================================
--- trunk/doc/C/howto.xml	(original)
+++ trunk/doc/C/howto.xml	Thu Sep  4 20:08:38 2008
@@ -114,6 +114,96 @@
     </para>
   </sect1>
 
+  <sect1 id="howto-modify-select">
+    <title>Modify the result of a SELECT command</title>
+    <para>
+      The <link linkend="GdaDataSelect">GdaDataSelect</link> data model (which is the data model returned
+      after the successfull execution of a SELECT statement) is by default read-only, but can be made writable
+      after giving it information about:
+      <itemizedlist>
+	<listitem><para>how to identify a single row in the modified table
+	    (the columns composing the primary key)</para></listitem>
+	<listitem><para>which statements to execute when the data model's values are modified or some rows
+	    are inserted or removed</para></listitem>
+      </itemizedlist>
+    </para>
+    <para>
+      The following example illustrates this using a table created as (SQLite syntax):
+      <![CDATA[CREATE TABLE customers (id integer NOT NULL PRIMARY KEY AUTOINCREMENT, name string NOT NULL, last_update timestamp NOT NULL, country string);]]>, where we select all the rows where the "country" column is "SP" and we modify
+      only one row:
+      <programlisting>
+GError *error = NULL;
+GdaDataModel *model;
+GdaStatement *stmt, *mod_stmt;
+GdaSet *params;
+GValue *value;
+
+/* create GdaDataSelect */
+stmt = stmt_from_string ("SELECT * FROM customers WHERE country = ##country::string");
+if (!gda_statement_get_parameters (stmt, &amp;params, &amp;error)) {
+   /* treat error */
+}
+if (! gda_set_set_holder_value (params, &amp;error, "country", "SP")) {
+   /* treat error */
+}
+model = gda_connection_statement_execute_select (cnc, stmt, params, &amp;error);
+g_object_unref (params);
+
+/* specify an UPDATE query */
+mod_stmt = stmt_from_string ("UPDATE customers SET name = ##+1::string, last_update = ##+2::timestamp WHERE id = ##-0::gint");
+if (!gda_data_select_set_modification_statement (GDA_DATA_SELECT (model), mod_stmt, &amp;error)) {
+   /* treat error */
+}
+
+/* Now modify the data model */
+g_value_set_string ((value = gda_value_new (G_TYPE_STRING)), "Jack");
+if (! check_set_value_at (model, 1, 0, value, cnc, stmt, NULL)) {
+   /* treat error */
+}
+gda_value_free (value);
+      </programlisting>
+    </para>
+    <para>
+      Note that in the code sample above, it would not have been possible to add or remove a row as no
+      INSERT or DELETE statement have been specified.
+    </para>
+    <para>
+      Now, if the meta data associated to the connection is up to date (after having called
+      <link linkend="gda-connection-update-meta-store">gda_connection_update_meta_store()</link>), then the code
+      above can be simplified as (and as a side benefit, it would also be possible to add or remove rows):
+      <programlisting>
+GError *error = NULL;
+GdaDataModel *model;
+GdaStatement *stmt;
+GdaSet *params;
+GValue *value;
+
+/* create GdaDataSelect */
+stmt = stmt_from_string ("SELECT * FROM customers WHERE country = ##country::string");
+if (!gda_statement_get_parameters (stmt, &amp;params, &amp;error)) {
+   /* treat error */
+}
+if (! gda_set_set_holder_value (params, &amp;error, "country", "SP")) {
+   /* treat error */
+}
+model = gda_connection_statement_execute_select (cnc, stmt, params, &amp;error);
+g_object_unref (params);
+
+/* specify that the data model can be writable */
+if (! gda_data_select_compute_modification_statements (GDA_DATA_SELECT (model), &amp;error)) {
+   /* treat error */
+}
+
+/* Now modify the data model */
+g_value_set_string ((value = gda_value_new (G_TYPE_STRING)), "Jack");
+if (! check_set_value_at (model, 1, 0, value, cnc, stmt, NULL)) {
+   /* treat error */
+}
+gda_value_free (value);
+      </programlisting>
+    </para>
+  </sect1>
+
   <sect1 id="howto-exec-non-select">
     <title>Execute an INSERT, UPDATE or DELETE command</title>
     <para>

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	Thu Sep  4 20:08:38 2008
@@ -272,7 +272,6 @@
 GdaDataAccessWrapperClass
 GdaDataAccessWrapperPrivate
 gda_data_access_wrapper_new
-gda_data_access_wrapper_row_exists
 <SUBSECTION Standard>
 GDA_DATA_ACCESS_WRAPPER
 GDA_DATA_ACCESS_WRAPPER_CLASS
@@ -286,36 +285,30 @@
 <FILE>gda-data-model</FILE>
 <TITLE>GdaDataModel</TITLE>
 GdaDataModel
-GdaDataModelAccessFlags
-GdaDataModelHint
-GdaDataModelIOFormat
-gda_data_model_changed
-gda_data_model_row_inserted
-gda_data_model_row_updated
-gda_data_model_row_removed
-gda_data_model_reset
-gda_data_model_freeze
-gda_data_model_thaw
-gda_data_model_get_access_flags
 gda_data_model_get_n_rows
 gda_data_model_get_n_columns
 gda_data_model_describe_column
-gda_data_model_get_column_index_by_name
+gda_data_model_get_column_index
 gda_data_model_get_column_name
-gda_data_model_set_column_name
 gda_data_model_get_column_title
-gda_data_model_set_column_title
-gda_data_model_get_attributes_at
+<SUBSECTION>
+GdaDataModelAccessFlags
+gda_data_model_get_access_flags
+gda_data_model_create_iter
 gda_data_model_get_value_at
-gda_data_model_get_value_at_col_name
+gda_data_model_get_typed_value_at
+gda_data_model_get_value_at_column
 gda_data_model_set_value_at
 gda_data_model_set_values
-gda_data_model_create_iter
+gda_data_model_get_attributes_at
 gda_data_model_append_values
 gda_data_model_append_row
 gda_data_model_remove_row
 gda_data_model_get_row_from_values
+<SUBSECTION>
+GdaDataModelHint
 gda_data_model_send_hint
+GdaDataModelIOFormat
 gda_data_model_export_to_string
 gda_data_model_export_to_file
 gda_data_model_add_data_from_xml_node
@@ -324,6 +317,15 @@
 gda_data_model_import_from_file
 gda_data_model_dump
 gda_data_model_dump_as_string
+<SUBSECTION>
+gda_data_model_set_column_name
+gda_data_model_set_column_title
+gda_data_model_row_inserted
+gda_data_model_row_updated
+gda_data_model_row_removed
+gda_data_model_reset
+gda_data_model_freeze
+gda_data_model_thaw
 <SUBSECTION Standard>
 GDA_DATA_MODEL
 GDA_DATA_MODEL_GET_CLASS
@@ -735,70 +737,78 @@
 <FILE>gda-value</FILE>
 <TITLE>Gda Value</TITLE>
 GValueAttribute
-GdaGeometricPoint
-GdaNumeric
-GdaTime
-GdaTimestamp
-GdaBinary
-GdaBlob
-GdaValueList
 gda_value_new
 gda_value_new_null
-gda_value_new_binary
-gda_value_new_blob
-gda_value_new_timestamp_from_timet
+gda_value_copy
+gda_value_free
 gda_value_new_from_string
+gda_value_set_from_string
+gda_value_set_from_value
+gda_value_set_null
+gda_value_stringify
+gda_value_differ
+gda_value_compare
 gda_value_new_from_xml
-gda_value_free
+gda_value_to_xml
 gda_value_reset_with_type
 gda_value_is_null
 gda_value_is_number
 gda_value_isa
-gda_value_copy
+<SUBSECTION>
+GdaBinary
+gda_value_new_binary
+gda_value_get_binary
+gda_value_set_binary
+gda_value_take_binary
 gda_binary_copy
 gda_binary_free
+gda_binary_to_string
+gda_string_to_binary
+<SUBSECTION>
+GdaBlob
+gda_value_new_blob
 gda_blob_copy
 gda_blob_free
+gda_value_get_blob
+gda_value_set_blob
+gda_value_take_blob
+<SUBSECTION>
+GdaGeometricPoint
 gda_geometricpoint_copy
 gda_geometricpoint_free
+gda_value_get_geometric_point
+gda_value_set_geometric_point
+<SUBSECTION>
+GdaValueList
 gda_value_list_copy
 gda_value_list_free
+gda_value_get_list
+gda_value_set_list
+<SUBSECTION>
+GdaNumeric
 gda_numeric_copy
 gda_numeric_free
+gda_value_get_numeric
+gda_value_set_numeric
+<SUBSECTION>
+GdaTime
 gda_time_copy
 gda_time_free
+gda_value_get_time
+gda_value_set_time
+<SUBSECTION>
+GdaTimestamp
 gda_timestamp_copy
 gda_timestamp_free
-gda_value_get_binary
-gda_value_set_binary
-gda_value_take_binary
-gda_value_get_blob
-gda_value_set_blob
-gda_value_take_blob
-gda_value_get_geometric_point
-gda_value_set_geometric_point
-gda_value_get_list
-gda_value_set_list
-gda_value_set_null
-gda_value_get_numeric
-gda_value_set_numeric
+gda_value_get_timestamp
+gda_value_set_timestamp
+gda_value_new_timestamp_from_timet
+<SUBSECTION>
 gda_value_get_short
 gda_value_set_short
+<SUBSECTION>
 gda_value_get_ushort
 gda_value_set_ushort
-gda_value_get_time
-gda_value_set_time
-gda_value_get_timestamp
-gda_value_set_timestamp
-gda_value_set_from_string
-gda_value_set_from_value
-gda_value_stringify
-gda_value_bcompare
-gda_value_compare
-gda_value_compare_ext
-gda_value_to_xml
-gda_binary_to_string
-gda_string_to_binary
 <SUBSECTION Standard>
 gda_binary_get_type
 gda_geometricpoint_get_type

Modified: trunk/doc/C/migration2.xml
==============================================================================
--- trunk/doc/C/migration2.xml	(original)
+++ trunk/doc/C/migration2.xml	Thu Sep  4 20:08:38 2008
@@ -65,9 +65,38 @@
       to a GdaDict object; this is not the case as now each <link linkend="GdaConnection">GdaConnection</link> object builts
       a <link linkend="GdaMetaStore">GdaMetaStore</link> when it needs it (providers implementations may benefit from it) and
       the user can provide his own <link linkend="GdaMetaStore">GdaMetaStore</link> object when needed.</para>
+  </sect1>
+
+  <sect1 id="migration-2-exec"><title>Statement execution</title>
+    <para>
+      &LIBGDA; still offers several methods to execute a statement, depending on the type of statement to execute
+      (there is still of course the <link linkend="gda-connection-statement-execute">gda_connection_statement_execute()</link>
+      method which works for any type of statement), but the methods have been improved:
+      <itemizedlist>
+	<listitem><para>For SELECT statements, it is now possible to specify the way the resulting data model will
+	    be accessed (random access or using a cursor) which enables applications to better manage memory
+	    consumption.</para></listitem>
+	<listitem><para>For INSERT statements, it is possible to obtain a list of all the values inserted in the
+	    table (not only the columns for which a value was specified)</para></listitem>
+	<listitem><para>The execution of a SELECT statement returns a <link linkend="GdaDataSelect">GdaDataSelect</link>
+	    data model which can (after having provided some information) be modified using the traditional
+	    <link linkend="GdaDataModel">GdaDataModel</link>'s data modification methods (modifications are
+	    translated into INSERT, UPDATE or DELETE statements).</para></listitem>
+      </itemizedlist>
+    </para>
   </sect1>  
 
   <sect1><title>Other changes</title>
+    <sect2><title>Multi threading environment</title>
+      <para>
+	Previous versions of &LIBGDA; only supported being used in a single thread at a time; this new version
+	still keeps this limitation except for objects which implement the <link linkend="GdaLockable">GdaLockable</link>
+	interface which can be used from any thread at the same time: the 
+	<link linkend="GdaConnection">GdaConnection</link> and <link linkend="GdaSqlParser">GdaSqlParser</link>
+	objects implement that interface.
+      </para>
+    </sect2>
+
     <sect2><title>Configuration management</title>
       <para>
 	<itemizedlist>
@@ -101,6 +130,12 @@
 	  gda_server_provider_get_info() has been replaced by a 
 	      <link linkend="gda-server-provider-get-name">gda_server_provider_get_name ()</link> method to access the
 	  provider's name.</para></listitem>
+	  <listitem><para><link linkend="gda-data-model-get-value-at">gda_data_model_get_value_at ()</link> now has an extra
+	      <link linkend="GError">GError</link> argument to return an error if getting the value has failed</para></listitem>
+	  <listitem><para>gda_data_model_get_column_index_by_name() has been replaced by 
+	      <link linkend="gda-data-model-get-column-index">gda_data_model_get_column_index()</link></para></listitem>
+	  <listitem><para>gda_data_model_get_value_at_col_name() has been replaced by 
+	      <link linkend="gda-data-model-get-value-at-column">gda_data_model_get_value_at_column()</link></para></listitem>
 	</itemizedlist>
       </para>
     </sect2>
@@ -133,6 +168,8 @@
  	  <listitem><para>gda_sql_transaction_parse*()</para></listitem>
  	  <listitem><para>sql_*() (from the libsql library)</para></listitem>
 	  <listitem><para>gda_server_provider_change_database()</para></listitem>
+	  <listitem><para>gda_value_compare_ext()</para></listitem>
+	  <listitem><para>gda_data_access_wrapper_row_exists()</para></listitem>
 	</itemizedlist>
       </para>
     </sect2>

Modified: trunk/doc/C/tmpl/gda-connection-event.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-connection-event.sgml	(original)
+++ trunk/doc/C/tmpl/gda-connection-event.sgml	Thu Sep  4 20:08:38 2008
@@ -6,9 +6,13 @@
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
-Events occuring on a connection are each represented as a #GdaConnectionEvent object. Each #GdaConnection
-is responsible for keeping a list of past events; that list can be consulted using the 
-gda_connection_get_events() function.
+  Events occuring on a connection are each represented as a #GdaConnectionEvent object. Each #GdaConnection
+  is responsible for keeping a list of past events; that list can be consulted using the 
+  gda_connection_get_events() function.
+</para>
+<para>
+  To avoid memory leaks, the list of connection events is cleared before each statement (or group of
+  statements) is executed.
 </para>
 
 <!-- ##### SECTION See_Also ##### -->

Modified: trunk/doc/C/tmpl/gda-data-access-wrapper.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-data-access-wrapper.sgml	(original)
+++ trunk/doc/C/tmpl/gda-data-access-wrapper.sgml	Thu Sep  4 20:08:38 2008
@@ -51,13 +51,3 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_data_access_wrapper_row_exists ##### -->
-<para>
-
-</para>
-
- wrapper: 
- row: 
- Returns: 
-
-

Modified: trunk/doc/C/tmpl/gda-data-model.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-data-model.sgml	(original)
+++ trunk/doc/C/tmpl/gda-data-model.sgml	Thu Sep  4 20:08:38 2008
@@ -101,97 +101,6 @@
 @gdadatamodel: the object which received the signal.
 @arg1: 
 
-<!-- ##### ENUM GdaDataModelAccessFlags ##### -->
-<para>
-
-</para>
-
- GDA_DATA_MODEL_ACCESS_RANDOM: 
- GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD: 
- GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD: 
- GDA_DATA_MODEL_ACCESS_CURSOR: 
- GDA_DATA_MODEL_ACCESS_INSERT: 
- GDA_DATA_MODEL_ACCESS_UPDATE: 
- GDA_DATA_MODEL_ACCESS_DELETE: 
- GDA_DATA_MODEL_ACCESS_WRITE: 
-
-<!-- ##### ENUM GdaDataModelHint ##### -->
-<para>
-
-</para>
-
- GDA_DATA_MODEL_HINT_START_BATCH_UPDATE: 
- GDA_DATA_MODEL_HINT_END_BATCH_UPDATE: 
- GDA_DATA_MODEL_HINT_REFRESH: 
-
-<!-- ##### ENUM GdaDataModelIOFormat ##### -->
-<para>
-
-</para>
-
- GDA_DATA_MODEL_IO_DATA_ARRAY_XML: 
- GDA_DATA_MODEL_IO_TEXT_SEPARATED: 
-
-<!-- ##### FUNCTION gda_data_model_row_inserted ##### -->
-<para>
-
-</para>
-
- model: 
- row: 
-
-
-<!-- ##### FUNCTION gda_data_model_row_updated ##### -->
-<para>
-
-</para>
-
- model: 
- row: 
-
-
-<!-- ##### FUNCTION gda_data_model_row_removed ##### -->
-<para>
-
-</para>
-
- model: 
- row: 
-
-
-<!-- ##### FUNCTION gda_data_model_reset ##### -->
-<para>
-
-</para>
-
- model: 
-
-
-<!-- ##### FUNCTION gda_data_model_freeze ##### -->
-<para>
-
-</para>
-
- model: 
-
-
-<!-- ##### FUNCTION gda_data_model_thaw ##### -->
-<para>
-
-</para>
-
- model: 
-
-
-<!-- ##### FUNCTION gda_data_model_get_access_flags ##### -->
-<para>
-
-</para>
-
- model: 
- Returns: 
-
-
 <!-- ##### FUNCTION gda_data_model_get_n_rows ##### -->
 <para>
 
@@ -220,7 +129,7 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_data_model_get_column_index_by_name ##### -->
+<!-- ##### FUNCTION gda_data_model_get_column_index ##### -->
 <para>
 
 </para>
@@ -240,37 +149,49 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_data_model_set_column_name ##### -->
+<!-- ##### FUNCTION gda_data_model_get_column_title ##### -->
 <para>
 
 </para>
 
 @model: 
 @col: 
- name: 
+ Returns: 
 
 
-<!-- ##### FUNCTION gda_data_model_get_column_title ##### -->
+<!-- ##### ENUM GdaDataModelAccessFlags ##### -->
+<para>
+
+</para>
+
+ GDA_DATA_MODEL_ACCESS_RANDOM: 
+ GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD: 
+ GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD: 
+ GDA_DATA_MODEL_ACCESS_CURSOR: 
+ GDA_DATA_MODEL_ACCESS_INSERT: 
+ GDA_DATA_MODEL_ACCESS_UPDATE: 
+ GDA_DATA_MODEL_ACCESS_DELETE: 
+ GDA_DATA_MODEL_ACCESS_WRITE: 
+
+<!-- ##### FUNCTION gda_data_model_get_access_flags ##### -->
 <para>
 
 </para>
 
 @model: 
- col: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_data_model_set_column_title ##### -->
+<!-- ##### FUNCTION gda_data_model_create_iter ##### -->
 <para>
 
 </para>
 
 @model: 
- col: 
- title: 
+ Returns: 
 
 
-<!-- ##### FUNCTION gda_data_model_get_attributes_at ##### -->
+<!-- ##### FUNCTION gda_data_model_get_value_at ##### -->
 <para>
 
 </para>
@@ -278,10 +199,11 @@
 @model: 
 @col: 
 @row: 
+ error: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_data_model_get_value_at ##### -->
+<!-- ##### FUNCTION gda_data_model_get_typed_value_at ##### -->
 <para>
 
 </para>
@@ -289,10 +211,13 @@
 @model: 
 @col: 
 @row: 
+ expected_type: 
+ nullok: 
+ error: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_data_model_get_value_at_col_name ##### -->
+<!-- ##### FUNCTION gda_data_model_get_value_at_column ##### -->
 <para>
 
 </para>
@@ -300,6 +225,7 @@
 @model: 
 @column_name: 
 @row: 
+ error: 
 @Returns: 
 
 
@@ -328,12 +254,14 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_data_model_create_iter ##### -->
+<!-- ##### FUNCTION gda_data_model_get_attributes_at ##### -->
 <para>
 
 </para>
 
 @model: 
+ col: 
+ row: 
 @Returns: 
 
 
@@ -380,6 +308,15 @@
 @Returns: 
 
 
+<!-- ##### ENUM GdaDataModelHint ##### -->
+<para>
+
+</para>
+
+ GDA_DATA_MODEL_HINT_START_BATCH_UPDATE: 
+ GDA_DATA_MODEL_HINT_END_BATCH_UPDATE: 
+ GDA_DATA_MODEL_HINT_REFRESH: 
+
 <!-- ##### FUNCTION gda_data_model_send_hint ##### -->
 <para>
 
@@ -390,6 +327,14 @@
 @hint_value: 
 
 
+<!-- ##### ENUM GdaDataModelIOFormat ##### -->
+<para>
+
+</para>
+
+ GDA_DATA_MODEL_IO_DATA_ARRAY_XML: 
+ GDA_DATA_MODEL_IO_TEXT_SEPARATED: 
+
 <!-- ##### FUNCTION gda_data_model_export_to_string ##### -->
 <para>
 
@@ -490,3 +435,74 @@
 @Returns: 
 
 
+<!-- ##### FUNCTION gda_data_model_set_column_name ##### -->
+<para>
+
+</para>
+
+ model: 
+ col: 
+ name: 
+
+
+<!-- ##### FUNCTION gda_data_model_set_column_title ##### -->
+<para>
+
+</para>
+
+ model: 
+ col: 
+ title: 
+
+
+<!-- ##### FUNCTION gda_data_model_row_inserted ##### -->
+<para>
+
+</para>
+
+ model: 
+ row: 
+
+
+<!-- ##### FUNCTION gda_data_model_row_updated ##### -->
+<para>
+
+</para>
+
+ model: 
+ row: 
+
+
+<!-- ##### FUNCTION gda_data_model_row_removed ##### -->
+<para>
+
+</para>
+
+ model: 
+ row: 
+
+
+<!-- ##### FUNCTION gda_data_model_reset ##### -->
+<para>
+
+</para>
+
+ model: 
+
+
+<!-- ##### FUNCTION gda_data_model_freeze ##### -->
+<para>
+
+</para>
+
+ model: 
+
+
+<!-- ##### FUNCTION gda_data_model_thaw ##### -->
+<para>
+
+</para>
+
+ model: 
+
+

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	Thu Sep  4 20:08:38 2008
@@ -132,7 +132,6 @@
 </para>
 
 @model: 
- require_pk: 
 @error: 
 @Returns: 
 

Modified: trunk/doc/C/tmpl/gda-holder.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-holder.sgml	(original)
+++ trunk/doc/C/tmpl/gda-holder.sgml	Thu Sep  4 20:08:38 2008
@@ -188,6 +188,7 @@
 
 @holder: 
 @value: 
+ error: 
 @Returns: 
 
 
@@ -199,6 +200,7 @@
 @holder: 
 @dh: 
 @value: 
+ error: 
 @Returns: 
 
 
@@ -209,6 +211,7 @@
 
 @holder: 
 @value: 
+ error: 
 @Returns: 
 
 
@@ -312,6 +315,8 @@
 
 @holder: 
 @bind_to: 
+ error: 
+ Returns: 
 
 
 <!-- ##### FUNCTION gda_holder_get_bind ##### -->

Modified: trunk/doc/C/tmpl/gda-set.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-set.sgml	(original)
+++ trunk/doc/C/tmpl/gda-set.sgml	Thu Sep  4 20:08:38 2008
@@ -186,6 +186,7 @@
 </para>
 
 @set: 
+ error: 
 @holder_id: 
 @Varargs: 
 @Returns: 

Modified: trunk/doc/C/tmpl/gda-value.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-value.sgml	(original)
+++ trunk/doc/C/tmpl/gda-value.sgml	Thu Sep  4 20:08:38 2008
@@ -44,123 +44,105 @@
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### STRUCT GdaGeometricPoint ##### -->
+<!-- ##### FUNCTION gda_value_new ##### -->
 <para>
 
 </para>
 
- x: 
- y: 
-
-<!-- ##### STRUCT GdaNumeric ##### -->
-<para>
-
-</para>
+ type: 
+ Returns: 
 
- number: 
- precision: 
- width: 
 
-<!-- ##### STRUCT GdaTime ##### -->
+<!-- ##### MACRO gda_value_new_null ##### -->
 <para>
 
 </para>
 
- hour: 
- minute: 
- second: 
- fraction: 
- timezone: 
-
-<!-- ##### STRUCT GdaTimestamp ##### -->
-<para>
-
-</para>
+ Returns: 
 
- year: 
- month: 
- day: 
- hour: 
- minute: 
- second: 
- fraction: 
- timezone: 
 
-<!-- ##### STRUCT GdaBinary ##### -->
+<!-- ##### FUNCTION gda_value_copy ##### -->
 <para>
 
 </para>
 
- data: 
- binary_length: 
+ value: 
+ Returns: 
 
-<!-- ##### STRUCT GdaBlob ##### -->
+
+<!-- ##### FUNCTION gda_value_free ##### -->
 <para>
 
 </para>
 
- data: 
- op: 
+ value: 
 
-<!-- ##### TYPEDEF GdaValueList ##### -->
+
+<!-- ##### FUNCTION gda_value_new_from_string ##### -->
 <para>
 
 </para>
 
+ as_string: 
+ type: 
+ Returns: 
 
-<!-- ##### FUNCTION gda_value_new ##### -->
+
+<!-- ##### FUNCTION gda_value_set_from_string ##### -->
 <para>
 
 </para>
 
+ value: 
+ as_string: 
 @type: 
 @Returns: 
 
 
-<!-- ##### MACRO gda_value_new_null ##### -->
+<!-- ##### FUNCTION gda_value_set_from_value ##### -->
 <para>
 
 </para>
 
+ value: 
+ from: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_new_binary ##### -->
+<!-- ##### FUNCTION gda_value_set_null ##### -->
 <para>
 
 </para>
 
- val: 
- size: 
- Returns: 
+ value: 
 
 
-<!-- ##### FUNCTION gda_value_new_blob ##### -->
+<!-- ##### FUNCTION gda_value_stringify ##### -->
 <para>
 
 </para>
 
- val: 
- size: 
+ value: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_new_timestamp_from_timet ##### -->
+<!-- ##### FUNCTION gda_value_differ ##### -->
 <para>
 
 </para>
 
- val: 
+ value1: 
+ value2: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_new_from_string ##### -->
+<!-- ##### FUNCTION gda_value_compare ##### -->
 <para>
 
 </para>
 
- as_string: 
- type: 
+ value1: 
+ value2: 
 @Returns: 
 
 
@@ -173,12 +155,13 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_free ##### -->
+<!-- ##### FUNCTION gda_value_to_xml ##### -->
 <para>
 
 </para>
 
 @value: 
+ Returns: 
 
 
 <!-- ##### FUNCTION gda_value_reset_with_type ##### -->
@@ -217,50 +200,52 @@
 @type: 
 
 
-<!-- ##### FUNCTION gda_value_copy ##### -->
+<!-- ##### STRUCT GdaBinary ##### -->
 <para>
 
 </para>
 
- value: 
- Returns: 
-
+ data: 
+ binary_length: 
 
-<!-- ##### FUNCTION gda_binary_copy ##### -->
+<!-- ##### FUNCTION gda_value_new_binary ##### -->
 <para>
 
 </para>
 
- boxed: 
+ val: 
+ size: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_binary_free ##### -->
+<!-- ##### FUNCTION gda_value_get_binary ##### -->
 <para>
 
 </para>
 
- boxed: 
+ value: 
+ Returns: 
 
 
-<!-- ##### FUNCTION gda_blob_copy ##### -->
+<!-- ##### FUNCTION gda_value_set_binary ##### -->
 <para>
 
 </para>
 
- boxed: 
- Returns: 
+ value: 
+ binary: 
 
 
-<!-- ##### FUNCTION gda_blob_free ##### -->
+<!-- ##### FUNCTION gda_value_take_binary ##### -->
 <para>
 
 </para>
 
- boxed: 
+ value: 
+ binary: 
 
 
-<!-- ##### FUNCTION gda_geometricpoint_copy ##### -->
+<!-- ##### FUNCTION gda_binary_copy ##### -->
 <para>
 
 </para>
@@ -269,7 +254,7 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_geometricpoint_free ##### -->
+<!-- ##### FUNCTION gda_binary_free ##### -->
 <para>
 
 </para>
@@ -277,41 +262,45 @@
 @boxed: 
 
 
-<!-- ##### FUNCTION gda_numeric_copy ##### -->
+<!-- ##### FUNCTION gda_binary_to_string ##### -->
 <para>
 
 </para>
 
- boxed: 
+ bin: 
+ maxlen: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_numeric_free ##### -->
+<!-- ##### FUNCTION gda_string_to_binary ##### -->
 <para>
 
 </para>
 
- boxed: 
+ str: 
+ bin: 
+ Returns: 
 
 
-<!-- ##### FUNCTION gda_time_copy ##### -->
+<!-- ##### STRUCT GdaBlob ##### -->
 <para>
 
 </para>
 
- boxed: 
- Returns: 
-
+ data: 
+ op: 
 
-<!-- ##### FUNCTION gda_time_free ##### -->
+<!-- ##### FUNCTION gda_value_new_blob ##### -->
 <para>
 
 </para>
 
- boxed: 
+ val: 
+ size: 
+ Returns: 
 
 
-<!-- ##### FUNCTION gda_timestamp_copy ##### -->
+<!-- ##### FUNCTION gda_blob_copy ##### -->
 <para>
 
 </para>
@@ -320,7 +309,7 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_timestamp_free ##### -->
+<!-- ##### FUNCTION gda_blob_free ##### -->
 <para>
 
 </para>
@@ -328,7 +317,7 @@
 @boxed: 
 
 
-<!-- ##### FUNCTION gda_value_get_binary ##### -->
+<!-- ##### FUNCTION gda_value_get_blob ##### -->
 <para>
 
 </para>
@@ -337,49 +326,47 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_set_binary ##### -->
+<!-- ##### FUNCTION gda_value_set_blob ##### -->
 <para>
 
 </para>
 
 @value: 
- binary: 
+ blob: 
 
 
-<!-- ##### FUNCTION gda_value_take_binary ##### -->
+<!-- ##### FUNCTION gda_value_take_blob ##### -->
 <para>
 
 </para>
 
 @value: 
- binary: 
+ blob: 
 
 
-<!-- ##### FUNCTION gda_value_get_blob ##### -->
+<!-- ##### STRUCT GdaGeometricPoint ##### -->
 <para>
 
 </para>
 
- value: 
- Returns: 
-
+ x: 
+ y: 
 
-<!-- ##### FUNCTION gda_value_set_blob ##### -->
+<!-- ##### FUNCTION gda_geometricpoint_copy ##### -->
 <para>
 
 </para>
 
- value: 
- blob: 
+ boxed: 
+ Returns: 
 
 
-<!-- ##### FUNCTION gda_value_take_blob ##### -->
+<!-- ##### FUNCTION gda_geometricpoint_free ##### -->
 <para>
 
 </para>
 
- value: 
- blob: 
+ boxed: 
 
 
 <!-- ##### FUNCTION gda_value_get_geometric_point ##### -->
@@ -400,6 +387,12 @@
 @val: 
 
 
+<!-- ##### TYPEDEF GdaValueList ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### FUNCTION gda_value_get_list ##### -->
 <para>
 
@@ -418,33 +411,33 @@
 @val: 
 
 
-<!-- ##### FUNCTION gda_value_set_null ##### -->
+<!-- ##### STRUCT GdaNumeric ##### -->
 <para>
 
 </para>
 
- value: 
-
+ number: 
+ precision: 
+ width: 
 
-<!-- ##### FUNCTION gda_value_get_numeric ##### -->
+<!-- ##### FUNCTION gda_numeric_copy ##### -->
 <para>
 
 </para>
 
- value: 
+ boxed: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_set_numeric ##### -->
+<!-- ##### FUNCTION gda_numeric_free ##### -->
 <para>
 
 </para>
 
- value: 
- val: 
+ boxed: 
 
 
-<!-- ##### FUNCTION gda_value_get_short ##### -->
+<!-- ##### FUNCTION gda_value_get_numeric ##### -->
 <para>
 
 </para>
@@ -453,7 +446,7 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_set_short ##### -->
+<!-- ##### FUNCTION gda_value_set_numeric ##### -->
 <para>
 
 </para>
@@ -462,82 +455,84 @@
 @val: 
 
 
-<!-- ##### FUNCTION gda_value_get_ushort ##### -->
+<!-- ##### STRUCT GdaTime ##### -->
 <para>
 
 </para>
 
- value: 
- Returns: 
-
+ hour: 
+ minute: 
+ second: 
+ fraction: 
+ timezone: 
 
-<!-- ##### FUNCTION gda_value_set_ushort ##### -->
+<!-- ##### FUNCTION gda_time_copy ##### -->
 <para>
 
 </para>
 
- value: 
- val: 
+ boxed: 
+ Returns: 
 
 
-<!-- ##### FUNCTION gda_value_get_time ##### -->
+<!-- ##### FUNCTION gda_time_free ##### -->
 <para>
 
 </para>
 
- value: 
- Returns: 
+ boxed: 
 
 
-<!-- ##### FUNCTION gda_value_set_time ##### -->
+<!-- ##### FUNCTION gda_value_get_time ##### -->
 <para>
 
 </para>
 
 @value: 
- val: 
+ Returns: 
 
 
-<!-- ##### FUNCTION gda_value_get_timestamp ##### -->
+<!-- ##### FUNCTION gda_value_set_time ##### -->
 <para>
 
 </para>
 
 @value: 
- Returns: 
+ val: 
 
 
-<!-- ##### FUNCTION gda_value_set_timestamp ##### -->
+<!-- ##### STRUCT GdaTimestamp ##### -->
 <para>
 
 </para>
 
- value: 
- val: 
-
+ year: 
+ month: 
+ day: 
+ hour: 
+ minute: 
+ second: 
+ fraction: 
+ timezone: 
 
-<!-- ##### FUNCTION gda_value_set_from_string ##### -->
+<!-- ##### FUNCTION gda_timestamp_copy ##### -->
 <para>
 
 </para>
 
- value: 
- as_string: 
- type: 
+ boxed: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_set_from_value ##### -->
+<!-- ##### FUNCTION gda_timestamp_free ##### -->
 <para>
 
 </para>
 
- value: 
- from: 
- Returns: 
+ boxed: 
 
 
-<!-- ##### FUNCTION gda_value_stringify ##### -->
+<!-- ##### FUNCTION gda_value_get_timestamp ##### -->
 <para>
 
 </para>
@@ -546,62 +541,57 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_bcompare ##### -->
+<!-- ##### FUNCTION gda_value_set_timestamp ##### -->
 <para>
 
 </para>
 
- value1: 
- value2: 
- Returns: 
+ value: 
+ val: 
 
 
-<!-- ##### FUNCTION gda_value_compare ##### -->
+<!-- ##### FUNCTION gda_value_new_timestamp_from_timet ##### -->
 <para>
 
 </para>
 
- value1: 
- value2: 
+ val: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_compare_ext ##### -->
+<!-- ##### FUNCTION gda_value_get_short ##### -->
 <para>
 
 </para>
 
- value1: 
- value2: 
+ value: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_value_to_xml ##### -->
+<!-- ##### FUNCTION gda_value_set_short ##### -->
 <para>
 
 </para>
 
 @value: 
- Returns: 
+ val: 
 
 
-<!-- ##### FUNCTION gda_binary_to_string ##### -->
+<!-- ##### FUNCTION gda_value_get_ushort ##### -->
 <para>
 
 </para>
 
- bin: 
- maxlen: 
+ value: 
 @Returns: 
 
 
-<!-- ##### FUNCTION gda_string_to_binary ##### -->
+<!-- ##### FUNCTION gda_value_set_ushort ##### -->
 <para>
 
 </para>
 
- str: 
- bin: 
- Returns: 
+ value: 
+ val: 
 
 

Modified: trunk/doc/C/tmpl/gda-vconnection-data-model.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-vconnection-data-model.sgml	(original)
+++ trunk/doc/C/tmpl/gda-vconnection-data-model.sgml	Thu Sep  4 20:08:38 2008
@@ -40,6 +40,7 @@
 </para>
 
 @Param1: 
+ Param2: 
 @Returns: 
 
 

Modified: trunk/libgda-report/engine/gda-report-engine.c
==============================================================================
--- trunk/libgda-report/engine/gda-report-engine.c	(original)
+++ trunk/libgda-report/engine/gda-report-engine.c	Thu Sep  4 20:08:38 2008
@@ -739,29 +739,33 @@
 	if (!model) 
 		return NULL;
 	g_object_set_data_full (G_OBJECT (model), "name", g_strdup (stmt_name), g_free);
-	
-	/* create a new RunContext */
-	RunContext *ctx;
-	ctx = g_new0 (RunContext, 1);
-	ctx->stmt = NULL;
-	ctx->cnc = cnc;
-	ctx->parent = context;
-	ctx->model = model;
-	ctx->iter = gda_data_model_create_iter (model);
-	
-	/* add a parameter for the number of rows, attached to ctx->model */
+		
+	/* add a parameter for the number of rows, attached to model */
 	GdaHolder *param;
 	GValue *value;
 	gchar *name;
 	param = gda_holder_new (G_TYPE_INT);
 	value = gda_value_new (G_TYPE_INT);
-	g_value_set_int (value, gda_data_model_get_n_rows  (ctx->model));
-	gda_holder_set_value (param, value);
+	g_value_set_int (value, gda_data_model_get_n_rows  (model));
+	if (! gda_holder_set_value (param, value, error)) {
+		g_object_unref (param);
+		gda_value_free (value);
+		return NULL;
+	}
 	gda_value_free (value);
 	name = g_strdup_printf ("%s/%%nrows", stmt_name);
-	g_object_set_data_full (G_OBJECT (ctx->model), name, param, g_object_unref);
+	g_object_set_data_full (G_OBJECT (model), name, param, g_object_unref);
 	g_free (name);
 
+	/* create a new RunContext */
+	RunContext *ctx;
+	ctx = g_new0 (RunContext, 1);
+	ctx->stmt = NULL;
+	ctx->cnc = cnc;
+	ctx->parent = context;
+	ctx->model = model;
+	ctx->iter = gda_data_model_create_iter (model);
+
 	/*g_print (">>>> PUSH CONTEXT %p\n", ctx);*/
 	return ctx;
 }
@@ -949,8 +953,10 @@
 			GType ptype, source_ptype;
 			ptype = gda_holder_get_g_type (GDA_HOLDER (list->data));
 			source_ptype = gda_holder_get_g_type (source_param);
-			if (ptype == source_ptype)
-				gda_holder_set_bind (GDA_HOLDER (list->data), source_param);
+			if (ptype == source_ptype) {
+				if (! gda_holder_set_bind (GDA_HOLDER (list->data), source_param, error))
+					return FALSE;
+			}
 			else {
 				const GValue *source_value;
 				source_value = gda_holder_get_value (source_param);
@@ -958,7 +964,10 @@
 					GValue *trans;
 					trans = gda_value_new (ptype);
 					if (g_value_transform (source_value, trans)) {
-						gda_holder_set_value (GDA_HOLDER (list->data), trans);
+						if (! gda_holder_set_value (GDA_HOLDER (list->data), trans, error)) {
+							gda_value_free (trans);
+							return FALSE;
+						}
 						gda_value_free (trans);
 					}
 					else {
@@ -970,7 +979,8 @@
 					}
 				}
 				else
-					gda_holder_set_value (GDA_HOLDER (list->data), NULL);
+					if (! gda_holder_set_value (GDA_HOLDER (list->data), NULL, error))
+						return FALSE;
 			}
 		}
 	}
@@ -1052,7 +1062,7 @@
 			     _("Expression '%s' should return exactly one value"), expr);
 		return NULL;
 	}
-	retval = (GValue *) gda_data_model_get_value_at (model, 0, 0);
+	retval = (GValue *) gda_data_model_get_value_at (model, 0, 0, error);
 	if (retval)
 		retval = gda_value_copy (retval);
 	g_object_unref (model);

Modified: trunk/libgda-xslt/sql_backend.c
==============================================================================
--- trunk/libgda-xslt/sql_backend.c	(original)
+++ trunk/libgda-xslt/sql_backend.c	Thu Sep  4 20:08:38 2008
@@ -92,11 +92,13 @@
 		return -1;
 	}
 	else {
-		gda_holder_set_value (param, value);
+		gint retval = 0;
+		if (! gda_holder_set_value (param, value, NULL))
+			retval = -1;
 		g_free (xvalue);
 		gda_value_free (value);
+		return retval;
 	}
-	return 0;
 }
 
 int
@@ -305,7 +307,7 @@
 		return -1;
 	}
 	gint col_index;
-	col_index = gda_data_model_get_column_index_by_name (GDA_DATA_MODEL (result), colname);
+	col_index = gda_data_model_get_column_index (GDA_DATA_MODEL (result), colname);
 	if (col_index < 0) {
 #ifdef GDA_DEBUG_NO
 		g_print ("no column found by name [%s]", colname);
@@ -314,7 +316,7 @@
 		return -1;
 	}
 	const GValue *db_value;
-	db_value = gda_data_model_get_value_at (GDA_DATA_MODEL (result), col_index, 0);
+	db_value = gda_data_model_get_value_at (GDA_DATA_MODEL (result), col_index, 0, error);
 	if (db_value == NULL) {
 #ifdef GDA_DEBUG_NO
 		g_print ("no value found on col_index [%d]", col_index);
@@ -428,24 +430,21 @@
 				xmlChar *str = NULL;
 				gboolean isnull = FALSE;
 
-				value = (GValue *)
-					gda_data_model_get_value_at
-					(model, rcols[c], r);
-				if (!value || gda_value_is_null ((GValue *)
-								 value))
+				value = (GValue *) gda_data_model_get_value_at (model, rcols[c], r, error);
+				if (!value) {
+					for (c = 0; c < rnb_cols; c++)
+						g_free (col_ids[c]);
+					g_free (col_ids);
+					return -1;
+				}
+				if (gda_value_is_null ((GValue *) value))
 					isnull = TRUE;
-				else {
+				else 
 					str = value_to_xmlchar (value);
-				}
-				field = xmlNewChild (row, NULL, (xmlChar *)
-						     "column",
-						     (xmlChar *) str);
-				xmlSetProp (field, (xmlChar *) "name",
-					    (xmlChar *) col_ids[c]);
+				field = xmlNewChild (row, NULL, (xmlChar *) "column", (xmlChar *) str);
+				xmlSetProp (field, (xmlChar *) "name", (xmlChar *) col_ids[c]);
 				if (isnull)
-					xmlSetProp (field, (xmlChar *)
-						    "isnull",
-						    (xmlChar *) "true");
+					xmlSetProp (field, (xmlChar *) "isnull", (xmlChar *) "true");
 				g_free (str);
 			}
 		}

Modified: trunk/libgda/gda-connection.c
==============================================================================
--- trunk/libgda/gda-connection.c	(original)
+++ trunk/libgda/gda-connection.c	Thu Sep  4 20:08:38 2008
@@ -2803,8 +2803,7 @@
 							   g_type_name (G_VALUE_TYPE (suggest->column_values[j])));
 						return NULL;
 					}
-					if (gda_value_compare_ext (templ_context->column_values[i], 
-								   (suggest->column_values[j])))
+					if (gda_value_compare (templ_context->column_values[i], suggest->column_values[j]))
 						/* different values */
 						return NULL;
 					break;
@@ -3264,7 +3263,11 @@
 			if (!set)
 				set = gda_set_new (NULL);
 			h = g_object_new (GDA_TYPE_HOLDER, "g-type", G_VALUE_TYPE (v), "id", fname, NULL);
-			gda_holder_set_value (h, v);
+			if (! gda_holder_set_value (h, v, error)) {
+				g_free (key.filters);
+				g_object_unref (set);
+				return NULL;
+			}
 			gda_set_add_holder (set, h);
 			g_object_unref (h);
 			key.filters[i] = fname;

Modified: trunk/libgda/gda-data-access-wrapper.c
==============================================================================
--- trunk/libgda/gda-data-access-wrapper.c	(original)
+++ trunk/libgda/gda-data-access-wrapper.c	Thu Sep  4 20:08:38 2008
@@ -73,7 +73,7 @@
 static gint                 gda_data_access_wrapper_get_n_columns   (GdaDataModel *model);
 static GdaColumn           *gda_data_access_wrapper_describe_column (GdaDataModel *model, gint col);
 static GdaDataModelAccessFlags gda_data_access_wrapper_get_access_flags(GdaDataModel *model);
-static const GValue      *gda_data_access_wrapper_get_value_at    (GdaDataModel *model, gint col, gint row);
+static const GValue        *gda_data_access_wrapper_get_value_at    (GdaDataModel *model, gint col, gint row, GError **error);
 static GdaValueAttribute    gda_data_access_wrapper_get_attributes_at (GdaDataModel *model, gint col, gint row);
 
 static void iter_row_changed_cb (GdaDataModelIter *iter, gint row, GdaDataAccessWrapper *model);
@@ -358,29 +358,6 @@
 	return GDA_DATA_MODEL (retmodel);
 }
 
-/**
- * gda_data_access_wrapper_row_exists
- * @wrapper: a #GdaDataAccessWrapper objects
- * @row: a row number to test existance
- *
- * Tests if the wrapper model of @wrapper has a row number @row
- *
- * Returns: TRUE if row number @row exists
- */
-gboolean
-gda_data_access_wrapper_row_exists (GdaDataAccessWrapper *wrapper, gint row)
-{
-	g_return_val_if_fail (GDA_IS_DATA_ACCESS_WRAPPER (wrapper), FALSE);
-	
-	if (wrapper->priv->nb_cols == 0)
-		return FALSE;
-
-	if (gda_data_model_get_value_at ((GdaDataModel*) wrapper, 0, row))
-		return TRUE;
-	else
-		return FALSE;
-}
-
 /*
  * GdaDataModel interface implementation
  */
@@ -479,7 +456,7 @@
 }
 
 static const GValue *
-gda_data_access_wrapper_get_value_at (GdaDataModel *model, gint col, gint row)
+gda_data_access_wrapper_get_value_at (GdaDataModel *model, gint col, gint row, GError **error)
 {
 	GdaDataAccessWrapper *imodel;
 
@@ -490,13 +467,14 @@
 	g_return_val_if_fail (row >= 0, NULL);
 
 	if (col >= imodel->priv->nb_cols) {
-		g_warning (_("Column %d out of range (0-%d)"), col, imodel->priv->nb_cols);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,
+			     _("Column %d out of range (0-%d)"), col, imodel->priv->nb_cols);
 		return NULL;
 	}
 
 	if (!imodel->priv->rows)
 		/* imodel->priv->model is a random access model, use it */
-		return gda_data_model_get_value_at (imodel->priv->model, col, row);
+		return gda_data_model_get_value_at (imodel->priv->model, col, row, error);
 	else {
 		GdaRow *gda_row;
 
@@ -511,8 +489,11 @@
 					if (row == imodel->priv->iter_row)
 						return gda_row_get_value (gda_row, col);
 				}
-				else
+				else {
+					g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+						     _("Can't set iterator's position"));
 					return NULL;
+				}
 			}
 				
 			gda_row = NULL;
@@ -537,6 +518,8 @@
 		}
 	}
 
+	g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+		     _("Can't access data"));
 	return NULL;
 }
 
@@ -582,7 +565,7 @@
 	imodel = (GdaDataAccessWrapper *) model;
 	g_return_val_if_fail (imodel->priv, 0);
 
-	if (!imodel->priv->rows)
+	if (imodel->priv->model)
 		flags = gda_data_model_get_attributes_at (imodel->priv->model, col, row);
 	flags |= GDA_VALUE_ATTR_NO_MODIF;
 	

Modified: trunk/libgda/gda-data-access-wrapper.h
==============================================================================
--- trunk/libgda/gda-data-access-wrapper.h	(original)
+++ trunk/libgda/gda-data-access-wrapper.h	Thu Sep  4 20:08:38 2008
@@ -49,7 +49,6 @@
 
 GType         gda_data_access_wrapper_get_type    (void) G_GNUC_CONST;
 GdaDataModel *gda_data_access_wrapper_new         (GdaDataModel *model);
-gboolean      gda_data_access_wrapper_row_exists  (GdaDataAccessWrapper *wrapper, gint row);
 
 G_END_DECLS
 

Modified: trunk/libgda/gda-data-comparator.c
==============================================================================
--- trunk/libgda/gda-data-comparator.c	(original)
+++ trunk/libgda/gda-data-comparator.c	Thu Sep  4 20:08:38 2008
@@ -355,6 +355,7 @@
  * It is assumed that both data model have the same number of columns and of "compatible" types.
  *
  * Returns: 
+ *          -2 if an error occurred
  *          -1 if not found, 
  *          >=0 if found (if changes need to be made, then @out_has_changed is set to TRUE).
  */
@@ -374,10 +375,16 @@
 			comp->priv->key_columns [i] = i;
 	}
 
-	for (i = 0; i < comp->priv->nb_key_columns; i++) 
-		values = g_slist_append (values, 
-					 (gpointer) gda_data_model_get_value_at (comp->priv->new_model, 
-										 comp->priv->key_columns[i], row));
+	for (i = 0; i < comp->priv->nb_key_columns; i++) {
+		const GValue *cvalue;
+		cvalue = gda_data_model_get_value_at (comp->priv->new_model, comp->priv->key_columns[i], row, error);
+		if (!cvalue) {
+			if (values)
+				g_slist_free (values);
+			return -2;
+		}
+		values = g_slist_append (values, (gpointer) cvalue);
+	}
 
 	erow = gda_data_model_get_row_from_values (comp->priv->old_model, values, comp->priv->key_columns);
 	g_slist_free (values);
@@ -386,9 +393,13 @@
 		gboolean changed = FALSE;
 		for (i = 0; i < ncols; i++) {
 			const GValue *v1, *v2;
-			v1 = gda_data_model_get_value_at (comp->priv->old_model, i, erow);
-			v2 = gda_data_model_get_value_at (comp->priv->new_model, i, row);
-			if (gda_value_compare_ext (v1, v2)) {
+			v1 = gda_data_model_get_value_at (comp->priv->old_model, i, erow, error);
+			if (!v1)
+				return -2;
+			v2 = gda_data_model_get_value_at (comp->priv->new_model, i, row, error);
+			if (!v2) 
+				return -2;
+			if (gda_value_compare (v1, v2)) {
 				changed = TRUE;
 				break;
 			}
@@ -410,7 +421,7 @@
  * If one connects to this signal and returns FALSE in the signal handler, then computing differences will be
  * stopped and an error will be returned.
  *
- * Returns: TRUE if all the differences have been sucessfully computed
+ * Returns: TRUE if all the differences have been sucessfully computed, and FALSE if an error occurred
  */
 gboolean
 gda_data_comparator_compute_diff (GdaDataComparator *comp, GError **error)
@@ -482,7 +493,7 @@
 		g_print ("FIND row %d returned row %d (%s)\n", i, erow, 
 			 has_changed ? "CHANGED" : "unchanged");
 #endif
-		if (erow < 0) {
+		if (erow == -1) {
 			gint j;
 			diff = g_new0 (GdaDiff, 1);
 			diff->type = GDA_DIFF_ADD_ROW;
@@ -490,10 +501,23 @@
 			diff->new_row = i;
 			diff->values = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free,
 							      (GDestroyNotify) gda_value_free);
-			for (j = 0; j < oncols; j++) 
+			for (j = 0; j < oncols; j++) {
+				const GValue *cvalue;
+				cvalue = gda_data_model_get_value_at (comp->priv->new_model, j, i, error);
+				if (!cvalue) {
+					/* an error occurred */
+					g_free (rows_to_del);
+					gda_diff_free (diff);
+					return FALSE;
+				}
 				g_hash_table_insert (diff->values, g_strdup_printf ("+%d", j),
-						     gda_value_copy (gda_data_model_get_value_at (comp->priv->new_model,
-												  j, i)));
+						     gda_value_copy (cvalue));
+			}
+		}
+		else if (erow < -1) {
+			/* an error occurred */
+			g_free (rows_to_del);
+			return FALSE;
 		}
 		else if (has_changed) {
 			gint j;
@@ -504,12 +528,25 @@
 			diff->values = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free,
 							      (GDestroyNotify) gda_value_free);
 			for (j = 0; j < oncols; j++) {
+				const GValue *cvalue;
+				cvalue = gda_data_model_get_value_at (comp->priv->new_model, j, i, error);
+				if (!cvalue) {
+					/* an error occurred */
+					g_free (rows_to_del);
+					gda_diff_free (diff);
+					return FALSE;
+				}
 				g_hash_table_insert (diff->values, g_strdup_printf ("+%d", j),
-						     gda_value_copy (gda_data_model_get_value_at (comp->priv->new_model,
-												  j, i)));
+						     gda_value_copy (cvalue));
+				cvalue = gda_data_model_get_value_at (comp->priv->old_model, j, i, error);
+				if (!cvalue) {
+					/* an error occurred */
+					g_free (rows_to_del);
+					gda_diff_free (diff);
+					return FALSE;
+				}
 				g_hash_table_insert (diff->values, g_strdup_printf ("-%d", j),
-						     gda_value_copy (gda_data_model_get_value_at (comp->priv->old_model,
-												  j, i)));
+						     gda_value_copy (cvalue));
 			}
 		}
 		rows_to_del [i] = FALSE;
@@ -538,10 +575,18 @@
 			diff->new_row = -1;
 			diff->values = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free,
 							      (GDestroyNotify) gda_value_free);
-			for (j = 0; j < oncols; j++) 
+			for (j = 0; j < oncols; j++)  {
+				const GValue *cvalue;
+				cvalue = gda_data_model_get_value_at (comp->priv->old_model, j, i, error);
+				if (!cvalue) {
+					/* an error occurred */
+					g_free (rows_to_del);
+					gda_diff_free (diff);
+					return FALSE;
+				}
 				g_hash_table_insert (diff->values, g_strdup_printf ("-%d", j),
-						     gda_value_copy (gda_data_model_get_value_at (comp->priv->old_model,
-												  j, i)));
+						     gda_value_copy (cvalue));
+			}
 			g_array_append_val (comp->priv->diffs, diff);
 			g_signal_emit (comp, gda_data_comparator_signals [DIFF_COMPUTED], 0, diff, &stop);
 			if (stop) {

Modified: trunk/libgda/gda-data-model-array.c
==============================================================================
--- trunk/libgda/gda-data-model-array.c	(original)
+++ trunk/libgda/gda-data-model-array.c	Thu Sep  4 20:08:38 2008
@@ -62,7 +62,7 @@
 static gint                 gda_data_model_array_get_n_rows      (GdaDataModel *model);
 static gint                 gda_data_model_array_get_n_columns   (GdaDataModel *model);
 static GdaColumn           *gda_data_model_array_describe_column (GdaDataModel *model, gint col);
-static const GValue        *gda_data_model_array_get_value_at    (GdaDataModel *model, gint col, gint row);
+static const GValue        *gda_data_model_array_get_value_at    (GdaDataModel *model, gint col, gint row, GError **error);
 static GdaValueAttribute    gda_data_model_array_get_attributes_at (GdaDataModel *model, gint col, gint row);
 static GdaDataModelAccessFlags gda_data_model_array_get_access_flags(GdaDataModel *model);
 
@@ -491,10 +491,12 @@
         for (i = 0; (i < nrows) && (nb_warnings < max_warnings); i++) {
                 GType vtype;
 
-                value = gda_data_model_array_get_value_at (GDA_DATA_MODEL (model), col, i);
-                if (value)
-                        vtype = G_VALUE_TYPE ((GValue *) value);
-                if (value && (vtype != GDA_TYPE_NULL) && (vtype != new)) {
+                value = gda_data_model_get_value_at ((GdaDataModel *) model, col, i, NULL);
+                if (!value)
+			continue;
+
+		vtype = G_VALUE_TYPE ((GValue *) value);
+                if ((vtype != GDA_TYPE_NULL) && (vtype != new)) {
                         nb_warnings ++;
                         if (nb_warnings < max_warnings) {
                                 if (nb_warnings == max_warnings)
@@ -510,42 +512,45 @@
                                 }
                         }
                 }
-
         }
 }
 
 static const GValue *
-gda_data_model_array_get_value_at (GdaDataModel *model, gint col, gint row)
+gda_data_model_array_get_value_at (GdaDataModel *model, gint col, gint row, GError **error)
 {
 	GdaRow *fields;
 	GdaDataModelArray *amodel = (GdaDataModelArray*) model;
 
 	if (amodel->priv->rows->len == 0) {
-		g_warning (_("No row in data model"));
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_NOT_FOUND_ERROR,
+			     _("No row in data model"));
 		return NULL;
 	}
 
 	if (row >= amodel->priv->rows->len) {
-		g_warning (_("Row %d out of range (0-%d)"), row, 
-			   amodel->priv->rows->len - 1);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR,
+			     _("Row %d out of range (0-%d)"), row, amodel->priv->rows->len - 1);
 		return NULL;
 	}
 
 	if (col >= amodel->priv->number_of_columns) {
-		g_warning (_("Column %d out of range (0-%d)"), col, 
-			   amodel->priv->number_of_columns - 1);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,
+			     _("Column %d out of range (0-%d)"), col, amodel->priv->number_of_columns - 1);
 		return NULL;
 	}
 
 	fields = g_array_index (amodel->priv->rows, GdaRow*, row);
-	if (fields != NULL) {
+	if (fields) {
 		GValue *field;
 
 		field = gda_row_get_value (fields, col);
 		return (const GValue *) field;
 	}
-
-	return NULL;
+	else {
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_NOT_FOUND_ERROR,
+			     _("Data model has no data"));
+		return NULL;
+	}
 }
 
 static GdaValueAttribute
@@ -562,7 +567,7 @@
                 flags |= GDA_VALUE_ATTR_CAN_BE_DEFAULT;
 
         if (row >= 0) {
-                gdavalue = gda_data_model_get_value_at (model, col, row);
+                gdavalue = gda_data_model_get_value_at (model, col, row, NULL);
                 if (!gdavalue || gda_value_is_null ((GValue *) gdavalue))
                         flags |= GDA_VALUE_ATTR_IS_NULL;
         }

Modified: trunk/libgda/gda-data-model-bdb.c
==============================================================================
--- trunk/libgda/gda-data-model-bdb.c	(original)
+++ trunk/libgda/gda-data-model-bdb.c	Thu Sep  4 20:08:38 2008
@@ -81,7 +81,7 @@
 static gint                 gda_data_model_bdb_get_n_columns   (GdaDataModel *model);
 static GdaColumn           *gda_data_model_bdb_describe_column (GdaDataModel *model, gint col);
 static GdaDataModelAccessFlags gda_data_model_bdb_get_access_flags(GdaDataModel *model);
-static const GValue      *gda_data_model_bdb_get_value_at    (GdaDataModel *model, gint col, gint row);
+static const GValue        *gda_data_model_bdb_get_value_at    (GdaDataModel *model, gint col, gint row, GError **error);
 static GdaValueAttribute    gda_data_model_bdb_get_attributes_at (GdaDataModel *model, gint col, gint row);
 
 static gboolean             gda_data_model_bdb_set_value_at (GdaDataModel *model, gint col, gint row, const GValue *value, GError **error);
@@ -591,7 +591,7 @@
 }
 
 static const GValue *
-gda_data_model_bdb_get_value_at (GdaDataModel *model, gint col, gint row)
+gda_data_model_bdb_get_value_at (GdaDataModel *model, gint col, gint row, GError **error)
 {
 	GdaDataModelBdb *imodel;
 	DBT key, data;
@@ -607,6 +607,8 @@
 		gchar *tmp;
 		tmp = g_strdup_printf (_("Column %d out of range (0-%d)"), col, imodel->priv->n_columns - 1);
 		add_error (imodel, tmp);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,
+			     tmp);
 		g_free (tmp);
 		return NULL;
 	}
@@ -619,6 +621,8 @@
 	ret = imodel->priv->dbpc->c_get (imodel->priv->dbpc, &key, &data, DB_CURRENT);
 	if (ret) {
 		add_error (imodel, db_strerror (ret));
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+			     db_strerror (ret));
 		return NULL;
 	}
 
@@ -736,6 +740,8 @@
 		gchar *tmp;
 		tmp = g_strdup_printf (_("Column %d out of range (0-%d)"), col, imodel->priv->n_columns - 1);
 		add_error (imodel, tmp);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,
+			     tmp);
 		g_free (tmp);
 		return FALSE;
 	}
@@ -836,6 +842,8 @@
 	ret = imodel->priv->dbpc->c_get (imodel->priv->dbpc, &key, &data, DB_CURRENT);
 	if (ret) {
 		add_error (imodel, db_strerror (ret));
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+			     db_strerror (ret));
 		return FALSE;
 	}
 
@@ -844,7 +852,7 @@
 		return FALSE;
 
 	if (key_modified) {
-		g_set_error (error, 0, 0,
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR,
 			     _("Key modification is not supported"));
 		return FALSE;
 	}
@@ -897,6 +905,8 @@
 		ret = imodel->priv->dbpc->c_put (imodel->priv->dbpc, &key, &data, DB_CURRENT);
 		if (ret) {
 			add_error (imodel, db_strerror (ret));
+			g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+				     db_strerror (ret));
 			return FALSE;
 		}
 	}
@@ -938,7 +948,8 @@
 	ret = imodel->priv->dbp->put (imodel->priv->dbp, NULL, &key, &data, 0);
 	if (ret) {
 		add_error (imodel, db_strerror (ret));
-		g_print ("ERR1\n");
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+			     db_strerror (ret));
 		return -1;
 	}
 
@@ -964,6 +975,8 @@
 	ret = imodel->priv->dbpc->c_del (imodel->priv->dbpc, 0);
 	if (ret) {
 		add_error (imodel, db_strerror (ret));
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+			     db_strerror (ret));
 		return FALSE;
 	}
 

Modified: trunk/libgda/gda-data-model-dir.c
==============================================================================
--- trunk/libgda/gda-data-model-dir.c	(original)
+++ trunk/libgda/gda-data-model-dir.c	Thu Sep  4 20:08:38 2008
@@ -128,7 +128,7 @@
 static gint                 gda_data_model_dir_get_n_columns   (GdaDataModel *model);
 static GdaColumn           *gda_data_model_dir_describe_column (GdaDataModel *model, gint col);
 static GdaDataModelAccessFlags gda_data_model_dir_get_access_flags(GdaDataModel *model);
-static const GValue      *gda_data_model_dir_get_value_at    (GdaDataModel *model, gint col, gint row);
+static const GValue        *gda_data_model_dir_get_value_at    (GdaDataModel *model, gint col, gint row, GError **error);
 static GdaValueAttribute    gda_data_model_dir_get_attributes_at (GdaDataModel *model, gint col, gint row);
 
 static gboolean             gda_data_model_dir_set_value_at (GdaDataModel *model, gint col, gint row, const GValue *value, GError **error);
@@ -553,7 +553,7 @@
  md5end:
 	if (value) {
 		if (row->md5sum_value && (G_VALUE_TYPE (row->md5sum_value) == G_TYPE_STRING)
-		    && !gda_value_compare_ext (row->md5sum_value, value))
+		    && !gda_value_compare (row->md5sum_value, value))
 			changed = FALSE;
 		else {
 			if (row->md5sum_value)
@@ -613,7 +613,7 @@
 
 	if (value) {
 		if (row->mime_value && (G_VALUE_TYPE (row->mime_value) == G_TYPE_STRING)
-		    && !gda_value_compare_ext (row->mime_value, value))
+		    && !gda_value_compare (row->mime_value, value))
 			changed = FALSE;
 		else {
 			if (row->mime_value)
@@ -776,7 +776,7 @@
 }
 
 static const GValue *
-gda_data_model_dir_get_value_at (GdaDataModel *model, gint col, gint row)
+gda_data_model_dir_get_value_at (GdaDataModel *model, gint col, gint row, GError **error)
 {
 	GdaDataModelDir *imodel;
 	GValue *value = NULL;
@@ -790,6 +790,8 @@
 		gchar *tmp;
 		tmp = g_strdup_printf (_("Column %d out of range (0-%d)"), col, COL_LAST-1);
 		add_error (imodel, tmp);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,
+			     tmp);
 		g_free (tmp);
 		return NULL;
 	}
@@ -799,6 +801,8 @@
                 str = g_strdup_printf (_("Row %d out of range (0-%d)"), row,
 				       imodel->priv->rows->len - 1);
 		add_error (imodel, str);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR,
+			     str);
 		g_free (str);
                 return NULL;
         }
@@ -862,6 +866,9 @@
 			break;
 		}
 	}
+	else
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_NOT_FOUND_ERROR,
+			     _("Row not found"));
 
 	return value;
 }
@@ -972,7 +979,10 @@
 
 	for (col = 0, list = values; list; list = list->next, col++) {
 		GValue *value = (GValue *) list->data;
-		if (!value || !gda_value_compare_ext (value, gda_data_model_get_value_at (model, col, row))) 
+		const GValue *cvalue = gda_data_model_get_value_at (model, col, row, error);
+		if (!cvalue)
+			return FALSE;
+		if (!value || !gda_value_compare (value, cvalue)) 
 			continue;
 
 		switch (col) {

Modified: trunk/libgda/gda-data-model-import.c
==============================================================================
--- trunk/libgda/gda-data-model-import.c	(original)
+++ trunk/libgda/gda-data-model-import.c	Thu Sep  4 20:08:38 2008
@@ -160,7 +160,7 @@
 static gint                 gda_data_model_import_get_n_columns   (GdaDataModel *model);
 static GdaColumn           *gda_data_model_import_describe_column (GdaDataModel *model, gint col);
 static GdaDataModelAccessFlags gda_data_model_import_get_access_flags(GdaDataModel *model);
-static const GValue      *gda_data_model_import_get_value_at    (GdaDataModel *model, gint col, gint row);
+static const GValue        *gda_data_model_import_get_value_at    (GdaDataModel *model, gint col, gint row, GError **error);
 static GdaValueAttribute    gda_data_model_import_get_attributes_at (GdaDataModel *model, gint col, gint row);
 static GdaDataModelIter    *gda_data_model_import_create_iter      (GdaDataModel *model);
 static gboolean             gda_data_model_import_iter_next       (GdaDataModel *model, GdaDataModelIter *iter); 
@@ -1712,7 +1712,7 @@
 }
 
 static const GValue *
-gda_data_model_import_get_value_at (GdaDataModel *model, gint col, gint row)
+gda_data_model_import_get_value_at (GdaDataModel *model, gint col, gint row, GError **error)
 {
 	GdaDataModelImport *imodel;
 	g_return_val_if_fail (GDA_IS_DATA_MODEL_IMPORT (model), NULL);
@@ -1721,10 +1721,13 @@
 
 	if (imodel->priv->random_access_model)
 		/* if there is a random access model, then use it */
-		return gda_data_model_get_value_at (imodel->priv->random_access_model, col, row);
-	else
+		return gda_data_model_get_value_at (imodel->priv->random_access_model, col, row, error);
+	else {
 		/* otherwise, bail out */
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+			     _("Data model does not support random access"));
 		return NULL;
+	}
 }
 
 static GdaValueAttribute
@@ -1859,24 +1862,30 @@
 		GSList *plist;
 		GSList *vlist;
 		gboolean update_model;
+		gboolean allok = TRUE;
 		
 		g_object_get (G_OBJECT (iter), "update_model", &update_model, NULL);
 		g_object_set (G_OBJECT (iter), "update_model", FALSE, NULL);
-		plist = ((GdaSet *) iter)->holders;
-		vlist = next_values;
-		while (plist && vlist) {
-			gda_holder_set_value (GDA_HOLDER (plist->data), 
-					      (GValue *) vlist->data);
-			plist = g_slist_next (plist);
-			vlist = g_slist_next (vlist);
+		for (plist = ((GdaSet *) iter)->holders, vlist = next_values;
+		     plist && vlist;
+		     plist = plist->next, vlist = vlist->next) {
+			GError *lerror = NULL;
+			if (! gda_holder_set_value (GDA_HOLDER (plist->data), 
+						    (GValue *) vlist->data, &lerror)) {
+				gchar *tmp;
+				tmp = g_strdup_printf (_("Could not set iterator's value: %s"),
+						       lerror && lerror->message ? lerror->message : _("No detail"));
+				add_error (imodel, tmp);
+				g_free (tmp);
+				allok = FALSE;
+			}
 		}
 		if (plist || vlist) {
+			allok = FALSE;
 			if (plist) {
 				add_error_too_few_values (imodel);
-				while (plist) {
-					gda_holder_set_value (GDA_HOLDER (plist->data), NULL);
-					plist = g_slist_next (plist);
-				}
+				for (; plist; plist = plist->next)
+					gda_holder_force_invalid (GDA_HOLDER (plist->data));
 			}
 			else
 				add_error_too_many_values (imodel);
@@ -1889,7 +1898,7 @@
 		g_object_set (G_OBJECT (iter), "current-row", imodel->priv->iter_row, 
 			      "update_model", update_model, NULL);
 
-		return TRUE;
+		return allok;
 	}
 	else {
 		g_signal_emit_by_name (iter, "end_of_data");
@@ -1926,24 +1935,30 @@
 		GSList *plist;
 		GSList *vlist;
 		gboolean update_model;
-		
+		gboolean allok = TRUE;
+
 		g_object_get (G_OBJECT (iter), "update_model", &update_model, NULL);
 		g_object_set (G_OBJECT (iter), "update_model", FALSE, NULL);
-		plist = ((GdaSet *) iter)->holders;
-		vlist = imodel->priv->cursor_values;
-		while (plist && vlist) {
-			gda_holder_set_value (GDA_HOLDER (plist->data), 
-					      (GValue *) vlist->data);
-			plist = g_slist_next (plist);
-			vlist = g_slist_next (vlist);
+		for (plist = ((GdaSet *) iter)->holders, vlist = imodel->priv->cursor_values;
+		     plist && vlist;
+		     plist = plist->next, vlist = vlist->next) {
+			GError *lerror = NULL;
+			if (! gda_holder_set_value (GDA_HOLDER (plist->data), 
+						    (GValue *) vlist->data, &lerror)) {
+				gchar *tmp;
+				tmp = g_strdup_printf (_("Could not set iterator's value: %s"),
+						       lerror && lerror->message ? lerror->message : _("No detail"));
+				add_error (imodel, tmp);
+				g_free (tmp);
+				allok = FALSE;
+			}
 		}
 		if (plist || vlist) {
+			allok = FALSE;
 			if (plist) {
 				add_error_too_few_values (imodel);
-				while (plist) {
-					gda_holder_set_value (GDA_HOLDER (plist->data), NULL);
-					plist = g_slist_next (plist);
-				}				
+				for (; plist; plist = plist->next)
+					gda_holder_force_invalid (GDA_HOLDER (plist->data));
 			}
 			else 
 				add_error_too_many_values (imodel);
@@ -1955,7 +1970,7 @@
 		g_assert (imodel->priv->iter_row >= 0);
 		g_object_set (G_OBJECT (iter), "current-row", imodel->priv->iter_row, 
 			      "update_model", update_model, NULL);
-		return TRUE;
+		return allok;
 	}
 	else {
 		g_object_set (G_OBJECT (iter), "current-row", -1, NULL);

Modified: trunk/libgda/gda-data-model-iter.c
==============================================================================
--- trunk/libgda/gda-data-model-iter.c	(original)
+++ trunk/libgda/gda-data-model-iter.c	Thu Sep  4 20:08:38 2008
@@ -271,9 +271,11 @@
 		if (! gda_data_model_set_value_at ((GdaDataModel *) iter->priv->data_model, 
 						   col, iter->priv->row, gda_holder_get_value (param), NULL)) {
 			/* writing to the model failed, revert back the change to parameter */
+			const GValue *cvalue = gda_data_model_get_value_at (GDA_DATA_MODEL (iter->priv->data_model), 
+									    col, iter->priv->row, NULL);
 			iter->priv->keep_param_changes = TRUE;
-			gda_holder_set_value (param, gda_data_model_get_value_at (GDA_DATA_MODEL (iter->priv->data_model), 
-										     col, iter->priv->row)); 
+			if (!cvalue || !gda_holder_set_value (param, cvalue, NULL))
+				gda_holder_force_invalid (param);
 			iter->priv->keep_param_changes = FALSE;
 		}
 		

Modified: trunk/libgda/gda-data-model-query.c
==============================================================================
--- trunk/libgda/gda-data-model-query.c	(original)
+++ trunk/libgda/gda-data-model-query.c	Thu Sep  4 20:08:38 2008
@@ -98,7 +98,7 @@
 static gint                 gda_data_model_query_get_n_columns   (GdaDataModel *model);
 static GdaColumn           *gda_data_model_query_describe_column (GdaDataModel *model, gint col);
 static GdaDataModelAccessFlags gda_data_model_query_get_access_flags(GdaDataModel *model);
-static const GValue        *gda_data_model_query_get_value_at    (GdaDataModel *model, gint col, gint row);
+static const GValue        *gda_data_model_query_get_value_at    (GdaDataModel *model, gint col, gint row, GError **error);
 static GdaValueAttribute    gda_data_model_query_get_attributes_at (GdaDataModel *model, gint col, gint row);
 
 static GdaDataModelIter    *gda_data_model_query_create_iter     (GdaDataModel *model);
@@ -488,7 +488,8 @@
 									if (bind_to) {
 										check_param_type (holder,
 												  gda_holder_get_g_type (bind_to));
-										gda_holder_set_bind (holder, bind_to);
+										if (! gda_holder_set_bind (holder, bind_to, NULL))
+											TO_IMPLEMENT;
 									}
 									else
 										g_warning (_("Could not find a parameter named "
@@ -563,6 +564,7 @@
 holder_changed_cb (GdaSet *paramlist, GdaHolder *param, GdaDataModelQuery *model)
 {
 	/* first: sync the parameters which are bound */
+	gboolean allok = TRUE;
 	if (model->priv->params [SEL_QUERY]) {
 		gint i;
 		for (i = INS_QUERY; i <= DEL_QUERY; i++) {
@@ -572,15 +574,16 @@
 					GdaHolder *bind_to;
 					bind_to = gda_holder_get_bind (GDA_HOLDER (params->data));
 					if (bind_to == param)
-						gda_holder_set_value (GDA_HOLDER (params->data),
-								      gda_holder_get_value (bind_to));
+						if (!gda_holder_set_value (GDA_HOLDER (params->data),
+									   gda_holder_get_value (bind_to), NULL))
+							allok = FALSE;
 				}
 			}
 		}
 	}
 
 	/* second: do a refresh */
-	if (gda_set_is_valid (paramlist))
+	if (allok && gda_set_is_valid (paramlist))
 		gda_data_model_query_refresh (model, NULL);
 	else {
 		if (model->priv->data) {
@@ -929,7 +932,7 @@
 }
 
 static const GValue *
-gda_data_model_query_get_value_at (GdaDataModel *model, gint col, gint row)
+gda_data_model_query_get_value_at (GdaDataModel *model, gint col, gint row, GError **error)
 {
 	GdaDataModelQuery *selmodel;
 	g_return_val_if_fail (GDA_IS_DATA_MODEL_QUERY (model), NULL);
@@ -940,9 +943,12 @@
 		gda_data_model_query_refresh (selmodel, NULL);
 	
 	if (selmodel->priv->data)
-		return gda_data_model_get_value_at (selmodel->priv->data, col, row);
-	else
+		return gda_data_model_get_value_at (selmodel->priv->data, col, row, error);
+	else {
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_NOT_FOUND_ERROR,
+			     _("Data model has no data"));
 		return NULL;
+	}
 }
 
 static GdaValueAttribute
@@ -1153,18 +1159,24 @@
 			num = GPOINTER_TO_INT (g_object_get_data ((GObject*) params->data, "+num")) - 1;
 			if (num >= 0) {
 				/* new values */
-				if (num == col)
-					gda_holder_set_value (GDA_HOLDER (params->data), value);
-				else
-					gda_holder_set_value (GDA_HOLDER (params->data), NULL);
+				if (num == col) {
+					if (!gda_holder_set_value (GDA_HOLDER (params->data), value, error))
+						return FALSE;
+				}
+				else {
+					if (! gda_holder_set_value (GDA_HOLDER (params->data), NULL, error))
+						return FALSE;
+				}
 			}
 			else {
 				num = GPOINTER_TO_INT (g_object_get_data ((GObject*) params->data, "-num")) - 1;	
-				if (num >= 0)
+				if (num >= 0) {
 					/* old values */
-					gda_holder_set_value (GDA_HOLDER (params->data),
-							      gda_data_model_get_value_at ((GdaDataModel*) selmodel, 
-											   num, row));
+					const GValue *cvalue;
+					cvalue = gda_data_model_get_value_at ((GdaDataModel*) selmodel, num, row, error);
+					if (!cvalue || gda_holder_set_value (GDA_HOLDER (params->data), cvalue, error)) 
+						return FALSE;
+				}
 			}
 		}
 	}
@@ -1202,18 +1214,24 @@
 				/* new values */
 				GValue *value;
 				value = g_list_nth_data ((GList *) values, num);
-				if (value)
-					gda_holder_set_value (GDA_HOLDER (params->data), value);
-				else
-					gda_holder_set_value (GDA_HOLDER (params->data), NULL);
+				if (value) {
+					if (!gda_holder_set_value (GDA_HOLDER (params->data), value, error))
+						return FALSE;
+				}
+				else {
+					if (! gda_holder_set_value (GDA_HOLDER (params->data), NULL, error))
+						return FALSE;
+				}
 			}
 			else {
 				num = GPOINTER_TO_INT (g_object_get_data ((GObject*) params->data, "-num")) - 1;
-				if (num >= 0)
+				if (num >= 0) {
 					/* old values */
-					gda_holder_set_value (GDA_HOLDER (params->data),
-							      gda_data_model_get_value_at ((GdaDataModel*) selmodel, 
-											   num, row));
+					const GValue *cvalue;
+					cvalue = gda_data_model_get_value_at ((GdaDataModel*) selmodel, num, row, error);
+					if (!cvalue || gda_holder_set_value (GDA_HOLDER (params->data), cvalue, error)) 
+						return FALSE;
+				}
 			}
 		}
 	}
@@ -1252,9 +1270,11 @@
 				/* new values only */
 				GValue *value;
 				value = g_list_nth_data ((GList *) values, num);
-				if (value)
-					gda_holder_set_value (GDA_HOLDER (params->data), value);
-				else
+				if (value) {
+					if (! gda_holder_set_value (GDA_HOLDER (params->data), value, error))
+						return -1;
+				}
+				else 
 					g_object_set (G_OBJECT (params->data), "use-default-value", TRUE, NULL);
 			}
 		}
@@ -1298,7 +1318,8 @@
 
 			if (num >= 0) 
 				/* new values only */
-				gda_holder_set_value (GDA_HOLDER (params->data), NULL);
+				if (! gda_holder_set_value (GDA_HOLDER (params->data), NULL, error))
+					return -1;
 		}
 	}
 
@@ -1336,10 +1357,13 @@
 			gint num;
 
 			num = GPOINTER_TO_INT (g_object_get_data ((GObject*) params->data, "-num")) - 1;
-			if (num >= 0) 
+			if (num >= 0) {
 				/* old values only */
-				gda_holder_set_value (GDA_HOLDER (params->data),
-						      gda_data_model_get_value_at ((GdaDataModel*) selmodel, num, row));
+				const GValue *cvalue;
+				cvalue = gda_data_model_get_value_at ((GdaDataModel*) selmodel, num, row, error);
+				if (!cvalue || gda_holder_set_value (GDA_HOLDER (params->data), cvalue, error)) 
+					return FALSE;
+			}
 		}
 	}
 

Modified: trunk/libgda/gda-data-model.c
==============================================================================
--- trunk/libgda/gda-data-model.c	(original)
+++ trunk/libgda/gda-data-model.c	Thu Sep  4 20:08:38 2008
@@ -199,10 +199,9 @@
 		nbcols = gda_data_model_get_n_columns (model);
 		for (i = 0; i < nbcols; i++) {
 			column = gda_data_model_describe_column (model, i);
-			value = gda_data_model_get_value_at (model, i, 0);
-			if ((gda_column_get_g_type (column) == G_TYPE_INVALID))
-				gda_column_set_g_type (column, 
-							 value ? G_VALUE_TYPE ((GValue *)value) : GDA_TYPE_NULL);
+			value = gda_data_model_get_value_at (model, i, 0, NULL);
+			if (value && (gda_column_get_g_type (column) == G_TYPE_INVALID))
+				gda_column_set_g_type (column, G_VALUE_TYPE ((GValue *)value));
 		}
 	}
 
@@ -422,16 +421,16 @@
 }
 
 /**
- * gda_data_model_get_column_index_by_name
+ * gda_data_model_get_column_index
  * @model: a #GdaDataModel object.
  * @name: a column name
  *
- * Get the index of the column named @name in @model
+ * Get the index of the first column named @name in @model.
  *
  * Returns: the column index, or -1 if no column named @name was found
  */
 gint
-gda_data_model_get_column_index_by_name (GdaDataModel *model, const gchar *name)
+gda_data_model_get_column_index (GdaDataModel *model, const gchar *name)
 {
 	gint nbcols, ncol, ret;
 
@@ -440,8 +439,8 @@
 	
 	ret = -1;
 	nbcols = gda_data_model_get_n_columns (model);
-	for(ncol = 0; ncol < nbcols; ncol++) {
-		if(g_str_equal (name, gda_data_model_get_column_title (model, ncol))) {
+	for (ncol = 0; ncol < nbcols; ncol++) {
+		if (g_str_equal (name, gda_data_model_get_column_title (model, ncol))) {
 			
 			ret = ncol;
 			break;
@@ -551,6 +550,7 @@
  * @model: a #GdaDataModel object.
  * @col: a valid column number.
  * @row: a valid row number.
+ * @error: a place to store errors, or %NULL
  *
  * Retrieves the data stored in the given position (identified by
  * the @col and @row parameters) on a data model.
@@ -559,9 +559,13 @@
  * To access data in a data model using a cursor, use a #GdaDataModelIter object, obtained using
  * gda_data_model_create_iter().
  *
- * Note that the returned #GValue must not be modified directly (unexpected behaviours may
- * occur if you do so). Also that value may become invalid as soon as any Libgda part is executed again,
- * which means if you want to keep the value, a copy must be made. 
+ * Note1: the returned #GValue must not be modified directly (unexpected behaviours may
+ * occur if you do so).
+ *
+ * Note2: the returned value may become invalid as soon as any Libgda part is executed again,
+ * which means if you want to keep the value, a copy must be made, however it will remain valid
+ * as long as the only Libgda usage is calling gda_data_model_get_value_at() for different values
+ * of the same row.
  *
  * If you want to modify a value stored in a #GdaDataModel, use the gda_data_model_set_value_at() or 
  * gda_data_model_set_values() methods.
@@ -570,26 +574,76 @@
  * position, or %NULL on error (out-of-bound position, etc).
  */
 const GValue *
-gda_data_model_get_value_at (GdaDataModel *model, gint col, gint row)
+gda_data_model_get_value_at (GdaDataModel *model, gint col, gint row, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_DATA_MODEL (model), NULL);
 
 	if (GDA_DATA_MODEL_GET_CLASS (model)->i_get_value_at)
-		return (GDA_DATA_MODEL_GET_CLASS (model)->i_get_value_at) (model, col, row);
+		return (GDA_DATA_MODEL_GET_CLASS (model)->i_get_value_at) (model, col, row, error);
 	else {
 		/* method not supported */
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR,
+			     _("Data model does not support getting individual value"));
 		return NULL;
 	}
 }
 
 /**
- * gda_data_model_get_value_at_col_name
+ * gda_data_model_get_typed_value_at
+ * @model: a #GdaDataModel object.
+ * @col: a valid column number.
+ * @row: a valid row number.
+ * @expected_type: the expected data type of the returned value
+ * @nullok: if TRUE, then NULL values (value of type %GDA_TYPE_NULL) will not generate any error
+ * @error: a place to store errors, or %NULL
+ *
+ * This method is similar to gda_data_model_get_value_at(), except that it also allows one to specify the expected
+ * #GType of the value to get: if the data model returned a #GValue of a type different than the expected one, then
+ * this method returns %NULL and an error code.
+ *
+ * Note: the same limitations and usage instructions apply as for gda_data_model_get_value_at().
+ *
+ * Returns: a #GValue containing the value stored in the given
+ * position, or %NULL on error (out-of-bound position, wrong data type, etc).
+ */
+const GValue *
+gda_data_model_get_typed_value_at (GdaDataModel *model, gint col, gint row, GType expected_type, gboolean nullok, GError **error)
+{
+	const GValue *cvalue = NULL;
+	g_return_val_if_fail (GDA_IS_DATA_MODEL (model), NULL);
+
+	if (GDA_DATA_MODEL_GET_CLASS (model)->i_get_value_at)
+		cvalue = (GDA_DATA_MODEL_GET_CLASS (model)->i_get_value_at) (model, col, row, error);
+
+	if (cvalue) {
+		if (nullok && (G_VALUE_TYPE (cvalue) != GDA_TYPE_NULL) && (G_VALUE_TYPE (cvalue) != expected_type)) {
+			cvalue = NULL;
+			g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_VALUE_TYPE_ERROR,
+				     _("Data model returned value of invalid '%s' type"), gda_g_type_to_string (G_VALUE_TYPE (cvalue)));
+		}
+		else if (!nullok && (G_VALUE_TYPE (cvalue) != expected_type)) {
+			cvalue = NULL;
+			if (G_VALUE_TYPE (cvalue) != GDA_TYPE_NULL)
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_VALUE_TYPE_ERROR,
+					     _("Data model returned invalid NULL value"));
+			else
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_VALUE_TYPE_ERROR,
+					     _("Data model returned value of invalid '%s' type"), 
+					     gda_g_type_to_string (G_VALUE_TYPE (cvalue)));
+		}
+	}
+	return cvalue;
+}
+
+/**
+ * gda_data_model_get_value_at_column
  * @model: a #GdaDataModel object.
  * @column_name: a valid column name.
  * @row: a valid row number.
+ * @error: a place to store errors, or %NULL
  *
  * Retrieves the data stored in the given position (identified by
- * the @col_name column and @row parameters) on a data model.
+ * the first column named @column_name and the @row row) in a data model.
  *
  * See also gda_data_model_get_value_at().
  *
@@ -597,18 +651,17 @@
  * position, or %NULL on error (out-of-bound position, etc).
  */
 const GValue *
-gda_data_model_get_value_at_col_name (GdaDataModel *model, 
-				      const gchar *column_name, gint row)
+gda_data_model_get_value_at_column (GdaDataModel *model, const gchar *column_name, gint row, GError **error)
 {
 	gint ncol;
 	g_return_val_if_fail (GDA_IS_DATA_MODEL (model), NULL);
 	g_return_val_if_fail (column_name, NULL);
 
-	ncol = gda_data_model_get_column_index_by_name (model, column_name);
+	ncol = gda_data_model_get_column_index (model, column_name);
 	if (ncol == -1)
 		return NULL;
 	else
-		return gda_data_model_get_value_at (model, ncol, row);
+		return gda_data_model_get_value_at (model, ncol, row, error);
 }
 
 /**
@@ -640,7 +693,7 @@
  * @model: a #GdaDataModel object.
  * @col: column number.
  * @row: row number.
- * @value: a #GValue, or %NULL
+ * @value: a #GValue (not %NULL)
  * @error: a place to store errors, or %NULL
  *
  * Modifies a value in @model, at (@col, @row).
@@ -656,6 +709,8 @@
 		return (GDA_DATA_MODEL_GET_CLASS (model)->i_set_value_at) (model, col, row, value, error);
 	else {
 		/* method not supported */
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR,
+			     _("Data model does not support setting individual value"));
 		return FALSE;
 	}
 }
@@ -757,11 +812,8 @@
 		return FALSE;
 
 	/* validity tests */
-	if (row >= gda_data_model_get_n_rows (model)) {
-		gda_data_model_iter_invalidate_contents (iter);
-		g_object_set (G_OBJECT (iter), "current_row", -1, NULL);
-		return FALSE;
-	}
+	if (row >= gda_data_model_get_n_rows (model)) 
+		goto onerror;
 		
 	g_return_val_if_fail (GDA_IS_DATA_MODEL_ITER (iter), FALSE);
 	
@@ -773,14 +825,20 @@
 	g_object_get (G_OBJECT (iter), "update_model", &update_model, NULL);
 	g_object_set (G_OBJECT (iter), "update_model", FALSE, NULL);
 	for (col = 0, list = ((GdaSet *) iter)->holders; list; col++, list = list->next) {
-		gda_holder_set_value ((GdaHolder*) list->data, 
-				      gda_data_model_get_value_at (model, col, row));
-
+		const GValue *cvalue;
+		cvalue = gda_data_model_get_value_at (model, col, row, NULL);
+		if (!cvalue || !gda_holder_set_value ((GdaHolder*) list->data, cvalue, NULL))
+			goto onerror;
 		set_param_attributes ((GdaHolder*) list->data, 
 				      gda_data_model_get_attributes_at (model, col, row));
 	}
 	g_object_set (G_OBJECT (iter), "current_row", row, "update_model", update_model, NULL);
 	return TRUE;
+
+ onerror:
+	gda_data_model_iter_invalidate_contents (iter);
+	g_object_set (G_OBJECT (iter), "current_row", -1, NULL);
+	return FALSE;
 }
 
 static void
@@ -791,7 +849,7 @@
 
 	gda_holder_set_not_null (holder, ! (flags & GDA_VALUE_ATTR_CAN_BE_NULL));
 	if (flags & GDA_VALUE_ATTR_IS_NULL)
-		gda_holder_set_value (holder, NULL);
+		gda_holder_set_value (holder, NULL, NULL);
 	if (flags & GDA_VALUE_ATTR_DATA_NON_VALID)
 		gda_holder_force_invalid (holder);
 }
@@ -842,23 +900,28 @@
 
 	g_object_get (G_OBJECT (iter), "current_row", &row, NULL);
 	row++;
-	if (row >= gda_data_model_get_n_rows (model)) {
-		g_object_set (G_OBJECT (iter), "current_row", -1, NULL);
-		return FALSE;
-	}
+	if (row >= gda_data_model_get_n_rows (model)) 
+		goto onerror;
 	
 	/* actual sync. */
 	g_object_get (G_OBJECT (iter), "update_model", &update_model, NULL);
 	g_object_set (G_OBJECT (iter), "update_model", FALSE, NULL);
 	for (col = 0, list = ((GdaSet *) iter)->holders; list; col++, list = list->next) {
-		gda_holder_set_value ((GdaHolder *) list->data, 
-				      gda_data_model_get_value_at (model, col, row));
+		const GValue *cvalue;
+		cvalue = gda_data_model_get_value_at (model, col, row, NULL);
+		if (!cvalue || !gda_holder_set_value ((GdaHolder *) list->data, cvalue, NULL)) 
+			goto onerror;
 		set_param_attributes ((GdaHolder *) list->data, 
 				      gda_data_model_get_attributes_at (model, col, row));
 	}
 	g_object_set (G_OBJECT (iter), "current_row", row, 
 		      "update_model", update_model, NULL);
 	return TRUE;
+	
+ onerror:
+	gda_data_model_iter_invalidate_contents (iter);
+	g_object_set (G_OBJECT (iter), "current_row", -1, NULL);
+	return FALSE;
 }
 
 /**
@@ -908,20 +971,27 @@
 	g_object_get (G_OBJECT (iter), "current_row", &row, NULL);
 	row--;
 	if (row < 0)
-		return FALSE;
+		goto onerror;
 	
 	/* actual sync. */
 	g_object_get (G_OBJECT (iter), "update_model", &update_model, NULL);
 	g_object_set (G_OBJECT (iter), "update_model", FALSE, NULL);
 	for (col = 0, list = ((GdaSet *) iter)->holders; list; col++, list = list->next) {
-		gda_holder_set_value ((GdaHolder*) list->data, 
-				      gda_data_model_get_value_at (model, col, row));
+		const GValue *cvalue;
+		cvalue = gda_data_model_get_value_at (model, col, row, NULL);
+		if (!cvalue || !gda_holder_set_value ((GdaHolder*) list->data, cvalue, NULL))
+			goto onerror;
 		set_param_attributes ((GdaHolder*) list->data,
 				      gda_data_model_get_attributes_at (model, col, row));
 	}
 	g_object_set (G_OBJECT (iter), "current_row", row, 
 		      "update_model", update_model, NULL);
-	return TRUE;	
+	return TRUE;
+
+ onerror:
+	gda_data_model_iter_invalidate_contents (iter);
+	g_object_set (G_OBJECT (iter), "current_row", -1, NULL);
+	return FALSE;
 }
 
 
@@ -1013,7 +1083,7 @@
 /**
  * gda_data_model_get_row_from_values
  * @model: a #GdaDataModel object.
- * @values: a list of #GValue values
+ * @values: a list of #GValue values (no %NULL is allowed)
  * @cols_index: an array of #gint containing the column number to match each value of @values
  *
  * Returns the first row where all the values in @values at the columns identified at
@@ -1063,9 +1133,9 @@
                 while (list && allequal) {
                         if (cols_index)
                                 g_return_val_if_fail (cols_index [index] < n_cols, FALSE);
-                        value = gda_data_model_get_value_at (model, cols_index [index], current_row);
+                        value = gda_data_model_get_value_at (model, cols_index [index], current_row, NULL);
 
-                        if (gda_value_compare_ext ((GValue *) (list->data), (GValue *) value))
+                        if (!value || !(list->data) || gda_value_compare ((GValue *) (list->data), (GValue *) value))
                                 allequal = FALSE;
 
                         list = g_slist_next (list);
@@ -1336,7 +1406,7 @@
 			GValue *value;
 			gchar *txt;
 
-			value = (GValue *) gda_data_model_get_value_at (model, cols[c], rows ? rows[r] : r);
+			value = (GValue *) gda_data_model_get_value_at (model, cols[c], rows ? rows[r] : r, NULL);
 			if (G_VALUE_TYPE (value) == G_TYPE_BOOLEAN)
 				txt = g_strdup (g_value_get_boolean (value) ? "TRUE" : "FALSE");
 			else {
@@ -1395,7 +1465,7 @@
  *
  * Converts a #GdaDataModel into a xmlNodePtr (as used in libxml).
  *
- * Returns: a xmlNodePtr representing the whole data model.
+ * Returns: a xmlNodePtr representing the whole data model, or %NULL if an error occurred
  */
 xmlNodePtr
 gda_data_model_to_xml_node (GdaDataModel *model, const gint *cols, gint nb_cols, 
@@ -1488,7 +1558,10 @@
 	}
 	
 	/* add the model data to the XML output */
-	gda_utility_data_model_dump_data_to_xml (model, node, cols, nb_cols, rows, nb_rows, FALSE);
+	if (!gda_utility_data_model_dump_data_to_xml (model, node, cols, nb_cols, rows, nb_rows, FALSE)) {
+		xmlFreeNode (node);
+		node = NULL;
+	}
 
 	if (!cols)
 		g_free (rcols);
@@ -1985,7 +2058,8 @@
 }
 
 static gchar *real_gda_data_model_dump_as_string (GdaDataModel *model, gboolean dump_attributes, 
-						  gboolean dump_rows, gboolean dump_title, gboolean null_as_empty);
+						  gboolean dump_rows, gboolean dump_title, gboolean null_as_empty,
+						  GError **error);
 
 /**
  * gda_data_model_dump
@@ -2010,6 +2084,7 @@
 	gboolean dump_rows = FALSE;
 	gboolean dump_title = FALSE;
 	gboolean null_as_empty = FALSE;
+	GError *error = NULL;
 
 	g_return_if_fail (GDA_IS_DATA_MODEL (model));
 	g_return_if_fail (to_stream);
@@ -2023,13 +2098,29 @@
 	if (getenv ("GDA_DATA_MODEL_NULL_AS_EMPTY")) 
 		null_as_empty = TRUE;
 
-	str = real_gda_data_model_dump_as_string (model, FALSE, dump_rows, dump_title, null_as_empty);
-	g_fprintf (to_stream, "%s", str);
-	g_free (str);
-	if (dump_attrs) {
-		str = real_gda_data_model_dump_as_string (model, TRUE, dump_rows, dump_title, null_as_empty);
+	str = real_gda_data_model_dump_as_string (model, FALSE, dump_rows, dump_title, null_as_empty, &error);
+	if (str) {
 		g_fprintf (to_stream, "%s", str);
 		g_free (str);
+		if (dump_attrs) {
+			str = real_gda_data_model_dump_as_string (model, TRUE, dump_rows, dump_title, null_as_empty, &error);
+			if (str) {
+				g_fprintf (to_stream, "%s", str);
+				g_free (str);
+			}
+			else {
+				g_warning (_("Could not dump data model's attributes: %s"),
+					   error && error->message ? error->message : _("No detail"));
+				if (error)
+					g_error_free (error);
+			}
+		}
+	}
+	else {
+		g_warning (_("Could not dump data model's contents: %s"),
+			   error && error->message ? error->message : _("No detail"));
+		if (error)
+			g_error_free (error);
 	}
 }
 
@@ -2063,7 +2154,7 @@
 	if (getenv ("GDA_DATA_MODEL_NULL_AS_EMPTY")) 
 		null_as_empty = TRUE;
 
-	return real_gda_data_model_dump_as_string (model, FALSE, dump_rows, dump_title, null_as_empty);
+	return real_gda_data_model_dump_as_string (model, FALSE, dump_rows, dump_title, null_as_empty, NULL);
 }
 
 static void
@@ -2090,10 +2181,11 @@
 
 static gchar *
 real_gda_data_model_dump_as_string (GdaDataModel *model, gboolean dump_attributes, 
-				    gboolean dump_rows, gboolean dump_title, gboolean null_as_empty)
+				    gboolean dump_rows, gboolean dump_title, gboolean null_as_empty, GError **error)
 {
 #define MULTI_LINE_NO_SEPARATOR
 
+	gboolean allok = TRUE;
 	GString *string;
 	gchar *offstr, *str;
 	gint n_cols, n_rows;
@@ -2173,7 +2265,11 @@
 	for (j = 0; j < n_rows; j++) {
 		for (i = 0; i < n_cols; i++) {
 			if (! dump_attributes) {
-				value = gda_data_model_get_value_at (model, i, j);
+				value = gda_data_model_get_value_at (model, i, j, error);
+				if (!value) {
+					allok = FALSE;
+					break;
+				}
 				str = NULL;
 				if (null_as_empty) {
 					if (!value || gda_value_is_null (value))
@@ -2198,10 +2294,12 @@
 				g_free (str);
 			}
 		}
+		if (!allok)
+			break;
 	}
 	
 	/* actual dumping of the contents: title */
-	if (dump_title) {
+	if (allok && dump_title) {
 		const gchar *title;
 		title = g_object_get_data (G_OBJECT (model), "name");
 		if (title) {
@@ -2221,10 +2319,10 @@
 	}
 
 	/* ...column titles...*/
-	if (dump_rows) 
+	if (allok && dump_rows) 
 		g_string_append_printf (string, "%*s", cols_size [0], "#row");
 
-	for (i = 0; i < n_cols; i++) {
+	for (i = 0; (i < n_cols) && allok; i++) {
 		gint j, max;
 		str = (gchar *) gda_data_model_get_column_title (model, i);
 		if (dump_rows || (i != 0))
@@ -2244,7 +2342,7 @@
 	g_string_append_c (string, '\n');
 		
 	/* ... separation line ... */
-	for (i = 0; i < n_cols + col_offset; i++) {
+	for (i = 0; (i < n_cols + col_offset) && allok; i++) {
 		if (i != 0)
 			g_string_append_printf (string, "%s", sep_row);
 		for (j = 0; j < cols_size [i]; j++)
@@ -2253,7 +2351,7 @@
 	g_string_append_c (string, '\n');
 
 	/* ... and data */
-	if (gda_data_model_get_access_flags (model) & GDA_DATA_MODEL_ACCESS_RANDOM) {
+	if (allok && gda_data_model_get_access_flags (model) & GDA_DATA_MODEL_ACCESS_RANDOM) {
 		for (j = 0; j < n_rows; j++) {
 			/* determine height for each column in that row */
 			gint *cols_height = g_new (gint, n_cols + col_offset);
@@ -2269,7 +2367,11 @@
 
 			for (i = 0; i < n_cols; i++) {
 				if (!dump_attributes) {
-					value = gda_data_model_get_value_at (model, i, j);
+					value = gda_data_model_get_value_at (model, i, j, error);
+					if (!value) {
+						allok = FALSE;
+						break;
+					}
 					str = NULL;
 					if (null_as_empty) {
 						if (!value || gda_value_is_null (value))
@@ -2294,6 +2396,8 @@
 					cols_height [i + col_offset] = 0;
 				}
 			}
+			if (!allok)
+				break;
 
 			for (k = 0; k < kmax; k++) {
 				for (i = 0; i < n_cols + col_offset; i++) {
@@ -2372,7 +2476,13 @@
 
 	g_free (offstr);
 	
-	str = string->str;
-	g_string_free (string, FALSE);
+	if (allok) {
+		str = string->str;
+		g_string_free (string, FALSE);
+	}
+	else {
+		str = NULL;
+		g_string_free (string, TRUE);
+	}
 	return str;
 }

Modified: trunk/libgda/gda-data-model.h
==============================================================================
--- trunk/libgda/gda-data-model.h	(original)
+++ trunk/libgda/gda-data-model.h	Thu Sep  4 20:08:38 2008
@@ -70,8 +70,10 @@
 	GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR,
 	GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,
 	GDA_DATA_MODEL_VALUES_LIST_ERROR,
+	GDA_DATA_MODEL_VALUE_TYPE_ERROR,
 	GDA_DATA_MODEL_ROW_NOT_FOUND_ERROR,
-	GDA_DATA_MODEL_ACCESS_ERROR
+	GDA_DATA_MODEL_ACCESS_ERROR,
+	GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR
 };
 
 /* struct for the interface */
@@ -85,7 +87,7 @@
 	GdaColumn           *(* i_describe_column)  (GdaDataModel *model, gint col);
 	GdaDataModelAccessFlags (* i_get_access_flags) (GdaDataModel *model);
 
-	const GValue        *(* i_get_value_at)     (GdaDataModel *model, gint col, gint row);
+	const GValue        *(* i_get_value_at)     (GdaDataModel *model, gint col, gint row, GError **error);
 	GdaValueAttribute    (* i_get_attributes_at)(GdaDataModel *model, gint col, gint row);
 	GdaDataModelIter    *(* i_create_iter)      (GdaDataModel *model);
 	gboolean             (* i_iter_at_row)      (GdaDataModel *model, GdaDataModelIter *iter, gint row);
@@ -122,15 +124,17 @@
 gint                gda_data_model_get_n_columns          (GdaDataModel *model);
 
 GdaColumn          *gda_data_model_describe_column        (GdaDataModel *model, gint col);
-gint                gda_data_model_get_column_index_by_name(GdaDataModel *model, const gchar *name);
+gint                gda_data_model_get_column_index       (GdaDataModel *model, const gchar *name);
 const gchar        *gda_data_model_get_column_name       (GdaDataModel *model, gint col);
 void                gda_data_model_set_column_name       (GdaDataModel *model, gint col, const gchar *name);
 const gchar        *gda_data_model_get_column_title       (GdaDataModel *model, gint col);
 void                gda_data_model_set_column_title       (GdaDataModel *model, gint col, const gchar *title);
 
-const GValue       *gda_data_model_get_value_at           (GdaDataModel *model, gint col, gint row);
-const GValue       *gda_data_model_get_value_at_col_name  (GdaDataModel *model, 
-							   const gchar *column_name, gint row);
+const GValue       *gda_data_model_get_value_at           (GdaDataModel *model, gint col, gint row, GError **error);
+const GValue       *gda_data_model_get_typed_value_at     (GdaDataModel *model, gint col, gint row, 
+							   GType expected_type, gboolean nullok, GError **error);
+const GValue       *gda_data_model_get_value_at_column    (GdaDataModel *model, 
+							   const gchar *column_name, gint row, GError **error);
 GdaValueAttribute   gda_data_model_get_attributes_at      (GdaDataModel *model, gint col, gint row);
 GdaDataModelIter   *gda_data_model_create_iter            (GdaDataModel *model);
 void                gda_data_model_freeze                 (GdaDataModel *model);

Modified: trunk/libgda/gda-data-proxy.c
==============================================================================
--- trunk/libgda/gda-data-proxy.c	(original)
+++ trunk/libgda/gda-data-proxy.c	Thu Sep  4 20:08:38 2008
@@ -61,7 +61,7 @@
 static gint                 gda_data_proxy_get_n_rows      (GdaDataModel *model);
 static gint                 gda_data_proxy_get_n_columns   (GdaDataModel *model);
 static GdaColumn           *gda_data_proxy_describe_column (GdaDataModel *model, gint col);
-static const GValue        *gda_data_proxy_get_value_at    (GdaDataModel *model, gint col, gint row);
+static const GValue        *gda_data_proxy_get_value_at    (GdaDataModel *model, gint col, gint row, GError **error);
 static GdaValueAttribute    gda_data_proxy_get_attributes_at (GdaDataModel *model, gint col, gint row);
 static GdaDataModelIter    *gda_data_proxy_create_iter     (GdaDataModel *model);
 
@@ -458,7 +458,7 @@
 			for (i=0; i<proxy->priv->model_nb_cols; i++) {
 				const GValue *oval;
 				
-				oval = gda_data_model_get_value_at (proxy->priv->model, i, model_row);
+				oval = gda_data_model_get_value_at (proxy->priv->model, i, model_row, NULL);
 				if (oval)
 					rm->orig_values [i] = gda_value_copy ((GValue *) oval);
 			}
@@ -1191,8 +1191,7 @@
 	g_return_val_if_fail (proxy_row >= 0, NULL);
 
 	for (i = 0; i < n_cols; i++) {
-		value = gda_data_proxy_get_value_at ((GdaDataModel *) proxy,
-						     cols_index[i], proxy_row);
+		value = gda_data_proxy_get_value_at ((GdaDataModel *) proxy, cols_index[i], proxy_row, NULL);
 		if (value)
 			retval = g_slist_prepend (retval, (GValue *) value);
 		else {
@@ -1552,8 +1551,7 @@
  * Returns: proxy row number if the row has been identified, or -1 otherwise
  */
 gint
-gda_data_proxy_find_row_from_values (GdaDataProxy *proxy, GSList *values,
-				     gint *cols_index)
+gda_data_proxy_find_row_from_values (GdaDataProxy *proxy, GSList *values, gint *cols_index)
 {
 	gboolean found = FALSE;
 	gint proxy_row;
@@ -1594,8 +1592,10 @@
 				g_return_val_if_fail (cols_index [index] < proxy->priv->model_nb_cols, FALSE);
 			value = gda_data_proxy_get_value_at ((GdaDataModel *) proxy, 
 							     cols_index ? cols_index [index] : 
-							     index, proxy_row);
-			if (gda_value_compare_ext ((GValue *) (list->data), (GValue *) value))
+							     index, proxy_row, NULL);
+			if (!value)
+				return -1;
+			if (gda_value_compare ((GValue *) (list->data), (GValue *) value))
 				allequal = FALSE;
 
 			list = g_slist_next (list);
@@ -2494,7 +2494,7 @@
 
 			g_assert (i + proxy->priv->sample_first_row < nb_rows);
 			value = gda_data_model_get_value_at (proxy->priv->filtered_rows, 
-							     0, i + proxy->priv->sample_first_row);
+							     0, i + proxy->priv->sample_first_row, NULL);
 			g_assert (value);
 			g_assert (G_VALUE_TYPE (value) == G_TYPE_INT);
 			val = g_value_get_int (value);
@@ -3238,19 +3238,23 @@
 }
 
 static const GValue *
-gda_data_proxy_get_value_at (GdaDataModel *model, gint column, gint proxy_row)
+gda_data_proxy_get_value_at (GdaDataModel *model, gint column, gint proxy_row, GError **error)
 {
 	gint model_row;
 	GValue *retval = NULL;
 	GdaDataProxy *proxy;
+	static GValue *null_value = NULL;
 
 	g_return_val_if_fail (GDA_IS_DATA_PROXY (model), NULL);
 	proxy = GDA_DATA_PROXY (model);
 	g_return_val_if_fail (proxy->priv, NULL);
 	g_return_val_if_fail (proxy_row >= 0, NULL);
 
-	if ((proxy_row == 0) && proxy->priv->add_null_entry) 
-		return NULL;
+	if ((proxy_row == 0) && proxy->priv->add_null_entry) {
+		if (!null_value)
+			null_value = gda_value_new_null ();
+		return null_value;
+	}
 
 	model_row = proxy_row_to_model_row (proxy, proxy_row);
 
@@ -3275,6 +3279,11 @@
 			if (rv) {
 				value_has_modifs = TRUE;
 				retval = rv->value;
+				if (!retval) {
+					if (!null_value)
+						null_value = gda_value_new_null ();
+					retval = null_value;
+				}
 			}
 		}
 
@@ -3282,12 +3291,14 @@
 			/* value has not been modified */
 			if (model_row >= 0) {
 				/* existing row */
-				retval = (GValue *) gda_data_model_get_value_at (proxy->priv->model, 
-										   column, model_row);
+				retval = (GValue *) gda_data_model_get_value_at (proxy->priv->model, column, model_row, error);
 			}
-			else 
-				/* empty row, return NULL */
+			else {
+				/* non existing row, return NULL */
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR,
+					     _("Row %d out of range (0-%d)"), proxy_row, gda_data_model_get_n_rows (model));
 				retval = NULL;
+			}
 		}
 
 		return retval;
@@ -3302,20 +3313,29 @@
 		if (rm) {
 			if (rm->orig_values)
 				retval = rm->orig_values [model_col];
-			else
-				retval = NULL;
+			else {
+				if (!null_value)
+					null_value = gda_value_new_null ();
+				retval = null_value;
+			}
 		}
 		else {
-			if (model_row >= 0)
-				retval = (GValue *) gda_data_model_get_value_at (proxy->priv->model, 
-										   model_col, model_row);
-			else
+			if (model_row >= 0) {
+				/* existing row */
+				retval = (GValue *) gda_data_model_get_value_at (proxy->priv->model, model_col, model_row, error);
+			}
+			else {
+				/* non existing row, return NULL */
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR,
+					     _("Row %d out of range (0-%d)"), proxy_row, gda_data_model_get_n_rows (model));
 				retval = NULL;
+			}
 		}
 		return retval;
 	}
 	
-	g_warning (_("Unknown GdaDataProxy column: %d"), column);
+	g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,
+		     _("Column %d out of range (0-%d)"), column, 2 *proxy->priv->model_nb_cols - 1);
 	return NULL;
 }
 
@@ -3388,6 +3408,7 @@
 	proxy = GDA_DATA_PROXY (model);
 	g_return_val_if_fail (proxy->priv, FALSE);
 	g_return_val_if_fail (proxy_row >= 0, FALSE);
+	g_return_val_if_fail (value, FALSE);
 
 	/* ensure that there is no sync to be done */
 	ensure_chunk_sync (proxy);
@@ -3406,8 +3427,10 @@
 		const GValue *cmp_value;
 
 		/* compare with the current stored value */
-		cmp_value = gda_data_proxy_get_value_at ((GdaDataModel *) proxy, col, proxy_row);
-		if (! gda_value_compare_ext ((GValue *) value, (GValue *) cmp_value)) {
+		cmp_value = gda_data_proxy_get_value_at ((GdaDataModel *) proxy, col, proxy_row, error);
+		if (!cmp_value)
+			return FALSE;
+		if (! gda_value_compare ((GValue *) value, (GValue *) cmp_value)) {
 			/* nothing to do: values are equal */
 			return TRUE;
 		}
@@ -3424,7 +3447,8 @@
 			}
 
 			if (rm->orig_values && (col < rm->orig_values_size) && 
-			    ! gda_value_compare_ext ((GValue *) value, rm->orig_values [col])) {
+			    rm->orig_values [col] &&
+			    ! gda_value_compare ((GValue *) value, rm->orig_values [col])) {
 				/* remove the RowValue */
 				rm->modify_values = g_slist_remove (rm->modify_values, rv);
 				g_free (rv);
@@ -3543,15 +3567,12 @@
 	notify_changes = proxy->priv->notify_changes;
 	proxy->priv->notify_changes = FALSE;
 
-	col = 0;
-	list = values;
-	while (list && !err) {
-		if (gda_data_proxy_set_value_at (model, col, row, (GValue *)(list->data), error)) {
-			col++;
-			list = g_list_next (list);
-		}
-		else
+	for (col = 0, list = values; list; col ++, list = list->next) {
+		if (list->data && 
+		    !gda_data_proxy_set_value_at (model, col, row, (GValue *)(list->data), error)) {
 			err = TRUE;
+			break;
+		}
 	}
 
 	proxy->priv->notify_changes = notify_changes;

Modified: trunk/libgda/gda-data-select.c
==============================================================================
--- trunk/libgda/gda-data-select.c	(original)
+++ trunk/libgda/gda-data-select.c	Thu Sep  4 20:08:38 2008
@@ -154,7 +154,7 @@
 static gint                 gda_data_select_get_n_columns   (GdaDataModel *model);
 static GdaColumn           *gda_data_select_describe_column (GdaDataModel *model, gint col);
 static GdaDataModelAccessFlags gda_data_select_get_access_flags(GdaDataModel *model);
-static const GValue        *gda_data_select_get_value_at    (GdaDataModel *model, gint col, gint row);
+static const GValue        *gda_data_select_get_value_at    (GdaDataModel *model, gint col, gint row, GError **error);
 static GdaValueAttribute    gda_data_select_get_attributes_at (GdaDataModel *model, gint col, gint row);
 
 static GdaDataModelIter    *gda_data_select_create_iter     (GdaDataModel *model);
@@ -1036,7 +1036,6 @@
 /**
  * gda_data_select_compute_modification_statements
  * @model: a #GdaDataSelect data model
- * @require_pk: FALSE if all fields can be used in the WHERE condition when no primary key exists
  * @error: a place to store errors, or %NULL
  *
  * Makes @model try to compute INSERT, UPDATE and DELETE statements to be used when modifying @model's contents.
@@ -1046,7 +1045,7 @@
  * computed
  */
 gboolean
-gda_data_select_compute_modification_statements (GdaDataSelect *model, gboolean require_pk, GError **error)
+gda_data_select_compute_modification_statements (GdaDataSelect *model, GError **error)
 {
 	GdaStatement *stmt;
 	ModType mtype;
@@ -1070,7 +1069,7 @@
 			model->priv->modif_stmts[mtype] = NULL;
 		}
 
-	retval = gda_compute_dml_statements (model->priv->cnc, stmt, require_pk,
+	retval = gda_compute_dml_statements (model->priv->cnc, stmt, TRUE,
 					     &(modif_stmts[INS_QUERY]),
 					     &(modif_stmts[UPD_QUERY]),
 					     &(modif_stmts[DEL_QUERY]), error);
@@ -1437,7 +1436,7 @@
 #endif
 
 static const GValue *
-gda_data_select_get_value_at (GdaDataModel *model, gint col, gint row)
+gda_data_select_get_value_at (GdaDataModel *model, gint col, gint row, GError **error)
 {
 	GdaRow *prow;
 	gint int_row, irow;
@@ -1448,12 +1447,18 @@
 	g_return_val_if_fail (imodel->priv, NULL);
 
 	/* available only if GDA_DATA_MODEL_ACCESS_RANDOM */
-	if (! (imodel->priv->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM))
+	if (! (imodel->priv->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM)) {
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+			     _("Data model does not support random access"));
 		return NULL;
+	}
 
 	int_row = external_to_internal_row (imodel, row, NULL);
-	if (int_row < 0)
+	if (int_row < 0) {
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR,
+			     _("Row %d out of range (0-%d)"), row, gda_data_select_get_n_rows (model) - 1);
 		return NULL;
+	}
 
 	DelayedSelectStmt *dstmt = NULL;
 #ifdef GDA_DEBUG_NO
@@ -1464,16 +1469,24 @@
 	if (dstmt) {
 		if (! dstmt->row) {
 			GdaDataModel *tmpmodel;
-			if (!dstmt->select || !dstmt->params)
+			if (!dstmt->select || !dstmt->params) {
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+					     _("Unable to retreive data after modifications"));
 				return NULL;
+			}
 			tmpmodel = gda_connection_statement_execute_select (imodel->priv->cnc, 
 									    dstmt->select,
 									    dstmt->params, NULL);
-			if (!tmpmodel)
+			if (!tmpmodel) {
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+					     _("Unable to retreive data after modifications"));
 				return NULL;
+			}
 
 			if (gda_data_model_get_n_rows (tmpmodel) != 1) {
 				g_object_unref (tmpmodel);
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+					     _("Unable to retreive data after modifications"));
 				return NULL;
 			}
 
@@ -1484,13 +1497,17 @@
 				GValue *value;
 				const GValue *cvalue;
 				value = gda_row_get_value (prow, i);
-				cvalue = gda_data_model_get_value_at (tmpmodel, i, 0);
-
-				if (cvalue && !gda_value_is_null (cvalue)) {
+				cvalue = gda_data_model_get_value_at (tmpmodel, i, 0, error);
+				if (!cvalue)
+					return NULL;
+				
+				if (!gda_value_is_null (cvalue)) {
 					gda_value_reset_with_type (value, G_VALUE_TYPE (cvalue));
 					if (! gda_value_set_from_value (value, cvalue)) {
 						g_object_unref (tmpmodel);
 						g_object_unref (prow);
+						g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+							     _("Unable to retreive data after modifications"));
 						return NULL;
 					}
 				}
@@ -1509,17 +1526,16 @@
 							     GINT_TO_POINTER (int_row + 1)));
 		if (irow <= 0) {
 			prow = NULL;
-			if (CLASS (model)->fetch_random) 
-				CLASS (model)->fetch_random (imodel, &prow, int_row, NULL);
+			if (CLASS (model)->fetch_random && 
+			    !CLASS (model)->fetch_random (imodel, &prow, int_row, error))
+				return NULL;
 		}
 		else
 			prow = g_array_index (imodel->priv->rows, GdaRow *, irow - 1);
 	}
 	
-	if (prow) 
-		return gda_row_get_value (prow, col);
-
-	return NULL;
+	g_assert (prow);
+	return gda_row_get_value (prow, col);
 }
 
 static GdaValueAttribute
@@ -1562,7 +1578,7 @@
 	}
 }
 
-static void update_iter (GdaDataSelect *imodel, GdaRow *prow);
+static gboolean update_iter (GdaDataSelect *imodel, GdaRow *prow);
 static gboolean
 gda_data_select_iter_next (GdaDataModel *model, GdaDataModelIter *iter)
 {
@@ -1598,8 +1614,7 @@
 	
 	if (prow) {
 		imodel->priv->iter_row = target_iter_row;
-                update_iter (imodel, prow);
-                return TRUE;
+                return update_iter (imodel, prow);
 	}
 	else {
 		g_signal_emit_by_name (iter, "end_of_data");
@@ -1647,8 +1662,7 @@
 
 	if (prow) {
 		imodel->priv->iter_row = target_iter_row;
-                update_iter (imodel, prow);
-                return TRUE;
+                return update_iter (imodel, prow);
 	}
 
  prev_error:
@@ -1685,8 +1699,7 @@
 			TO_IMPLEMENT;
 		if (prow) {
 			imodel->priv->iter_row = row;
-			update_iter (imodel, prow);
-			return TRUE;
+			return update_iter (imodel, prow);
 		}
 		else {
 			g_object_set (G_OBJECT (iter), "current-row", -1, NULL);
@@ -1697,8 +1710,7 @@
 	else {
 		if (prow) {
 			imodel->priv->iter_row = row;
-			update_iter (imodel, prow);
-			return TRUE;
+			return update_iter (imodel, prow);
 		}
 		else {
 			/* implementation of fetch_at() is optional */
@@ -1708,13 +1720,14 @@
 	}
 }
 
-static void
+static gboolean
 update_iter (GdaDataSelect *imodel, GdaRow *prow)
 {
         gint i;
 	GdaDataModelIter *iter = imodel->priv->iter;
 	GSList *plist;
 	gboolean update_model;
+	gboolean retval = TRUE;
 	
 	g_object_get (G_OBJECT (iter), "update_model", &update_model, NULL);
 	if (update_model)
@@ -1725,12 +1738,15 @@
 	     i++, plist = plist->next) {
 		const GValue *value;
 		value = gda_row_get_value (prow, i);
-		gda_holder_set_value ((GdaHolder*) plist->data, value);
+		if (! gda_holder_set_value ((GdaHolder*) plist->data, value, NULL))
+			retval = FALSE;
         }
 
 	g_object_set (G_OBJECT (iter), "current-row", imodel->priv->iter_row, NULL);
 	if (update_model)
 		g_object_set (G_OBJECT (iter), "update_model", update_model, NULL);
+
+	return retval;
 }
 
 /*
@@ -2126,12 +2142,13 @@
 		holder = gda_set_get_holder (imodel->priv->modif_set, str);
 		g_free (str);
 		if (holder) {
-			if (! gda_holder_set_value (holder,
-						    gda_data_model_get_value_at ((GdaDataModel*) imodel, i, int_row))) {
-				g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_VALUE_ERROR,
-					     _("Wrong value type"));
+			const GValue *cvalue;
+			cvalue = gda_data_model_get_value_at ((GdaDataModel*) imodel, i, int_row, error);
+			if (!cvalue)
+				return FALSE;
+
+			if (! gda_holder_set_value (holder, cvalue, error))
 				return FALSE;
-			}
 		}
 	}
 
@@ -2173,7 +2190,7 @@
 				eholder = gda_set_get_holder (imodel->priv->modif_set, 
 							      gda_holder_get_id (holder));
 				if (!eholder || 
-				    ! gda_holder_set_value (holder, gda_holder_get_value (eholder))) {
+				    ! gda_holder_set_value (holder, gda_holder_get_value (eholder), error)) {
 					g_object_unref (dstmt->params);
 					dstmt->params = NULL;
 					break;
@@ -2238,11 +2255,8 @@
 			     _("Column %d can't be modified"), col);
 		return FALSE;
 	}
-	if (! gda_holder_set_value (holder, value)) {
-		g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_VALUE_ERROR,
-			     _("Wrong value type"));
+	if (! gda_holder_set_value (holder, value, error)) 
 		return FALSE;
-	}
 
 	/* BVector */
 	BVector *bv;
@@ -2332,9 +2346,7 @@
 			bvector_free (bv);
 			return FALSE;
 		}
-		if (! gda_holder_set_value (holder, (GValue *) list->data)) {
-			g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_VALUE_ERROR,
-				     _("Wrong value type"));
+		if (! gda_holder_set_value (holder, (GValue *) list->data, error)) {
 			bvector_free (bv);
 			return FALSE;
 		}
@@ -2432,9 +2444,7 @@
 			bvector_free (bv);
 			return -1;
 		}
-		if (! gda_holder_set_value (holder, (GValue *) list->data)) {
-			g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_VALUE_ERROR,
-				     _("Wrong value type"));
+		if (! gda_holder_set_value (holder, (GValue *) list->data, error)) {
 			bvector_free (bv);
 			return -1;
 		}
@@ -2493,7 +2503,7 @@
 					eholder = g_slist_nth_data (last_insert->holders, 
 								    imodel->priv->insert_to_select_mapping[pos]);
 					if (!eholder || 
-					    ! gda_holder_set_value (holder, gda_holder_get_value (eholder))) {
+					    ! gda_holder_set_value (holder, gda_holder_get_value (eholder), error)) {
 						g_object_unref (dstmt->params);
 						dstmt->params = NULL;
 						break;
@@ -2557,12 +2567,12 @@
 		holder = gda_set_get_holder (imodel->priv->modif_set, str);
 		g_free (str);
 		if (holder) {
-			if (! gda_holder_set_value (holder,
-						    gda_data_model_get_value_at (model, i, int_row))) {
-				g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_VALUE_ERROR,
-					     _("Wrong value type"));
+			const GValue *cvalue;
+			cvalue = gda_data_model_get_value_at (model, i, int_row, error);
+			if (!cvalue)
+				return FALSE;
+			if (! gda_holder_set_value (holder, cvalue, error))
 				return FALSE;
-			}
 		}
 	}
 

Modified: trunk/libgda/gda-data-select.h
==============================================================================
--- trunk/libgda/gda-data-select.h	(original)
+++ trunk/libgda/gda-data-select.h	Thu Sep  4 20:08:38 2008
@@ -97,7 +97,7 @@
 
 gboolean       gda_data_select_set_modification_statement      (GdaDataSelect *model, GdaStatement *mod_stmt, GError **error);
 gboolean       gda_data_select_set_modification_statement_sql  (GdaDataSelect *model, const gchar *sql, GError **error);
-gboolean       gda_data_select_compute_modification_statements (GdaDataSelect *model, gboolean require_pk, GError **error);
+gboolean       gda_data_select_compute_modification_statements (GdaDataSelect *model, GError **error);
 
 G_END_DECLS
 

Modified: trunk/libgda/gda-holder.c
==============================================================================
--- trunk/libgda/gda-holder.c	(original)
+++ trunk/libgda/gda-holder.c	Thu Sep  4 20:08:38 2008
@@ -18,6 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include <glib/gi18n-lib.h>
 #include <stdarg.h>
 #include <string.h>
 #include "gda-holder.h"
@@ -268,6 +269,7 @@
 {
 	GObject *obj;
 	GdaHolder *holder;
+	gboolean allok = TRUE;
 
 	g_return_val_if_fail (orig && GDA_IS_HOLDER (orig), NULL);
 	g_return_val_if_fail (orig->priv, NULL);
@@ -284,28 +286,34 @@
 
 	if (orig->priv->full_bind)
 		gda_holder_set_full_bind (holder, orig->priv->full_bind);
-	if (orig->priv->simple_bind)
-		gda_holder_set_bind (holder, orig->priv->simple_bind);
+	if (orig->priv->simple_bind) 
+		allok = gda_holder_set_bind (holder, orig->priv->simple_bind, NULL);
 	
-	if (orig->priv->source_model) {
+	if (allok && orig->priv->source_model) {
 		/*g_print ("Source holder %p\n", holder);*/
-		gda_holder_set_source_model (holder, orig->priv->source_model, orig->priv->source_col,
-					       NULL);
+		allok = gda_holder_set_source_model (holder, orig->priv->source_model, orig->priv->source_col,
+						     NULL);
 	}
 
-	/* direct settings */
-	holder->priv->invalid_forced = orig->priv->invalid_forced;
-	holder->priv->valid = orig->priv->valid;
-	holder->priv->default_forced = orig->priv->default_forced;	
-	if (orig->priv->value)
-		holder->priv->value = gda_value_copy (orig->priv->value);
-	if (orig->priv->default_value)
-		holder->priv->default_value = gda_value_copy (orig->priv->default_value);
-	holder->priv->not_null = orig->priv->not_null;
-	if (orig->priv->plugin)
-		holder->priv->plugin = g_strdup (orig->priv->plugin);
-
-	return holder;
+	if (allok) {
+		/* direct settings */
+		holder->priv->invalid_forced = orig->priv->invalid_forced;
+		holder->priv->valid = orig->priv->valid;
+		holder->priv->default_forced = orig->priv->default_forced;	
+		if (orig->priv->value)
+			holder->priv->value = gda_value_copy (orig->priv->value);
+		if (orig->priv->default_value)
+			holder->priv->default_value = gda_value_copy (orig->priv->default_value);
+		holder->priv->not_null = orig->priv->not_null;
+		if (orig->priv->plugin)
+			holder->priv->plugin = g_strdup (orig->priv->plugin);
+		return holder;
+	}
+	else {
+		g_warning ("Internal error: could not copy GdaHolder (please report a bug).");
+		g_object_unref (holder);
+		return NULL;
+	}
 }
 
 /**
@@ -335,6 +343,7 @@
 	if (holder) {
 		GValue *value;
 		va_list ap;
+		GError *lerror = NULL;
 
 		if (id)
 			holder->priv->id = g_strdup (id);
@@ -378,12 +387,22 @@
 			gda_value_set_numeric (value, va_arg (ap, GdaNumeric *));
 		else if (type == G_TYPE_DATE)
 			g_value_set_boxed (value, va_arg (ap, GDate *));
-		else
+		else {
 			g_warning ("%s() does not handle values of type %s, value will not be assigned.",
 				   __FUNCTION__, g_type_name (type));
+			g_object_unref (holder);
+			holder = NULL;
+		}
 		va_end (ap);
 
-		gda_holder_set_value (holder, value);
+		if (holder && !gda_holder_set_value (holder, value, &lerror)) {
+			g_warning (_("Unable to set holder's value: %s"),
+				   lerror && lerror->message ? lerror->message : _("No detail"));
+			if (lerror)
+				g_error_free (lerror);
+			g_object_unref (holder);
+			holder = NULL;
+		}
 		gda_value_free (value);
 	}
 
@@ -397,7 +416,7 @@
 
 	holder = GDA_HOLDER (object);
 	if (holder->priv) {
-		gda_holder_set_bind (holder, NULL);
+		gda_holder_set_bind (holder, NULL, NULL);
 		gda_holder_set_full_bind (holder, NULL);
 
 		if (holder->priv->source_model) {
@@ -501,7 +520,8 @@
 			break;
 		}
 		case PROP_SIMPLE_BIND:
-			gda_holder_set_bind (holder, GDA_HOLDER (g_value_get_object (value)));
+			if (!gda_holder_set_bind (holder, GDA_HOLDER (g_value_get_object (value)), NULL))
+				g_warning ("Could not set the 'simple-bind' property");
 			break;
 		case PROP_FULL_BIND:
 			gda_holder_set_full_bind (holder, GDA_HOLDER (g_value_get_object (value)));
@@ -509,7 +529,7 @@
 		case PROP_SOURCE_MODEL: {
 			GdaDataModel* ptr = g_value_get_object (value);
 			g_return_if_fail (gda_holder_set_source_model (holder, 
-									 (GdaDataModel *)ptr, -1, NULL));
+								       (GdaDataModel *)ptr, -1, NULL));
 			break;
                 }
 		case PROP_SOURCE_COLUMN:
@@ -609,7 +629,7 @@
  * Get the value held into the holder. If @holder is set to use its default value
  * and that default value is not of the same type as @holder, then %NULL is returned.
  *
- * If @holder is set to NULL, then the returned value is a GDA_TYPE_NULL GValue.
+ * If @holder is set to NULL, then the returned value is a #GDA_TYPE_NULL GValue.
  *
  * Returns: the value, or %NULL
  */
@@ -669,12 +689,13 @@
         }
 }
 
-static gboolean real_gda_holder_set_value (GdaHolder *holder, GValue *value, gboolean do_copy);
+static gboolean real_gda_holder_set_value (GdaHolder *holder, GValue *value, gboolean do_copy, GError **error);
 
 /**
  * gda_holder_set_value
  * @holder: a #GdaHolder object
- * @value: a value to set the holder to
+ * @value: a value to set the holder to, or %NULL
+ * @error: a place to store errors, or %NULL
  *
  * Sets the value within the holder. If @holder is an alias for another
  * holder, then the value is also set for that other holder.
@@ -683,17 +704,22 @@
  * as soon as this method is called, even if @holder's value does not change.
  * 
  * If the value is not different from the one already contained within @holder,
- * then @holder is not chaged and no signal is emitted.
+ * then @holder is not changed and no signal is emitted.
+ *
+ * Note1: the @value argument is treated the same way if it is %NULL or if it is a #GDA_TYPE_NULL value
+ *
+ * Note2: if @holder can't accept the @value value, then this method returns FALSE, and @holder will be left
+ * in an invalid state.
  *
  * Returns: TRUE if value has been set
  */
 gboolean
-gda_holder_set_value (GdaHolder *holder, const GValue *value)
+gda_holder_set_value (GdaHolder *holder, const GValue *value, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_HOLDER (holder), FALSE);
 	g_return_val_if_fail (holder->priv, FALSE);
 
-	return real_gda_holder_set_value (holder, (GValue*) value, TRUE);
+	return real_gda_holder_set_value (holder, (GValue*) value, TRUE, error);
 }
 
 /**
@@ -701,26 +727,27 @@
  * @holder: a #GdaHolder object
  * @dh: a #GdaDataHandler to use, or %NULL
  * @value: a value to set the holder to, as a string
+ * @error: a place to store errors, or %NULL
  *
  * Same functionality as gda_holder_set_value() except that it uses a string representation
  * of the value to set, which will be converted into a GValue first (using default data handler if
  * @dh is %NULL).
  *
- * Note that is @value is %NULL or is the "NULL" string, then @holder's value is set to %NULL.
+ * Note1: if @value is %NULL or is the "NULL" string, then @holder's value is set to %NULL.
+ * Note2: if @holder can't accept the @value value, then this method returns FALSE, and @holder will be left
+ * in an invalid state.
  *
  * Returns: TRUE if value has been set
  */
 gboolean
-gda_holder_set_value_str (GdaHolder *holder, GdaDataHandler *dh, const gchar *value)
+gda_holder_set_value_str (GdaHolder *holder, GdaDataHandler *dh, const gchar *value, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_HOLDER (holder), FALSE);
 	g_return_val_if_fail (holder->priv, FALSE);
 	g_return_val_if_fail (!dh || GDA_IS_DATA_HANDLER (dh), FALSE);
 
-	if (!value || !g_ascii_strcasecmp (value, "NULL")) {
-                gda_holder_set_value (holder, NULL);
-                return TRUE;
-        }
+	if (!value || !g_ascii_strcasecmp (value, "NULL")) 
+                return gda_holder_set_value (holder, NULL, error);
         else {
                 GValue *gdaval = NULL;
 
@@ -730,9 +757,13 @@
                         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);
-                else
+			return real_gda_holder_set_value (holder, gdaval, FALSE, error);
+                else {
+			g_set_error (error, GDA_HOLDER_ERROR, GDA_HOLDER_STRING_CONVERSION_ERROR,
+				     _("Unable to convert string to '%s' type"), 
+				     gda_g_type_to_string (holder->priv->g_type));
                         return FALSE;
+		}
         }
 }
 
@@ -740,6 +771,7 @@
  * gda_holder_take_value
  * @holder: a #GdaHolder object
  * @value: a value to set the holder to
+ * @error: a place to store errors, or %NULL
  *
  * Sets the value within the holder. If @holder is an alias for another
  * holder, then the value is also set for that other holder.
@@ -750,21 +782,23 @@
  * If the value is not different from the one already contained within @holder,
  * then @holder is not chaged and no signal is emitted.
  *
+ * Note: if @holder can't accept the @value value, then this method returns FALSE, and @holder will be left
+ * in an invalid state.
+ *
  * Returns: TRUE if value has been set
  */
 gboolean
-gda_holder_take_value (GdaHolder *holder, GValue *value)
+gda_holder_take_value (GdaHolder *holder, GValue *value, GError **error)
 {
 	g_return_val_if_fail (GDA_IS_HOLDER (holder), FALSE);
 	g_return_val_if_fail (holder->priv, FALSE);
 
-	return real_gda_holder_set_value (holder, (GValue*) value, FALSE);
+	return real_gda_holder_set_value (holder, (GValue*) value, FALSE, error);
 }
 
 static gboolean
-real_gda_holder_set_value (GdaHolder *holder, GValue *value, gboolean do_copy)
+real_gda_holder_set_value (GdaHolder *holder, GValue *value, gboolean do_copy, GError **error)
 {
-	gboolean retval = FALSE;
 	gboolean changed = TRUE;
 	gboolean newvalid;
 	const GValue *current_val;
@@ -787,16 +821,24 @@
 		changed = FALSE;
 	else if (value && current_val &&
 		 (G_VALUE_TYPE (value) == G_VALUE_TYPE ((GValue *)current_val)))
-		changed = gda_value_bcompare (value, (GValue *)current_val);
+		changed = gda_value_differ (value, (GValue *)current_val);
 		
 	/* holder's validity */
 	newvalid = TRUE;
-	if (newnull)
-		if (holder->priv->not_null)
-			newvalid = FALSE;
-
-	if (!newnull && (G_VALUE_TYPE (value) != holder->priv->g_type)) 
+	if (newnull && holder->priv->not_null) {
+		g_set_error (error, GDA_HOLDER_ERROR, GDA_HOLDER_VALUE_NULL_ERROR,
+			     _("Holder does not allow NULL values"));
+		newvalid = FALSE;
+		changed = TRUE;
+	}
+	else if (!newnull && (G_VALUE_TYPE (value) != holder->priv->g_type)) {
+		g_set_error (error, GDA_HOLDER_ERROR, GDA_HOLDER_VALUE_TYPE_ERROR,
+			     _("Wrong value type: expected type '%s' when value's type is '%s'"),
+			     gda_g_type_to_string (holder->priv->g_type),
+			     gda_g_type_to_string (G_VALUE_TYPE (value)));
 		newvalid = FALSE;
+		changed = TRUE;
+	}
 
 #ifdef DEBUG_HOLDER
 	g_print ("Changed holder %p (%s): value %s --> %s \t(type %d -> %d) VALID: %d->%d CHANGED: %d\n", 
@@ -824,7 +866,7 @@
 			holder->priv->default_forced = TRUE;
 		else if ((G_VALUE_TYPE (holder->priv->default_value) == holder->priv->g_type) &&
 			 value && (G_VALUE_TYPE (value) == holder->priv->g_type))
-			holder->priv->default_forced = !gda_value_compare_ext (holder->priv->default_value, value);
+			holder->priv->default_forced = !gda_value_compare (holder->priv->default_value, value);
 	}
 
 	/* real setting of the value */
@@ -833,7 +875,7 @@
 		g_print ("Holder %p is alias of holder %p => propagating changes to holder %p\n",
 			 holder, holder->priv->full_bind, holder->priv->full_bind);
 #endif
-		retval = real_gda_holder_set_value (holder->priv->full_bind, value, do_copy);
+		return real_gda_holder_set_value (holder->priv->full_bind, value, do_copy, error);
 	}
 	else {
 		if (holder->priv->value) {
@@ -842,17 +884,20 @@
 		}
 
 		if (value) {
-			retval = TRUE;
-			if (do_copy)
-				holder->priv->value = gda_value_copy (value);
-			else
-				holder->priv->value = value;
+			if (newvalid) {
+				if (do_copy)
+					holder->priv->value = gda_value_copy (value);
+				else
+					holder->priv->value = value;
+			}
+			else if (!do_copy) 
+				gda_value_free (value);
 		}
 
 		g_signal_emit (holder, gda_holder_signals[CHANGED], 0);
 	}
 
-	return retval;
+	return newvalid;
 }
 
 /**
@@ -995,7 +1040,7 @@
  * @value: a value to set the holder's default value, or %NULL
  *
  * Sets the default value within the holder. If @value is %NULL then @holder won't have a
- * default value anymore. To set a default value to %NULL, then pass GValue created using
+ * default value anymore. To set a default value to %NULL, then pass a #GValue created using
  * gda_value_new_null().
  *
  * NOTE: the default value does not need to be of the same type as the one required by @holder.
@@ -1008,7 +1053,7 @@
 
 	if (holder->priv->default_value) {
 		if (holder->priv->default_forced) {
-			gda_holder_take_value (holder, holder->priv->default_value);
+			gda_holder_take_value (holder, holder->priv->default_value, NULL);
 			holder->priv->default_forced = FALSE;
 			holder->priv->default_value = NULL;
 		}
@@ -1027,7 +1072,7 @@
 		    (!current || gda_value_is_null (current)))
 			holder->priv->default_forced = TRUE;
 		else if ((G_VALUE_TYPE (value) == holder->priv->g_type) &&
-			 current && !gda_value_compare_ext (value, current))
+			 current && !gda_value_compare (value, current))
 			holder->priv->default_forced = TRUE;
 
 		holder->priv->default_value = gda_value_copy ((GValue *)value);
@@ -1152,25 +1197,29 @@
  *
  * If @bind_to is %NULL, then @holder will not be bound anymore.
  */
-void
-gda_holder_set_bind (GdaHolder *holder, GdaHolder *bind_to)
+gboolean
+gda_holder_set_bind (GdaHolder *holder, GdaHolder *bind_to, GError **error)
 {
 	const GValue *cvalue;
 	GValue *value1 = NULL;
 	const GValue *value2 = NULL;
 
-	g_return_if_fail (GDA_IS_HOLDER (holder));
-	g_return_if_fail (holder->priv);
-	g_return_if_fail (holder != bind_to);
+	g_return_val_if_fail (GDA_IS_HOLDER (holder), FALSE);
+	g_return_val_if_fail (holder->priv, FALSE);
+	g_return_val_if_fail (holder != bind_to, FALSE);
 
 	if (holder->priv->simple_bind == bind_to)
-		return;
+		return TRUE;
 
 	/* get a copy of the current values of @holder and @bind_to */
 	if (bind_to) {
-		g_return_if_fail (GDA_IS_HOLDER (bind_to));
-		g_return_if_fail (bind_to->priv);
-		g_return_if_fail (holder->priv->g_type == bind_to->priv->g_type);
+		g_return_val_if_fail (GDA_IS_HOLDER (bind_to), FALSE);
+		g_return_val_if_fail (bind_to->priv, FALSE);
+		if (holder->priv->g_type != bind_to->priv->g_type) {
+			g_set_error (error, GDA_HOLDER_ERROR, GDA_HOLDER_VALUE_TYPE_ERROR,
+				     _("Cannot bind holders if their type is not the same"));
+			return FALSE;
+		}
 		value2 = gda_holder_get_value (bind_to);
 	}
 
@@ -1194,12 +1243,12 @@
 				  G_CALLBACK (full_bind_changed_cb), holder);
 
 		/* if bind_to has a different value than holder, then we set holder to the new value */
-		gda_holder_set_value (holder, value2);
 		if (value1)
 			gda_value_free (value1);
+		return gda_holder_set_value (holder, value2, error);
 	}
 	else
-		gda_holder_take_value (holder, value1);
+		return gda_holder_take_value (holder, value1, error);
 }
 
 /*

Modified: trunk/libgda/gda-holder.h
==============================================================================
--- trunk/libgda/gda-holder.h	(original)
+++ trunk/libgda/gda-holder.h	Thu Sep  4 20:08:38 2008
@@ -37,7 +37,9 @@
 #define GDA_HOLDER_ERROR gda_holder_error_quark ()
 
 typedef enum {
-	GDA_HOLDER_QUERY_LIMIT_ERROR
+	GDA_HOLDER_STRING_CONVERSION_ERROR,
+	GDA_HOLDER_VALUE_TYPE_ERROR,
+	GDA_HOLDER_VALUE_NULL_ERROR
 } GdaHolderError;
 
 /* struct for the object's data */
@@ -70,9 +72,9 @@
 
 const GValue       *gda_holder_get_value               (GdaHolder *holder);
 gchar              *gda_holder_get_value_str           (GdaHolder *holder, GdaDataHandler *dh);
-gboolean            gda_holder_set_value               (GdaHolder *holder, const GValue *value);
-gboolean            gda_holder_take_value              (GdaHolder *holder, GValue *value);
-gboolean            gda_holder_set_value_str           (GdaHolder *holder, GdaDataHandler *dh, const gchar *value);
+gboolean            gda_holder_set_value               (GdaHolder *holder, const GValue *value, GError **error);
+gboolean            gda_holder_take_value              (GdaHolder *holder, GValue *value, GError **error);
+gboolean            gda_holder_set_value_str           (GdaHolder *holder, GdaDataHandler *dh, const gchar *value, GError **error);
 
 const GValue       *gda_holder_get_default_value       (GdaHolder *holder);
 void                gda_holder_set_default_value       (GdaHolder *holder, const GValue *value);
@@ -90,7 +92,7 @@
 							 gint col, GError **error);
 GdaDataModel       *gda_holder_get_source_model         (GdaHolder *holder, gint *col);
 
-void                gda_holder_set_bind                 (GdaHolder *holder, GdaHolder *bind_to);
+gboolean            gda_holder_set_bind                 (GdaHolder *holder, GdaHolder *bind_to, GError **error);
 GdaHolder          *gda_holder_get_bind                 (GdaHolder *holder);
 
 G_END_DECLS

Modified: trunk/libgda/gda-meta-store.c
==============================================================================
--- trunk/libgda/gda-meta-store.c	(original)
+++ trunk/libgda/gda-meta-store.c	Thu Sep  4 20:08:38 2008
@@ -1859,7 +1859,10 @@
 			return FALSE;
 		}
 		
-		version = gda_data_model_get_value_at (model, 0, 0);
+		version = gda_data_model_get_value_at (model, 0, 0, error);
+		if (!version)
+			return FALSE;
+
 		if (gda_value_is_null (version) || !gda_value_isa (version, G_TYPE_STRING)) {
 			g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_INCORRECT_SCHEMA_ERROR,
 				_ ("Could not get the internal schema's version"));
@@ -1992,9 +1995,7 @@
 			if (!h)
 				g_warning (_("Parameter '%s' is not present in statement"), pname);
 			else {
-				if (!gda_holder_set_value (h, value)) {
-					g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_EXTRACT_SQL_ERROR,
-						     _("Could not set value of parameter '%s'"), pname);
+				if (!gda_holder_set_value (h, value, error)) {
 					g_object_unref (stmt);
 					g_object_unref (params);
 					va_end (ap);
@@ -2249,8 +2250,18 @@
 				h = gda_set_get_holder (schema_set->params, pid);
 				if (h) {
 					const GValue *value;
-					value = gda_data_model_get_value_at (new_data, j, i);
-					gda_holder_set_value (h, value);
+					value = gda_data_model_get_value_at (new_data, j, i, error);
+					if (!value) {
+						g_free (pid);
+						retval = FALSE;
+						goto out;
+					}
+						
+					if (! gda_holder_set_value (h, value, error)) {
+						g_free (pid);
+						retval = FALSE;
+						goto out;
+					}
 					if (change) {
 						g_hash_table_insert (change->keys, pid, gda_value_copy (value));
 						pid = NULL;
@@ -2282,8 +2293,17 @@
 					h = gda_set_get_holder (schema_set->params, pid);
 					if (h) {
 						const GValue *value;
-						value = gda_data_model_get_value_at (current, j, erow);
-						gda_holder_set_value (h, value);
+						value = gda_data_model_get_value_at (current, j, erow, error);
+						if (!value) {
+							g_free (pid);
+							retval = FALSE;
+							goto out;
+						}
+						if (!gda_holder_set_value (h, value, error)) {
+							g_free (pid);
+							retval = FALSE;
+							goto out;
+						}
 						if (change) {
 							g_hash_table_insert (change->keys, pid, gda_value_copy (value));
 							pid = NULL;
@@ -2322,9 +2342,15 @@
 					context.column_names = tfk->fk_names_array;
 					context.column_values = g_new (GValue *, context.size);
 					
-					for (k = 0; k < tfk->cols_nb; k++) 
+					for (k = 0; k < tfk->cols_nb; k++) {
 						context.column_values [k] = (GValue*) gda_data_model_get_value_at (new_data, 
-										      tfk->ref_pk_cols_array[k], i);
+									    tfk->ref_pk_cols_array[k], i, error);
+						if (!context.column_values [k]) {
+							g_free (context.column_values);
+							retval = FALSE;
+							goto out;
+						}
+					}
 #ifdef DEBUG_STORE_MODIFY
 					g_print ("Suggest update data into table '%s':", tfk->table_info->obj_name);
 					for (k = 0; k < tfk->cols_nb; k++) {
@@ -2374,8 +2400,17 @@
 					h = gda_set_get_holder (schema_set->params, pid);
 					if (h) {
 						const GValue *value;
-						value = gda_data_model_get_value_at (current, j, i);
-						gda_holder_set_value (h, value);
+						value = gda_data_model_get_value_at (current, j, i, error);
+						if (!value) {
+							g_free (pid);
+							retval = FALSE;
+							goto out;
+						}
+						if (! gda_holder_set_value (h, value, error)) {
+							g_free (pid);
+							retval = FALSE;
+							goto out;
+						}
 						if (change) {
 							g_hash_table_insert (change->keys, pid, gda_value_copy (value));
 							pid = NULL;
@@ -2395,8 +2430,14 @@
 					
 					/*g_print ("Also remove data from table '%s'...\n", tfk->table_info->obj_name);*/
 					values = g_new (const GValue *, tfk->cols_nb);
-					for (k = 0; k < tfk->cols_nb; k++) 
-						values [k] = gda_data_model_get_value_at (current, tfk->ref_pk_cols_array[k], i);
+					for (k = 0; k < tfk->cols_nb; k++) {
+						values [k] = gda_data_model_get_value_at (current, tfk->ref_pk_cols_array[k], i, error);
+						if (!values [k]) {
+							g_free (values);
+							retval = FALSE;
+							goto out;
+						}
+					}
 					if (!gda_meta_store_modify_v (store, tfk->table_info->obj_name, NULL,
 								      tfk->fk_fields_cond, error, 
 								      tfk->cols_nb, (const gchar **) tfk->fk_names_array, values)) {
@@ -2460,8 +2501,13 @@
 	gint i, erow;
 	GSList *values = NULL;
 	
-	for (i = 0; i < pk_cols_nb; i++) 
-		values = g_slist_append (values, (gpointer) gda_data_model_get_value_at (data, pk_cols[i], row));
+	for (i = 0; i < pk_cols_nb; i++) {
+		const GValue *cvalue;
+		cvalue = gda_data_model_get_value_at (data, pk_cols[i], row, error);
+		if (!cvalue)
+			return -2;
+		values = g_slist_append (values, (gpointer) cvalue);
+	}
 	erow = gda_data_model_get_row_from_values (find_in, values, pk_cols);
 	g_slist_free (values);
 	
@@ -2477,9 +2523,13 @@
 			gboolean changed = FALSE;
 			for (i = 0; i < ncols; i++) {
 				const GValue *v1, *v2;
-				v1 = gda_data_model_get_value_at (find_in, i, erow);
-				v2 = gda_data_model_get_value_at (data, i, row);
-				if (gda_value_compare_ext (v1, v2)) {
+				v1 = gda_data_model_get_value_at (find_in, i, erow, error);
+				if (!v1)
+					return -2;
+				v2 = gda_data_model_get_value_at (data, i, row, error);
+				if (!v2)
+					return -2;
+				if (gda_value_compare (v1, v2)) {
 					changed = TRUE;
 					break;
 				}
@@ -2538,7 +2588,7 @@
 		GdaHolder *h;
 		
 		h = gda_set_get_holder ((*out_cond_infos)->params, value_names [i]);
-		if (!h || !gda_holder_set_value (h, values[i])) {
+		if (!h || !gda_holder_set_value (h, values[i], NULL)) {
 			g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_INTERNAL_ERROR,
 				_ ("Could not set value for parameter '%s'"), value_names [i]);
 			return FALSE;
@@ -2850,10 +2900,14 @@
 	nrows = gda_data_model_get_n_rows (model);
 	for (i = 0; i < nrows; i++) {
 		/* FIXME: only take into account the database objects which have a corresponding DbObject */
-		if (!gda_meta_struct_complement (mstruct, GDA_META_DB_UNKNOWN,
-						 gda_data_model_get_value_at (model, 0, i),
-						 gda_data_model_get_value_at (model, 1, i),
-						 gda_data_model_get_value_at (model, 2, i), error)) {
+		const GValue *cv0, *cv1, *cv2;
+		cv0 = gda_data_model_get_value_at (model, 0, i, error);
+		if (!cv0) return NULL;
+		cv1 = gda_data_model_get_value_at (model, 1, i, error);
+		if (!cv1) return NULL;
+		cv2 = gda_data_model_get_value_at (model, 2, i, error);
+		if (!cv2) return NULL;
+		if (!gda_meta_struct_complement (mstruct, GDA_META_DB_UNKNOWN, cv0, cv1, cv2, error)) {
 			g_object_unref (mstruct);
 			g_object_unref (model);
 			return NULL;
@@ -2945,8 +2999,10 @@
 			     ngettext ("Attribute '%s' has %d value", "Attribute '%s' has %d values", nrows), 
 			     att_name, nrows);
 	else {
-		value = (GValue*) gda_data_model_get_value_at (model, 0, 0);
-		if (value && (G_VALUE_TYPE (value) == G_TYPE_STRING)) {
+		value = (GValue*) gda_data_model_get_value_at (model, 0, 0, error);
+		if (!value)
+			return FALSE;
+		if (G_VALUE_TYPE (value) == G_TYPE_STRING) {
 			const gchar *val;
 			val = g_value_get_string (value);
 			if (val) 
@@ -2997,11 +3053,8 @@
 	}
 	g_static_mutex_unlock (&set_mutex);
 
-	if (!gda_set_set_holder_value (set, "name", att_name)) {
-		g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_ATTRIBUTE_ERROR,
-			     _("Internal GdaMetaStore error"));
+	if (!gda_set_set_holder_value (set, error, "name", att_name)) 
 		return FALSE;
-	}
 	
 	/* start a transaction if possible */
 	if (! gda_connection_get_transaction_status (store->priv->cnc)) 
@@ -3020,11 +3073,9 @@
 
 	if (att_value) {
 		/* set new attribute */
-		if (!gda_set_set_holder_value (set, "value", att_value)) {
-			g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_ATTRIBUTE_ERROR,
-				     _("Internal GdaMetaStore error"));
+		if (!gda_set_set_holder_value (set, error, "value", att_value))
 			goto onerror;
-		}
+
 		if (gda_connection_statement_execute_non_select (store->priv->cnc, 
 								 klass->cpriv->prep_stmts [STMT_SET_ATT_VALUE], set,
 								 NULL, error) == -1)

Modified: trunk/libgda/gda-meta-struct.c
==============================================================================
--- trunk/libgda/gda-meta-struct.c	(original)
+++ trunk/libgda/gda-meta-struct.c	Thu Sep  4 20:08:38 2008
@@ -496,7 +496,8 @@
 			 const GValue *short_name, const GValue *full_name, const GValue *owner, GError **error)
 {
 	/* at this point icatalog, ischema and iname are NOT NULL */
-	GdaMetaDbObject *dbo = NULL;	
+	GdaMetaDbObject *dbo = NULL;
+	const GValue *cvalue;
 
 	/* create new GdaMetaDbObject or get already existing one */
 	dbo = _meta_struct_get_db_object (mstruct, icatalog, ischema, iname);
@@ -549,16 +550,30 @@
 			goto onerror;
 		}
 		
-		if (!dbo->obj_short_name)
-			dbo->obj_short_name = g_strdup (g_value_get_string (gda_data_model_get_value_at (model, 2, 0)));
-		if (!dbo->obj_full_name)
-			dbo->obj_full_name = g_strdup (g_value_get_string (gda_data_model_get_value_at (model, 3, 0)));
-		if (!dbo->obj_owner)
-			dbo->obj_owner = g_strdup (g_value_get_string (gda_data_model_get_value_at (model, 4, 0)));
+		if (!dbo->obj_short_name) {
+			cvalue = gda_data_model_get_value_at (model, 2, 0, error);
+			if (!cvalue) goto onerror;
+			dbo->obj_short_name = g_value_dup_string (cvalue);
+		}
+		if (!dbo->obj_full_name) {
+			cvalue = gda_data_model_get_value_at (model, 3, 0, error);
+			if (!cvalue) goto onerror;
+			dbo->obj_full_name = g_value_dup_string (cvalue);
+		}
+		if (!dbo->obj_owner) {
+			cvalue = gda_data_model_get_value_at (model, 4, 0, error);
+			if (!cvalue) goto onerror;
+			dbo->obj_owner = g_value_dup_string (cvalue);
+		}
 
 		mv = GDA_META_VIEW (dbo);
-		mv->view_def = g_strdup (g_value_get_string (gda_data_model_get_value_at (model, 0, 0)));
-		mv->is_updatable = g_value_get_boolean (gda_data_model_get_value_at (model, 1, 0));
+		cvalue = gda_data_model_get_value_at (model, 0, 0, error);
+		if (!cvalue) goto onerror;
+		mv->view_def = g_value_dup_string (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 1, 0, error);
+		if (!cvalue) goto onerror;
+		mv->is_updatable = g_value_get_boolean (cvalue);
 
 		/* view's dependencies, from its definition */
 		if ((mstruct->priv->features & GDA_META_STRUCT_FEATURE_VIEW_DEPENDENCIES) && 
@@ -609,42 +624,68 @@
 				     g_value_get_string (iname));
 			goto onerror;
 		}
-		if (!dbo->obj_short_name)
-			dbo->obj_short_name = g_strdup (g_value_get_string (gda_data_model_get_value_at (model, 4, 0)));
-		if (!dbo->obj_full_name)
-			dbo->obj_full_name = g_strdup (g_value_get_string (gda_data_model_get_value_at (model, 5, 0)));
+		if (!dbo->obj_short_name) {
+			cvalue = gda_data_model_get_value_at (model, 4, 0, error);
+			if (!cvalue) goto onerror;
+			dbo->obj_short_name = g_value_dup_string (cvalue);
+		}
+		if (!dbo->obj_full_name) {
+			cvalue = gda_data_model_get_value_at (model, 5, 0, error);
+			if (!cvalue) goto onerror;
+			dbo->obj_full_name = g_value_dup_string (cvalue);
+		}
 		if (!dbo->obj_owner) {
-			const GValue *cv = gda_data_model_get_value_at (model, 7, 0);
-			if (cv && !gda_value_is_null (cv))
-				dbo->obj_owner = g_strdup (g_value_get_string (cv));
+			cvalue = gda_data_model_get_value_at (model, 7, 0, error);
+			if (!cvalue) goto onerror;
+			if (!gda_value_is_null (cvalue))
+				dbo->obj_owner = g_value_dup_string (cvalue);
 		}
 
 		mt = GDA_META_TABLE (dbo);
 		for (i = 0; i < nrows; i++) {
 			GdaMetaTableColumn *tcol;
-			const GValue *val;
 			const gchar *cstr = NULL;
-			tcol = g_new0 (GdaMetaTableColumn, 1);
-			tcol->column_name = g_strdup (g_value_get_string (gda_data_model_get_value_at (model, 0, i)));
-			val = gda_data_model_get_value_at (model, 1, i);
-			if (val && !gda_value_is_null (val))
-				cstr = g_value_get_string (val);
+			tcol = g_new0 (GdaMetaTableColumn, 1); /* Note: tcol->pkey is not determined here */
+			mt->columns = g_slist_prepend (mt->columns, tcol);
+
+			cvalue = gda_data_model_get_value_at (model, 0, i, error);
+			if (!cvalue) goto onerror;
+			tcol->column_name = g_value_dup_string (cvalue);
+
+			cvalue = gda_data_model_get_value_at (model, 1, i, error);
+			if (!cvalue) goto onerror;
+			if (!gda_value_is_null (cvalue))
+				cstr = g_value_get_string (cvalue);
 			if (cstr && *cstr)
 				tcol->column_type = g_strdup (cstr);
-			else 
-				tcol->column_type = array_type_to_sql (mstruct->priv->store, 
-								       gda_data_model_get_value_at (model, 8, i));
-			tcol->gtype = gda_g_type_from_string (g_value_get_string (gda_data_model_get_value_at (model, 2, i)));
-			tcol->nullok = g_value_get_boolean (gda_data_model_get_value_at (model, 3, i));
-			val = gda_data_model_get_value_at (model, 6, i);
-			if (val && !gda_value_is_null (val))
-				tcol->default_value = g_strdup (g_value_get_string (val));
-			val = gda_data_model_get_value_at (model, 9, i);
-			if (val && !gda_value_is_null (val)) {
+			else {
+				cvalue = gda_data_model_get_value_at (model, 8, i, error);
+				if (!cvalue) goto onerror;
+				tcol->column_type = array_type_to_sql (mstruct->priv->store, cvalue); 
+				if (!tcol->column_type)
+					goto onerror;
+			}
+			
+			cvalue = gda_data_model_get_value_at (model, 2, i, error);
+			if (!cvalue) goto onerror;
+			tcol->gtype = gda_g_type_from_string (g_value_get_string (cvalue));
+
+			cvalue = gda_data_model_get_value_at (model, 3, i, error);
+			if (!cvalue) goto onerror;
+			tcol->nullok = g_value_get_boolean (cvalue);
+
+			cvalue = gda_data_model_get_value_at (model, 6, i, error);
+			if (!cvalue) goto onerror;
+			if (!gda_value_is_null (cvalue))
+				tcol->default_value = g_value_dup_string (cvalue);
+
+			cvalue = gda_data_model_get_value_at (model, 9, i, error);
+			if (!cvalue) goto onerror;
+			if (!gda_value_is_null (cvalue)) {
 				gchar **array, *tmp;
 				gint ai;
 				GArray *extra_array = NULL;
-				cstr = g_value_get_string (val);
+				cstr = g_value_get_string (cvalue);
 				array = g_strsplit (cstr, ",", 0);
 				for (ai = 0; array [ai]; ai++) {
 					if (!extra_array)
@@ -655,9 +696,6 @@
 				g_free (array); /* don't use g_strfreev() here because we have stolen the string pointers */
 				tcol->extra = extra_array;
 			}
-
-			/* Note: tcol->pkey is not determined here */
-			mt->columns = g_slist_prepend (mt->columns, tcol);
 		}
 		mt->columns = g_slist_reverse (mt->columns);
 		g_object_unref (model);
@@ -673,11 +711,13 @@
 		if (nrows >= 1) {
 			GdaDataModel *pkmodel;
 			sql = "SELECT column_name FROM _key_column_usage WHERE table_catalog = ##cc::string AND table_schema = ##cs::string AND table_name = ##tname::string AND constraint_name = ##cname::string ORDER BY ordinal_position";
+			cvalue = gda_data_model_get_value_at (model, 0, 0, error);
+			if (!cvalue) goto onerror;
 			pkmodel = gda_meta_store_extract (mstruct->priv->store, sql, error, 
 							  "cc", icatalog,
 							  "cs", ischema,
 							  "tname", iname,
-							  "cname", gda_data_model_get_value_at (model, 0, 0), NULL);
+							  "cname", cvalue, NULL);
 			if (!pkmodel) {
 				g_object_unref (model);
 				goto onerror;
@@ -687,12 +727,15 @@
 			mt->pk_cols_array = g_new0 (gint, mt->pk_cols_nb);
 			for (i = 0; i < nrows; i++) {
 				GdaMetaTableColumn *tcol;
-				tcol = gda_meta_struct_get_table_column (mstruct, mt, 
-									 gda_data_model_get_value_at (pkmodel, 0, i));
+				cvalue = gda_data_model_get_value_at (pkmodel, 0, i, error);
+				if (!cvalue) goto onerror;
+				tcol = gda_meta_struct_get_table_column (mstruct, mt, cvalue);
 				if (!tcol) {
 					mt->pk_cols_array [i] = -1;
-					g_warning (_("Internal GdaMetaStore error: column %s not found"),
-						   g_value_get_string (gda_data_model_get_value_at (pkmodel, 0, i)));
+					g_set_error (error, GDA_META_STRUCT_ERROR, GDA_META_STRUCT_INCOHERENCE_ERROR,
+						     _("Internal GdaMetaStore error: column %s not found"),
+						     g_value_get_string (cvalue));
+					goto onerror;
 				}
 				else {
 					mt->pk_cols_array [i] = g_slist_index (mt->columns, tcol);
@@ -719,9 +762,13 @@
 				GdaMetaTableForeignKey *tfk;
 				const GValue *fk_catalog, *fk_schema, *fk_name;
 				
-				fk_catalog = gda_data_model_get_value_at (model, 0, i);
-				fk_schema = gda_data_model_get_value_at (model, 1, i);
-				fk_name = gda_data_model_get_value_at (model, 2, i);
+				fk_catalog = gda_data_model_get_value_at (model, 0, i, error);
+				if (!fk_catalog) goto onfkerror;
+				fk_schema = gda_data_model_get_value_at (model, 1, i, error);
+				if (!fk_schema) goto onfkerror;
+				fk_name = gda_data_model_get_value_at (model, 2, i, error);
+				if (!fk_name) goto onfkerror;
+
 				tfk = g_new0 (GdaMetaTableForeignKey, 1);
 				tfk->meta_table = dbo;
 				tfk->depend_on = _meta_struct_get_db_object (mstruct, fk_catalog, fk_schema, fk_name);
@@ -749,16 +796,21 @@
 				sql = "SELECT k.column_name, c.ordinal_position FROM _key_column_usage k INNER JOIN _columns c ON (c.table_catalog = k.table_catalog AND c.table_schema = k.table_schema AND c.table_name=k.table_name AND c.column_name=k.column_name) WHERE k.table_catalog = ##tc::string AND k.table_schema = ##ts::string AND k.table_name = ##tname::string AND k.constraint_name = ##cname::string ORDER BY k.ordinal_position";
 				GdaDataModel *fk_cols, *ref_pk_cols;
 				gboolean fkerror = FALSE;
+				cvalue = gda_data_model_get_value_at (model, 3, i, error);
+				if (!cvalue) goto onfkerror;
 				fk_cols = gda_meta_store_extract (mstruct->priv->store, sql, error, 
 								  "tc", icatalog, 
 								  "ts", ischema, 
 								  "tname", iname, 
-								  "cname", gda_data_model_get_value_at (model, 3, i), NULL);
+								  "cname", cvalue, NULL);
+
+				cvalue = gda_data_model_get_value_at (model, 4, i, error);
+				if (!cvalue) goto onfkerror;
 				ref_pk_cols = gda_meta_store_extract (mstruct->priv->store, sql, error, 
 								      "tc", fk_catalog,
 								      "ts", fk_schema,
 								      "tname", fk_name,
-								      "cname", gda_data_model_get_value_at (model, 4, i), NULL);
+								      "cname", cvalue, NULL);
 				if (fk_cols && ref_pk_cols) {
 					gint fk_nrows, ref_pk_nrows;
 					fk_nrows = gda_data_model_get_n_rows (fk_cols);
@@ -774,14 +826,20 @@
 						tfk->ref_pk_names_array = g_new0 (gchar *, fk_nrows);
 						for (n = 0; n < fk_nrows; n++) {
 							const GValue *cv;
-							cv = gda_data_model_get_value_at (fk_cols, 1, n);
+							cv = gda_data_model_get_value_at (fk_cols, 1, n, error);
+							if (!cv) goto onfkerror;
 							tfk->fk_cols_array [n] = g_value_get_int (cv);
-							cv = gda_data_model_get_value_at (fk_cols, 0, n);
+
+							cv = gda_data_model_get_value_at (fk_cols, 0, n, error);
+							if (!cv) goto onfkerror;
 							tfk->fk_names_array [n] = g_value_dup_string (cv);
 
-							cv = gda_data_model_get_value_at (ref_pk_cols, 1, n);
+							cv = gda_data_model_get_value_at (ref_pk_cols, 1, n, error);
+							if (!cv) goto onfkerror;
 							tfk->ref_pk_cols_array [n] = g_value_get_int (cv);
-							cv = gda_data_model_get_value_at (ref_pk_cols, 0, n);
+
+							cv = gda_data_model_get_value_at (ref_pk_cols, 0, n, error);
+							if (!cv) goto onfkerror;
 							tfk->ref_pk_names_array [n] = g_value_dup_string (cv);
 						}
 					}
@@ -789,22 +847,34 @@
 				else
 					fkerror = TRUE;
 
-				if (fkerror)
-					g_warning (_("Meta data incoherence in foreign key constraint for table %s.%s.%s "
-						     "referencing table %s.%s.%s"),
-						   g_value_get_string (icatalog), 
-						   g_value_get_string (ischema), 
-						   g_value_get_string (iname),
-						   g_value_get_string (fk_catalog), 
-						   g_value_get_string (fk_schema), 
-						   g_value_get_string (fk_name));
+				if (fkerror) {
+					g_set_error (error, GDA_META_STRUCT_ERROR, GDA_META_STRUCT_INCOHERENCE_ERROR,
+						     _("Meta data incoherence in foreign key constraint for table %s.%s.%s "
+						       "referencing table %s.%s.%s"),
+						     g_value_get_string (icatalog), 
+						     g_value_get_string (ischema), 
+						     g_value_get_string (iname),
+						     g_value_get_string (fk_catalog), 
+						     g_value_get_string (fk_schema), 
+						     g_value_get_string (fk_name));
+					goto onfkerror;
+				}
 				if (fk_cols)
 					g_object_unref (fk_cols);
 				if (ref_pk_cols)
 					g_object_unref (ref_pk_cols);
 				
+				mt->fk_list = g_slist_prepend (mt->fk_list, tfk);
+				continue;
+
+			onfkerror:
+				if (fk_cols)
+					g_object_unref (fk_cols);
+				if (ref_pk_cols)
+					g_object_unref (ref_pk_cols);
 				
 				mt->fk_list = g_slist_prepend (mt->fk_list, tfk);
+				goto onerror;
 			}
 			mt->fk_list = g_slist_reverse (mt->fk_list);
 			g_object_unref (model);
@@ -905,17 +975,25 @@
 		return g_strdup ("[]");
 	}
 	
-	cvalue = gda_data_model_get_value_at (model, 0, 0);
-	if (!cvalue || gda_value_is_null (cvalue) || !g_value_get_string (cvalue)) {
+	cvalue = gda_data_model_get_value_at (model, 0, 0, NULL);
+	if (!cvalue)
+		return NULL;
+	if (gda_value_is_null (cvalue) || !g_value_get_string (cvalue)) {
 		/* use array_spec */
 		gchar *str2;
-		cvalue = gda_data_model_get_value_at (model, 1, 0);
+		cvalue = gda_data_model_get_value_at (model, 1, 0, NULL);
+		if (!cvalue)
+			return NULL;
 		str2 = array_type_to_sql (store, cvalue);
 		str = g_strdup_printf ("%s[]", str2);
 		g_free (str2);
 	}
-	else
-		str = g_strdup_printf ("%s[]", g_value_get_string (gda_data_model_get_value_at (model, 0, 0)));
+	else {
+		cvalue = gda_data_model_get_value_at (model, 0, 0, NULL);
+		if (!cvalue)
+			return NULL;
+		str = g_strdup_printf ("%s[]", g_value_get_string (cvalue));
+	}
 	g_object_unref (model);
 	return str;
 }
@@ -940,7 +1018,8 @@
 				   GError **error)
 {
 	GdaDataModel *tables_model = NULL, *views_model = NULL;
-	gint i, nrows;
+	gint i, nrows, k;
+	const GValue *cvalues[6];
 	
 	/* schema and catalog are known */
 	const gchar *sql1 = "SELECT table_name "
@@ -1002,13 +1081,21 @@
 	/* tables */
 	nrows = gda_data_model_get_n_rows (tables_model);
 	for (i = 0; i < nrows; i++) {
+		for (k = 0; k <= 5; k++) {
+			cvalues [k] = gda_data_model_get_value_at (tables_model, k, i, error);
+			if (!cvalues [k]) {
+				g_object_unref (tables_model);
+				g_object_unref (views_model);
+				return FALSE;
+			}
+		}
 		if (!_meta_struct_complement (mstruct, GDA_META_DB_TABLE,
-					      catalog ? catalog : gda_data_model_get_value_at (tables_model, 4, i),
-					      schema ? schema : gda_data_model_get_value_at (tables_model, 5, i),
-					      gda_data_model_get_value_at (tables_model, 3, i), 
-					      gda_data_model_get_value_at (tables_model, 0, i), 
-					      gda_data_model_get_value_at (tables_model, 1, i), 
-					      gda_data_model_get_value_at (tables_model, 2, i), error)) {
+					      catalog ? catalog : cvalues [4],
+					      schema ? schema : cvalues [5],
+					      cvalues [3],
+					      cvalues [0],
+					      cvalues [1],
+					      cvalues [2], error)) {
 			g_object_unref (tables_model);
 			g_object_unref (views_model);
 			return FALSE;
@@ -1016,16 +1103,23 @@
 	}
 	g_object_unref (tables_model);
 
-	/* tables */
+	/* views */
 	nrows = gda_data_model_get_n_rows (views_model);
 	for (i = 0; i < nrows; i++) {
+		for (k = 0; k <= 5; k++) {
+			cvalues [k] = gda_data_model_get_value_at (views_model, k, i, error);
+			if (!cvalues [k]) {
+				g_object_unref (views_model);
+				return FALSE;
+			}
+		}
 		if (!_meta_struct_complement (mstruct, GDA_META_DB_VIEW,
-					      catalog ? catalog : gda_data_model_get_value_at (views_model, 4, i),
-					      schema ? schema : gda_data_model_get_value_at (views_model, 5, i),
-					      gda_data_model_get_value_at (views_model, 3, i), 
-					      gda_data_model_get_value_at (views_model, 0, i), 
-					      gda_data_model_get_value_at (views_model, 1, i), 
-					      gda_data_model_get_value_at (views_model, 2, i), error)) {
+					      catalog ? catalog : cvalues [4],
+					      schema ? schema : cvalues [5],
+					      cvalues [3],
+					      cvalues [0],
+					      cvalues [1],
+					      cvalues [2], error)) {
 			g_object_unref (views_model);
 			return FALSE;
 		}
@@ -1050,7 +1144,8 @@
 gda_meta_struct_complement_default (GdaMetaStruct *mstruct, GError **error)
 {
 	GdaDataModel *model;
-	gint i, nrows;
+	gint i, nrows, k;
+	const GValue *cvalues[6];
 	const gchar *sql1 = "SELECT table_catalog, table_schema, table_name, table_short_name, table_full_name, table_owner "
 		"FROM _tables WHERE table_short_name = table_name AND table_type='BASE TABLE' "
 		"ORDER BY table_schema, table_name";
@@ -1067,13 +1162,17 @@
 		return FALSE;
 	nrows = gda_data_model_get_n_rows (model);
 	for (i = 0; i < nrows; i++) {
+		for (k = 0; k <= 5; k++) {
+			cvalues [k] = gda_data_model_get_value_at (model, k, i, error);
+			if (!cvalues [k]) {
+				g_object_unref (model);
+				return FALSE;
+			}
+		}
 		if (!_meta_struct_complement (mstruct, GDA_META_DB_TABLE,
-					      gda_data_model_get_value_at (model, 0, i),
-					      gda_data_model_get_value_at (model, 1, i),
-					      gda_data_model_get_value_at (model, 2, i),
-					      gda_data_model_get_value_at (model, 3, i),
-					      gda_data_model_get_value_at (model, 4, i),
-					      gda_data_model_get_value_at (model, 5, i), error)) {
+					      cvalues [0], cvalues [1],
+					      cvalues [2], cvalues [3],
+					      cvalues [4], cvalues [5], error)) {
 			g_object_unref (model);
 			return FALSE;
 		}
@@ -1086,13 +1185,17 @@
 		return FALSE;
 	nrows = gda_data_model_get_n_rows (model);
 	for (i = 0; i < nrows; i++) {
+		for (k = 0; k <= 5; k++) {
+			cvalues [k] = gda_data_model_get_value_at (model, k, i, error);
+			if (!cvalues [k]) {
+				g_object_unref (model);
+				return FALSE;
+			}
+		}
 		if (!_meta_struct_complement (mstruct, GDA_META_DB_VIEW,
-					      gda_data_model_get_value_at (model, 0, i),
-					      gda_data_model_get_value_at (model, 1, i),
-					      gda_data_model_get_value_at (model, 2, i),
-					      gda_data_model_get_value_at (model, 3, i),
-					      gda_data_model_get_value_at (model, 4, i),
-					      gda_data_model_get_value_at (model, 5, i), error)) {
+					      cvalues [0], cvalues [1],
+					      cvalues [2], cvalues [3],
+					      cvalues [4], cvalues [5], error)) {
 			g_object_unref (model);
 			return FALSE;
 		}
@@ -1609,6 +1712,8 @@
 					  GValue **out_full_name, GValue **out_owner, 
 					  const GValue *schema, const GValue *name)
 {
+	const GValue *cvalue;
+	GdaDataModel *model = NULL;
 	*out_catalog = NULL;
 	*out_short_name = NULL;
 	*out_full_name = NULL;
@@ -1636,7 +1741,6 @@
 
 	case GDA_META_DB_TABLE: {
 		const gchar *sql = "SELECT table_catalog, table_short_name, table_full_name, table_owner FROM _tables as t WHERE table_schema = ##ts::string AND table_short_name = ##tname::string AND table_name NOT IN (SELECT v.table_name FROM _views as v WHERE v.table_catalog=t.table_catalog AND v.table_schema=t.table_schema)";
-		GdaDataModel *model;
 		gint nrows;
 		model = gda_meta_store_extract (mstruct->priv->store, sql, NULL, "ts", schema, "tname", name, NULL);
 		if (!model) 
@@ -1647,17 +1751,28 @@
 			g_object_unref (model);
 			return FALSE;
 		}
-		*out_catalog = gda_value_copy (gda_data_model_get_value_at (model, 0, 0));
-		*out_short_name = gda_value_copy (gda_data_model_get_value_at (model, 1, 0));
-		*out_full_name = gda_value_copy (gda_data_model_get_value_at (model, 2, 0));
-		*out_owner = gda_value_copy (gda_data_model_get_value_at (model, 3, 0));
+		cvalue = gda_data_model_get_value_at (model, 0, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_catalog = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 1, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_short_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 2, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_full_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 3, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_owner = gda_value_copy (cvalue);
+
 		g_object_unref (model);
 		return TRUE;
 	}
 
 	case GDA_META_DB_VIEW:{
 		const gchar *sql = "SELECT table_catalog, table_short_name, table_full_name, table_owner FROM _tables NATURAL JOIN _views WHERE table_schema = ##ts::string AND table_short_name = ##tname::string";
-		GdaDataModel *model;
 		gint nrows;
 		model = gda_meta_store_extract (mstruct->priv->store, sql, NULL, "ts", schema, "tname", name, NULL);
 		if (!model) 
@@ -1668,10 +1783,22 @@
 			g_object_unref (model);
 			return FALSE;
 		}
-		*out_catalog = gda_value_copy (gda_data_model_get_value_at (model, 0, 0));
-		*out_short_name = gda_value_copy (gda_data_model_get_value_at (model, 1, 0));
-		*out_full_name = gda_value_copy (gda_data_model_get_value_at (model, 2, 0));
-		*out_owner = gda_value_copy (gda_data_model_get_value_at (model, 3, 0));
+		cvalue = gda_data_model_get_value_at (model, 0, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_catalog = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 1, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_short_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 2, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_full_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 3, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_owner = gda_value_copy (cvalue);
+
 		g_object_unref (model);
 		return TRUE;
 	}
@@ -1679,6 +1806,26 @@
 		TO_IMPLEMENT;
 	}
 
+ copyerror:
+	if (model)
+		g_object_unref (model);
+	if (*out_catalog) {
+		gda_value_free (*out_catalog);
+		*out_catalog = NULL;
+	}
+	if (*out_short_name) {
+		gda_value_free (*out_short_name);
+		*out_short_name = NULL;
+	}
+	if (*out_full_name) {
+		gda_value_free (*out_full_name);
+		*out_full_name = NULL;
+	}
+	if (*out_owner) {
+		gda_value_free (*out_owner);
+		*out_owner = NULL;
+	}
+
 	return FALSE;
 }
 
@@ -1688,6 +1835,8 @@
 				     GValue **out_schema, GValue **out_name, GValue **out_short_name, 
 				     GValue **out_full_name, GValue **out_owner, const GValue *name)
 {
+	const GValue *cvalue;
+	GdaDataModel *model = NULL;
 	*out_name = NULL;
 	*out_schema = NULL;
 	*out_catalog = NULL;
@@ -1716,7 +1865,6 @@
 
 	case GDA_META_DB_TABLE: {
 		const gchar *sql = "SELECT table_catalog, table_schema, table_name, table_short_name, table_full_name, table_owner FROM _tables as t WHERE table_short_name = ##tname::string AND table_name NOT IN (SELECT v.table_name FROM _views as v WHERE v.table_catalog=t.table_catalog AND v.table_schema=t.table_schema)";
-		GdaDataModel *model;
 		gint nrows;
 		model = gda_meta_store_extract (mstruct->priv->store, sql, NULL, "tname", name, NULL);
 		if (!model) 
@@ -1727,19 +1875,37 @@
 			g_object_unref (model);
 			goto next;
 		}
-		*out_catalog = gda_value_copy (gda_data_model_get_value_at (model, 0, 0));
-		*out_schema = gda_value_copy (gda_data_model_get_value_at (model, 1, 0));
-		*out_name = gda_value_copy (gda_data_model_get_value_at (model, 2, 0));
-		*out_short_name = gda_value_copy (gda_data_model_get_value_at (model, 3, 0));
-		*out_full_name = gda_value_copy (gda_data_model_get_value_at (model, 4, 0));
-		*out_owner = gda_value_copy (gda_data_model_get_value_at (model, 5, 0));
+
+		cvalue = gda_data_model_get_value_at (model, 0, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_catalog = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 1, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_schema = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 2, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 3, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_short_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 4, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_full_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 5, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_owner = gda_value_copy (cvalue);
+
 		g_object_unref (model);
 		return TRUE;
 	}
 
 	case GDA_META_DB_VIEW:{
 		const gchar *sql = "SELECT table_catalog, table_schema, table_name, table_short_name, table_full_name, table_owner FROM _tables NATURAL JOIN _views WHERE table_short_name = ##tname::string";
-		GdaDataModel *model;
 		gint nrows;
 		model = gda_meta_store_extract (mstruct->priv->store, sql, NULL, "tname", name, NULL);
 		if (!model) 
@@ -1750,12 +1916,31 @@
 			g_object_unref (model);
 			goto next;
 		}
-		*out_catalog = gda_value_copy (gda_data_model_get_value_at (model, 0, 0));
-		*out_schema = gda_value_copy (gda_data_model_get_value_at (model, 1, 0));
-		*out_name = gda_value_copy (gda_data_model_get_value_at (model, 2, 0));
-		*out_short_name = gda_value_copy (gda_data_model_get_value_at (model, 3, 0));
-		*out_full_name = gda_value_copy (gda_data_model_get_value_at (model, 4, 0));
-		*out_owner = gda_value_copy (gda_data_model_get_value_at (model, 5, 0));
+
+		cvalue = gda_data_model_get_value_at (model, 0, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_catalog = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 1, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_schema = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 2, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 3, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_short_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 4, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_full_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 5, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_owner = gda_value_copy (cvalue);
+
 		g_object_unref (model);
 		return TRUE;
 	}
@@ -1796,6 +1981,34 @@
 		}
 	}
 
+ copyerror:
+	if (model)
+		g_object_unref (model);
+	if (*out_catalog) {
+		gda_value_free (*out_catalog);
+		*out_catalog = NULL;
+	}
+	if (*out_schema) {
+		gda_value_free (*out_schema);
+		*out_schema = NULL;
+	}
+	if (*out_name) {
+		gda_value_free (*out_name);
+		*out_name = NULL;
+	}
+	if (*out_short_name) {
+		gda_value_free (*out_short_name);
+		*out_short_name = NULL;
+	}
+	if (*out_full_name) {
+		gda_value_free (*out_full_name);
+		*out_full_name = NULL;
+	}
+	if (*out_owner) {
+		gda_value_free (*out_owner);
+		*out_owner = NULL;
+	}
+
 	return FALSE;
 }
 
@@ -1807,32 +2020,76 @@
 {
 	/* try as a view first */
 	const gchar *sql = "SELECT table_short_name, table_full_name, table_owner FROM _tables NATURAL JOIN _views WHERE table_catalog = ##tc::string AND table_schema = ##ts::string AND table_name = ##tname::string";
-	GdaDataModel *model;
+	GdaDataModel *model = NULL;
+	const GValue *cvalue;
+
+	*out_type = GDA_META_DB_UNKNOWN;
+	*out_short_name = NULL;
+	*out_full_name = NULL;
+	*out_owner = NULL;
 
 	model = gda_meta_store_extract (mstruct->priv->store, sql, NULL, "tc", catalog, "ts", schema, "tname", name, NULL);
 	if (model && (gda_data_model_get_n_rows (model) == 1)) {
 		*out_type = GDA_META_DB_VIEW;
-		*out_short_name = gda_value_copy (gda_data_model_get_value_at (model, 0, 0));
-		*out_full_name = gda_value_copy (gda_data_model_get_value_at (model, 1, 0));
-		*out_owner = gda_value_copy (gda_data_model_get_value_at (model, 2, 0));
+		
+		cvalue = gda_data_model_get_value_at (model, 0, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_short_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 1, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_full_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 2, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_owner = gda_value_copy (cvalue);
+
 		g_object_unref (model);
 		return TRUE;
 	}
-	if (model) g_object_unref (model);
+	if (model)
+		g_object_unref (model);
 
 	/* try as a table */
 	sql = "SELECT table_short_name, table_full_name, table_owner FROM _tables WHERE table_catalog = ##tc::string AND table_schema = ##ts::string AND table_name = ##tname::string";
 	model = gda_meta_store_extract (mstruct->priv->store, sql, NULL, "tc", catalog, "ts", schema, "tname", name, NULL);
 	if (model && (gda_data_model_get_n_rows (model) == 1)) {
 		*out_type = GDA_META_DB_TABLE;
-		*out_short_name = gda_value_copy (gda_data_model_get_value_at (model, 0, 0));
-		*out_full_name = gda_value_copy (gda_data_model_get_value_at (model, 1, 0));
-		*out_owner = gda_value_copy (gda_data_model_get_value_at (model, 2, 0));
+
+		cvalue = gda_data_model_get_value_at (model, 0, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_short_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 1, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_full_name = gda_value_copy (cvalue);
+
+		cvalue = gda_data_model_get_value_at (model, 2, 0, NULL);
+		if (!cvalue) goto copyerror;
+		*out_owner = gda_value_copy (cvalue);
+
 		g_object_unref (model);
 		return TRUE;
 	}
 	if (model) g_object_unref (model);
 	
+copyerror:
+	if (model)
+		g_object_unref (model);
+
+	*out_type = GDA_META_DB_UNKNOWN;
+	if (*out_short_name) {
+		gda_value_free (*out_short_name);
+		*out_short_name = NULL;
+	}
+	if (*out_full_name) {
+		gda_value_free (*out_full_name);
+		*out_full_name = NULL;
+	}
+	if (*out_owner) {
+		gda_value_free (*out_owner);
+		*out_owner = NULL;
+	}
 	return FALSE;
 }
 

Modified: trunk/libgda/gda-server-operation.c
==============================================================================
--- trunk/libgda/gda-server-operation.c	(original)
+++ trunk/libgda/gda-server-operation.c	Thu Sep  4 20:08:38 2008
@@ -332,8 +332,10 @@
 	}
 
 	g_free (node->path_name);
-	op->priv->topnodes = g_slist_remove (op->priv->topnodes, node);
-	op->priv->allnodes = g_slist_remove (op->priv->allnodes, node);
+	if (op) {
+		op->priv->topnodes = g_slist_remove (op->priv->topnodes, node);
+		op->priv->allnodes = g_slist_remove (op->priv->allnodes, node);
+	}
 
 	g_free (node);
 }
@@ -464,7 +466,7 @@
 	return retval;
 }
 
-static GSList *load_xml_spec (GdaServerOperation *op, xmlNodePtr specnode, const gchar *root);
+static GSList *load_xml_spec (GdaServerOperation *op, xmlNodePtr specnode, const gchar *root, GError **error);
 
 /* add a new item to @node and inserts it into @op's private structures */
 static void
@@ -472,6 +474,7 @@
 {
 	gchar *path, *seq_path;
 	Node *new_node;
+	GSList *seq_item_nodes;
 
 	g_assert (node);
 	g_assert (node->type == GDA_SERVER_OPERATION_NODE_SEQUENCE);
@@ -479,13 +482,16 @@
 	seq_path = node_get_complete_path (op, node);
 	path = g_strdup_printf ("%s/%d", seq_path, g_slist_length (node->d.seq.seq_items));
 
+	seq_item_nodes = load_xml_spec (op, node->d.seq.xml_spec, path, NULL);
+	g_assert (seq_item_nodes);
+
 	new_node = node_new (node, GDA_SERVER_OPERATION_NODE_SEQUENCE_ITEM, NULL);
 	op->priv->allnodes = g_slist_append (op->priv->allnodes, new_node);
 	new_node->d.seq_item_nodes = NULL;
 	new_node->status = node->status;
 	node->d.seq.seq_items = g_slist_append (node->d.seq.seq_items, new_node);
 
-	new_node->d.seq_item_nodes = load_xml_spec (op, node->d.seq.xml_spec, path);
+	new_node->d.seq_item_nodes = seq_item_nodes;
 
 	clean_nodes_info_cache (op);
 #ifdef GDA_DEBUG_signal
@@ -632,9 +638,17 @@
 		}
 	}
 
-	if (op->priv->xml_spec_doc && op->priv->cnc_set && op->priv->prov_set) 
+	if (op->priv->xml_spec_doc && op->priv->cnc_set && op->priv->prov_set) {
 		/* load XML file */
-		op->priv->topnodes = load_xml_spec (op, xmlDocGetRootElement (op->priv->xml_spec_doc), NULL);
+		GError *lerror = NULL;
+		op->priv->topnodes = load_xml_spec (op, xmlDocGetRootElement (op->priv->xml_spec_doc), NULL, &lerror);
+		if (!op->priv->topnodes) {
+			g_warning (_("Could not load XML specifications: %s"),
+				   lerror && lerror->message ? lerror->message : _("No detail"));
+			if (lerror)
+				g_error_free (lerror);
+		}
+	}
 }
 
 static void
@@ -689,7 +703,7 @@
 }
 
 static GSList *
-load_xml_spec (GdaServerOperation *op, xmlNodePtr specnode, const gchar *root)
+load_xml_spec (GdaServerOperation *op, xmlNodePtr specnode, const gchar *root, GError **error)
 {
 	xmlNodePtr node;
 	const gchar *lang = gda_lang_locale;
@@ -708,7 +722,7 @@
 		node = specnode->children;
 		while (node && (xmlNodeIsText (node) || strcmp ((gchar*)node->name, "sources"))) 
 		node = node->next; 
-		if (node && !strcmp ((gchar*)node->name, "sources")){
+		if (node && !strcmp ((gchar*)node->name, "sources")) {
 			for (node = node->xmlChildrenNode; (node != NULL); node = node->next) {
 				if (xmlNodeIsText (node)) 
 					continue;
@@ -721,7 +735,11 @@
 					errors = gda_data_model_import_get_errors (GDA_DATA_MODEL_IMPORT (model));
 					if (errors) {
 						g_object_unref (model);
-						model = NULL;
+						if (sources) {
+							g_slist_foreach (sources, (GFunc) g_object_unref, NULL);
+							g_slist_free (sources);
+							return NULL;
+						}
 					}
 					else  {
 						xmlChar *str;
@@ -741,7 +759,6 @@
 	while (node) {
 		xmlChar *id, *this_lang;
 		gchar *complete_path = NULL, *path_name = NULL;
-		GError *error = NULL;
 		Node *opnode = NULL;
 		Node *old_opnode;
 
@@ -790,13 +807,8 @@
 		if (!strcmp ((gchar*)node->name, "parameters")) {
 			GdaSet *plist;
 
-			plist = gda_set_new_from_spec_node (node, &error);
-			if (!plist) {
-				g_warning (_("GdaServerOperation: error loading GdaSet spec %s: '%s'"), 
-					   complete_path, error && error->message ? error->message : _("No detail"));
-				g_error_free (error);
-			}
-			else {
+			plist = gda_set_new_from_spec_node (node, error);
+			if (plist) {
 				opnode = node_new (parent, GDA_SERVER_OPERATION_NODE_PARAMLIST, path_name);
 				opnode->d.plist = plist;
 			}
@@ -806,10 +818,7 @@
 			GdaDataModel *import;
 
 			import = gda_data_model_import_new_xml_node (node);
-			if (!import) {
-				TO_IMPLEMENT;
-			}
-			else {
+			if (import) {
 				GdaDataModel *model;
 				model = (GdaDataModel*) gda_data_model_array_copy_model (import, NULL);
 				opnode = node_new (parent, GDA_SERVER_OPERATION_NODE_DATA_MODEL, path_name);
@@ -855,8 +864,13 @@
 				xmlFree (prop);
 			}
 
-			seq_tmpl = load_xml_spec (op, node, complete_path);
-			opnode->d.seq.seq_tmpl = seq_tmpl;
+			seq_tmpl = load_xml_spec (op, node, complete_path, error);
+			if (! seq_tmpl) {
+				node_destroy (NULL, opnode);
+				opnode = NULL;
+			}
+			else
+				opnode->d.seq.seq_tmpl = seq_tmpl;
 		}
 
 		/* GDA_SERVER_OPERATION_NODE_PARAM */
@@ -870,13 +884,14 @@
 							  "g_type", 
 							  gdatype ? gda_g_type_from_string ((gchar*) gdatype) : G_TYPE_STRING,
 							  NULL));
-			if (gdatype) xmlFree (gdatype);
+			if (gdatype)
+				xmlFree (gdatype);
 			
 			/* set parameter's attributes */
-			gda_utility_holder_load_attributes (param, node, op->priv->sources);
-			
-			opnode = node_new (parent, GDA_SERVER_OPERATION_NODE_PARAM, path_name);
-			opnode->d.param = param;
+			if (gda_utility_holder_load_attributes (param, node, op->priv->sources, error)) {
+				opnode = node_new (parent, GDA_SERVER_OPERATION_NODE_PARAM, path_name);
+				opnode->d.param = param;
+			}
 		}
 		else {
 			node = node->next;
@@ -910,7 +925,12 @@
 				}
 			}
 		}
-		
+		else {
+			g_free (path_name);
+			g_free (complete_path);
+			g_slist_free (retlist);
+			return NULL;
+		}
 		g_free (path_name);
 		g_free (complete_path);
 		node = node->next;
@@ -1129,7 +1149,7 @@
 	}
 }
 
-static void node_save (GdaServerOperation *op, Node *opnode, xmlNodePtr parent);
+static gboolean node_save (GdaServerOperation *op, Node *opnode, xmlNodePtr parent);
 
 /**
  * gda_server_operation_save_data_to_xml
@@ -1155,18 +1175,21 @@
 	xmlSetProp (topnode, BAD_CAST "type", 
 		    BAD_CAST gda_server_operation_op_type_to_string (gda_server_operation_get_op_type (op)));
 
-	list = op->priv->topnodes;
-	while (list) {
-		node_save (op, NODE (list->data), topnode);
-		list = g_slist_next (list);
+	for (list = op->priv->topnodes; list; list = list->next) {
+		if (!node_save (op, NODE (list->data), topnode)) {
+			xmlFreeNode (topnode);
+			topnode = NULL;
+			break;
+		}
 	}
 
 	return topnode;
 }
 
-static void
+static gboolean
 node_save (GdaServerOperation *op, Node *opnode, xmlNodePtr parent)
 {
+	gboolean retval = TRUE;
 	xmlNodePtr node;
 	GSList *list;
 	gchar *complete_path;
@@ -1203,7 +1226,8 @@
 	case GDA_SERVER_OPERATION_NODE_DATA_MODEL:
 		node = xmlNewChild (parent, NULL, BAD_CAST "op_data", NULL);
 		xmlSetProp(node, (xmlChar*)"path", (xmlChar*)complete_path);
-		gda_utility_data_model_dump_data_to_xml (opnode->d.model, node, NULL, 0, NULL, 0, TRUE);
+		if (!gda_utility_data_model_dump_data_to_xml (opnode->d.model, node, NULL, 0, NULL, 0, TRUE))
+			retval = FALSE;
 		break;
 	case GDA_SERVER_OPERATION_NODE_PARAM: {
 		const GValue *value;
@@ -1227,14 +1251,20 @@
 		GSList *list;
 		
 		for (list =  opnode->d.seq.seq_items; list; list = list->next) 
-			node_save (op, NODE (list->data), parent);
+			if (!node_save (op, NODE (list->data), parent)) {
+				retval = FALSE;
+				break;
+			}
 		break;
 	}
 	case GDA_SERVER_OPERATION_NODE_SEQUENCE_ITEM: {
 		GSList *list;
 		
 		for (list =  opnode->d.seq_item_nodes; list; list = list->next) 
-			node_save (op, NODE (list->data), parent);
+			if (! node_save (op, NODE (list->data), parent)) {
+				retval = FALSE;
+				break;
+			}
 		break;
 	}
 	default:
@@ -1242,6 +1272,7 @@
 	}
 
 	g_free (complete_path);
+	return retval;
 }
 
 /**
@@ -1355,12 +1386,8 @@
 								GValue *v;
 								v = gda_value_new_from_string ((gchar*)contents->content, 
 											       gda_holder_get_g_type (param));
-								if (!gda_holder_take_value (param, v)) {
-									g_set_error (error, 0, 0,
-										     _("Could not set parameter '%s' to value '%s'"), 
-										     prop, cur->content);
+								if (!gda_holder_take_value (param, v, error)) 
 									allok = FALSE;
-								}
 							}
 						}
 					}
@@ -1380,11 +1407,8 @@
 						GValue *v;
 						v = gda_value_new_from_string ((gchar*)contents->content, 
 									       gda_holder_get_g_type (opnode->d.param));
-						if (!gda_holder_take_value (opnode->d.param, v)) {
-							g_set_error (error, 0, 0,
-								     _("Could not set parameter '%s' to value '%s'"), prop, cur->content);
+						if (!gda_holder_take_value (opnode->d.param, v, error)) 
 							allok = FALSE;
-						}
 					}
 					break;
 				}
@@ -1860,7 +1884,7 @@
 				if (row >= 0) 
 					value = gda_data_model_get_value_at (node_info->model, 
 									     gda_column_get_position (node_info->column), 
-									     row);
+									     row, NULL);
 				g_free(extension);
 			}
 			g_free (str);
@@ -1980,12 +2004,8 @@
 									       gda_holder_get_g_type (param));
 					else
 						v = gda_value_new_null ();
-					if (!gda_holder_take_value (param, v)) {
-						g_set_error (error, 0, 0,
-							     _("Could not set parameter '%s' to value '%s'"), 
-							     path, value);
+					if (!gda_holder_take_value (param, v, error))
 						allok = FALSE;
-					}
 				}
 			}
 			break;
@@ -2043,12 +2063,8 @@
 							       gda_holder_get_g_type (opnode->d.param));
 			else
 				v = gda_value_new_null ();
-			if (!gda_holder_take_value (opnode->d.param, v)) {
-				g_set_error (error, 0, 0,
-					     _("Could not set parameter '%s' to value '%s'"), 
-					     path, value);
+			if (!gda_holder_take_value (opnode->d.param, v, error))
 				allok = FALSE;
-			}
 			break;
 		}
 		case GDA_SERVER_OPERATION_NODE_SEQUENCE:

Modified: trunk/libgda/gda-server-provider-extra.c
==============================================================================
--- trunk/libgda/gda-server-provider-extra.c	(original)
+++ trunk/libgda/gda-server-provider-extra.c	Thu Sep  4 20:08:38 2008
@@ -514,32 +514,6 @@
 	g_object_ref (dh);
 }
 
-
-/*
- * Find the GType of a DBMS type using the TYPES schema array
- */
-static GType
-find_gtype (GdaDataModel *types, const gchar *name)
-{
-	GType gtype = G_TYPE_INVALID;
-	gint row, nrows;
-	nrows = gda_data_model_get_n_rows (types);
-	for (row = 0; (row < nrows) && (gtype == G_TYPE_INVALID); row++) {
-		const GValue *value;
-		value = gda_data_model_get_value_at (types, 0, row);
-		if (value && gda_value_isa (value, G_TYPE_STRING)) {
-			const gchar *t = g_value_get_string ((GValue*) value);
-			if (!strcmp (t, name)) {
-				value = gda_data_model_get_value_at (types, 3, row);
-				if (value && gda_value_isa (value, G_TYPE_ULONG))
-					gtype = g_value_get_ulong (value);
-			}
-		}
-	}
-	
-	return gtype;
-}
-
 /*
  * Tries to create a list of Key fields for table @table_name using @dict (and if @dict does not know about
  * that table, get the FIELDS schema from the provider)

Modified: trunk/libgda/gda-set.c
==============================================================================
--- trunk/libgda/gda-set.c	(original)
+++ trunk/libgda/gda-set.c	Thu Sep  4 20:08:38 2008
@@ -336,11 +336,12 @@
 GdaSet *
 gda_set_new_inline (gint nb, ...)
 {
-	GdaSet *set;
+	GdaSet *set = NULL;
 	GSList *holders = NULL;
 	va_list ap;
 	gchar *id;
 	gint i;
+	gboolean allok = TRUE;
 
 	/* build the list of holders */
 	va_start (ap, nb);
@@ -348,6 +349,7 @@
 		GType type;
 		GdaHolder *holder;
 		GValue *value;
+		GError *lerror = NULL;
 
 		id = va_arg (ap, char *);
 		type = va_arg (ap, GType);
@@ -390,29 +392,41 @@
 			g_value_set_long (value, va_arg (ap, glong));
 		else if (type == G_TYPE_ULONG)
 			g_value_set_ulong (value, va_arg (ap, gulong));
-		else
-			g_warning (_("%s() does not handle values of type %s, value not assigned."),
+		else {
+			g_warning (_("%s() does not handle values of type '%s'."),
 				   __FUNCTION__, g_type_name (type));
+			g_object_unref (holder);
+			allok = FALSE;
+			break;
+		}
 
-		if (!gda_holder_take_value (holder, value))
-			g_warning (_("Could not set GdaHolder's value, value not assigned"));
+		if (!gda_holder_take_value (holder, value, &lerror)) {
+			g_warning (_("Unable to set holder's value: %s"),
+				   lerror && lerror->message ? lerror->message : _("No detail"));
+			if (lerror)
+				g_error_free (lerror);
+			g_object_unref (holder);
+			allok = FALSE;
+			break;
+		}
 		holders = g_slist_append (holders, holder);
         }
 	va_end (ap);
 
 	/* create the set */
-	set = gda_set_new (holders);
+	if (allok) 
+		set = gda_set_new (holders);
 	if (holders) {
 		g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
 		g_slist_free (holders);
 	}
-
 	return set;
 }
 
 /**
  * gda_set_set_holder_value
  * @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
  *
@@ -421,7 +435,7 @@
  * Returns: TRUE if no error occurred and the value was set correctly
  */
 gboolean
-gda_set_set_holder_value (GdaSet *set, const gchar *holder_id, ...)
+gda_set_set_holder_value (GdaSet *set, GError **error, const gchar *holder_id, ...)
 {
 	GdaHolder *holder;
 	va_list ap;
@@ -475,16 +489,16 @@
 		g_value_set_long (value, va_arg (ap, glong));
 	else if (type == G_TYPE_ULONG)
 		g_value_set_ulong (value, va_arg (ap, gulong));
-	else
-		g_warning (_("%s() does not handle values of type %s, value not assigned."),
-			   __FUNCTION__, g_type_name (type));
-	
-	va_end (ap);
-	if (!gda_holder_take_value (holder, value)) {
-		g_warning (_("Could not set GdaHolder's value, value not assigned"));
+	else {
+		g_set_error (error, 0, 0,
+			     _("%s() does not handle values of type '%s'."),
+			     __FUNCTION__, g_type_name (type));
+		va_end (ap);
 		return FALSE;
 	}
-	return TRUE;
+
+	va_end (ap);
+	return gda_holder_take_value (holder, value, error);
 }
 
 /**
@@ -731,10 +745,12 @@
 								     NULL));
 				holders = g_slist_append (holders, holder);
 			}
-			if (gdatype) xmlFree (gdatype);
+			if (gdatype)
+				xmlFree (gdatype);
 			
 			/* set holder's attributes */
-			gda_utility_holder_load_attributes (holder, cur, sources);
+			if (! gda_utility_holder_load_attributes (holder, cur, sources, error))
+				allok = FALSE;
 		}
 	}
 
@@ -815,7 +831,6 @@
 		xmlNodePtr node;
 		GdaHolder *holder = GDA_HOLDER (list->data);
 		gchar *str;
-		const gchar *cstr;
 
 		node = xmlNewTextChild (root, NULL, (xmlChar*)"parameter", NULL);
 		g_object_get (G_OBJECT (holder), "id", &str, NULL);

Modified: trunk/libgda/gda-set.h
==============================================================================
--- trunk/libgda/gda-set.h	(original)
+++ trunk/libgda/gda-set.h	Thu Sep  4 20:08:38 2008
@@ -139,7 +139,7 @@
 GdaSet       *gda_set_new_from_spec_node       (xmlNodePtr xml_spec, GError **error);
 gchar        *gda_set_get_spec                 (GdaSet *set);
 
-gboolean      gda_set_set_holder_value         (GdaSet *set, const gchar *holder_id, ...);
+gboolean      gda_set_set_holder_value         (GdaSet *set, GError **error, const gchar *holder_id, ...);
 const GValue *gda_set_get_holder_value         (GdaSet *set, const gchar *holder_id);
 GdaHolder    *gda_set_get_holder               (GdaSet *set, const gchar *holder_id);
 gboolean      gda_set_add_holder               (GdaSet *set, GdaHolder *holder);

Modified: trunk/libgda/gda-util.c
==============================================================================
--- trunk/libgda/gda-util.c	(original)
+++ trunk/libgda/gda-util.c	Thu Sep  4 20:08:38 2008
@@ -276,16 +276,20 @@
  * @use_col_ids:
  *
  * Dump the data in a #GdaDataModel into a xmlNodePtr (as used in libxml).
+ *
+ * Returns: TRUE if no error occurred
  */
-void
+gboolean
 gda_utility_data_model_dump_data_to_xml (GdaDataModel *model, xmlNodePtr parent, 
 					 const gint *cols, gint nb_cols, 
 					 const gint *rows, gint nb_rows,
 					 gboolean use_col_ids)
 {
+	gboolean retval = TRUE;
 	gint nrows, i;
 	gint *rcols, rnb_cols;
 	gchar **col_ids = NULL;
+	xmlNodePtr data = NULL;
 
 	/* compute columns if not provided */
 	if (!cols) {
@@ -324,19 +328,22 @@
 	else
 		nrows = nb_rows;
 	if (nrows > 0) {
-		xmlNodePtr row, data;
+		xmlNodePtr row;
 		gint r, c;
 
 		data = xmlNewChild (parent, NULL, (xmlChar*)"gda_array_data", NULL);
-		for (r = 0; r < nrows; r++) {
+		for (r = 0; (r < nrows) && retval; r++) {
 			row = xmlNewChild (data, NULL,  (xmlChar*)"gda_array_row", NULL);
 			for (c = 0; c < rnb_cols; c++) {
 				GValue *value;
 				gchar *str = NULL;
 				xmlNodePtr field = NULL;
 
-				value = (GValue *) gda_data_model_get_value_at (model, rcols [c], rows ? rows [r] : r);
-				
+				value = (GValue *) gda_data_model_get_value_at (model, rcols [c], rows ? rows [r] : r, NULL);
+				if (!value) {
+					retval = FALSE;
+					break;
+				}
 				if (value && !gda_value_is_null ((GValue *) value)) { 
 					if (G_VALUE_TYPE (value) == G_TYPE_BOOLEAN)
 						str = g_strdup (g_value_get_boolean (value) ? "TRUE" : "FALSE");
@@ -372,6 +379,13 @@
 			g_free (col_ids [c]);
 		g_free (col_ids);
 	}
+
+	if (!retval) {
+		xmlUnlinkNode (data);
+		xmlFreeNode (data);
+	}
+
+	return retval;
 }
 
 /**
@@ -379,14 +393,18 @@
  * @holder:
  * @node: an xmlNodePtr with a &lt;parameter&gt; tag
  * @sources: a list of #GdaDataModel
+ * @error: a place to store errors, or %NULL
  *
- * WARNING: may set the "source" custom string property 
+ * Note: this method may set the "source" custom string property
+ *
+ * Returns: TRUE if no error occurred
  */
-void
-gda_utility_holder_load_attributes (GdaHolder *holder, xmlNodePtr node, GSList *sources)
+gboolean
+gda_utility_holder_load_attributes (GdaHolder *holder, xmlNodePtr node, GSList *sources, GError **error)
 {
 	xmlChar *str;
 	xmlNodePtr vnode;
+	gboolean retval = TRUE;
 
 	/* set properties from the XML spec */
 	str = xmlGetProp (node, BAD_CAST "id");
@@ -418,7 +436,7 @@
 	
 	str = xmlGetProp (node, BAD_CAST "source");
 	if (str) 
-		g_object_set_data_full (G_OBJECT (holder), "source", (gchar*)str, g_free);
+		g_object_set_data_full (G_OBJECT (holder), "source", str, xmlFree);
 
 	/* set restricting source if specified */
 	if (str && sources) {
@@ -448,7 +466,7 @@
 				    (fno >= gda_data_model_get_n_columns (model))) 
 					g_warning (_("Field number %d not found in source named '%s'"), fno, ptr1); 
 				else {
-					if (gda_holder_set_source_model (holder, model, fno, NULL)) {
+					if (gda_holder_set_source_model (holder, model, fno, error)) {
 						gchar *str;
 						/* rename the wrapper with the current holder's name */
 						g_object_get (G_OBJECT (holder), "name", &str, NULL);
@@ -456,6 +474,8 @@
 						g_object_get (G_OBJECT (holder), "description", &str, NULL);
 						g_object_set_data_full (G_OBJECT (model), "newdescr", str, g_free);
 					}
+					else
+						retval = FALSE;
 				}
 			}
 		}
@@ -481,9 +501,9 @@
 			}
 
 			/* don't care about entries for the wrong locale */
-			this_lang = xmlGetProp(vnode, (xmlChar*)"lang");
+			this_lang = xmlGetProp (vnode, (xmlChar*)"lang");
 			if (this_lang && strncmp ((gchar*)this_lang, lang, strlen ((gchar*)this_lang))) {
-				g_free (this_lang);
+				xmlFree (this_lang);
 				vnode = vnode->next;
 				continue;
 			}
@@ -497,27 +517,23 @@
 			}
 			
 			if (!isnull) {
-				GValue *value;
 				gchar* nodeval = (gchar*)xmlNodeGetContent (vnode);
 
-				value = g_new0 (GValue, 1);
-				if (! gda_value_set_from_string (value, nodeval, gdatype)) {
-					/* error */
-					g_free (value);
-				}
-				else 
-					gda_holder_take_value (holder, value);
-
+				if (! gda_holder_set_value_str (holder, NULL, nodeval, error))
+					retval = FALSE;
  				xmlFree(nodeval);
 			}
 			else {
-				gda_holder_set_value (holder, NULL);
 				xmlFree (isnull);
+				if (! gda_holder_set_value (holder, NULL, error))
+					retval = FALSE;
 			}
 			
 			vnode = vnode->next;
 		}
 	}
+
+	return retval;
 }
 
 
@@ -1075,6 +1091,7 @@
 {
 	GArray *compl = NULL;
 	gchar *text;
+	const GValue *cvalue;
 
 	if (!cnc) 
 		return NULL;
@@ -1152,15 +1169,18 @@
 		
 		nrows = gda_data_model_get_n_rows (model);
 		for (i = 0; i < nrows; i++) {
-			const gchar *tname;
-			tname = g_value_get_string (gda_data_model_get_value_at (model, 0, i));
-			if (!strncmp (tname, obj_name, len)) {
-				gchar *str;
-				if (schema_value) 
-					str = concat_ident (obj_schema, tname);
-				else
-					str = copy_ident (tname);
-				g_array_append_val (compl, str);
+			cvalue = gda_data_model_get_value_at (model, 0, i, NULL);
+			if (cvalue) {
+				const gchar *tname;
+				tname = g_value_get_string (cvalue);
+				if (!strncmp (tname, obj_name, len)) {
+					gchar *str;
+					if (schema_value) 
+						str = concat_ident (obj_schema, tname);
+					else
+						str = copy_ident (tname);
+					g_array_append_val (compl, str);
+				}
 			}
 		}
 		g_object_unref (model);
@@ -1179,12 +1199,15 @@
 		
 		nrows = gda_data_model_get_n_rows (model);
 		for (i = 0; i < nrows; i++) {
-			const gchar *cname;
-			cname = g_value_get_string (gda_data_model_get_value_at (model, 0, i));
-			if (!strncmp (cname, obj_name, len)) {
-				gchar *str;
-				str = copy_ident (cname);
-				g_array_append_val (compl, str);
+			cvalue = gda_data_model_get_value_at (model, 0, i, NULL);
+			if (cvalue) {
+				const gchar *cname;
+				cname = g_value_get_string (cvalue);
+				if (!strncmp (cname, obj_name, len)) {
+					gchar *str;
+					str = copy_ident (cname);
+					g_array_append_val (compl, str);
+				}
 			}
 		}
 		g_object_unref (model);
@@ -1202,30 +1225,35 @@
 		
 		nrows = gda_data_model_get_n_rows (model);
 		for (i = 0; i < nrows; i++) {
-			const gchar *tname;
-			tname = g_value_get_string (gda_data_model_get_value_at (model, 0, i));
-			if (!strncmp (tname, obj_name, len)) {
-				char *str;
-				GdaDataModel *m2;
-				str = copy_ident (tname);
+			cvalue = gda_data_model_get_value_at (model, 0, i, NULL);
+			if (cvalue) {
+				const gchar *tname;
+				tname = g_value_get_string (cvalue);
+				if (!strncmp (tname, obj_name, len)) {
+					char *str;
+					GdaDataModel *m2;
+					str = copy_ident (tname);
 				
-				m2 = gda_meta_store_extract (store, 
-							     "SELECT table_name FROM _tables WHERE table_schema = ##schema::string", 
-							     NULL, "schema", gda_data_model_get_value_at (model, 0, i), 
-							     NULL);
-				if (m2) {
-					gint i2, nrows2;
-					nrows2 = gda_data_model_get_n_rows (m2);
-					for (i2 = 0; i2 < nrows2; i2++) {
-						gchar *str2;
-						tname = g_value_get_string (gda_data_model_get_value_at (m2, 0, i2));
-						str2 = concat_ident (str, tname);
-						g_array_append_val (compl, str2);
+					m2 = gda_meta_store_extract (store, 
+								     "SELECT table_name FROM _tables WHERE table_schema = ##schema::string", 
+								     NULL, "schema", cvalue, NULL);
+					if (m2) {
+						gint i2, nrows2;
+						nrows2 = gda_data_model_get_n_rows (m2);
+						for (i2 = 0; i2 < nrows2; i2++) {
+							cvalue = gda_data_model_get_value_at (m2, 0, i2, NULL);
+							if (cvalue) {
+								gchar *str2;
+								tname = g_value_get_string (cvalue);
+								str2 = concat_ident (str, tname);
+								g_array_append_val (compl, str2);
+							}
+						}
+						
+						g_object_unref (m2);
 					}
-					
-					g_object_unref (m2);
+					free (str);
 				}
-				free (str);
 			}
 		}
 		g_object_unref (model);

Modified: trunk/libgda/gda-util.h
==============================================================================
--- trunk/libgda/gda-util.h	(original)
+++ trunk/libgda/gda-util.h	Thu Sep  4 20:08:38 2008
@@ -52,10 +52,10 @@
  * Param & model utilities
  */
 gboolean     gda_utility_check_data_model (GdaDataModel *model, gint nbcols, ...);
-void         gda_utility_data_model_dump_data_to_xml (GdaDataModel *model, xmlNodePtr parent, 
+gboolean     gda_utility_data_model_dump_data_to_xml (GdaDataModel *model, xmlNodePtr parent, 
 					      const gint *cols, gint nb_cols, const gint *rows, gint nb_rows,
 					      gboolean use_col_ids);
-void         gda_utility_holder_load_attributes (GdaHolder *holder, xmlNodePtr node, GSList *sources);
+gboolean     gda_utility_holder_load_attributes (GdaHolder *holder, xmlNodePtr node, GSList *sources, GError **error);
 
 /* 
  * translate any text to an alphanumerical text 

Modified: trunk/libgda/gda-value.c
==============================================================================
--- trunk/libgda/gda-value.c	(original)
+++ trunk/libgda/gda-value.c	Thu Sep  4 20:08:38 2008
@@ -1835,25 +1835,49 @@
 }
 	
 /**
- * gda_value_bcompare
+ * gda_value_differ
  * @value1: a #GValue to compare.
  * @value2: the other #GValue to be compared to @value1.
  *
- * Tells if two values are equal or not, by comparing memory representations.
+ * Tells if two values are equal or not, by comparing memory representations. Unlike gda_value_compare(),
+ * the returned value is boolean, and gives no idea about ordering.
  *
- * Returns: 0 if @value1 and @value2 are equal, and something else otherwise
+ * The two values must be of the same type, with the exception that a value of any type can be
+ * compared to a GDA_TYPE_NULL value, specifically:
+ * <itemizedlist>
+ *   <listitem><para>if @value1 and @value2 are both GDA_TYPE_NULL values then the returned value is 0</para></listitem>
+ *   <listitem><para>if @value1 is a GDA_TYPE_NULL value and @value2 is of another type then the returned value is 1</para></listitem>
+ *   <listitem><para>if @value1 is of another type and @value2 is a GDA_TYPE_NULL value then the returned value is 1</para></listitem>
+ *   <listitem><para>in all other cases, @value1 and @value2 must be of the same type and their values are compared</para></listitem>
+ * </itemizedlist>
+ *
+ * Returns: a non 0 value if @value1 and @value2 differ, and 0 if they are equal
  */
 gint
-gda_value_bcompare (const GValue *value1, const GValue *value2)
+gda_value_differ (const GValue *value1, const GValue *value2)
 {
 	GType type;
 	g_return_val_if_fail (value1 && value2, FALSE);
 
 	/* blind value comparison */
+	type = G_VALUE_TYPE (value1);
 	if (!bcmp (value1, value2, sizeof (GValue)))
 		return 0;
 
-	type = G_VALUE_TYPE (value1);
+	/* handle GDA_TYPE_NULL comparisons with other types */
+	else if (type == GDA_TYPE_NULL) {
+		if (G_VALUE_TYPE (value2) == GDA_TYPE_NULL)
+			return 0;
+		else
+			return 1;
+	}
+
+	else if (G_VALUE_TYPE (value2) == GDA_TYPE_NULL)
+		return 1;
+
+	g_return_val_if_fail (G_VALUE_TYPE (value1) == G_VALUE_TYPE (value2), 1);
+
+	/* general case */
 	if (type == GDA_TYPE_BINARY) {
 		const GdaBinary *binary1 = gda_value_get_binary (value1);
 		const GdaBinary *binary2 = gda_value_get_binary (value2);
@@ -1899,7 +1923,7 @@
 		GList *l1, *l2;
 		for (l1 = (GList*) gda_value_get_list (value1), l2 = (GList*) gda_value_get_list (value2); 
 		     l1 != NULL && l2 != NULL; l1 = l1->next, l2 = l2->next){
-			if (gda_value_bcompare ((GValue *) l1->data, (GValue *) l2->data))
+			if (gda_value_differ ((GValue *) l1->data, (GValue *) l2->data))
 				return 1;
 		}
 		return 0;
@@ -1912,18 +1936,6 @@
                 if (num1 && num2)
 			return strcmp (num1->number, num2->number);
 	}
-
-	else if (type == GDA_TYPE_SHORT) {
-		gshort i1 = gda_value_get_short (value1);
-		gshort i2 = gda_value_get_short (value2);
-		return (i1 == i2) ? 0 : 1;
-	}
-	
-	else if (type == GDA_TYPE_USHORT) {
-		gushort i1 = gda_value_get_ushort (value1);
-		gushort i2 = gda_value_get_ushort (value2);
-		return (i1 == i2) ? 0 : 1;
-	}
 	
 	else if (type == G_TYPE_STRING)	{
 		const gchar *str1, *str2;
@@ -1949,15 +1961,41 @@
 			return bcmp (ts1, ts2, sizeof (GdaTimestamp));
 	}
 
+	else if ((type == G_TYPE_INT) ||
+		 (type == G_TYPE_UINT) ||
+		 (type == G_TYPE_INT64) ||
+		 (type == G_TYPE_UINT64) ||
+		 (type == GDA_TYPE_SHORT) ||
+		 (type == GDA_TYPE_USHORT) ||
+		 (type == G_TYPE_FLOAT) ||
+		 (type == G_TYPE_DOUBLE) ||
+		 (type == G_TYPE_BOOLEAN) ||
+		 (type == G_TYPE_CHAR) ||
+		 (type == G_TYPE_UCHAR) ||
+		 (type == G_TYPE_LONG) ||
+		 (type == G_TYPE_ULONG))
+		/* values here ARE different because otherwise the bcmp() at the beginning would
+		 * already have retruned */
+		return 1;
+
+	g_warning ("%s() cannot handle values of type %s", __FUNCTION__, g_type_name (G_VALUE_TYPE (value1)));
+
 	return 1;
 }
 
 /**
  * gda_value_compare
- * @value1: a #GValue to compare.
- * @value2: the other #GValue to be compared to @value1.
+ * @value1: a #GValue to compare (not %NULL)
+ * @value2: the other #GValue to be compared to @value1 (not %NULL)
  *
- * Compares two values of the same type.
+ * Compares two values of the same type, with the exception that a value of any type can be
+ * compared to a GDA_TYPE_NULL value, specifically:
+ * <itemizedlist>
+ *   <listitem><para>if @value1 and @value2 are both GDA_TYPE_NULL values then the returned value is 0</para></listitem>
+ *   <listitem><para>if @value1 is a GDA_TYPE_NULL value and @value2 is of another type then the returned value is -1</para></listitem>
+ *   <listitem><para>if @value1 is of another type and @value2 is a GDA_TYPE_NULL value then the returned value is 1</para></listitem>
+ *   <listitem><para>in all other cases, @value1 and @value2 must be of the same type and their values are compared</para></listitem>
+ * </itemizedlist>
  *
  * Returns: if both values have the same type, returns 0 if both contain
  * the same value, an integer less than 0 if @value1 is less than @value2 or
@@ -1971,14 +2009,27 @@
 	GType type;
 
 	g_return_val_if_fail (value1 && value2, -1);
-	g_return_val_if_fail (G_VALUE_TYPE (value1) == G_VALUE_TYPE (value2), -1);
 
 	type = G_VALUE_TYPE (value1);
 	
 	if (value1 == value2)
 		return 0;
 
-	else if (type == G_TYPE_INT64) {
+	/* handle GDA_TYPE_NULL comparisons with other types */
+	else if (type == GDA_TYPE_NULL) {
+		if (G_VALUE_TYPE (value2) == GDA_TYPE_NULL)
+			return 0;
+		else
+			return -1;
+	}
+
+	else if (G_VALUE_TYPE (value2) == GDA_TYPE_NULL)
+		return 1;
+
+	/* general case */
+	g_return_val_if_fail (G_VALUE_TYPE (value1) == G_VALUE_TYPE (value2), -1);
+
+	if (type == G_TYPE_INT64) {
 		gint64 i1 = g_value_get_int64 (value1);
 		gint64 i2 = g_value_get_int64 (value2);
 		return (i1 > i2) ? 1 : ((i1 == i2) ? 0 : -1);
@@ -2206,42 +2257,6 @@
 	return 0;
 }
 
-#define _value_is_null(x) (!(x) || (G_VALUE_TYPE (x) == GDA_TYPE_NULL) || \
-			   ((G_VALUE_TYPE (x) == G_TYPE_STRING) && !g_value_get_string (x)))
-
-/**
- * gda_value_compare_ext
- * @value1: a #GValue to compare.
- * @value2: the other #GValue to be compared to @value1.
- *
- * Like gda_value_compare(), compares two values of the same type, except that NULL values and values
- * of type GDA_TYPE_NULL are considered equals
- *
- * Returns: 0 if both contain the same value, an integer less than 0 if @value1 is less than @value2 or
- * an integer greater than 0 if @value1 is greater than @value2.
- */
-gint
-gda_value_compare_ext (const GValue *value1, const GValue *value2)
-{
-	if (value1 == value2)
-		return 0;
-
-	if (_value_is_null (value1)) {
-		/* value1 represents a NULL value */
-		if (_value_is_null (value2))
-			return 0;
-		else
-			return 1;
-	}
-	else {
-		/* value1 does not represents a NULL value */
-		if (_value_is_null (value2))
-			return -1;
-		else
-			return gda_value_compare (value1, value2);
-	}
-}
-
 /*
  * to_string
  * 

Modified: trunk/libgda/gda-value.h
==============================================================================
--- trunk/libgda/gda-value.h	(original)
+++ trunk/libgda/gda-value.h	Thu Sep  4 20:08:38 2008
@@ -155,9 +155,8 @@
 						             GType type);
 gboolean                          gda_value_set_from_value (GValue *value, const GValue *from);
 
-gint                              gda_value_bcompare (const GValue *value1, const GValue *value2);
+gint                              gda_value_differ (const GValue *value1, const GValue *value2);
 gint                              gda_value_compare (const GValue *value1, const GValue *value2);
-gint                              gda_value_compare_ext (const GValue *value1, const GValue *value2);
 gchar                            *gda_value_stringify (const GValue *value);
 xmlNodePtr                        gda_value_to_xml (const GValue *value);
 

Modified: trunk/libgda/sqlite/gda-sqlite-meta.c
==============================================================================
--- trunk/libgda/sqlite/gda-sqlite-meta.c	(original)
+++ trunk/libgda/sqlite/gda-sqlite-meta.c	Thu Sep  4 20:08:38 2008
@@ -371,7 +371,11 @@
 	nrows = gda_data_model_get_n_rows (tmpmodel);
         for (i = 0; i < nrows; i++) {
 		/* iterate through the schemas */
-                const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
+                const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+                        break;
+		}
                 if (!strcmp (g_value_get_string (cvalue), TMP_DATABASE_NAME))
 			continue; /* nothing to do */
 		if (! fill_udt_model (cdata, added_hash, mod_model, cvalue, error)) {
@@ -578,9 +582,13 @@
 	for (i = 0; (i < nrows) && retval; i++) {
 		const GValue *cvalue;
 		
-		cvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
+		cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+                        break;
+		}
 		if (!schema_name_n || 
-		    !gda_value_compare_ext (schema_name_n, cvalue)) {
+		    !gda_value_compare (schema_name_n, cvalue)) {
 			const gchar *cstr;
 			GValue *v1;
 
@@ -643,9 +651,13 @@
         for (i = 0; (i < nrows) && retval; i++) {
                 const GValue *cvalue;
 
-                cvalue = gda_data_model_get_value_at (tmpmodel, 0, i);
+                cvalue = gda_data_model_get_value_at (tmpmodel, 0, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+                        break;
+		}
                 if (!p_table_name ||
-                    !gda_value_compare_ext (p_table_name, cvalue)) {
+                    !gda_value_compare (p_table_name, cvalue)) {
                         GValue *v1, *v2 = NULL;
                         const GValue *tvalue;
                         const GValue *dvalue;
@@ -657,8 +669,16 @@
 			if (!strcmp (this_table_name, "sqlite_sequence"))
                                 continue; /* ignore that table */
 
-                        tvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
-                        dvalue = gda_data_model_get_value_at (tmpmodel, 2, i);
+                        tvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+			if (!tvalue) {
+				retval = FALSE;
+				break;
+			}
+                        dvalue = gda_data_model_get_value_at (tmpmodel, 2, i, error);
+			if (!dvalue) {
+				retval = FALSE;
+				break;
+			}
                         if (*(g_value_get_string (tvalue)) == 'v')
                                 is_view = TRUE;
                         g_value_set_boolean ((v1 = gda_value_new (G_TYPE_BOOLEAN)), TRUE);
@@ -712,7 +732,11 @@
 	nrows = gda_data_model_get_n_rows (tmpmodel);
 	for (i = 0; i < nrows; i++) {
 		/* iterate through the schemas */
-		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
+		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		if (!strcmp (g_value_get_string (cvalue), TMP_DATABASE_NAME))
 			 continue; /* nothing to do */
 
@@ -789,11 +813,16 @@
 	if (strcmp (schema_name, "main")) {
 		gchar *str;
 		str = g_strdup_printf ("%s.%s", schema_name, g_value_get_string (p_table_name));
-		gda_set_set_holder_value (pragma_set, "tblname", str);
+		if (! gda_set_set_holder_value (pragma_set, error, "tblname", str)) {
+			g_free (str);
+			return FALSE;
+		}
 		g_free (str);
 	}
-	else
-		gda_set_set_holder_value (pragma_set, "tblname", g_value_get_string (p_table_name));
+	else {
+		if (! gda_set_set_holder_value (pragma_set, error, "tblname", g_value_get_string (p_table_name)))
+			return FALSE;
+	}
 
 	tmpmodel = gda_connection_statement_execute_select_full (cnc, internal_stmt[I_PRAGMA_TABLE_INFO], pragma_set, 
 								 GDA_STATEMENT_MODEL_RANDOM_ACCESS, 
@@ -813,8 +842,13 @@
 		const gchar *this_col_name;
 		const GValue *this_col_pname;
 		GType gtype = 0;
+		const GValue *cvalue;
 		
-		this_col_pname = gda_data_model_get_value_at (tmpmodel, 1, i);
+		this_col_pname = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+		if (!this_col_pname) {
+			retval = FALSE;
+			break;
+		}
 		this_table_name = g_value_get_string (p_table_name);
 		g_assert (this_table_name);
 		if (!strcmp (this_table_name, "sqlite_sequence"))
@@ -826,14 +860,34 @@
 						   &pzDataType, &pzCollSeq, &pNotNull, &pPrimaryKey, &pAutoinc)
 		    != SQLITE_OK) {
 			/* may fail because we have a view and not a table => use @tmpmodel to fetch info. */
-			pzDataType = g_value_get_string (gda_data_model_get_value_at (tmpmodel, 2, i));
+			cvalue = gda_data_model_get_value_at (tmpmodel, 2, i, error);
+			if (!cvalue) {
+				retval = FALSE;
+				break;
+			}	
+			pzDataType = g_value_get_string (cvalue);
 			pzCollSeq = NULL;
-			pNotNull = g_value_get_int (gda_data_model_get_value_at (tmpmodel, 3, i));
-			pPrimaryKey = g_value_get_boolean (gda_data_model_get_value_at (tmpmodel, 5, i));
+			cvalue = gda_data_model_get_value_at (tmpmodel, 3, i, error);
+			if (!cvalue) {
+				retval = FALSE;
+				break;
+			}
+			pNotNull = g_value_get_int (cvalue);
+			cvalue = gda_data_model_get_value_at (tmpmodel, 5, i, error);
+			if (!cvalue) {
+				retval = FALSE;
+				break;
+			}
+			pPrimaryKey = g_value_get_boolean (cvalue);
 			pAutoinc = 0;
 		}
 		
-		v1 = gda_value_copy (gda_data_model_get_value_at (tmpmodel, 0, i));
+		cvalue = gda_data_model_get_value_at (tmpmodel, 0, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
+		v1 = gda_value_copy (cvalue);
 		g_value_set_string ((v2 = gda_value_new (G_TYPE_STRING)), pzDataType);
 		g_value_set_boolean ((v3 = gda_value_new (G_TYPE_BOOLEAN)), pNotNull ? FALSE : TRUE);
 		g_value_set_string ((v4 = gda_value_new (G_TYPE_STRING)), pzCollSeq);
@@ -855,13 +909,18 @@
 			g_value_set_string ((v6 = gda_value_new (G_TYPE_STRING)), "string");
 		else
 			g_value_set_string ((v6 = gda_value_new (G_TYPE_STRING)), g_type_name (gtype));
+		cvalue = gda_data_model_get_value_at (tmpmodel, 4, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		if (! append_a_row (mod_model, error, 24, 
 				    FALSE, catalog_value, /* table_catalog */
 				    FALSE, p_table_schema, /* table_schema */
 				    FALSE, p_table_name, /* table_name */
 				    FALSE, this_col_pname, /* column name */
 				    TRUE, v1, /* ordinal_position */
-				    FALSE, gda_data_model_get_value_at (tmpmodel, 4, i), /* column default */
+				    FALSE, cvalue, /* column default */
 				    TRUE, v3, /* is_nullable */
 				    TRUE, v2, /* data_type */
 				    FALSE, NULL, /* array_spec */
@@ -913,8 +972,11 @@
 		/* iterate through the schemas */
 		GdaDataModel *tables_model;
 		const gchar *schema_name;
-		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
-
+		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		schema_name = g_value_get_string (cvalue); 
 		if (!strcmp (schema_name, TMP_DATABASE_NAME))
 			 continue; /* nothing to do */
@@ -940,9 +1002,13 @@
 		tnrows = gda_data_model_get_n_rows (tables_model);
 		for (ti = 0; ti < tnrows; ti++) {
 			/* iterate through the tables */
-			if (!fill_columns_model (cnc, cdata, mod_model, cvalue, 
-						 gda_data_model_get_value_at (tables_model, 0, ti), 
-						 error)) {
+			const GValue *cv;
+			cv = gda_data_model_get_value_at (tables_model, 0, ti, error);
+			if (!cv) {
+				retval = FALSE;
+				break;
+			}
+			if (!fill_columns_model (cnc, cdata, mod_model, cvalue, cv, error)) {
 				retval = FALSE;
 				break;
 			}
@@ -1020,12 +1086,17 @@
 	if (strcmp (schema_name, "main")) {
 		gchar *str;
 		str = g_strdup_printf ("%s.%s", schema_name, g_value_get_string (p_table_name));
-		gda_set_set_holder_value (pragma_set, "tblname", str);
+		if (! gda_set_set_holder_value (pragma_set, error, "tblname", str)) {
+			g_free (str);
+			return FALSE;
+		}
 		g_free (str);
 	}
-	else
-		gda_set_set_holder_value (pragma_set, "tblname", g_value_get_string (p_table_name));
-	
+	else {
+		if (!gda_set_set_holder_value (pragma_set, error, "tblname", g_value_get_string (p_table_name)))
+			return FALSE;
+	}	
+
 	/* 
 	 * PRIMARY KEY
 	 *
@@ -1050,9 +1121,13 @@
 		int pAutoinc; /* True if column is auto-increment */
 		const gchar *this_table_name;
 		const gchar *this_col_name;
-		const GValue *this_col_pname;
+		const GValue *this_col_pname, *cvalue;
 		
-		this_col_pname = gda_data_model_get_value_at (tmpmodel, 1, i);
+		this_col_pname = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+		if (!this_col_pname) {
+			retval = FALSE;
+			break;
+		}
 		this_table_name = g_value_get_string (p_table_name);
 		g_assert (this_table_name);
 		if (!strcmp (this_table_name, "sqlite_sequence"))
@@ -1062,9 +1137,15 @@
 		if (sqlite3_table_column_metadata (cdata->connection, g_value_get_string (p_table_schema), 
 						   this_table_name, this_col_name,
 						   &pzDataType, &pzCollSeq, &pNotNull, &pPrimaryKey, &pAutoinc)
-		    != SQLITE_OK) 
+		    != SQLITE_OK) {
 			/* may fail because we have a view and not a table => use @tmpmodel to fetch info. */
-			pPrimaryKey = g_value_get_boolean (gda_data_model_get_value_at (tmpmodel, 5, i));
+			cvalue = gda_data_model_get_value_at (tmpmodel, 5, i, error);
+			if (!cvalue) {
+				retval = FALSE;
+				break;
+			}
+			pPrimaryKey = g_value_get_boolean (cvalue);
+		}
 		
 		if (pPrimaryKey) {
 			has_pk = TRUE;
@@ -1072,7 +1153,7 @@
 		}
 	}
 
-	if (has_pk) {
+	if (retval && has_pk) {
 		if (!constraint_name_n || ! strcmp (g_value_get_string (constraint_name_n), "primary_key")) {
 			GValue *v1, *v2;
 			g_value_set_string ((v1 = gda_value_new (G_TYPE_STRING)), "primary_key");
@@ -1113,11 +1194,19 @@
 		const GValue *cvalue;
 		GValue *v2;
 
-		cvalue = gda_data_model_get_value_at (tmpmodel, 2, i);
+		cvalue = gda_data_model_get_value_at (tmpmodel, 2, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		if (!g_value_get_int (cvalue))
 			continue;
 		
-		cvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
+		cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		if (constraint_name_n && strcmp (g_value_get_string (constraint_name_n), g_value_get_string (cvalue)))
 			continue;
 
@@ -1155,7 +1244,11 @@
 	for (i = 0; i < nrows; i++) {
 		const GValue *cvalue;
 
-		cvalue = gda_data_model_get_value_at (tmpmodel, 2, i);
+		cvalue = gda_data_model_get_value_at (tmpmodel, 2, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		if (! ref_table || strcmp (ref_table, g_value_get_string (cvalue))) {
 			gchar *constname;
 			GValue *v1, *v2;
@@ -1222,8 +1315,11 @@
 		/* iterate through the schemas */
 		GdaDataModel *tables_model;
 		const gchar *schema_name;
-		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
-
+		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		schema_name = g_value_get_string (cvalue); 
 		if (!strcmp (schema_name, TMP_DATABASE_NAME))
 			 continue; /* nothing to do */
@@ -1249,9 +1345,12 @@
 		tnrows = gda_data_model_get_n_rows (tables_model);
 		for (ti = 0; ti < tnrows; ti++) {
 			/* iterate through the tables */
-			if (!fill_constraints_tab_model (cnc, cdata, mod_model, cvalue, 
-							 gda_data_model_get_value_at (tables_model, 0, ti),
-							 NULL, error)) {
+			const GValue *cv = gda_data_model_get_value_at (tables_model, 0, ti, error);
+			if (!cv) {
+				retval = FALSE;
+				break;
+			}
+			if (!fill_constraints_tab_model (cnc, cdata, mod_model, cvalue, cv, NULL, error)) {
 				retval = FALSE;
 				break;
 			}
@@ -1312,11 +1411,16 @@
 	if (strcmp (schema_name, "main")) {
 		gchar *str;
 		str = g_strdup_printf ("%s.%s", schema_name, g_value_get_string (p_table_name));
-		gda_set_set_holder_value (pragma_set, "tblname", str);
+		if (! gda_set_set_holder_value (pragma_set, error, "tblname", str)) {
+			g_free (str);
+			return FALSE;
+		}
 		g_free (str);
 	}
-	else
-		gda_set_set_holder_value (pragma_set, "tblname", g_value_get_string (p_table_name));	
+	else {
+		if (! gda_set_set_holder_value (pragma_set, error, "tblname", g_value_get_string (p_table_name)))
+			return FALSE;
+	}
 
 	GType fk_col_types[] = {G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE};
 	gchar *ref_table = NULL;
@@ -1330,7 +1434,11 @@
 	for (i = 0; i < nrows; i++) {
 		const GValue *cvalue;
 
-		cvalue = gda_data_model_get_value_at (tmpmodel, 2, i);
+		cvalue = gda_data_model_get_value_at (tmpmodel, 2, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		if (! ref_table || strcmp (ref_table, g_value_get_string (cvalue))) {
 			gchar *constname;
 			GValue *v2, *v3, *v4, *v5;
@@ -1399,8 +1507,11 @@
 		/* iterate through the schemas */
 		GdaDataModel *tables_model;
 		const gchar *schema_name;
-		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
-
+		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		schema_name = g_value_get_string (cvalue); 
 		if (!strcmp (schema_name, TMP_DATABASE_NAME))
 			 continue; /* nothing to do */
@@ -1426,9 +1537,12 @@
 		tnrows = gda_data_model_get_n_rows (tables_model);
 		for (ti = 0; ti < tnrows; ti++) {
 			/* iterate through the tables */
-			if (!fill_constraints_ref_model (cnc, cdata, mod_model, cvalue,
-							 gda_data_model_get_value_at (tables_model, 0, ti),
-							 NULL, error)) {
+			const GValue *cv = gda_data_model_get_value_at (tables_model, 0, ti, error);
+			if (!cv) {
+				retval = FALSE;
+				break;
+			}
+			if (!fill_constraints_ref_model (cnc, cdata, mod_model, cvalue, cv, NULL, error)) {
 				retval = FALSE;
 				break;
 			}
@@ -1489,11 +1603,16 @@
 	if (strcmp (schema_name, "main")) {
 		gchar *str;
 		str = g_strdup_printf ("%s.%s", schema_name, g_value_get_string (p_table_name));
-		gda_set_set_holder_value (pragma_set, "tblname", str);
+		if (! gda_set_set_holder_value (pragma_set, error, "tblname", str)) {
+			g_free (str);
+			return FALSE;
+		}
 		g_free (str);
 	}
-	else
-		gda_set_set_holder_value (pragma_set, "tblname", g_value_get_string (p_table_name));
+	else {
+		if (! gda_set_set_holder_value (pragma_set, error, "tblname", g_value_get_string (p_table_name)))
+			return FALSE;
+	}
 
 	const_name = g_value_get_string (constraint_name);
 	if (!strcmp (const_name, "primary_key")) {
@@ -1518,10 +1637,14 @@
 			int pAutoinc; /* True if column is auto-increment */
 			const gchar *this_table_name;
 			const gchar *this_col_name;
-			const GValue *this_col_pname;
+			const GValue *this_col_pname, *cvalue;
 			GValue *v1;
 			
-			this_col_pname = gda_data_model_get_value_at (tmpmodel, 1, i);
+			this_col_pname = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+			if (!this_col_pname) {
+				retval = FALSE;
+				break;
+			}
 			this_table_name = g_value_get_string (p_table_name);
 			g_assert (this_table_name);
 			if (!strcmp (this_table_name, "sqlite_sequence"))
@@ -1531,17 +1654,28 @@
 			if (sqlite3_table_column_metadata (cdata->connection, g_value_get_string (p_table_schema), 
 							   this_table_name, this_col_name,
 							   &pzDataType, &pzCollSeq, &pNotNull, &pPrimaryKey, &pAutoinc)
-			    != SQLITE_OK) 
+			    != SQLITE_OK) {
 				/* may fail because we have a view and not a table => use @tmpmodel to fetch info. */
-				pPrimaryKey = g_value_get_boolean (gda_data_model_get_value_at (tmpmodel, 5, i));
+				cvalue = gda_data_model_get_value_at (tmpmodel, 5, i, error);
+				if (!cvalue) {
+					retval = FALSE;
+					break;
+				}
+				pPrimaryKey = g_value_get_boolean (cvalue);
+			}
 			if (pPrimaryKey) {
+				cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+				if (!cvalue) {
+					retval = FALSE;
+					break;
+				}
 				g_value_set_int ((v1 = gda_value_new (G_TYPE_INT)), ord_pos++);
 				if (! append_a_row (mod_model, error, 6, 
 						    FALSE, catalog_value, /* table_catalog */
 						    FALSE, p_table_schema, /* table_schema */
 						    FALSE, p_table_name, /* table_name */
 						    FALSE, constraint_name, /* constraint_name */
-						    FALSE, gda_data_model_get_value_at (tmpmodel, 1, i), /* column_name */
+						    FALSE, cvalue, /* column_name */
 						    TRUE, v1 /* ordinal_position */)) {
 					retval = FALSE;
 					break;
@@ -1568,7 +1702,11 @@
 			const GValue *cvalue;
 			GValue *v1;
 			
-			cvalue = gda_data_model_get_value_at (tmpmodel, 2, i);
+			cvalue = gda_data_model_get_value_at (tmpmodel, 2, i, error);
+			if (!cvalue) {
+				retval = FALSE;
+				break;
+			}
 			if (! ref_table || strcmp (ref_table, g_value_get_string (cvalue))) {
 				gchar *constname;
 				
@@ -1585,12 +1723,17 @@
 			}
 			
 			g_value_set_int ((v1 = gda_value_new (G_TYPE_INT)), ord_pos++);
+			cvalue = gda_data_model_get_value_at (tmpmodel, 3, i, error);
+			if (!cvalue) {
+				retval = FALSE;
+				break;
+			}
 			if (! append_a_row (mod_model, error, 6, 
 					    FALSE, catalog_value, /* table_catalog */
 					    FALSE, p_table_schema, /* table_schema */
 					    FALSE, p_table_name, /* table_name */
 					    FALSE, constraint_name, /* constraint_name */
-					    FALSE, gda_data_model_get_value_at (tmpmodel, 3, i), /* column_name */
+					    FALSE, cvalue, /* column_name */
 					    TRUE, v1 /* ordinal_position */))
 				retval = FALSE;
 		}
@@ -1604,7 +1747,8 @@
 		 */
 		GType unique_col_types[] = {G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_NONE};
 		
-		gda_set_set_holder_value (pragma_set, "idxname", g_value_get_string (constraint_name));
+		if (! gda_set_set_holder_value (pragma_set, error, "idxname", g_value_get_string (constraint_name)))
+			return FALSE;
 		tmpmodel = gda_connection_statement_execute_select_full (cnc, internal_stmt[I_PRAGMA_INDEX_INFO], pragma_set, 
 									 GDA_STATEMENT_MODEL_RANDOM_ACCESS, 
 									 unique_col_types, error);
@@ -1614,15 +1758,24 @@
 		nrows = gda_data_model_get_n_rows (tmpmodel);
 		for (i = 0; i < nrows; i++) {
 			GValue *v1;
-			
-			g_value_set_int ((v1 = gda_value_new (G_TYPE_INT)), 
-					 g_value_get_int (gda_data_model_get_value_at (tmpmodel, 1, i)) + 1);
+			const GValue *cvalue;
+			cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+			if (!cvalue) {
+				retval = FALSE;
+				break;
+			}
+			g_value_set_int ((v1 = gda_value_new (G_TYPE_INT)), g_value_get_int (cvalue) + 1);
+			cvalue = gda_data_model_get_value_at (tmpmodel, 2, i, error);
+			if (!cvalue) {
+				retval = FALSE;
+				break;
+			}
 			if (! append_a_row (mod_model, error, 6, 
 					    FALSE, catalog_value, /* table_catalog */
 					    FALSE, p_table_schema, /* table_schema */
 					    FALSE, p_table_name, /* table_name */
 					    FALSE, constraint_name, /* constraint_name */
-					    FALSE, gda_data_model_get_value_at (tmpmodel, 2, i), /* column_name */
+					    FALSE, cvalue, /* column_name */
 					    TRUE, v1 /* ordinal_position */))
 				retval = FALSE;
 		}
@@ -1663,8 +1816,12 @@
 		/* iterate through the schemas */
 		GdaDataModel *tables_model;
 		const gchar *schema_name;
-		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i);
+		const GValue *cvalue = gda_data_model_get_value_at (tmpmodel, 1, i, error);
 
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		schema_name = g_value_get_string (cvalue); 
 		if (!strcmp (schema_name, TMP_DATABASE_NAME))
 			 continue; /* nothing to do */
@@ -1690,9 +1847,12 @@
 		tnrows = gda_data_model_get_n_rows (tables_model);
 		for (ti = 0; ti < tnrows; ti++) {
 			/* iterate through the tables */
-			if (!fill_constraints_tab_model (cnc, cdata, const_model, cvalue,
-							 gda_data_model_get_value_at (tables_model, 0, ti),
-							 NULL, error)) {
+			const GValue *cv = gda_data_model_get_value_at (tables_model, 0, ti, error);
+			if (!cv) {
+				retval = FALSE;
+				break;
+			}
+			if (!fill_constraints_tab_model (cnc, cdata, const_model, cvalue, cv, NULL, error)) {
 				retval = FALSE;
 				break;
 			}
@@ -1713,11 +1873,23 @@
 
 	nrows = gda_data_model_get_n_rows (const_model);
 	for (i = 0; i < nrows; i++) {
-		if (!fill_key_columns_model (cnc, cdata, mod_model, 
-					     gda_data_model_get_value_at (const_model, 4, i), 
-					     gda_data_model_get_value_at (const_model, 5, i), 
-					     gda_data_model_get_value_at (const_model, 2, i), 
-					     error)) {
+		const GValue *v2, *v4, *v5;
+		v2 = gda_data_model_get_value_at (const_model, 2, i, error);
+		if (!v2) {
+			retval = FALSE;
+			break;
+		}
+		v4 = gda_data_model_get_value_at (const_model, 4, i, error);
+		if (!v4) {
+			retval = FALSE;
+			break;
+		}
+		v5 = gda_data_model_get_value_at (const_model, 5, i, error);
+		if (!v5) {
+			retval = FALSE;
+			break;
+		}
+		if (!fill_key_columns_model (cnc, cdata, mod_model, v4, v5, v2, error)) {
 			retval = FALSE;
 			break;
 		}
@@ -1863,12 +2035,18 @@
 			gint i, nrows;
 			for (i = 0; i < nrows; i++) {
 				const GValue *cv0, *cv2, *cv3;
-				cv0 = gda_data_model_get_value_at (cdata->functions_model, 0, i);
-				cv2 = gda_data_model_get_value_at (cdata->functions_model, 1, i);
-				cv3 = gda_data_model_get_value_at (cdata->functions_model, 2, i);
-				if (!cv0 || !cv2 ||!cv3) {
-					g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_DATA_ERROR,
-						     _("Can't read data"));
+				cv0 = gda_data_model_get_value_at (cdata->functions_model, 0, i, error);
+				if (!cv0) {
+					retval = FALSE;
+					break;
+				}
+				cv2 = gda_data_model_get_value_at (cdata->functions_model, 1, i, error);
+				if (!cv2) {
+					retval = FALSE;
+					break;
+				}
+				cv3 = gda_data_model_get_value_at (cdata->functions_model, 2, i, error);
+				if (!cv3) {
 					retval = FALSE;
 					break;
 				}
@@ -1883,12 +2061,18 @@
 			gint i, nrows;
 			for (i = 0; i < nrows; i++) {
 				const GValue *cv0, *cv2, *cv3;
-				cv0 = gda_data_model_get_value_at (cdata->aggregates_model, 0, i);
-				cv2 = gda_data_model_get_value_at (cdata->aggregates_model, 1, i);
-				cv3 = gda_data_model_get_value_at (cdata->aggregates_model, 2, i);
-				if (!cv0 || !cv2 ||!cv3) {
-					g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_DATA_ERROR,
-						     _("Can't read data"));
+				cv0 = gda_data_model_get_value_at (cdata->aggregates_model, 0, i, error);
+				if (!cv0) {
+					retval = FALSE;
+					break;
+				}
+				cv2 = gda_data_model_get_value_at (cdata->aggregates_model, 1, i, error);
+				if (!cv2) {
+					retval = FALSE;
+					break;
+				}
+				cv3 = gda_data_model_get_value_at (cdata->aggregates_model, 2, i, error);
+				if (!cv3) {
 					retval = FALSE;
 					break;
 				}
@@ -1920,13 +2104,23 @@
 		nrows = gda_data_model_get_n_rows (tmpmodel);
 		for (i = 0; i < nrows; i++) {
 			const GValue *cv0, *cv1, *cv2, *cv3;
-			cv0 = gda_data_model_get_value_at (tmpmodel, 0, i);
-			cv1 = gda_data_model_get_value_at (tmpmodel, 1, i);
-			cv2 = gda_data_model_get_value_at (tmpmodel, 2, i);
-			cv3 = gda_data_model_get_value_at (tmpmodel, 3, i);
-			if (!cv0 || !cv1 || !cv2 ||!cv3) {
-				g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_DATA_ERROR,
-					     _("Can't read data"));
+			cv0 = gda_data_model_get_value_at (tmpmodel, 0, i, error);
+			if (!cv0) {
+				retval = FALSE;
+				break;
+			}
+			cv1 = gda_data_model_get_value_at (tmpmodel, 1, i, error);
+			if (!cv1) {
+				retval = FALSE;
+				break;
+			}
+			cv2 = gda_data_model_get_value_at (tmpmodel, 2, i, error);
+			if (!cv2) {
+				retval = FALSE;
+				break;
+			}
+			cv3 = gda_data_model_get_value_at (tmpmodel, 3, i, error);
+			if (!cv3) {
 				retval = FALSE;
 				break;
 			}

Modified: trunk/libgda/sqlite/gda-sqlite-provider.c
==============================================================================
--- trunk/libgda/sqlite/gda-sqlite-provider.c	(original)
+++ trunk/libgda/sqlite/gda-sqlite-provider.c	Thu Sep  4 20:08:38 2008
@@ -1015,10 +1015,10 @@
 		g_static_mutex_lock (&mutex);
 		if (!params_set)
 			params_set = gda_set_new_inline (1, "name", G_TYPE_STRING, name);
-		else 
-			gda_set_set_holder_value (params_set, "name", name);
-		if (gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_BEGIN_NAMED], 
-								 params_set, NULL, NULL) == -1) 
+		else if (! gda_set_set_holder_value (params_set, error, "name", name))
+			status = FALSE;
+		if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_BEGIN_NAMED], 
+									   params_set, NULL, NULL) == -1) 
 			status = FALSE;
 		g_static_mutex_unlock (&mutex);
 	}
@@ -1049,10 +1049,10 @@
 		g_static_mutex_lock (&mutex);
 		if (!params_set)
 			params_set = gda_set_new_inline (1, "name", G_TYPE_STRING, name);
-		else 
-			gda_set_set_holder_value (params_set, "name", name);
-		if (gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_COMMIT_NAMED], 
-								 params_set, NULL, NULL) == -1) 
+		else if (!gda_set_set_holder_value (params_set, error, "name", name))
+			status = FALSE;
+		if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_COMMIT_NAMED], 
+									   params_set, NULL, NULL) == -1) 
 			status = FALSE;
 		g_static_mutex_unlock (&mutex);
 	}
@@ -1084,10 +1084,10 @@
 		g_static_mutex_lock (&mutex);
 		if (!params_set)
 			params_set = gda_set_new_inline (1, "name", G_TYPE_STRING, name);
-		else 
-			gda_set_set_holder_value (params_set, "name", name);
-		if (gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ROLLBACK_NAMED], 
-								 params_set, NULL, NULL) == -1) 
+		else if (! gda_set_set_holder_value (params_set, error, "name", name))
+			status = FALSE;
+		if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ROLLBACK_NAMED], 
+									   params_set, NULL, NULL) == -1) 
 			status = FALSE;
 		g_static_mutex_unlock (&mutex);
 	}
@@ -1755,7 +1755,7 @@
 		return NULL;
         }
 	else {
-		GdaSet *set;
+		GdaSet *set = NULL;
 		GSList *holders = NULL;
 		gint nrows, ncols, i;
 
@@ -1774,21 +1774,32 @@
 			GdaHolder *h;
 			GdaColumn *col;
 			gchar *id;
+			const GValue *cvalue;
 			col = gda_data_model_describe_column (model, i);
 			h = gda_holder_new (gda_column_get_g_type (col));
 			id = g_strdup_printf ("+%d", i);
 			g_object_set (G_OBJECT (h), "id", id, "not-null", FALSE, 
 				      "name", gda_column_get_name (col), NULL);
 			g_free (id);
-			gda_holder_set_value (h, gda_data_model_get_value_at (model, i, 0));
+			cvalue = gda_data_model_get_value_at (model, i, 0, NULL);
+			if (!cvalue || !gda_holder_set_value (h, cvalue, NULL)) {
+				if (holders) {
+					g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
+					g_slist_free (holders);
+					holders = NULL;
+				}
+				break;
+			}
 			holders = g_slist_prepend (holders, h);
 		}
 		g_object_unref (model);
 
-		holders = g_slist_reverse (holders);
-		set = gda_set_new (holders);
-		g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
-		g_slist_free (holders);
+		if (holders) {
+			holders = g_slist_reverse (holders);
+			set = gda_set_new (holders);
+			g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
+			g_slist_free (holders);
+		}
 
 		return set;
 	}

Modified: trunk/libgda/sqlite/virtual/gda-vconnection-data-model.h
==============================================================================
--- trunk/libgda/sqlite/virtual/gda-vconnection-data-model.h	(original)
+++ trunk/libgda/sqlite/virtual/gda-vconnection-data-model.h	Thu Sep  4 20:08:38 2008
@@ -38,7 +38,7 @@
 typedef struct _GdaVconnectionDataModelPrivate GdaVconnectionDataModelPrivate;
 typedef struct _GdaVconnectionDataModelSpec  GdaVconnectionDataModelSpec;
 
-typedef GList        *(*GdaVconnectionDataModelCreateColumnsFunc) (GdaVconnectionDataModelSpec *);
+typedef GList        *(*GdaVconnectionDataModelCreateColumnsFunc) (GdaVconnectionDataModelSpec *, GError **);
 typedef GdaDataModel *(*GdaVconnectionDataModelCreateModelFunc)   (GdaVconnectionDataModelSpec *);
 
 struct _GdaVconnectionDataModelSpec {

Modified: trunk/libgda/sqlite/virtual/gda-vconnection-hub.c
==============================================================================
--- trunk/libgda/sqlite/virtual/gda-vconnection-hub.c	(original)
+++ trunk/libgda/sqlite/virtual/gda-vconnection-hub.c	Thu Sep  4 20:08:38 2008
@@ -353,7 +353,7 @@
 }
 
 static GList *
-dict_table_create_columns_func (GdaVconnectionDataModelSpec *spec)
+dict_table_create_columns_func (GdaVconnectionDataModelSpec *spec, GError **error)
 {
 	LocalSpec *lspec = (LocalSpec *) spec;
 	gint i, nrows;
@@ -367,11 +367,25 @@
 	nrows = gda_data_model_get_n_rows (model);
 	for (i = 0; i < nrows; i++) {
 		GdaColumn *col;
+		const GValue *v0, *v1, *v2;
+
+		v0 = gda_data_model_get_value_at (model, 0, i, error);
+		v1 = gda_data_model_get_value_at (model, 1, i, error);
+		v2 = gda_data_model_get_value_at (model, 2, i, error);
+
+		if (!v0 || !v1 || !v2) {
+			if (columns) {
+				g_list_foreach (columns, (GFunc) g_object_unref, NULL);
+				g_list_free (columns);
+				columns = NULL;
+			}
+			break;
+		}
+
 		col = gda_column_new ();
-		gda_column_set_name (col, g_value_get_string (gda_data_model_get_value_at (model, 0, i)));
-		gda_column_set_g_type (col, 
-			   gda_g_type_from_string (g_value_get_string (gda_data_model_get_value_at (model, 2, i))));
-		gda_column_set_dbms_type (col, g_value_get_string (gda_data_model_get_value_at (model, 1, i)));
+		gda_column_set_name (col, g_value_get_string (v0));
+		gda_column_set_g_type (col, gda_g_type_from_string (g_value_get_string (v2)));
+		gda_column_set_dbms_type (col, g_value_get_string (v1));
 		columns = g_list_prepend (columns, col);
 	}
 	g_object_unref (model);
@@ -440,7 +454,8 @@
 		return FALSE;
 	nrows = gda_data_model_get_n_rows (model);
 	for (i = 0; i < nrows; i++) {
-		if (!table_add (hc, gda_data_model_get_value_at (model, 0, i), error)) {
+		const GValue *cv = gda_data_model_get_value_at (model, 0, i, error);
+		if (!cv || !table_add (hc, cv, error)) {
 			g_object_unref (model);
 			return FALSE;
 		}
@@ -478,7 +493,7 @@
 				/* we only want tables where table_short_name = table_name */
 				tsn = g_hash_table_lookup (ch->keys, "+6");
 				tn = g_hash_table_lookup (ch->keys, "+2");
-				if (! gda_value_compare_ext (tsn, tn))
+				if (tn && tsn && !gda_value_compare (tsn, tn))
 					table_add (hc, tn, NULL);
 				break;
 			}
@@ -486,7 +501,7 @@
 				/* we only want tables where table_short_name = table_name */
 				tsn = g_hash_table_lookup (ch->keys, "-6");
 				tn = g_hash_table_lookup (ch->keys, "-2");
-				if (! gda_value_compare_ext (tsn, tn))
+				if (tn && tsn && !gda_value_compare (tsn, tn))
 					table_remove (hc, tn);
 				break;
 			}
@@ -494,11 +509,11 @@
 				/* we only want tables where table_short_name = table_name */
 				tsn = g_hash_table_lookup (ch->keys, "-6");
 				tn = g_hash_table_lookup (ch->keys, "-2");
-				if (! gda_value_compare_ext (tsn, tn))
+				if (tn && tsn && !gda_value_compare (tsn, tn))
 					table_remove (hc, tn);
 				tsn = g_hash_table_lookup (ch->keys, "+6");
 				tn = g_hash_table_lookup (ch->keys, "+2");
-				if (! gda_value_compare_ext (tsn, tn))
+				if (tn && tsn && !gda_value_compare (tsn, tn))
 					table_add (hc, tn, NULL);
 				break;
 			}
@@ -559,8 +574,11 @@
 	if (!model)
 		return;
 	nrows = gda_data_model_get_n_rows (model);
-	for (i = 0; i < nrows; i++) 
-		table_remove (hc, gda_data_model_get_value_at (model, 0, i));
+	for (i = 0; i < nrows; i++) {
+		const GValue *cv = gda_data_model_get_value_at (model, 0, i, NULL);
+		if (cv)
+			table_remove (hc, cv);
+	}
 	g_object_unref (model);
 
 	/* remove the :memory: database */

Modified: trunk/libgda/sqlite/virtual/gda-vprovider-data-model.c
==============================================================================
--- trunk/libgda/sqlite/virtual/gda-vprovider-data-model.c	(original)
+++ trunk/libgda/sqlite/virtual/gda-vprovider-data-model.c	Thu Sep  4 20:08:38 2008
@@ -401,7 +401,18 @@
 		g_object_ref (td->real_model);
 	}
 	else  {
-		columns = td->spec->create_columns_func (td->spec);
+		GError *error = NULL;
+		columns = td->spec->create_columns_func (td->spec, &error);
+		if (! columns) {
+			if (error && error->message) {
+				int len = strlen (error->message) + 1;
+				*pzErr = sqlite3_malloc (sizeof (gchar) * len);
+				memcpy (*pzErr, error->message, len);
+			}
+			else 
+				*pzErr = sqlite3_mprintf (_("Could not compute virtual table's columns"));
+			return SQLITE_ERROR;
+		}
 		ncols = g_list_length (columns);
 	}
 

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Thu Sep  4 20:08:38 2008
@@ -15,6 +15,7 @@
 libgda/gda-data-proxy.c
 libgda/gda-data-select.c
 libgda/gda-easy.c
+libgda/gda-holder.c
 libgda/gda-init.c
 libgda/gda-log.c
 libgda/gda-meta-store.c

Modified: trunk/providers/mysql/gda-mysql-meta.c
==============================================================================
--- trunk/providers/mysql/gda-mysql-meta.c	(original)
+++ trunk/providers/mysql/gda-mysql-meta.c	Thu Sep  4 20:08:38 2008
@@ -564,7 +564,8 @@
 	GdaDataModel *model;
 	gboolean retval;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), catalog_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), catalog_name, error))
+		return FALSE;
 	if (!schema_name_n) {
 		model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_SCHEMAS], i_set, error);
 		if (model == NULL)
@@ -574,7 +575,8 @@
 			g_object_unref (G_OBJECT(model));
 		}
 	} else {
-		gda_holder_set_value (gda_set_get_holder (i_set, "name"), schema_name_n);
+		if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), schema_name_n, error))
+			return FALSE;
 		model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_SCHEMA_NAMED], i_set, error);
 		if (model == NULL)
 			retval = FALSE;
@@ -665,8 +667,10 @@
 	/* Copy contents, just because we need to modify @context->table_name */
 	GdaMetaContext copy = *context;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
 	if (!table_name_n) {
 		model_tables = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TABLES], i_set, error);
 		if (model_tables == NULL)
@@ -685,7 +689,8 @@
 		}
 
 	} else {
-		gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name_n);
+		if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name_n, error))
+			return FALSE;
 		model_tables = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TABLE_NAMED], i_set, error);
 		if (model_tables == NULL)
 			retval = FALSE;
@@ -872,18 +877,22 @@
 		gint n_rows = gda_data_model_get_n_rows (model);
 		gint i;
 		for (i = 0; i < n_rows; ++i) {
-			const GValue *value = gda_data_model_get_value_at (model, 7, i);
+			const GValue *value = gda_data_model_get_value_at (model, 7, i, error);
+			if (!value) {
+				retval = FALSE;
+				break;
+			}
 
 			GValue *newvalue = map_mysql_to_gda (value);
 
 			retval = gda_data_model_set_value_at (GDA_DATA_MODEL(proxy), 8, i, newvalue, error);
 			gda_value_free (newvalue);
-			if (retval == 0)
+			if (! retval)
 				break;
 
 		}
 
-		if (retval != 0)
+		if (retval)
 			retval = gda_meta_store_modify_with_context (store, context, proxy, error);
 		g_object_unref (G_OBJECT(proxy));
 		g_object_unref (G_OBJECT(model));
@@ -923,9 +932,12 @@
 	}
 
 	/* Use a prepared statement for the "base" model. */
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select_full (cnc, internal_stmt[I_STMT_COLUMNS_OF_TABLE], i_set,
 							      GDA_STATEMENT_MODEL_RANDOM_ACCESS, /* col_types */ NULL, error);
 	if (model == NULL)
@@ -936,18 +948,22 @@
 		gint n_rows = gda_data_model_get_n_rows (model);
 		gint i;
 		for (i = 0; i < n_rows; ++i) {
-			const GValue *value = gda_data_model_get_value_at (model, 7, i);
+			const GValue *value = gda_data_model_get_value_at (model, 7, i, error);
+			if (!value) {
+				retval = FALSE;
+				break;
+			}
 
 			GValue *newvalue = map_mysql_to_gda (value);
 
 			retval = gda_data_model_set_value_at (GDA_DATA_MODEL(proxy), 8, i, newvalue, error);
 			gda_value_free (newvalue);
-			if (retval == 0)
+			if (! retval)
 				break;
 
 		}
 
-		if (retval != 0)
+		if (retval)
 			retval = gda_meta_store_modify (store, context->table_name, proxy,
 							"table_schema=##schema::string AND table_name=##name::string",
 							error,
@@ -1007,9 +1023,12 @@
 	GdaDataModel *model;
 	gboolean retval;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), view_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), view_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), view_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), view_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), view_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), view_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_VIEWS_COLUMNS], i_set, error);
 	if (model == NULL)
 		retval = FALSE;
@@ -1060,9 +1079,12 @@
 	GdaDataModel *model;
 	gboolean retval;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
 	if (!constraint_name_n) {
 		model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TABLES_CONSTRAINTS], i_set, error);
 		if (model == NULL)
@@ -1075,7 +1097,8 @@
 			g_object_unref (G_OBJECT(model));
 		}
 	} else {
-		gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name_n);
+		if (! gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name_n, error))
+			return FALSE;
 		model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TABLES_CONSTRAINTS_NAMED], i_set, error);
 		if (model == NULL)
 			retval = FALSE;
@@ -1135,10 +1158,14 @@
 	gboolean retval;
 
 	/* Use a prepared statement for the "base" model. */
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_REF_CONSTRAINTS], i_set, error);
 	if (model == NULL)
 		retval = FALSE;
@@ -1206,10 +1233,14 @@
 	}
 
 	/* Use a prepared statement for the "base" model. */
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_KEY_COLUMN_USAGE], i_set, error);
 	if (model == NULL)
 		retval = FALSE;
@@ -1309,9 +1340,12 @@
 		return FALSE;
 	}
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TRIGGERS], i_set, error);
 	if (model == NULL)
 		retval = FALSE;

Modified: trunk/providers/postgres/gda-postgres-meta.c
==============================================================================
--- trunk/providers/postgres/gda-postgres-meta.c	(original)
+++ trunk/providers/postgres/gda-postgres-meta.c	Thu Sep  4 20:08:38 2008
@@ -319,7 +319,11 @@
 	for (i = 0; i < nrows; i++) {
 		const GValue *value;
 		GType type;
-		value = gda_data_model_get_value_at (model, 6, i);
+		value = gda_data_model_get_value_at (model, 6, i, error);
+		if (!value) {
+			retval = FALSE;
+			break;
+		}
 		
 		type = _gda_postgres_type_oid_to_gda (cdata, g_value_get_int64 (value));
 		if (type != G_TYPE_STRING) {
@@ -366,8 +370,10 @@
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), udt_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), udt_schema);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), udt_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), udt_schema, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_UDT], i_set, error);
 	if (!model)
 		return FALSE;
@@ -402,9 +408,12 @@
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), udt_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), udt_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), udt_name);
+	if (!gda_holder_set_value (gda_set_get_holder (i_set, "cat"), udt_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), udt_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), udt_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_UDT_COLUMNS], i_set, error);
 	if (!model)
 		return FALSE;
@@ -456,8 +465,10 @@
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), domain_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), domain_schema);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), domain_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), domain_schema, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_DOMAINS], i_set, error);
 	if (!model)
 		return FALSE;
@@ -493,9 +504,12 @@
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), domain_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), domain_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), domain_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), domain_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), domain_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), domain_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_DOMAINS_CONSTRAINTS], i_set, error);
 	if (!model)
 		return FALSE;
@@ -542,7 +556,8 @@
 	GdaDataModel *model;
 	gboolean retval;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), specific_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), specific_name, error))
+		return FALSE;
 	cstr = g_value_get_string (specific_name);
 	if (*cstr == 'C') {
 		/* check correct postgres server version */
@@ -641,7 +656,8 @@
 	GdaDataModel *model;
 	gboolean retval;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), catalog_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), catalog_name, error))
+		return FALSE;
 	if (!schema_name_n) {
 		model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_SCHEMAS], i_set, error);
 		if (!model)
@@ -649,7 +665,8 @@
 		retval = gda_meta_store_modify (store, context->table_name, model, NULL, error, NULL);
 	}
 	else {
-		gda_holder_set_value (gda_set_get_holder (i_set, "name"), schema_name_n);
+		if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), schema_name_n, error))
+			return FALSE;
 		model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_SCHEMA_NAMED], i_set, error);
 		if (!model)
 			return FALSE;
@@ -725,8 +742,10 @@
 		return FALSE;
 	}
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
 	if (!table_name_n) {
 		tables_model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TABLES], i_set, error);
 		if (!tables_model)
@@ -738,7 +757,8 @@
 		}
 	}
 	else {
-		gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name_n);
+		if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name_n, error))
+			return FALSE;
 		tables_model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TABLE_NAMED], i_set, error);
 		if (!tables_model)
 			return FALSE;
@@ -794,7 +814,11 @@
 	for (i = 0; i < nrows; i++) {
 		const GValue *value;
 		GType type;
-		value = gda_data_model_get_value_at (model, 24, i);
+		value = gda_data_model_get_value_at (model, 24, i, error);
+		if (!value) {
+			retval = FALSE;
+			break;
+		}
 		
 		type = _gda_postgres_type_oid_to_gda (cdata, g_value_get_int64 (value));
 		if (type != G_TYPE_STRING) {
@@ -841,9 +865,12 @@
 	}
 
 	/* use a prepared statement for the "base" model */
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select_full (cnc, internal_stmt[I_STMT_COLUMNS_OF_TABLE], i_set, 
 							      GDA_STATEMENT_MODEL_RANDOM_ACCESS, col_types, error);
 	if (!model)
@@ -856,8 +883,12 @@
 	for (i = 0; i < nrows; i++) {
 		const GValue *value;
 		GType type;
-		value = gda_data_model_get_value_at (model, 25, i);
-		
+		value = gda_data_model_get_value_at (model, 25, i, error);
+		if (!value) {
+			retval = FALSE;
+			break;
+		}
+
 		type = _gda_postgres_type_oid_to_gda (cdata, g_value_get_int64 (value));
 		if (type != G_TYPE_STRING) {
 			GValue *v;
@@ -916,9 +947,12 @@
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), view_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), view_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), view_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), view_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), view_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), view_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_VIEWS_COLUMNS], i_set, error);
 	if (!model)
 		return FALSE;
@@ -954,9 +988,12 @@
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
 
 	if (!constraint_name_n) {
 		model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TABLES_CONSTRAINTS], i_set, 
@@ -971,7 +1008,8 @@
 
 	}
 	else {
-		gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name_n);
+		if (! gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name_n, error))
+			return FALSE;
 		model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TABLES_CONSTRAINT_NAMED], i_set, 
 								 error);
 		if (!model)
@@ -1013,10 +1051,14 @@
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_REF_CONSTRAINTS], i_set, 
 							 error);
 	if (!model)
@@ -1060,10 +1102,14 @@
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_KEY_COLUMN_USAGE], i_set, 
 							 error);
 	if (!model)
@@ -1107,10 +1153,14 @@
 	GdaDataModel *model;
 	gboolean retval = TRUE;
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name2"), constraint_name, error))
+		return FALSE;
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_CHECK_COLUMN_USAGE], i_set, 
 							 error);
 	if (!model)
@@ -1176,9 +1226,12 @@
 		return FALSE;
 	}
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), table_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), table_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), table_name, error))
+		return FALSE;
 
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_TRIGGERS], i_set, 
 							 error);
@@ -1238,10 +1291,13 @@
 		return FALSE;
 	}
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), routine_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), routine_schema);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), routine_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), routine_schema, error))
+		return FALSE;
 	if (routine_name_n) {
-		gda_holder_set_value (gda_set_get_holder (i_set, "name"), routine_name_n);
+		if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), routine_name_n, error))
+			return FALSE;
 		model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_ROUTINES_ONE], i_set, 
 								 error);
 	}
@@ -1290,7 +1346,11 @@
 		const GValue *cvalue;
 		GValue *v;
 
-		cvalue = gda_data_model_get_value_at (model, 2, i);
+		cvalue = gda_data_model_get_value_at (model, 2, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
 		if (!spname || gda_value_compare (spname, cvalue))
 			/* reinit ordinal position */
 			ordinal_pos = 1;
@@ -1333,9 +1393,12 @@
 		return FALSE;
 	}
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), rout_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), rout_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), rout_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), rout_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), rout_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), rout_name, error))
+		return FALSE;
 
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_ROUTINE_COL], i_set, 
 							 error);
@@ -1350,7 +1413,12 @@
 		const GValue *cvalue;
 		GValue *v;
 
-		cvalue = gda_data_model_get_value_at (model, 2, i);
+		cvalue = gda_data_model_get_value_at (model, 2, i, error);
+		if (!cvalue) {
+			retval = FALSE;
+			break;
+		}
+
 		if (!spname || gda_value_compare (spname, cvalue))
 			/* reinit ordinal position */
 			ordinal_pos = 1;
@@ -1419,9 +1487,12 @@
 		return FALSE;
 	}
 
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), rout_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), rout_schema);
-	gda_holder_set_value (gda_set_get_holder (i_set, "name"), rout_name);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), rout_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), rout_schema, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "name"), rout_name, error))
+		return FALSE;
 
 	model = gda_connection_statement_execute_select (cnc, internal_stmt[I_STMT_ROUTINE_PAR], i_set, 
 							 error);

Modified: trunk/providers/postgres/gda-postgres-provider.c
==============================================================================
--- trunk/providers/postgres/gda-postgres-provider.c	(original)
+++ trunk/providers/postgres/gda-postgres-provider.c	Thu Sep  4 20:08:38 2008
@@ -1838,7 +1838,7 @@
 		return NULL;
         }
 	else {
-		GdaSet *set;
+		GdaSet *set = NULL;
 		GSList *holders = NULL;
 		gint nrows, ncols, i;
 
@@ -1857,21 +1857,33 @@
 			GdaHolder *h;
 			GdaColumn *col;
 			gchar *id;
+			const GValue *cvalue;
+
 			col = gda_data_model_describe_column (model, i);
 			h = gda_holder_new (gda_column_get_g_type (col));
 			id = g_strdup_printf ("+%d", i);
 			g_object_set (G_OBJECT (h), "id", id, "not-null", FALSE,
 				      "name", gda_column_get_name (col), NULL);
 			g_free (id);
-			gda_holder_set_value (h, gda_data_model_get_value_at (model, i, 0));
+			cvalue = gda_data_model_get_value_at (model, i, 0, NULL);
+			if (!cvalue || !gda_holder_set_value (h, cvalue, NULL)) {
+				if (holders) {
+					g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
+					g_slist_free (holders);
+					holders = NULL;
+				}
+				break;
+			}
 			holders = g_slist_prepend (holders, h);
 		}
 		g_object_unref (model);
 
-		holders = g_slist_reverse (holders);
-		set = gda_set_new (holders);
-		g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
-		g_slist_free (holders);
+		if (holders) {
+			holders = g_slist_reverse (holders);
+			set = gda_set_new (holders);
+			g_slist_foreach (holders, (GFunc) g_object_unref, NULL);
+			g_slist_free (holders);
+		}
 
 		return set;
 	}
@@ -2218,7 +2230,7 @@
 	if (!gda_statement_get_parameters (internal_stmt [I_STMT_XA_PREPARE], &params, error))
 		return FALSE;
 	str = gda_xa_transaction_id_to_string (xid);
-	if (!gda_set_set_holder_value (params, "xid", str)) {
+	if (!gda_set_set_holder_value (params, NULL, "xid", str)) {
 		g_free (str);
 		g_object_unref (params);
 		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_INTERNAL_ERROR,
@@ -2254,7 +2266,7 @@
 	if (!gda_statement_get_parameters (internal_stmt [I_STMT_XA_PREPARE], &params, error))
 		return FALSE;
 	str = gda_xa_transaction_id_to_string (xid);
-	if (!gda_set_set_holder_value (params, "xid", str)) {
+	if (!gda_set_set_holder_value (params, NULL, "xid", str)) {
 		g_free (str);
 		g_object_unref (params);
 		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_INTERNAL_ERROR,
@@ -2289,7 +2301,7 @@
 	if (!gda_statement_get_parameters (internal_stmt [I_STMT_XA_PREPARE], &params, error))
 		return FALSE;
 	str = gda_xa_transaction_id_to_string (xid);
-	if (!gda_set_set_holder_value (params, "xid", str)) {
+	if (!gda_set_set_holder_value (params, NULL, "xid", str)) {
 		g_free (str);
 		g_object_unref (params);
 		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_INTERNAL_ERROR,
@@ -2329,7 +2341,7 @@
 		
 		nrows = gda_data_model_get_n_rows (model);
 		for (i = 0; i < nrows; i++) {
-			const GValue *cvalue = gda_data_model_get_value_at (model, 0, i);
+			const GValue *cvalue = gda_data_model_get_value_at (model, 0, i, NULL);
 			if (cvalue && !gda_value_is_null (cvalue))
 				list = g_list_prepend (list, 
 						       gda_xa_transaction_string_to_id (g_value_get_string (cvalue)));

Modified: trunk/providers/skel-implementation/capi/gda-capi-meta.c
==============================================================================
--- trunk/providers/skel-implementation/capi/gda-capi-meta.c	(original)
+++ trunk/providers/skel-implementation/capi/gda-capi-meta.c	Thu Sep  4 20:08:38 2008
@@ -133,8 +133,10 @@
 	gboolean retval = TRUE;
 
 	/* set internal holder's values from the arguments */
-	gda_holder_set_value (gda_set_get_holder (i_set, "cat"), udt_catalog);
-	gda_holder_set_value (gda_set_get_holder (i_set, "schema"), udt_schema);
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "cat"), udt_catalog, error))
+		return FALSE;
+	if (! gda_holder_set_value (gda_set_get_holder (i_set, "schema"), udt_schema, error))
+		return FALSE;
 
 	TO_IMPLEMENT;
 	/* fill in @model, with something like:

Modified: trunk/samples/BDB/access-raw.c
==============================================================================
--- trunk/samples/BDB/access-raw.c	(original)
+++ trunk/samples/BDB/access-raw.c	Thu Sep  4 20:08:38 2008
@@ -31,12 +31,22 @@
 		
 		g_print ("=============== ROW %d\n", i);
 
-		c_value= gda_data_model_get_value_at (model, 0, i);
+		c_value= gda_data_model_get_value_at (model, 0, i, &error);
+		if (!c_value) {
+			g_print ("Could not get value from data model: %s\n",
+				 error && error->message ? error->messag : "No detail");
+			exit (1);
+		}
 		bin = gda_value_get_binary (c_value);
 		key = (Key *)bin->data;
 		g_print ("color/type = %s/%d\n", key->color, key->type);
 
-		c_value= gda_data_model_get_value_at (model, 1, i);
+		c_value= gda_data_model_get_value_at (model, 1, i, &error);
+		if (!c_value) {
+			g_print ("Could not get value from data model: %s\n",
+				 error && error->message ? error->messag : "No detail");
+			exit (1);
+		}
 		bin = gda_value_get_binary (c_value);
 		value = (Value *)bin->data;
 		g_print ("size/name = %f/%s\n", value->size, value->name);

Modified: trunk/samples/TableCopy/table-copy.c
==============================================================================
--- trunk/samples/TableCopy/table-copy.c	(original)
+++ trunk/samples/TableCopy/table-copy.c	Thu Sep  4 20:08:38 2008
@@ -109,17 +109,18 @@
 		GValue *value;
 		gint res;
 
+		/* REM: exit status for each function should be check but has been omitted for clarity */
 		p = gda_set_get_holder (params, "ref");
-		gda_holder_set_value (p, gda_data_model_get_value_at (source, 0, row));
+		gda_holder_set_value (p, gda_data_model_get_value_at (source, 0, row, NULL));
 		p = gda_set_get_holder (params, "name");
-		gda_holder_set_value (p, gda_data_model_get_value_at (source, 1, row));
+		gda_holder_set_value (p, gda_data_model_get_value_at (source, 1, row, NULL));
 		p = gda_set_get_holder (params, "price");
 		value = gda_value_new (G_TYPE_DOUBLE);
-		g_value_set_double (value, g_value_get_double (gda_data_model_get_value_at (source, 2, row)) * 1.05);
+		g_value_set_double (value, g_value_get_double (gda_data_model_get_value_at (source, 2, row, NULL)) * 1.05);
 		gda_holder_set_value (p, value);
 		gda_value_free (value);
 		p = gda_set_get_holder (params, "location");
-		gda_holder_set_value (p, gda_data_model_get_value_at (source, 3, row));
+		gda_holder_set_value (p, gda_data_model_get_value_at (source, 3, row, NULL));
 
 		res = gda_connection_statement_execute_non_select (d_cnc, stmt, params, NULL, &error);
 		if (res == -1) {

Modified: trunk/testing/gda-provider-status.c
==============================================================================
--- trunk/testing/gda-provider-status.c	(original)
+++ trunk/testing/gda-provider-status.c	Thu Sep  4 20:08:38 2008
@@ -104,7 +104,13 @@
 			for (i = 0; i < nb; i++) {
 				GdaServerProvider *prov = NULL;
 				const gchar *pname;
-				pname = g_value_get_string (gda_data_model_get_value_at (providers, 0, i));
+				const GValue *cvalue;
+
+				cvalue = gda_data_model_get_value_at (providers, 0, i, error);
+				if (!cvalue) 
+					g_error ("Can't load the '%s' provider: %s\n", pname,
+						 error && error->message ? error->message : "No detail");
+				pname = g_value_get_string (cvalue);
 				prov = gda_config_get_provider_object (pname, &error);
 				if (!prov) 
 					g_error ("Can't load the '%s' provider: %s\n", pname,

Modified: trunk/testing/gda-test-blob.c
==============================================================================
--- trunk/testing/gda-test-blob.c	(original)
+++ trunk/testing/gda-test-blob.c	Thu Sep  4 20:08:38 2008
@@ -213,19 +213,22 @@
 	/* blob id */
 	param = gda_set_get_holder (plist, "id");
 	str = g_strdup_printf ("%d", id);
-	gda_holder_set_value_str (param, NULL, str);
+	if (! gda_holder_set_value_str (param, NULL, str, error))
+		return FALSE;
 	g_free (str);
 
 	/* blob name */
 	param = gda_set_get_holder (plist, "name");
 	str = g_strdup_printf ("BLOB_%d", id);
-	gda_holder_set_value_str (param, NULL, str);
+	if (! gda_holder_set_value_str (param, NULL, str, error))
+		return FALSE;
 	g_free (str);
 
 	/* blob data */
 	param = gda_set_get_holder (plist, "theblob");
 	value = gda_value_new_blob (data, binary_length);
-	gda_holder_set_value (param, value);
+	if (! gda_holder_set_value (param, value, error))
+		return FALSE;
 	gda_value_free (value);
 
 	gda_connection_clear_events_list (cnc);
@@ -257,19 +260,22 @@
 	/* blob id */
 	param = gda_set_get_holder (plist, "id");
 	str = g_strdup_printf ("%d", id);
-	gda_holder_set_value_str (param, NULL, str);
+	if (! gda_holder_set_value_str (param, NULL, str, error))
+		return FALSE;
 	g_free (str);
 
 	/* blob name */
 	param = gda_set_get_holder (plist, "name");
 	str = g_strdup_printf ("BLOB_%d", id);
-	gda_holder_set_value_str (param, NULL, str);
+	if (! gda_holder_set_value_str (param, NULL, str, error))
+		return FALSE;
 	g_free (str);
 
 	/* blob data */
 	param = gda_set_get_holder (plist, "theblob");
 	value = gda_value_new_blob (data, binary_length);
-	gda_holder_set_value (param, value);
+	if (! gda_holder_set_value (param, value, error))
+		return FALSE;
 	gda_value_free (value);
 
 	gda_connection_clear_events_list (cnc);
@@ -299,12 +305,14 @@
 
 	/* blob name */
 	param = gda_set_get_holder (plist, "name");
-	gda_holder_set_value_str (param, NULL, "---");
+	if (! gda_holder_set_value_str (param, NULL, "---", error))
+		return FALSE;
 
 	/* blob data */
 	param = gda_set_get_holder (plist, "theblob");
 	value = gda_value_new_blob (data, binary_length);
-	gda_holder_set_value (param, value);
+	if (! gda_holder_set_value (param, value, error))
+		return FALSE;
 	gda_value_free (value);
 
 	gda_connection_clear_events_list (cnc);

Modified: trunk/testing/html.c
==============================================================================
--- trunk/testing/html.c	(original)
+++ trunk/testing/html.c	Thu Sep  4 20:08:38 2008
@@ -340,8 +340,14 @@
                                 GValue *value;
                                 gchar *str;
 
-                                value = (GValue *) gda_data_model_get_value_at (model, c, r);
-				if (!value || gda_value_is_null (value)) {
+                                value = (GValue *) gda_data_model_get_value_at (model, c, r, NULL);
+				if (!value) {
+					xmlNodePtr p;
+					td = xmlNewChild (tr, NULL, "td", NULL);
+					p = xmlNewChild (td, NULL, "p", "ERROR");
+					xmlSetProp(p, "class", (xmlChar*)"null");
+				}
+				else if (gda_value_is_null (value)) {
 					xmlNodePtr p;
 					td = xmlNewChild (tr, NULL, "td", NULL);
 					p = xmlNewChild (td, NULL, "p", "NULL");

Modified: trunk/tests/data-models/check_data_proxy.c
==============================================================================
--- trunk/tests/data-models/check_data_proxy.c	(original)
+++ trunk/tests/data-models/check_data_proxy.c	Thu Sep  4 20:08:38 2008
@@ -1212,8 +1212,16 @@
 		}
 		ncols = gda_data_model_get_n_columns (model);
 		for (col = 0; col < ncols; col++) {
-			const GValue *value = gda_data_model_get_value_at (model, col, 0);
-			if (value) {
+			GError *lerror = NULL;
+			const GValue *value = gda_data_model_get_value_at (model, col, 0, &lerror);
+			if (!value) {
+#ifdef CHECK_EXTRA_INFO
+				g_print ("Can't get data model's value: %s\n",
+					 lerror && lerror->message ? lerror->message : "No detail");
+#endif
+				exit (1);
+			}
+			else if (! gda_value_is_null (value)) {
 #ifdef CHECK_EXTRA_INFO
 				g_print ("ERROR: As the \"prepend-null-entry\" property is set, there should always be a first "
 					 "all-NULL entry, got '%s' at column %d\n", gda_value_stringify (value), col);
@@ -1322,6 +1330,7 @@
 	GValue *gvalue;
 	const GValue *mvalue;
 	gboolean retval;
+	GError *lerror = NULL;
 
 	row = ADJUST_ROW_FOR_MODEL (model, row);
 
@@ -1335,8 +1344,15 @@
 	else
 		gvalue = gda_value_new_null ();	
 
-	mvalue = gda_data_model_get_value_at (model, col, row); 
-	retval = !gda_value_compare_ext (gvalue, mvalue);
+	mvalue = gda_data_model_get_value_at (model, col, row, &lerror);
+	if (!mvalue) {
+#ifdef CHECK_EXTRA_INFO
+		g_print ("Can't get data model's value: %s\n",
+			 lerror && lerror->message ? lerror->message : "No detail");
+#endif
+		return FALSE;
+	}
+	retval = !gda_value_compare (gvalue, mvalue);
 	gda_value_free (gvalue);
 
 #ifdef CHECK_EXTRA_INFO
@@ -1366,7 +1382,7 @@
 		return FALSE;
 	}
 
-	value = gda_data_model_get_value_at (model, 0, nrows);
+	value = gda_data_model_get_value_at (model, 0, nrows, NULL);
 	if (value) {
 #ifdef CHECK_EXTRA_INFO
 		g_print ("ERROR: Got a value at row %d, should not get any as it is out of bounds\n", nrows);
@@ -1443,8 +1459,16 @@
 	GList *list;
 	gint col;
 	for (col = 0, list = values; list; col++, list = list->next) {
-		const GValue *cvalue = gda_data_model_get_value_at (model, col, row);
-		if (list->data && gda_value_compare_ext (cvalue, (GValue *) list->data)) {
+		GError *lerror = NULL;
+		const GValue *cvalue = gda_data_model_get_value_at (model, col, row, &lerror);
+		if (!cvalue) {
+#ifdef CHECK_EXTRA_INFO
+			g_print ("Can't get data model's value: %s\n",
+				 lerror && lerror->message ? lerror->message : "No detail");
+#endif
+			return FALSE;
+		}
+		if (list->data && gda_value_compare (cvalue, (GValue *) list->data)) {
 #ifdef CHECK_EXTRA_INFO
 			g_print ("ERROR: Read value is not equal to set value: got '%s' and expected '%s'\n",
 				 gda_value_stringify (cvalue), gda_value_stringify ((GValue *) list->data));

Modified: trunk/tests/data-models/check_model_copy.c
==============================================================================
--- trunk/tests/data-models/check_model_copy.c	(original)
+++ trunk/tests/data-models/check_model_copy.c	Thu Sep  4 20:08:38 2008
@@ -143,6 +143,8 @@
 	if (gda_data_comparator_get_n_diffs (cmp) > 0) {
 #ifdef CHECK_EXTRA_INFO
 		g_print ("There are %d difference(s)\n", gda_data_comparator_get_n_diffs (cmp));
+		gda_data_model_dump (import, stdout);
+		gda_data_model_dump (copy, stdout);
 #endif
 		retval = FALSE;
 	}

Modified: trunk/tests/data-models/check_pmodel.c
==============================================================================
--- trunk/tests/data-models/check_pmodel.c	(original)
+++ trunk/tests/data-models/check_pmodel.c	Thu Sep  4 20:08:38 2008
@@ -296,7 +296,13 @@
 #endif
 		goto out;
 	}
-	gda_set_set_holder_value (params, "country", "SP");
+	if (! gda_set_set_holder_value (params, &error, "country", "SP")) {
+		nfailed++;
+#ifdef CHECK_EXTRA_INFO
+		g_print ("Could not set SELECT's parameters!\n");
+#endif
+		goto out;
+	}
 	model = gda_connection_statement_execute_select (cnc, stmt, params, &error);
 	g_object_unref (params);
 	if (!model) {
@@ -800,7 +806,13 @@
 #endif
 		goto out;
 	}
-	gda_set_set_holder_value (params, "country", "SP");
+	if (! gda_set_set_holder_value (params, &error, "country", "SP")) {
+		nfailed++;
+#ifdef CHECK_EXTRA_INFO
+		g_print ("Could not get SELECT's parameters!\n");
+#endif
+		goto out;
+	}
 	model = gda_connection_statement_execute_select (cnc, stmt, params, &error);
 	if (!model) {
 		nfailed++;
@@ -816,7 +828,7 @@
 
 	
 	/* gda_data_select_compute_modification_statements() */
-	if (!gda_data_select_compute_modification_statements (GDA_DATA_SELECT (model), TRUE, &error)) {
+	if (!gda_data_select_compute_modification_statements (GDA_DATA_SELECT (model), &error)) {
 		nfailed++;
 #ifdef CHECK_EXTRA_INFO
 		g_print ("gda_data_select_compute_modification_statements() should have succedded, error: %s\n",
@@ -862,8 +874,15 @@
 #endif
 		return FALSE;
 	}
-	get_value = gda_data_model_get_value_at (model, col, row);
-	if (gda_value_compare_ext (get_value, set_value)) {
+	get_value = gda_data_model_get_value_at (model, col, row, &error);
+	if (!get_value) {
+#ifdef CHECK_EXTRA_INFO
+		g_print ("Can't get data model's value: %s",
+			 error && error->message ? error->message : "No detail");
+#endif
+		return FALSE;
+	}
+	if (gda_value_compare (get_value, set_value)) {
 #ifdef CHECK_EXTRA_INFO
 		gchar *s1, *s2;
 		s1 = gda_value_stringify (get_value);
@@ -939,8 +958,15 @@
 		if (!list->data)
 			continue;
 		
-		get_value = gda_data_model_get_value_at (model, i, row);
-		if (gda_value_compare_ext (get_value, (GValue*) list->data)) {
+		get_value = gda_data_model_get_value_at (model, i, row, &error);
+		if (!get_value) {
+#ifdef CHECK_EXTRA_INFO
+			g_print ("Can't get data model's value: %s",
+				 error && error->message ? error->message : "No detail");
+#endif
+			return FALSE;
+		}
+		if (gda_value_compare (get_value, (GValue*) list->data)) {
 #ifdef CHECK_EXTRA_INFO
 			gchar *s1, *s2;
 			s1 = gda_value_stringify (get_value);
@@ -1021,8 +1047,15 @@
 		if (!list->data)
 			continue;
 		
-		get_value = gda_data_model_get_value_at (model, i, newrow);
-		if (gda_value_compare_ext (get_value, (GValue*) list->data)) {
+		get_value = gda_data_model_get_value_at (model, i, newrow, &error);
+		if (!get_value) {
+#ifdef CHECK_EXTRA_INFO
+			g_print ("Can't get data model's value: %s",
+				 error && error->message ? error->message : "No detail");
+#endif
+			return FALSE;
+		}
+		if (gda_value_compare (get_value, (GValue*) list->data)) {
 #ifdef CHECK_EXTRA_INFO
 			gchar *s1, *s2;
 			s1 = gda_value_stringify (get_value);

Modified: trunk/tests/data-models/data1.xml
==============================================================================
--- trunk/tests/data-models/data1.xml	(original)
+++ trunk/tests/data-models/data1.xml	Thu Sep  4 20:08:38 2008
@@ -2,8 +2,8 @@
 <gda_array id="FIELDS_A" name="Table's columns">
   <gda_array_field id="COLUMN_NAME" name="Field name" title="Field name" gdatype="gchararray"/>
   <gda_array_field id="COLUMN_TYPE" name="Data type" title="Data type" gdatype="gchararray"/>
-  <gda_array_field id="COLUMN_SIZE" name="Size" title="Size" gdatype="guint"/>
-  <gda_array_field id="COLUMN_SCALE" name="Scale" title="Scale" gdatype="guint"/>
+  <gda_array_field id="COLUMN_SIZE" name="Size" title="Size" gdatype="guint" nullok="TRUE"/>
+  <gda_array_field id="COLUMN_SCALE" name="Scale" title="Scale" gdatype="guint" nullok="TRUE"/>
   <gda_array_field id="COLUMN_NNUL" name="Not NULL" title="Not NULL" gdatype="gboolean"/>
   <gda_array_field id="COLUMN_AUTOINC" name="Auto increment" title="Auto increment" gdatype="gboolean"/>
   <gda_array_field id="COLUMN_UNIQUE" name="Unique" title="Unique" gdatype="gboolean"/>

Modified: trunk/tests/meta-store/common.c
==============================================================================
--- trunk/tests/meta-store/common.c	(original)
+++ trunk/tests/meta-store/common.c	Thu Sep  4 20:08:38 2008
@@ -135,7 +135,12 @@
 		
 		v = gda_value_new (G_TYPE_ULONG);
 		g_value_set_ulong (v, gda_g_type_from_string (va_arg (args, gchar*)));
-		gda_holder_take_value (holder, v);
+		if (! gda_holder_take_value (holder, v, NULL)) {
+			va_end (args);
+			g_object_unref (holder);
+			g_object_unref (options);
+			return NULL;
+		}
 		
 		gda_set_add_holder (options, holder);
 		g_object_unref (holder);
@@ -226,8 +231,14 @@
 		for (j = 0; j < ncols; j++) {
 			gchar *str;
 			const GValue *value;
+			GError *lerror = NULL;
 			str = g_strdup_printf ("+%d", j);
-			value = gda_data_model_get_value_at (model, j, i);
+			value = gda_data_model_get_value_at (model, j, i, &lerror);
+			if (!value) {
+				g_print ("Can't get data model's value: %s",
+					 lerror && lerror->message ? lerror->message : "No detail");
+				exit (1);
+			}
 			g_hash_table_insert (ac->keys, str, gda_value_copy (value));
 		}
 

Modified: trunk/tests/multi-threading/check_parser.c
==============================================================================
--- trunk/tests/multi-threading/check_parser.c	(original)
+++ trunk/tests/multi-threading/check_parser.c	Thu Sep  4 20:08:38 2008
@@ -62,7 +62,13 @@
 	providers_model = gda_config_list_providers ();
 	for (i = 0; i < gda_data_model_get_n_rows (providers_model); i++) {
 		const GValue *pname;
-		pname = gda_data_model_get_value_at (providers_model, 0, i);
+		GError *lerror = NULL;
+		pname = gda_data_model_get_value_at (providers_model, 0, i, &lerror);
+		if (!pname) {
+			g_print ("Can't get data model's value: %s",
+				 lerror && lerror->message ? lerror->message : "No detail");
+			exit (1);
+		}
 		parser = create_parser_for_provider (g_value_get_string (pname));
 		g_hash_table_insert (parsers_hash, g_strdup (g_value_get_string (pname)), parser);
 		g_print ("Created parser for provider %s\n", g_value_get_string (pname));

Modified: trunk/tests/parser/check_parser.c
==============================================================================
--- trunk/tests/parser/check_parser.c	(original)
+++ trunk/tests/parser/check_parser.c	Thu Sep  4 20:08:38 2008
@@ -42,7 +42,13 @@
 	providers_model = gda_config_list_providers ();
 	for (i = 0; i < gda_data_model_get_n_rows (providers_model); i++) {
 		const GValue *pname;
-		pname = gda_data_model_get_value_at (providers_model, 0, i);
+		GError *lerror = NULL;
+		pname = gda_data_model_get_value_at (providers_model, 0, i, &lerror);
+		if (!pname) {
+			g_print ("Can't get data model's value: %s",
+				 lerror && lerror->message ? lerror->message : "No detail");
+			exit (1);
+		}
 		parser = create_parser_for_provider (g_value_get_string (pname));
 		g_hash_table_insert (parsers_hash, g_strdup (g_value_get_string (pname)), parser);
 		g_print ("Created parser for provider %s\n", g_value_get_string (pname));

Modified: trunk/tests/providers/prov-test-util.c
==============================================================================
--- trunk/tests/providers/prov-test-util.c	(original)
+++ trunk/tests/providers/prov-test-util.c	Thu Sep  4 20:08:38 2008
@@ -79,13 +79,28 @@
 				continue;
 			const GValue *m_val, *e_val;
 			GdaColumn *column;
+			GError *lerror = NULL;
 
 			column = gda_data_model_describe_column (model, col);
 			if (!strcmp (gda_column_get_name (column), "Owner"))
 				continue;
-			m_val = gda_data_model_get_value_at (model, col, row);
-			e_val =  gda_data_model_get_value_at (compare_m, col, row);
-			if (gda_value_compare_ext (m_val, e_val)) {
+			m_val = gda_data_model_get_value_at (model, col, row, &lerror);
+			if (! m_val) {
+#ifdef CHECK_EXTRA_INFO
+				g_warning ("Can't get data model's value: %s",
+					   lerror && lerror->message ? lerror->message : "No detail");
+#endif
+				retval = FALSE;
+			}
+			e_val =  gda_data_model_get_value_at (compare_m, col, row, &lerror);
+			if (! e_val) {
+#ifdef CHECK_EXTRA_INFO
+				g_warning ("Can't get data model's value: %s",
+					   lerror && lerror->message ? lerror->message : "No detail");
+#endif
+				retval = FALSE;
+			}
+			if (retval && gda_value_compare (m_val, e_val)) {
 #ifdef CHECK_EXTRA_INFO
 				g_warning ("Reported schema error line %d, col %d: expected '%s' and got '%s'",
 					   row, col, 
@@ -264,9 +279,23 @@
         }
         for (i = 0, list = GDA_SET (iter)->holders; i < cols; i++, list = list->next) {
                 const GValue *v1, *v2;
+		GError *lerror = NULL;
                 v1 = gda_holder_get_value (GDA_HOLDER (list->data));
-                v2 = gda_data_model_get_value_at (ref_model, i, rownum);
-                if (gda_value_compare_ext (v1, v2)) {
+		if (!v1) {
+#ifdef CHECK_EXTRA_INFO
+			g_warning ("GdaHolder is set to default (unspecified) value");
+#endif
+			return FALSE;
+		}
+                v2 = gda_data_model_get_value_at (ref_model, i, rownum, &lerror);
+		if (!v2) {
+#ifdef CHECK_EXTRA_INFO
+			g_warning ("Can't get data model's value: %s",
+				   lerror && lerror->message ? lerror->message : "No detail");
+#endif
+			return FALSE;
+		}
+                if (gda_value_compare (v1, v2)) {
 #ifdef CHECK_EXTRA_INFO
                         g_print ("Wrong value:\n\tgot: %s\n\texp: %s\n",
                                  gda_value_stringify (v1),
@@ -395,13 +424,22 @@
 			tmp = g_strdup_printf ("+%d", i);
 			const GValue *value;
 			GdaHolder *h;
-			value = gda_data_model_get_value_at (imodel, i, row);
+			GError *lerror = NULL;
+			value = gda_data_model_get_value_at (imodel, i, row, &lerror);
+			if (!value) {
+#ifdef CHECK_EXTRA_INFO
+				g_warning ("Can't get data model's value: %s",
+					   lerror && lerror->message ? lerror->message : "No detail");
+#endif
+				g_object_unref (imodel);
+				return FALSE;
+			}
 			h = gda_set_get_holder (set, tmp);
-			if (! gda_holder_set_value (h, value)) {
+			if (! gda_holder_set_value (h, value, &lerror)) {
 #ifdef CHECK_EXTRA_INFO
 				g_warning ("Could not set INSERT statement's parameter '%s': %s",
 					   tmp,
-					   error && error->message ? error->message : "No detail");
+					   lerror && lerror->message ? lerror->message : "No detail");
 #endif
 				g_object_unref (imodel);
 				return FALSE;

Modified: trunk/tests/test-cnc-utils.c
==============================================================================
--- trunk/tests/test-cnc-utils.c	(original)
+++ trunk/tests/test-cnc-utils.c	Thu Sep  4 20:08:38 2008
@@ -410,9 +410,13 @@
 		gint j;
 		GSList *list;
 		for (list = params->holders, j = 0; list && (j < ncols); list = list->next, j++) {
-			const GValue *cvalue = gda_data_model_get_value_at (import, j, i);
-			if (! gda_holder_set_value (GDA_HOLDER (list->data), cvalue)) {
-				g_set_error (error, 0, 0, "Error using value at col=>%d and row=>%d", j, i);
+			const GValue *cvalue = gda_data_model_get_value_at (import, j, i, error);
+			if (!cvalue) {
+				gda_connection_rollback_transaction (cnc, NULL, NULL);
+				retval = FALSE;
+				goto out;
+			}
+			if (! gda_holder_set_value (GDA_HOLDER (list->data), cvalue, error)) {
 				gda_connection_rollback_transaction (cnc, NULL, NULL);
 				retval = FALSE;
 				goto out;

Modified: trunk/tests/value-holders/check_holder.c
==============================================================================
--- trunk/tests/value-holders/check_holder.c	(original)
+++ trunk/tests/value-holders/check_holder.c	Thu Sep  4 20:08:38 2008
@@ -92,18 +92,15 @@
 	/***/
 	value = gda_value_new_from_string ("my string", G_TYPE_STRING);
 	emitted_signals_reset ();
-	if (!gda_holder_set_value (h, value)) {
-		g_set_error (error, 0, 0,
-			     "Could not set GdaHolder's value");
+	if (!gda_holder_set_value (h, value, error))
 		return FALSE;
-	}
 	if (!emitted_signals_find (h, "changed", error))
 		return FALSE;
 	if (!emitted_signals_chech_empty (NULL, "changed", error))
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is incorrect");
 		return FALSE;
@@ -114,18 +111,15 @@
 	value = gda_value_new_from_string ("my other string", G_TYPE_STRING);
 	copy = gda_value_copy (value);
 	emitted_signals_reset ();
-	if (!gda_holder_take_value (h, value)) {
-		g_set_error (error, 0, 0,
-			     "Could not set GdaHolder's value");
+	if (!gda_holder_take_value (h, value, error))
 		return FALSE;
-	}
 	if (!emitted_signals_find (h, "changed", error))
 		return FALSE;
 	if (!emitted_signals_chech_empty (NULL, "changed", error))
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (copy, cvalue)) {
+	if (!cvalue || gda_value_compare (copy, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is incorrect");
 		return FALSE;
@@ -149,7 +143,7 @@
 	h = gda_holder_new_boolean ("ABOOL", TRUE);
 	value = gda_value_new_from_string ("TRUE", G_TYPE_BOOLEAN);
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is incorrect");
 		return FALSE;
@@ -166,7 +160,7 @@
 	h = gda_holder_new_string ("Astring", "A string value");
 	value = gda_value_new_from_string ("A string value", G_TYPE_STRING);
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is incorrect");
 		return FALSE;
@@ -182,7 +176,7 @@
 	h = gda_holder_new_int ("AnInt",  15);
 	value = gda_value_new_from_string ("15", G_TYPE_INT);
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is incorrect");
 		return FALSE;
@@ -234,7 +228,8 @@
 	/***/
 	emitted_signals_reset ();
 	value = gda_value_new_from_string ("FALSE", G_TYPE_BOOLEAN);
-	gda_holder_take_value (h, value);
+	if (! gda_holder_take_value (h, value, error))
+		return FALSE;
 	if (!gda_holder_is_valid (h)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder is invalid");
@@ -287,7 +282,7 @@
 		return FALSE;
 
 	cvalue = gda_holder_get_default_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder's default value is invalid");
 		return FALSE;
@@ -313,29 +308,24 @@
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h);
-	value = gda_value_new_null ();
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (cvalue) {
 		tests_common_display_value ("cvalue", cvalue);
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is invalid");
 		return FALSE;
 	}
-	gda_value_free (value);
 
 	/** set value to "hey" */
 	value = gda_value_new_from_string ("hey", G_TYPE_STRING);
-	if (!gda_holder_set_value (h, value)) {
-		g_set_error (error, 0, 0,
-			     "Could not set GdaHolder's value");
+	if (!gda_holder_set_value (h, value, error))
 		return FALSE;
-	}
 	if (!emitted_signals_find (h, "changed", error))
 		return FALSE;
 	if (!emitted_signals_chech_empty (NULL, "changed", error))
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		tests_common_display_value ("cvalue", cvalue);
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is invalid");
@@ -350,7 +340,7 @@
 		return FALSE;
 
 	cvalue = gda_holder_get_default_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder's default value is invalid");
 		return FALSE;
@@ -397,7 +387,7 @@
 		return FALSE;
 
 	cvalue = gda_holder_get_default_value (h);
-	if (gda_value_compare_ext (defvalue, cvalue)) {
+	if (!cvalue || gda_value_compare (defvalue, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder's default value is invalid");
 		return FALSE;
@@ -422,7 +412,7 @@
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (defvalue, cvalue)) {
+	if (!cvalue || gda_value_compare (defvalue, cvalue)) {
 		tests_common_display_value ("cvalue", cvalue);
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is invalid");
@@ -431,18 +421,15 @@
 
 	/** set value to "hey" */
 	value = gda_value_new_from_string ("hey", G_TYPE_STRING);
-	if (!gda_holder_set_value (h, value)) {
-		g_set_error (error, 0, 0,
-			     "Could not set GdaHolder's value");
+	if (!gda_holder_set_value (h, value, error))
 		return FALSE;
-	}
 	if (!emitted_signals_find (h, "changed", error))
 		return FALSE;
 	if (!emitted_signals_chech_empty (NULL, "changed", error))
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		tests_common_display_value ("cvalue", cvalue);
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is invalid");
@@ -459,18 +446,15 @@
 
 	/** set value to "ABC" */
 	value = gda_value_new_from_string ("ABC", G_TYPE_STRING);
-	if (!gda_holder_set_value (h, value)) {
-		g_set_error (error, 0, 0,
-			     "Could not set GdaHolder's value");
+	if (!gda_holder_set_value (h, value, error))
 		return FALSE;
-	}
 	if (!emitted_signals_find (h, "changed", error))
 		return FALSE;
 	if (!emitted_signals_chech_empty (NULL, "changed", error))
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		tests_common_display_value ("cvalue", cvalue);
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is invalid");
@@ -518,7 +502,7 @@
 		return FALSE;
 
 	cvalue = gda_holder_get_default_value (h);
-	if (gda_value_compare_ext (defvalue, cvalue)) {
+	if (!cvalue || gda_value_compare (defvalue, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "GdaHolder's default value is invalid");
 		return FALSE;
@@ -552,13 +536,10 @@
 
 	/** set value to "hey" */
 	value = gda_value_new_from_string ("hey", G_TYPE_STRING);
-	if (!gda_holder_set_value (h, value)) {
-		g_set_error (error, 0, 0,
-			     "Could not set GdaHolder's value");
+	if (!gda_holder_set_value (h, value, error))
 		return FALSE;
-	}
 	cvalue = gda_holder_get_value (h);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		tests_common_display_value ("cvalue", cvalue);
 		g_set_error (error, 0, 0,
 			     "GdaHolder's value is invalid");
@@ -595,7 +576,8 @@
 	emitted_signals_monitor_holder (h2);
 	emitted_signals_reset ();
 
-	gda_holder_set_bind (h1, h2);
+	if (! gda_holder_set_bind (h1, h2, error))
+		return FALSE;
 	if (!emitted_signals_find (h1, "changed", error))
 		return FALSE;
 	if (!emitted_signals_notfind (h2, "changed", error))
@@ -605,7 +587,7 @@
 
 	value = gda_value_new_from_string ("Master string", G_TYPE_STRING);
 	cvalue = gda_holder_get_value (h1);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		tests_common_display_value ("Slave", cvalue);
 		g_set_error (error, 0, 0,
 			     "Slave GdaHolder's value is wrong");
@@ -615,11 +597,8 @@
 	
 	/***/
 	value = gda_value_new_from_string ("A string", G_TYPE_STRING);
-	if (!gda_holder_set_value (h1, value)) {
-		g_set_error (error, 0, 0,
-			     "Could not set Slave's value");
+	if (!gda_holder_set_value (h1, value, error))
 		return FALSE;
-	}
 	if (!emitted_signals_find (h1, "changed", error))
 		return FALSE;
 	if (!emitted_signals_notfind (h2, "changed", error))
@@ -628,7 +607,7 @@
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h1);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		tests_common_display_value ("Slave", cvalue);
 		g_set_error (error, 0, 0,
 			     "Slave GdaHolder's value is wrong");
@@ -638,11 +617,8 @@
 
 	/***/
 	value = gda_value_new_from_string ("A string", G_TYPE_STRING);
-	if (!gda_holder_set_value (h2, value)) {
-		g_set_error (error, 0, 0,
-			     "Could not set Master's value");
+	if (!gda_holder_set_value (h2, value, error))
 		return FALSE;
-	}
 	if (!emitted_signals_find (h1, "changed", error))
 		return FALSE;
 	if (!emitted_signals_find (h2, "changed", error))
@@ -651,25 +627,26 @@
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h2);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "Master GdaHolder's value is wrong");
 		return FALSE;
 	}
 	cvalue = gda_holder_get_value (h1);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "Slave GdaHolder's value is wrong");
 		return FALSE;
 	}
 
 	/***/
-	gda_holder_set_bind (h1, NULL);
+	if (! gda_holder_set_bind (h1, NULL, error))
+		return FALSE;
 	if (!emitted_signals_chech_empty (NULL, "changed", error))
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h1);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "Slave GdaHolder's value is wrong");
 		return FALSE;
@@ -677,11 +654,8 @@
 	gda_value_free (value);
 
 	value = gda_value_new_from_string ("Another string", G_TYPE_STRING);
-	if (!gda_holder_set_value (h1, value)) {
-		g_set_error (error, 0, 0,
-			     "Could not set Master's value");
+	if (!gda_holder_set_value (h1, value, error))
 		return FALSE;
-	}
 	if (!emitted_signals_find (h1, "changed", error))
 		return FALSE;
 	if (!emitted_signals_notfind (h2, "changed", error))
@@ -690,14 +664,14 @@
 		return FALSE;
 
 	cvalue = gda_holder_get_value (h1);
-	if (gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "Slave GdaHolder's value is wrong");
 		return FALSE;
 	}
 
 	cvalue = gda_holder_get_value (h2);
-	if (!gda_value_compare_ext (value, cvalue)) {
+	if (!cvalue || !gda_value_compare (value, cvalue)) {
 		g_set_error (error, 0, 0,
 			     "Master GdaHolder's value is wrong");
 		return FALSE;

Modified: trunk/tests/value-holders/check_statement.c
==============================================================================
--- trunk/tests/value-holders/check_statement.c	(original)
+++ trunk/tests/value-holders/check_statement.c	Thu Sep  4 20:08:38 2008
@@ -129,7 +129,9 @@
 	providers_model = gda_config_list_providers ();
 	for (i = 0; i < gda_data_model_get_n_rows (providers_model); i++) {
 		const GValue *pname;
-		pname = gda_data_model_get_value_at (providers_model, 0, i);
+		pname = gda_data_model_get_value_at (providers_model, 0, i, error);
+		if (!pname)
+			return FALSE;
 		parser = create_parser_for_provider (g_value_get_string (pname));
 		g_hash_table_insert (parsers_hash, g_strdup (g_value_get_string (pname)), parser);
 		g_print ("Created parser for provider %s\n", g_value_get_string (pname));

Modified: trunk/tools/command-exec.c
==============================================================================
--- trunk/tools/command-exec.c	(original)
+++ trunk/tools/command-exec.c	Thu Sep  4 20:08:38 2008
@@ -876,14 +876,24 @@
 			for (i = 0; i < nrows; i++) {
 				GString *string = NULL;
 				const GValue *cvalue;
-				const gchar *str;
+				const gchar *str = NULL;
 
-				cvalue = gda_data_model_get_value_at (model, 0, i);
+				cvalue = gda_data_model_get_value_at (model, 0, i, error);
+				if (!cvalue) {
+					gda_internal_command_exec_result_free (res);
+					res = NULL;
+					goto out;
+				}
 				str = g_value_get_string (cvalue);
 				if (*str == 'P') {
 					/* primary key */
 					GdaDataModel *cols;
-					cvalue = gda_data_model_get_value_at (model, 1, i);
+					cvalue = gda_data_model_get_value_at (model, 1, i, error);
+					if (!cvalue) {
+						gda_internal_command_exec_result_free (res);
+						res = NULL;
+						goto out;
+					}
 					string = g_string_new (_("Primary key"));
 					g_string_append_printf (string, " '%s'", g_value_get_string (cvalue));
 					str = "SELECT column_name, ordinal_position "
@@ -903,8 +913,15 @@
 							for (j = 0; j < cnrows; j++) {
 								if (j > 0)
 									g_string_append (string, ", ");
-								g_string_append (string, 
-										 g_value_get_string (gda_data_model_get_value_at (cols, 0, j)));
+								cvalue = gda_data_model_get_value_at (cols, 0, j, error);
+								if (!cvalue) {
+									gda_internal_command_exec_result_free (res);
+									res = NULL;
+									g_object_unref (cols);
+									g_string_free (string, TRUE);
+									goto out;
+								}
+								g_string_append (string, g_value_get_string (cvalue));
 							}
 							g_string_append_c (string, ')');
 						}
@@ -914,7 +931,12 @@
 				else if (*str == 'F') {
 					/* foreign key */
 					GdaDataModel *cols;
-					cvalue = gda_data_model_get_value_at (model, 1, i);
+					cvalue = gda_data_model_get_value_at (model, 1, i, error);
+					if (!cvalue) {
+						gda_internal_command_exec_result_free (res);
+						res = NULL;
+						goto out;
+					}
 					string = g_string_new (_("Foreign key"));
 					g_string_append_printf (string, " '%s'", g_value_get_string (cvalue));
 
@@ -935,23 +957,51 @@
 							for (j = 0; j < cnrows; j++) {
 								if (j > 0)
 									g_string_append (string, ", ");
-								g_string_append (string, 
-										 g_value_get_string (gda_data_model_get_value_at (cols, 2, j)));
+								cvalue = gda_data_model_get_value_at (cols, 2, j, error);
+								if (!cvalue) {
+									gda_internal_command_exec_result_free (res);
+									res = NULL;
+									g_object_unref (cols);
+									g_string_free (string, TRUE);
+									goto out;
+								}
+								g_string_append (string, g_value_get_string (cvalue));
 							}
 							g_string_append (string, ") references ");
 
 							const GValue *v1, *v2;
 							
-							v1 = gda_data_model_get_value_at (cols, 0, 0);
-							v2 = gda_data_model_get_value_at (cols, 1, 0);
+							v1 = gda_data_model_get_value_at (cols, 0, 0, error);
+							if (!v1) {
+								gda_internal_command_exec_result_free (res);
+								res = NULL;
+								g_object_unref (cols);
+								g_string_free (string, TRUE);
+								goto out;
+							}
+							v2 = gda_data_model_get_value_at (cols, 1, 0, error);
+							if (!v2) {
+								gda_internal_command_exec_result_free (res);
+								res = NULL;
+								g_object_unref (cols);
+								g_string_free (string, TRUE);
+								goto out;
+							}
 							g_string_append_printf (string, " %s.%s (", 
 										g_value_get_string (v1),
 										g_value_get_string (v2));
 							for (j = 0; j < cnrows; j++) {
 								if (j > 0)
 									g_string_append (string, ", ");
-								g_string_append (string, 
-										 g_value_get_string (gda_data_model_get_value_at (cols, 2, j)));
+								cvalue = gda_data_model_get_value_at (cols, 2, j, error);
+								if (!cvalue) {
+									gda_internal_command_exec_result_free (res);
+									res = NULL;
+									g_object_unref (cols);
+									g_string_free (string, TRUE);
+									goto out;
+								}
+								g_string_append (string, g_value_get_string (cvalue));
 							}
 							g_string_append_c (string, ')');
 						}
@@ -961,7 +1011,12 @@
 				else if (*str == 'U') {
 					/* Unique constraint */
 					GdaDataModel *cols;
-					cvalue = gda_data_model_get_value_at (model, 1, i);
+					cvalue = gda_data_model_get_value_at (model, 1, i, error);
+					if (!cvalue) {
+						gda_internal_command_exec_result_free (res);
+						res = NULL;
+						goto out;
+					}
 					string = g_string_new (_("Unique"));
 					g_string_append_printf (string, " '%s'", g_value_get_string (cvalue));
 					str = "SELECT column_name, ordinal_position "
@@ -981,8 +1036,15 @@
 							for (j = 0; j < cnrows; j++) {
 								if (j > 0)
 									g_string_append (string, ", ");
-								g_string_append (string, 
-										 g_value_get_string (gda_data_model_get_value_at (cols, 0, j)));
+								cvalue = gda_data_model_get_value_at (cols, 0, j, error);
+								if (!cvalue) {
+									gda_internal_command_exec_result_free (res);
+									res = NULL;
+									g_object_unref (cols);
+									g_string_free (string, TRUE);
+									goto out;
+								}
+								g_string_append (string, g_value_get_string (cvalue));
 							}
 							g_string_append_c (string, ')');
 						}
@@ -1009,6 +1071,7 @@
 	else 
 		TO_IMPLEMENT;
 
+ out:
 	g_object_unref (mstruct);
 	return res;
 }

Modified: trunk/tools/gda-sql.c
==============================================================================
--- trunk/tools/gda-sql.c	(original)
+++ trunk/tools/gda-sql.c	Thu Sep  4 20:08:38 2008
@@ -683,7 +683,11 @@
 										 gda_holder_get_g_type (h));
 				value = gda_data_handler_get_value_from_str (dh, str, gda_holder_get_g_type (h));
 				g_free (str);
-				gda_holder_take_value (h, value);
+				if (! gda_holder_take_value (h, value, error)) {
+					g_free (res);
+					res = NULL;
+					goto cleanup;
+				}
 			}
 			else {
 				if (! gda_holder_is_valid (h)) {
@@ -1165,11 +1169,17 @@
 			xmlSetProp (row_node, BAD_CAST "valign", BAD_CAST "top");
 			for (j = 0; j < ncols; j++) {
 				const GValue *value;
-				value = gda_data_model_get_value_at (model, j, i);
-				str = gda_value_stringify (value);
-				col_node = xmlNewChild (row_node, NULL, BAD_CAST "td", BAD_CAST str);
-				xmlSetProp (col_node, BAD_CAST "align", BAD_CAST "left");
-				g_free (str);
+				value = gda_data_model_get_value_at (model, j, i, NULL);
+				if (!value) {
+					col_node = xmlNewChild (row_node, NULL, BAD_CAST "td", BAD_CAST "ERROR");
+					xmlSetProp (col_node, BAD_CAST "align", BAD_CAST "left");
+				}
+				else {
+					str = gda_value_stringify (value);
+					col_node = xmlNewChild (row_node, NULL, BAD_CAST "td", BAD_CAST str);
+					xmlSetProp (col_node, BAD_CAST "align", BAD_CAST "left");
+					g_free (str);
+				}
 			}
 		}
 
@@ -2523,8 +2533,10 @@
 		if (param) {
 			if (value) {
 				/* set param's value */
-				if (!strcmp (value, "_null_"))
-					gda_holder_set_value (param, NULL);
+				if (!strcmp (value, "_null_")) {
+					if (! gda_holder_set_value (param, NULL, error))
+						return NULL;
+				}
 				else {
 					GdaServerProvider *prov;
 					GdaDataHandler *dh;
@@ -2534,7 +2546,8 @@
 					dh = gda_server_provider_get_data_handler_gtype (prov, data->current->cnc,
 											 gda_holder_get_g_type (param));
 					gvalue = gda_data_handler_get_value_from_str (dh, value, gda_holder_get_g_type (param));
-					gda_holder_take_value (param, gvalue);
+					if (! gda_holder_take_value (param, gvalue, error))
+						return NULL;
 				}
 
 				res = g_new0 (GdaInternalCommandResult, 1);



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