gnomemm r1760 - in libgdamm/trunk: . examples/simple libgda/libgdamm libgda/src tools/extra_defs_gen tools/m4



Author: jhs
Date: Sat Nov  1 09:15:20 2008
New Revision: 1760
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1760&view=rev

Log:
2008-11-01  Johannes Schmid  <jschmid openismus com>

	* libgda/libgdamm/Makefile.am:
	* libgda/libgdamm/value_tools.h (deleted):
	* libgda/libgdamm/value.h (added):
	* libgda/libgdamm/value.cc (added):	
	* libgda/src/Makefile_list_of_hg.am_fragment:
	* libgda/src/connection.hg:
	* libgda/src/datahandler.ccg:
	* libgda/src/datahandler.hg:
	* libgda/src/datamodel.ccg:
	* libgda/src/datamodel.hg:
	* libgda/src/datamodeliter.ccg:
	* libgda/src/datamodeliter.hg:
	* libgda/src/holder.ccg:
	* libgda/src/holder.hg:
	* libgda/src/libgda_signals.defs:
	* libgda/src/set.ccg:
	* libgda/src/set.hg:
	* libgda/src/xatransaction.ccg:
	* libgda/src/xatransaction.hg:
	* tools/extra_defs_gen/generate_defs_gda.cc:
	* tools/m4/convert_libgdamm.m4:
	
	Readded GdaValue and converted classes to use it

Added:
   libgdamm/trunk/libgda/libgdamm/value.cc
      - copied unchanged from r1759, /libgdamm/branches/libgdamm-3-0/libgda/libgdamm/value.cc
   libgdamm/trunk/libgda/libgdamm/value.h
      - copied unchanged from r1759, /libgdamm/branches/libgdamm-3-0/libgda/libgdamm/value.h
   libgdamm/trunk/libgda/src/xatransaction.ccg
   libgdamm/trunk/libgda/src/xatransaction.hg
Removed:
   libgdamm/trunk/libgda/libgdamm/value_tools.h
Modified:
   libgdamm/trunk/ChangeLog
   libgdamm/trunk/examples/simple/main.cc
   libgdamm/trunk/libgda/libgdamm/Makefile.am
   libgdamm/trunk/libgda/src/Makefile_list_of_hg.am_fragment
   libgdamm/trunk/libgda/src/connection.hg
   libgdamm/trunk/libgda/src/datahandler.ccg
   libgdamm/trunk/libgda/src/datahandler.hg
   libgdamm/trunk/libgda/src/datamodel.ccg
   libgdamm/trunk/libgda/src/datamodel.hg
   libgdamm/trunk/libgda/src/datamodeliter.ccg
   libgdamm/trunk/libgda/src/datamodeliter.hg
   libgdamm/trunk/libgda/src/holder.ccg
   libgdamm/trunk/libgda/src/holder.hg
   libgdamm/trunk/libgda/src/libgda_signals.defs
   libgdamm/trunk/libgda/src/set.ccg
   libgdamm/trunk/libgda/src/set.hg
   libgdamm/trunk/tools/extra_defs_gen/generate_defs_gda.cc
   libgdamm/trunk/tools/m4/convert_libgdamm.m4

Modified: libgdamm/trunk/examples/simple/main.cc
==============================================================================
--- libgdamm/trunk/examples/simple/main.cc	(original)
+++ libgdamm/trunk/examples/simple/main.cc	Sat Nov  1 09:15:20 2008
@@ -80,7 +80,7 @@
 void
 display_products_contents (const Glib::RefPtr<Gda::Connection>& cnc, const Glib::RefPtr<Gda::SqlParser>& parser)
 {
-	const Glib::ustring sql = "SELECT ref, name, price FROM products";
+  const Glib::ustring sql = "SELECT ref, name, price FROM products";
   Glib::ustring remain;
 	Glib::RefPtr<Gda::Statement> stmt;
   try
@@ -93,7 +93,7 @@
     return;
   }
   Glib::RefPtr<Gda::Set> params;
-	Glib::RefPtr<Gda::DataModel> data_model;
+  Glib::RefPtr<Gda::DataModel> data_model;
   try
   {
     data_model = cnc->statement_execute_select (stmt, params);

Modified: libgdamm/trunk/libgda/libgdamm/Makefile.am
==============================================================================
--- libgdamm/trunk/libgda/libgdamm/Makefile.am	(original)
+++ libgdamm/trunk/libgda/libgdamm/Makefile.am	Sat Nov  1 09:15:20 2008
@@ -11,8 +11,8 @@
 sublib_topdir = libgda
 
 
-files_extra_h	= init.h wrap_init.h value_tools.h
-files_extra_cc = init.cc
+files_extra_h	= init.h wrap_init.h value.h
+files_extra_cc = init.cc value.cc
 
 include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment
 

Modified: libgdamm/trunk/libgda/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- libgdamm/trunk/libgda/src/Makefile_list_of_hg.am_fragment	(original)
+++ libgdamm/trunk/libgda/src/Makefile_list_of_hg.am_fragment	Sat Nov  1 09:15:20 2008
@@ -13,7 +13,7 @@
      set.hg row.hg column.hg holder.hg statement.hg sqlparser.hg \
      batch.hg metastore.hg metastruct.hg config.hg threader.hg \
      blobop.hg blob.hg quarklist.hg error.hg datacomparator.hg \
-     dataaccesswrapper.hg dataselect.hg
+     dataaccesswrapper.hg dataselect.hg xatransaction.hg
 
 
 

Modified: libgdamm/trunk/libgda/src/connection.hg
==============================================================================
--- libgdamm/trunk/libgda/src/connection.hg	(original)
+++ libgdamm/trunk/libgda/src/connection.hg	Sat Nov  1 09:15:20 2008
@@ -26,6 +26,7 @@
 #include <libgdamm/statement.h>
 #include <libgdamm/sqlparser.h>
 #include <libgdamm/serveroperation.h>
+#include <libgdamm/value.h>
 
 #include <libgda/gda-meta-store.h>
 
@@ -156,7 +157,7 @@
   _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const ConnectionEvent> > get_events() const, gda_connection_get_events)
 
 
-  _WRAP_METHOD(Glib::ustring value_to_sql_string(const Glib::ValueBase& from) const, gda_connection_value_to_sql_string)
+  _WRAP_METHOD(Glib::ustring value_to_sql_string(const Value& from) const, gda_connection_value_to_sql_string)
 
   _WRAP_METHOD(bool supports_feature(ConnectionFeature feature) const, gda_connection_supports_feature)
       

Modified: libgdamm/trunk/libgda/src/datahandler.ccg
==============================================================================
--- libgdamm/trunk/libgda/src/datahandler.ccg	(original)
+++ libgdamm/trunk/libgda/src/datahandler.ccg	Sat Nov  1 09:15:20 2008
@@ -31,33 +31,6 @@
 namespace Gda
 {
 
-Glib::ValueBase DataHandler::get_value_from_sql(const Glib::ustring& sql, GType type) const
-{
-  Glib::ValueBase retval;
-  GValue* value = gda_data_handler_get_value_from_sql(const_cast<GdaDataHandler*>(gobj()), sql.c_str(), type);
-  retval.init(value);
-  g_free(value);
-  return retval;
-}
-
-Glib::ValueBase DataHandler::get_value_from_str(const Glib::ustring& str, GType type) const
-{
-  Glib::ValueBase retval;
-  GValue* value = gda_data_handler_get_value_from_sql(const_cast<GdaDataHandler*>(gobj()), str.c_str(), type);
-  retval.init(value);
-  g_free(value);
-  return retval;
-}
-
-Glib::ValueBase DataHandler::get_sane_init_value(GType type) const
-{
-  Glib::ValueBase retval;
-  GValue* value = gda_data_handler_get_sane_init_value(const_cast<GdaDataHandler*>(gobj()), type);
-  retval.init(value);
-  g_free(value);
-  return retval;
-}
-
 } /* namespace Gda */
 
 } /* namespace Gnome */

Modified: libgdamm/trunk/libgda/src/datahandler.hg
==============================================================================
--- libgdamm/trunk/libgda/src/datahandler.hg	(original)
+++ libgdamm/trunk/libgda/src/datahandler.hg	Sat Nov  1 09:15:20 2008
@@ -20,6 +20,7 @@
  */
 
 #include <glibmm/interface.h>
+#include <libgdamm/value.h>
 #include <libgda/gda-data-handler.h>
 
 _DEFS(libgdamm,libgda)
@@ -57,45 +58,12 @@
   _CLASS_INTERFACE(DataHandler, GdaDataHandler, GDA_DATA_HANDLER, GdaDataHandlerClass)
 public:
 
-  _WRAP_METHOD(Glib::ustring get_sql_from_value(const Glib::ValueBase& value) const, gda_data_handler_get_sql_from_value)
-  _WRAP_METHOD(Glib::ustring get_str_from_value(const Glib::ValueBase& value) const, gda_data_handler_get_str_from_value)
+  _WRAP_METHOD(Glib::ustring get_sql_from_value(const Value& value) const, gda_data_handler_get_sql_from_value)
+  _WRAP_METHOD(Glib::ustring get_str_from_value(const Value& value) const, gda_data_handler_get_str_from_value)
 
-  // Hand-coded this to get proper return values
-  _IGNORE(gda_data_handler_get_value_from_sql, gda_data_handler_get_value_from_str, gda_data_handler_get_sane_init_value)
-
-  /** Creates a new Value which represents the SQL value given as argument. 
-   * This is the opposite of the function get_sql_from_value(). 
-   * The type argument is used to determine the real data type requested for the returned value.
-   *
-   * If the sql string is empty, then the returned Value is of type TYPE_NULL.
-   * If the sql string does not correspond to a valid SQL string for the requested type, then a NULL Value is returned.
-   * 
-   * @param sql
-   * @param type
-   * @result The new Value.
-   */
-  Glib::ValueBase get_value_from_sql(const Glib::ustring& sql, GType type) const;
-
-  /** Creates a new Value which represents the STR value given as argument. 
-   * This is the opposite of the function get_str_from_value(). The type argument is used to determine the real data 
-   * type requested for the returned value.
-   *
-   * If the str string is empty, then the returned Value is of type TYPE_NULL.
-   * If the str string does not correspond to a valid STR string for the requested type, then a NULL value is returned.
-   * 
-   * @param str
-   * @param type
-   * @result The new Value.
-   */
-  Glib::ValueBase get_value_from_str(const Glib::ustring& str, GType type) const;
-
-  /** Creates a new Value which holds a sane initial value to be used if no value is specifically provided.
-   * For example, for a simple string, this would return a new value containing the "" string.
-   * 
-   * @param type
-   * @result The new Value.
-   */
-  Glib::ValueBase get_sane_init_value(GType type) const;
+  _WRAP_METHOD(Value get_value_from_sql(const Glib::ustring& sql, GType type) const, gda_data_handler_get_value_from_sql);
+  _WRAP_METHOD(Value get_value_from_str(const Glib::ustring& sql, GType type) const, gda_data_handler_get_value_from_str);
+  _WRAP_METHOD(Value get_sane_init_value(GType type) const, gda_data_handler_get_sane_init_value);
 
   _WRAP_METHOD(unsigned int get_nb_g_types() const, gda_data_handler_get_nb_g_types)
   _WRAP_METHOD(bool accepts_g_type(GType type) const, gda_data_handler_accepts_g_type)

Modified: libgdamm/trunk/libgda/src/datamodel.ccg
==============================================================================
--- libgdamm/trunk/libgda/src/datamodel.ccg	(original)
+++ libgdamm/trunk/libgda/src/datamodel.ccg	Sat Nov  1 09:15:20 2008
@@ -33,50 +33,6 @@
 
 namespace Gda
 {
-     
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-Glib::ValueBase DataModel::get_value_at(int col, int row) const
-#else
-Glib::ValueBase DataModel::get_value_at(int col, int row, std::auto_ptr<Glib::Error>& error) const
-#endif
-{
-  GError* gerror = 0;
-  Glib::ValueBase retval;
-  const GValue* value;
-  //Note that the function does not return a new value, so we should not free it:
-  value = gda_data_model_get_value_at(const_cast<GdaDataModel*>(gobj()), col, row, &gerror);
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-#else
-  if(gerror)
-    error = ::Glib::Error::throw_exception(gerror);
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-  retval.init(value);
-  return retval;
-}
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-Glib::ValueBase DataModel::get_typed_value_at (int col, int row, GType expected_type, bool nullok) const
-#else
-Glib::ValueBase DataModel::get_typed_value_at (int col, int row, GType expected_type, bool nullok, std::auto_ptr<Glib::Error>& error) const
-#endif  
-{
-  GError* gerror = 0;
-  Glib::ValueBase retval;
-  const GValue* value;
-  //Note that the function does not return a new value, so we should not free it:
-  value = gda_data_model_get_typed_value_at(const_cast<GdaDataModel*>(gobj()), col, row, expected_type, nullok, &gerror);
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-#else
-  if(gerror)
-    error = ::Glib::Error::throw_exception(gerror);
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-  retval.init(value);
-  return retval;  
-}
 
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
 bool DataModel::export_to_file(DataModelIOFormat format, const std::string& file, const Glib::ArrayHandle<int>& cols, const Glib::ArrayHandle<int>& rows, const Glib::RefPtr<Set>& options)

Modified: libgdamm/trunk/libgda/src/datamodel.hg
==============================================================================
--- libgdamm/trunk/libgda/src/datamodel.hg	(original)
+++ libgdamm/trunk/libgda/src/datamodel.hg	Sat Nov  1 09:15:20 2008
@@ -23,6 +23,7 @@
 #include <glibmm/object.h>
 #include <libgdamm/datamodeliter.h>
 #include <libgdamm/column.h>
+#include <libgdamm/value.h>
 #include <libgda/gda-data-model.h>
 
 _DEFS(libgdamm,libgda)
@@ -43,27 +44,8 @@
 
 typedef GdaValueAttribute ValueAttribute;
 
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-struct TypeTraitsValueBase
-{
-  typedef Glib::ValueBase   CppType;
-  typedef const GValue*  CType;
-  typedef GValue*        CTypeNonConst;
-
-  static CType to_c_type(const CppType value) {return value.gobj();};
-  static CppType to_cpp_type(CType value) 
-  {
-    Glib::ValueBase base;
-    base.init(value);
-    return base;
-  }
-  static void release_c_type(CType value) {g_free(const_cast<GValue*>(value));};
-};
-#endif
-
-
-typedef Glib::ListHandle<Glib::ValueBase, TypeTraitsValueBase> ValueList;
-typedef Glib::SListHandle<Glib::ValueBase, TypeTraitsValueBase> ValueSList;
+typedef Glib::ListHandle<Value, ValueTraits> ValueList;
+typedef Glib::SListHandle<Value, ValueTraits> ValueSList;
 
 /** @defgroup DataModels Data Models
  */
@@ -117,18 +99,8 @@
   _WRAP_METHOD(Glib::ustring get_column_title(int col) const, gda_data_model_get_column_title)
   _WRAP_METHOD(void set_column_title(int col, const Glib::ustring& title), gda_data_model_set_column_title)
 
-  _WRAP_METHOD_DOCS_ONLY(gda_data_model_get_value_at)
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  Glib::ValueBase get_value_at(int col, int row) const;
-#else
-  Glib::ValueBase get_value_at(int col, int row, std::auto_ptr<Glib::Error>& error) const;
-#endif
-  _WRAP_METHOD_DOCS_ONLY (gda_data_model_get_typed_value_at);
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  Glib::ValueBase get_typed_value_at (int col, int row, GType expected_type, bool nullok) const;
-#else
-  Glib::ValueBase get_typed_value_at (int col, int row, GType expected_type, bool nullok, std::auto_ptr<Glib::Error>& error) const;
-#endif  
+  _WRAP_METHOD(Value get_value_at(int col, int row) const, gda_data_model_get_value_at, errthrow);
+  _WRAP_METHOD(Value get_typed_value_at (int col, int row, GType expected_type, bool nullok) const, gda_data_model_get_typed_value_at, errthrow);
   _WRAP_METHOD(ValueAttribute get_attributes_at(int col, int row), gda_data_model_get_attributes_at)
 
   _WRAP_METHOD(Glib::RefPtr<DataModelIter> create_iter(), gda_data_model_create_iter)
@@ -136,7 +108,7 @@
   //Ignore private functions:
   _IGNORE(gda_data_model_move_iter_at_row, gda_data_model_move_iter_next, gda_data_model_move_iter_prev)
 
-  _WRAP_METHOD(bool set_value_at(int col, int row, const Glib::ValueBase& value), gda_data_model_set_value_at, errthrow)
+  _WRAP_METHOD(bool set_value_at(int col, int row, const Value& value), gda_data_model_set_value_at, errthrow)
 
   #m4 _CONVERSION(`const ValueList&',`const GList*',`$3.data()')
   #m4 _CONVERSION(`const ValueList&',`GList*',`$3.data()')
@@ -155,7 +127,7 @@
   #m4 _CONVERSION(`const ValueSList&', `GSList*', `$3.data()')
   _WRAP_METHOD(int get_row_from_values(const ValueSList& values, const Glib::ArrayHandle<int>& cols_index), gda_data_model_get_row_from_values)
 
-  _WRAP_METHOD(void send_hint(DataModelHint hint, const Glib::ValueBase& hint_value), gda_data_model_send_hint)
+  _WRAP_METHOD(void send_hint(DataModelHint hint, const Value& hint_value), gda_data_model_send_hint)
 
 
   /** Exports data contained in @a model to the a string; the format is specified using the @a format argument.

Modified: libgdamm/trunk/libgda/src/datamodeliter.ccg
==============================================================================
--- libgdamm/trunk/libgda/src/datamodeliter.ccg	(original)
+++ libgdamm/trunk/libgda/src/datamodeliter.ccg	Sat Nov  1 09:15:20 2008
@@ -29,22 +29,6 @@
 namespace Gda
 {
 
-Glib::ValueBase DataModelIter::get_value_at (int col)
-{
-  Glib::ValueBase retval;
-  const GValue* value = gda_data_model_iter_get_value_at (gobj(), col);
-  retval.init(value);
-  return retval;
-}
-
-Glib::ValueBase DataModelIter::get_value_for_field (const Glib::ustring& field_name)
-{
-  Glib::ValueBase retval;
-  const GValue* value = gda_data_model_iter_get_value_for_field (gobj(), field_name.c_str());
-  retval.init(value);
-  return retval;
-}
-
 } /* namespace Gda */
 
 } /* namespace Gnome */

Modified: libgdamm/trunk/libgda/src/datamodeliter.hg
==============================================================================
--- libgdamm/trunk/libgda/src/datamodeliter.hg	(original)
+++ libgdamm/trunk/libgda/src/datamodeliter.hg	Sat Nov  1 09:15:20 2008
@@ -21,6 +21,7 @@
 
 #include <glibmm/object.h>
 #include <libgdamm/set.h>
+#include <libgdamm/value.h>
 
 _DEFS(libgdamm,libgda)
 _PINCLUDE(libgdamm/private/set_p.h)
@@ -50,10 +51,8 @@
   _WRAP_METHOD(int get_row() const, gda_data_model_iter_get_row)
   _WRAP_METHOD(void invalidate_contents(), gda_data_model_iter_invalidate_contents)
 
-  _WRAP_METHOD_DOCS_ONLY(gda_data_model_iter_get_value_at)
-  Glib::ValueBase get_value_at (int col);
-  _WRAP_METHOD_DOCS_ONLY(gda_data_model_iter_get_value_for_field)
-  Glib::ValueBase get_value_for_field (const Glib::ustring& field_name);
+  _WRAP_METHOD(Value get_value_at (int col), gda_data_model_iter_get_value_at)
+  _WRAP_METHOD(Value get_value_for_field (const Glib::ustring& field_name), gda_data_model_iter_get_value_for_field)
 
   _WRAP_PROPERTY("current-row", int)
   _WRAP_PROPERTY("data-model", Glib::RefPtr<DataModel>)

Modified: libgdamm/trunk/libgda/src/holder.ccg
==============================================================================
--- libgdamm/trunk/libgda/src/holder.ccg	(original)
+++ libgdamm/trunk/libgda/src/holder.ccg	Sat Nov  1 09:15:20 2008
@@ -29,52 +29,6 @@
 namespace Gda
 {
 
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-Glib::ValueBase Holder::take_static_value (const Glib::ValueBase& value, bool& value_changed)
-#else
-Glib::ValueBase Holder::take_static_value (const Glib::ValueBase& value, bool& value_changed, std::auto_ptr<Glib::Error>& error)
-#endif
-{
-  GError* gerror = 0;
-  Glib::ValueBase retval;
-  const GValue* cvalue;
-  //Note that the function does not return a new value, so we should not free it:
-  cvalue = gda_holder_take_static_value(gobj(), value.gobj(), (gboolean*)&value_changed, &gerror);
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-#else
-  if(gerror)
-    error = ::Glib::Error::throw_exception(gerror);
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-  retval.init(cvalue);
-  return retval;  
-}
-
-Glib::ValueBase Holder::get_value()
-{
-  Glib::ValueBase retval;
-  const GValue* value = gda_holder_get_value(gobj());
-  retval.init(value);
-  return retval;
-}
-
-Glib::ValueBase Holder::get_default_value()
-{
-  Glib::ValueBase retval;
-  const GValue* value = gda_holder_get_default_value(gobj());
-  retval.init(value);
-  return retval;
-}
-
-Glib::ValueBase Holder::get_attribute(Glib::ustring& attribute) const
-{
-  const GValue* value = gda_holder_get_attribute(const_cast<GdaHolder*>(gobj()), attribute.c_str());
-  Glib::ValueBase retval;
-  retval.init(value);
-  return retval;
-}
-
 } /* namespace Gda */
 
 } /* namespace Gnome */

Modified: libgdamm/trunk/libgda/src/holder.hg
==============================================================================
--- libgdamm/trunk/libgda/src/holder.hg	(original)
+++ libgdamm/trunk/libgda/src/holder.hg	Sat Nov  1 09:15:20 2008
@@ -21,6 +21,7 @@
 
 #include <libgdamm/datahandler.h>
 #include <libgdamm/error.h>
+#include <libgdamm/value.h>
 
 _DEFS(libgdamm,libgda)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -48,27 +49,17 @@
   
   _WRAP_METHOD(GType get_g_type() const, gda_holder_get_g_type)
   _WRAP_METHOD(Glib::ustring get_id() const, gda_holder_get_id)
-  _WRAP_METHOD_DOCS_ONLY(gda_holder_get_value)
-  Glib::ValueBase get_value();
+  _WRAP_METHOD(Value get_value(), gda_holder_get_value)
   _WRAP_METHOD(Glib::ustring get_value_str(const Glib::RefPtr<DataHandler>& dh), gda_holder_get_value_str)
-  _WRAP_METHOD(bool set_value(const Glib::ValueBase& value), gda_holder_set_value, errthrow)
+  _WRAP_METHOD(bool set_value(const Value& value), gda_holder_set_value, errthrow)
   _WRAP_METHOD(bool set_value_str (const Glib::RefPtr<DataHandler>& dh, const Glib::ustring& value), gda_holder_set_value_str, errthrow)
-  _WRAP_METHOD(bool take_value (Glib::ValueBase& value), gda_holder_take_value, errthrow)
-  _WRAP_METHOD_DOCS_ONLY(gda_holder_take_static_value)
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  Glib::ValueBase take_static_value (const Glib::ValueBase& value, bool& value_changed);
-#else
-  Glib::ValueBase take_static_value (const Glib::ValueBase& value, bool& value_changed, std::auto_ptr<Glib::Error>& error);
-#endif
-  _WRAP_METHOD(void set_attribute (const Glib::ustring& attribute, const Glib::ValueBase& value), gda_holder_set_attribute);
-  _WRAP_METHOD_DOCS_ONLY(gda_holder_get_attribute);
-  Glib::ValueBase get_attribute(Glib::ustring& attribute) const;
-
-  
+  _WRAP_METHOD(bool take_value (Value value), gda_holder_take_value, errthrow)
+  _WRAP_METHOD(Value take_static_value (const Value& value, bool& value_changed), gda_holder_take_static_value, errthrow)
+  _WRAP_METHOD(void set_attribute (const Glib::ustring& attribute, const Value& value), gda_holder_set_attribute);
+  _WRAP_METHOD(Value get_attribute(const Glib::ustring& attribute) const, gda_holder_get_attribute); 
   
-  _WRAP_METHOD_DOCS_ONLY(gda_holder_get_default_value)
-  Glib::ValueBase get_default_value();
-  _WRAP_METHOD(void set_default_value(const Glib::ValueBase& value), gda_holder_set_default_value)
+  _WRAP_METHOD(Value get_default_value(), gda_holder_get_default_value)
+  _WRAP_METHOD(void set_default_value(const Value& value), gda_holder_set_default_value)
   _WRAP_METHOD(bool set_value_to_default(), gda_holder_set_value_to_default)
   _WRAP_METHOD(bool value_is_default(), gda_holder_value_is_default)
 
@@ -95,8 +86,8 @@
 
   _WRAP_SIGNAL(void changed(), "changed")
   _WRAP_SIGNAL(void source_changed(), "source-changed")
-  _WRAP_SIGNAL(Error validate_change(Glib::ValueBase value), "validate-change", no_default_handler)
-  _WRAP_SIGNAL(void attribute_changed (Glib::ustring attr_name, Glib::ValueBase value), "attribute-changed", no_default_handler)
+  _WRAP_SIGNAL(Error validate_change(Value value), "validate-change", no_default_handler)
+  _WRAP_SIGNAL(void attribute_changed (Glib::ustring attr_name, Value value), "attribute-changed", no_default_handler)
 
 		
 };

Modified: libgdamm/trunk/libgda/src/libgda_signals.defs
==============================================================================
--- libgdamm/trunk/libgda/src/libgda_signals.defs	(original)
+++ libgdamm/trunk/libgda/src/libgda_signals.defs	Sat Nov  1 09:15:20 2008
@@ -77,7 +77,7 @@
   )
 )
 
-(define-property user-filename
+(define-property system-filename
   (of-object "GdaConfig")
   (prop-type "GParamString")
   (docs "")
@@ -86,7 +86,7 @@
   (construct-only #f)
 )
 
-(define-property system-filename
+(define-property user-filename
   (of-object "GdaConfig")
   (prop-type "GParamString")
   (docs "")
@@ -1063,6 +1063,26 @@
 
 ;; From GdaTransactionStatus
 
+;; From GdaXaTransaction
+
+(define-property format-id
+  (of-object "GdaXaTransaction")
+  (prop-type "GParamUInt")
+  (docs "")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property transaction-id
+  (of-object "GdaXaTransaction")
+  (prop-type "GParamString")
+  (docs "")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
 ;; From GdaSqlParser
 
 (define-property tokenizer-flavour

Modified: libgdamm/trunk/libgda/src/set.ccg
==============================================================================
--- libgdamm/trunk/libgda/src/set.ccg	(original)
+++ libgdamm/trunk/libgda/src/set.ccg	Sat Nov  1 09:15:20 2008
@@ -29,14 +29,6 @@
 namespace Gda
 {
 
-Glib::ValueBase Set::get_holder_value(const Glib::ustring& holder_id)
-{
-  Glib::ValueBase retval;
-  const GValue* value = gda_set_get_holder_value(gobj(), holder_id.c_str());
-  retval.init(value);
-  return retval;
-}
-
 template<class T> bool Set::set_holder_value(const Glib::ustring& id, T value)
 {
   return gda_set_set_holder_value (gobj(), id.c_str(), value);

Modified: libgdamm/trunk/libgda/src/set.hg
==============================================================================
--- libgdamm/trunk/libgda/src/set.hg	(original)
+++ libgdamm/trunk/libgda/src/set.hg	Sat Nov  1 09:15:20 2008
@@ -20,8 +20,8 @@
  */
 
 #include <libgdamm/holder.h>
-#include <libgdamm/value_tools.h>
 #include <libgdamm/error.h>
+#include <libgdamm/value.h>
 
 _DEFS(libgdamm,libgda)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -54,8 +54,7 @@
   
   _WRAP_METHOD(Glib::RefPtr<Set> copy(), gda_set_copy)
 
-  _WRAP_METHOD_DOCS_ONLY(gda_set_get_holder_value)
-  Glib::ValueBase get_holder_value(const Glib::ustring& holder_id);
+  _WRAP_METHOD (Value get_holder_value(const Glib::ustring& holder_id), gda_set_get_holder_value);
   _WRAP_METHOD_DOCS_ONLY(gda_set_set_holder_value)
   template<class T> bool set_holder_value(const Glib::ustring& id, T value);
   
@@ -75,8 +74,8 @@
   _WRAP_SIGNAL(void holder_changed (const Glib::RefPtr<Holder>& holder), "holder-changed")
   _WRAP_SIGNAL(void public_data_changed (), "public-data-changed")
   _WRAP_SIGNAL(Error validate_set(), "validate-set", no_default_handler)
-  _WRAP_SIGNAL(Error validate_holder_change(const Glib::RefPtr<Holder>& holder, Glib::ValueBase value), "validate-holder-change", no_default_handler)
-  _WRAP_SIGNAL(void holder_attr_changed (const Glib::RefPtr<Holder>& holder, Glib::ustring attr_name, Glib::ValueBase value), "holder-attr-changed", no_default_handler)
+  _WRAP_SIGNAL(Error validate_holder_change(const Glib::RefPtr<Holder>& holder, Value value), "validate-holder-change", no_default_handler)
+  _WRAP_SIGNAL(void holder_attr_changed (const Glib::RefPtr<Holder>& holder, Glib::ustring attr_name, Value value), "holder-attr-changed", no_default_handler)
      
   _WRAP_PROPERTY("description", Glib::ustring)
   _WRAP_PROPERTY("id", Glib::ustring)

Added: libgdamm/trunk/libgda/src/xatransaction.ccg
==============================================================================
--- (empty file)
+++ libgdamm/trunk/libgda/src/xatransaction.ccg	Sat Nov  1 09:15:20 2008
@@ -0,0 +1,89 @@
+// -*- C++ -*- // this is for the .ccg, I realize gensig puts one in
+
+/* xatransaction.cc
+ * 
+ * Copyright 2003 libgdamm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <libgda/gda-xa-transaction.h>
+
+namespace Gnome
+{
+
+namespace Gda
+{
+
+typedef Glib::SListHandle< Glib::RefPtr<Connection> > ConnectionSList;
+  
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool XaTransaction::commit(ConnectionList& cncs_to_recover)
+#else
+bool XaTransaction::commit(ConnectionList& cncs_to_recover, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  GSList* cncs = NULL;
+  bool retvalue = gda_xa_transaction_commit (gobj(), &cncs, &gerror);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  ConnectionSList cncs_cpp(cncs, Glib::OWNERSHIP_SHALLOW);
+  for (ConnectionSList::const_iterator i = cncs_cpp.begin();
+       i != cncs_cpp.end(); i++)
+  {
+    cncs_to_recover.push_back(*i);
+  }
+  
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool XaTransaction::commit_recovered(ConnectionList& cncs_to_recover)
+#else
+bool XaTransaction::commit_recovered(ConnectionList& cncs_to_recover, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  GSList* cncs = NULL;
+  bool retvalue = gda_xa_transaction_commit_recovered (gobj(), &cncs, &gerror);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  ConnectionSList cncs_cpp(cncs, Glib::OWNERSHIP_SHALLOW);
+  for (ConnectionSList::const_iterator i = cncs_cpp.begin();
+       i != cncs_cpp.end(); i++)
+  {
+    cncs_to_recover.push_back(*i);
+  }
+  
+  return retvalue;
+}
+
+}
+
+} /* namespace Gnome */
+

Added: libgdamm/trunk/libgda/src/xatransaction.hg
==============================================================================
--- (empty file)
+++ libgdamm/trunk/libgda/src/xatransaction.hg	Sat Nov  1 09:15:20 2008
@@ -0,0 +1,67 @@
+// -*- C++ -*- // this is for the .hg, I realize gensig puts one in
+
+/* xatransaction.h
+ *
+ * Copyright 2006 libgdamm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or(at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+_DEFS(libgdamm,libgda)
+_PINCLUDE(glibmm/private/object_p.h)
+
+#include <libgdamm/connection.h>
+
+namespace Gnome
+{
+
+namespace Gda
+{
+
+class XaTransaction : public Glib::Object
+{
+  _CLASS_GOBJECT(XaTransaction, GdaXaTransaction, GDA_XA_TRANSACTION, Glib::Object, GObject)
+protected:
+  _WRAP_CTOR(XaTransaction(guint32 format_id, const Glib::ustring& transaction_id), gda_xa_transaction_new)
+public:
+  _WRAP_CREATE(guint32 format_id, const Glib::ustring& transaction_id)
+  
+  _WRAP_METHOD(bool register_connection (const Glib::RefPtr<Connection>& cnc, const Glib::ustring& branch), gda_xa_transaction_register_connection, errthrow)
+  _WRAP_METHOD(void unregister_connection (const Glib::RefPtr<Connection>& cnc), gda_xa_transaction_unregister_connection)
+
+  _WRAP_METHOD(bool begin(), gda_xa_transaction_begin, errthrow)
+  _WRAP_METHOD(bool rollback(), gda_xa_transaction_rollback, errthrow)
+  typedef std::list<Glib::RefPtr<const Connection> > ConnectionList;
+  _WRAP_METHOD_DOCS_ONLY (gda_xa_transaction_commit)  
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  bool commit(ConnectionList& cncs_to_recover);
+  #else
+  bool commit(ConnectionList& cncs_to_recover, std::auto_ptr<Glib::Error>& error);
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  _WRAP_METHOD_DOCS_ONLY (gda_xa_transaction_commit_recovered)  
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  bool commit_recovered(ConnectionList& cncs_to_recover);
+  #else
+  bool commit_recovered(ConnectionList& cncs_to_recover, std::auto_ptr<Glib::Error>& error);
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+  
+  _WRAP_PROPERTY("transaction-id", Glib::ustring)
+  _WRAP_PROPERTY("format-id", uint)
+};
+
+} // namespace Gda
+} // namespace Gnome
+

Modified: libgdamm/trunk/tools/extra_defs_gen/generate_defs_gda.cc
==============================================================================
--- libgdamm/trunk/tools/extra_defs_gen/generate_defs_gda.cc	(original)
+++ libgdamm/trunk/tools/extra_defs_gen/generate_defs_gda.cc	Sat Nov  1 09:15:20 2008
@@ -56,6 +56,7 @@
     << get_defs (GDA_TYPE_STATEMENT)
     << get_defs (GDA_TYPE_THREADER)
     << get_defs (GDA_TYPE_TRANSACTION_STATUS)
+    << get_defs (GDA_TYPE_XA_TRANSACTION)
     << get_defs (GDA_TYPE_SQL_PARSER)
     << std::endl;
     return 0;

Modified: libgdamm/trunk/tools/m4/convert_libgdamm.m4
==============================================================================
--- libgdamm/trunk/tools/m4/convert_libgdamm.m4	(original)
+++ libgdamm/trunk/tools/m4/convert_libgdamm.m4	Sat Nov  1 09:15:20 2008
@@ -11,6 +11,7 @@
 _EQUAL(GdaDiff*, Diff*)
 _EQUAL(const GdaDiff*, const Diff*)
 
+_CONVERSION(`bool&',`gboolean*',`(gboolean*)(&($3))')
 
 _CONVERSION(`GdaConnectionEvent*',`Glib::RefPtr<ConnectionEvent>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<ConnectionEvent>&', `GdaConnectionEvent*', __CONVERT_REFPTR_TO_P)
@@ -74,11 +75,6 @@
 _CONVERSION(`const GObject*',`Glib::RefPtr<const Glib::Object>',`Glib::wrap(const_cast<GObject*>($3))')
 _CONVERSION(`const Glib::RefPtr<Glib::Object>&', `const GObject*', `($3)->gobj()')
 
-_CONVERSION(`Glib::ValueBase&', `GValue*', `($3).gobj()')
-_CONVERSION(`Glib::ValueBase', `GValue*', `($3).gobj()')
-_CONVERSION(`const Glib::ValueBase&', `const GValue*', `($3).gobj()')
-_CONVERSION(`GValue*', `Glib::ValueBase', `gvalue_to_valuebase($3)')
-
 _CONVERSION(`GdaRow*', `const Glib::RefPtr<Row>',  `Glib::wrap($3)')
 _CONVERSION(`GdaRow*', `const Glib::RefPtr<const Row>',  `Glib::wrap($3)')
 
@@ -141,6 +137,13 @@
 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3)')
 _CONVERSION(`const Glib::ArrayHandle<int>&',`const gint*', `$3.data()')
 
+# Value
+_CONVERSION(`const Value&', `GValue*', `const_cast<GValue*>(($3).gobj())')
+_CONVERSION(`const Value&', `const GValue*', `($3).gobj()')
+_CONVERSION(`Value', `GValue*', `($3).gobj()')
+_CONVERSION(`GValue*', `Value', `$2($3)')
+_CONVERSION(`const GValue*', `Value', `$2($3)')
+
 
 # For signals:
 _CONVERSION(`GdaConnection*',`const Glib::RefPtr<Connection>&',`Glib::wrap($3)')



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