gnomemm r1554 - in libgdamm/branches/libgdamm-4-0: libgda/src tools/m4



Author: jhs
Date: Mon Jun  9 11:00:50 2008
New Revision: 1554
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1554&view=rev

Log:
2008-06-09  Johannes Schmid  <johannes schmid openismus com>

	* libgda/src/batch.hg:
	* libgda/src/column.hg:
	* libgda/src/holder.hg:
	* libgda/src/libgda_signals.defs:
	* libgda/src/metastore.ccg:
	* libgda/src/metastore.hg:
	* libgda/src/set.ccg:
	* libgda/src/set.hg:
	* libgda/src/statement.ccg:
	* libgda/src/statement.hg:
	* tools/m4/convert_libgdamm.m4:
	
	(Hand-)wrapped more methods

Modified:
   libgdamm/branches/libgdamm-4-0/libgda/src/batch.hg
   libgdamm/branches/libgdamm-4-0/libgda/src/column.hg
   libgdamm/branches/libgdamm-4-0/libgda/src/holder.hg
   libgdamm/branches/libgdamm-4-0/libgda/src/libgda_signals.defs
   libgdamm/branches/libgdamm-4-0/libgda/src/metastore.ccg
   libgdamm/branches/libgdamm-4-0/libgda/src/metastore.hg
   libgdamm/branches/libgdamm-4-0/libgda/src/set.ccg
   libgdamm/branches/libgdamm-4-0/libgda/src/set.hg
   libgdamm/branches/libgdamm-4-0/libgda/src/statement.ccg
   libgdamm/branches/libgdamm-4-0/libgda/src/statement.hg
   libgdamm/branches/libgdamm-4-0/tools/m4/convert_libgdamm.m4

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/batch.hg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/batch.hg	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/batch.hg	Mon Jun  9 11:00:50 2008
@@ -44,6 +44,7 @@
   _CTOR_DEFAULT()
 public:
   _WRAP_CREATE()
+  _WRAP_METHOD(Glib::RefPtr<Batch> copy(), gda_batch_new_copy)  
   
   _WRAP_METHOD(void add_statement(const Glib::RefPtr<Statement>& stmt), gda_batch_add_statement)
   _WRAP_METHOD(void remove_statement(const Glib::RefPtr<Statement>& stmt), gda_batch_remove_statement)
@@ -52,7 +53,7 @@
   #m4 _CONVERSION(`const GSList*',`StatementSList',`$2((GSList*)$3, Glib::OWNERSHIP_NONE)')
   _WRAP_METHOD(StatementSList get_statements(), gda_batch_get_statements)
 
-  // TODO:
+  // FIXME: Use better marshaller in libgda
   //_WRAP_SIGNAL(void changed(Glib::RefPtr<Statement> stmt), "changed")
 };
 

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/column.hg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/column.hg	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/column.hg	Mon Jun  9 11:00:50 2008
@@ -87,10 +87,7 @@
 
 #m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
   _WRAP_SIGNAL(void name_changed(const Glib::ustring& old_name), "name-changed")
-// TODO: 
-//#m4 _CONVERSION(`gint', `GType', ($3)($2))
-//#m4 _CONVERSION(`GType', `gint', ($3)($2))
-//  _WRAP_SIGNAL(void g_type_changed(GType old_type, GType new_type), "g-type-changed")
+  _WRAP_SIGNAL(void g_type_changed(GType old_type, GType new_type), "g-type-changed")
 
   _WRAP_PROPERTY("id", Glib::ustring)
 };

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/holder.hg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/holder.hg	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/holder.hg	Mon Jun  9 11:00:50 2008
@@ -43,6 +43,7 @@
   _WRAP_CTOR(Holder (GType type), gda_holder_new)
 public:
   _WRAP_CREATE(GType g_type)
+  _WRAP_METHOD(Glib::RefPtr<Holder> copy(), gda_holder_copy)
   
   _WRAP_METHOD(GType get_g_type() const, gda_holder_get_g_type)
   _WRAP_METHOD(Glib::ustring get_id() const, gda_holder_get_id)

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/libgda_signals.defs
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/libgda_signals.defs	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/libgda_signals.defs	Mon Jun  9 11:00:50 2008
@@ -14,8 +14,8 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("gint" "p0")
-    '("gint" "p1")
+    '("GType" "p0")
+    '("GType" "p1")
   )
 )
 

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/metastore.ccg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/metastore.ccg	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/metastore.ccg	Mon Jun  9 11:00:50 2008
@@ -24,6 +24,31 @@
 namespace Gnome
 {
 
+namespace Gda
+{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool MetaStore::get_atrribute_value(const Glib::ustring& att_name, Glib::ustring& att_value)
+#else
+bool MetaStore::get_atrribute_value(const Glib::ustring& att_name, Glib::ustring& att_value, std::auto_ptr<Glib::Error>)
+#endif
+{
+  GError* gerror = 0;
+  gchar* c_att_value = 0;
+  bool retval = gda_meta_store_get_attribute_value(gobj(), att_name.c_str(), &c_att_value, &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
+  if (c_att_value)
+    att_value = c_att_value;
+
+  return retval;
+}
+
+}
 
 } /* namespace Gnome */
 

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/metastore.hg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/metastore.hg	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/metastore.hg	Mon Jun  9 11:00:50 2008
@@ -41,20 +41,32 @@
 {
   _CLASS_GOBJECT(MetaStore, GdaMetaStore, GDA_META_STORE, Glib::Object, GObject)
 protected:
-  _CTOR_DEFAULT()
+  _WRAP_CTOR(MetaStore(const Glib::ustring& cnc_string), gda_meta_store_new)
+  // TODO: cannot be overloaded, no filename property  
+  //_WRAP_CTOR(MetaStore(const std::string& filename), gda_meta_store_new_with_file)
 
 public:
-  _WRAP_CREATE()
+  _WRAP_CREATE(const Glib::ustring& cnc_string)
   
   _WRAP_METHOD(int get_version(), gda_meta_store_get_version)
   //TODO: varargs: extract(), modify()
 
   _WRAP_METHOD(bool modify_with_context (MetaContext* context, const Glib::RefPtr<DataModel>& new_data), gda_meta_store_modify_with_context, errthrow)
+  _WRAP_METHOD(Glib::RefPtr<DataModel> create_modify_data_model(const Glib::ustring& table_name), gda_meta_store_create_modify_data_model)
   _WRAP_METHOD(Glib::RefPtr<MetaStruct> schema_get_structure(), gda_meta_store_schema_get_structure, errthrow)
+  _WRAP_METHOD(Glib::SListHandle<Glib::ustring> schema_get_all_tables(), gda_meta_store_schema_get_all_tables)
+  _WRAP_METHOD(Glib::SListHandle<Glib::ustring> schema_get_depend_tables(const Glib::ustring& table_name), gda_meta_store_schema_get_depend_tables)  
+
+  _WRAP_METHOD_DOCS_ONLY(gda_meta_store_get_attribute_value)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+   bool get_atrribute_value(const Glib::ustring& att_name, Glib::ustring& att_value);
+#else
+   bool get_atrribute_value(const Glib::ustring& att_name, Glib::ustring& att_value, std::auto_ptr<Glib::Error>);
+#endif
 
-  //TODO get_atrribute_value()
   _WRAP_METHOD(bool set_attribute_value(const Glib::ustring& att_name, const Glib::ustring& att_value), gda_meta_store_set_attribute_value, errthrow)
   _WRAP_METHOD(bool schema_add_custom_object(const Glib::ustring& xml), gda_meta_store_schema_add_custom_object, errthrow)
+  _WRAP_METHOD(bool schema_remove_custom_object(const Glib::ustring& obj_name), gda_meta_store_schema_remove_custom_object, errthrow)
   _WRAP_METHOD(Glib::RefPtr<Connection> get_internal_connection(), gda_meta_store_get_internal_connection)
 
   //TODO Properties

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/set.ccg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/set.ccg	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/set.ccg	Mon Jun  9 11:00:50 2008
@@ -20,6 +20,7 @@
  */
 
 #include <libgdamm/set.h>
+#include <libgdamm/datamodel.h>
 #include <libgda/gda-set.h>
 
 namespace Gnome

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/set.hg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/set.hg	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/set.hg	Mon Jun  9 11:00:50 2008
@@ -31,6 +31,9 @@
 {
 
 typedef Glib::SListHandle<Holder> HolderSList;
+typedef GdaSetSource SetSource;
+typedef GdaSetGroup SetGroup;
+typedef GdaSetNode SetNode;
 
 /** Container for several values
  *
@@ -46,24 +49,31 @@
 public:
   _WRAP_CREATE(const HolderSList& holders)
   
-  _WRAP_METHOD (Glib::ustring get_spec(), gda_set_get_spec)
+  _WRAP_METHOD(Glib::RefPtr<Set> copy(), gda_set_copy)
+
+  _WRAP_METHOD(Glib::ustring get_spec(), gda_set_get_spec)
   _WRAP_METHOD_DOCS_ONLY(gda_set_get_holder_value)
   Glib::ValueBase get_holder_value(const Glib::ustring& holder_id);
   // TODO:
-  //_WRAP_METHOD (bool set_holder_value())
+  //_WRAP_METHOD(bool set_holder_value())
   
-  _WRAP_METHOD (Glib::RefPtr<Holder> get_holder (const Glib::ustring& holder_id), gda_set_get_holder)
-  _WRAP_METHOD (void add_holder (const Glib::RefPtr<Holder>& holder), gda_set_add_holder)
-  _WRAP_METHOD (void remove_holder (const Glib::RefPtr<Holder>& holder), gda_set_remove_holder)
+  _WRAP_METHOD(Glib::RefPtr<Holder> get_holder (const Glib::ustring& holder_id), gda_set_get_holder)
+  _WRAP_METHOD(void add_holder (const Glib::RefPtr<Holder>& holder), gda_set_add_holder)
+  _WRAP_METHOD(void remove_holder (const Glib::RefPtr<Holder>& holder), gda_set_remove_holder)
 
-  _WRAP_METHOD (void merge_with_set (const Glib::RefPtr<Set>& set_to_merge), gda_set_merge_with_set)
+  _WRAP_METHOD(void merge_with_set (const Glib::RefPtr<Set>& set_to_merge), gda_set_merge_with_set)
   
-  _WRAP_METHOD (bool is_valid() const, gda_set_is_valid)
+  _WRAP_METHOD(bool is_valid() const, gda_set_is_valid)
 
-  _WRAP_SIGNAL (void holder_attr_changed (const Glib::RefPtr<Holder>& holder), "holder-attr-changed")
-  _WRAP_SIGNAL (void holder_changed (const Glib::RefPtr<Holder>& holder), "holder-changed")
-  _WRAP_SIGNAL (void holder_plugin_changed (const Glib::RefPtr<Holder>& holder), "holder-plugin-changed")
-  _WRAP_SIGNAL (void public_data_changed (), "public-data-changed")
+  _WRAP_METHOD(SetSource* get_source_for_model (const Glib::RefPtr<DataModel>& model), gda_set_get_source_for_model)
+  _WRAP_METHOD(SetSource* get_source (const Glib::RefPtr<Holder>& param), gda_set_get_source)
+  _WRAP_METHOD(SetGroup* get_group (const Glib::RefPtr<Holder>& param), gda_set_get_group)
+  _WRAP_METHOD(SetNode* get_node (const Glib::RefPtr<Holder>& param), gda_set_get_node)
+
+  _WRAP_SIGNAL(void holder_attr_changed (const Glib::RefPtr<Holder>& holder), "holder-attr-changed")
+  _WRAP_SIGNAL(void holder_changed (const Glib::RefPtr<Holder>& holder), "holder-changed")
+  _WRAP_SIGNAL(void holder_plugin_changed (const Glib::RefPtr<Holder>& holder), "holder-plugin-changed")
+  _WRAP_SIGNAL(void public_data_changed (), "public-data-changed")
 };
 
 } // namespace Gda

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/statement.ccg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/statement.ccg	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/statement.ccg	Mon Jun  9 11:00:50 2008
@@ -22,11 +22,84 @@
 #include <libgdamm/statement.h>
 #include <libgdamm/connection.h>
 #include <libgda/gda-enum-types.h>
+#include <libgda/gda-holder.h>
 #include <sql-parser/gda-sql-parser-enum-types.h>
 
 namespace Gnome
 {
 
+namespace Gda
+{
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool Statement::get_parameters(Glib::RefPtr<Set>& params)
+#else
+bool Statement::get_parameters(Glib::RefPtr<Set>& params, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  GdaSet* set = 0;
+  bool retval = gda_statement_get_parameters(gobj(), &set, &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
+  if (set)
+  {
+    params = Glib::wrap(set);
+  }
+  return retval;
+}
+  
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::ustring Statement::to_sql(const Glib::RefPtr<Set>& params)
+#else
+Glib::ustring Statement::to_sql(const Glib::RefPtr<Set>& params, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  Glib::ustring retval = gda_statement_to_sql(gobj(), Glib::unwrap(params), &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
+  return retval;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::ustring Statement::to_sql_extended(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params, 
+                              StatementSqlFlag flags, HolderSList& params_used)
+#else
+Glib::ustring Statement::to_sql_extended(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params, 
+                              StatementSqlFlag flags, HolderSList& params_used,
+                              std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  GSList* list = 0;
+  Glib::ustring retval = gda_statement_to_sql_extended(gobj(), Glib::unwrap(cnc), Glib::unwrap(params), (GdaStatementSqlFlag) flags, &list, &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
+  if (list)
+  {
+    // FIXME: Set params_used somehow
+  }
+  return retval;
+}
+
+} // namespace Gda
+
 
 } /* namespace Gnome */
 

Modified: libgdamm/branches/libgdamm-4-0/libgda/src/statement.hg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/statement.hg	(original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/statement.hg	Mon Jun  9 11:00:50 2008
@@ -19,6 +19,9 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <libgdamm/set.h>
+#include <libgdamm/holder.h>
+
 _DEFS(libgdamm,libgda)
 _PINCLUDE(glibmm/private/object_p.h)
 _PINCLUDE(libgda/gda-connection.h)
@@ -33,6 +36,7 @@
 
 _WRAP_ENUM (SqlStatementType, GdaSqlStatementType)
 _WRAP_ENUM (StatementModelUsage, GdaStatementModelUsage)
+_WRAP_ENUM (StatementSqlFlag, GdaStatementSqlFlag)
 
 /** Container for several values
  *
@@ -46,14 +50,36 @@
 
 public:
   _WRAP_CREATE()
+  _WRAP_METHOD(Glib::RefPtr<Statement> copy(), gda_statement_copy)
   
   _WRAP_METHOD(Glib::ustring serialize(), gda_statement_serialize)
   _WRAP_METHOD(static Glib::RefPtr<Statement> deserialize(const Glib::ustring& str), gda_statement_deserialize, errthrow)
-  // TODO:
-  //_WRAP_METHOD(bool get_parameters ())
+  
+  _WRAP_METHOD_DOCS_ONLY(gda_statement_get_parameters)
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  bool get_parameters(Glib::RefPtr<Set>& params);
+  #else
+  bool get_parameters(Glib::RefPtr<Set>& params, std::auto_ptr<Glib::Error>& error);
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+  
 
-  //to_sql(const Glib::RefPtr<Set>& params); //This is a #define
-  //_WRAP_METHOD(to_sql_extended(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params), gda_statement_to_sql, errthrow)
+  _IGNORE(gda_statement_to_sql_real)
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  Glib::ustring to_sql(const Glib::RefPtr<Set>& params);
+  #else
+  Glib::ustring to_sql(const Glib::RefPtr<Set>& params, std::auto_ptr<Glib::Error>& error);
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  typedef Glib::ListHandle< const Glib::RefPtr<Holder> > HolderSList;
+  _WRAP_METHOD_DOCS_ONLY(gda_statement_to_sql_extended)  
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  Glib::ustring to_sql_extended(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params, 
+                                StatementSqlFlag flags, HolderSList& params_used);
+  #else
+  Glib::ustring to_sql_extended(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Set>& params, 
+                                StatementSqlFlag flags, HolderSList& params_used,
+                                std::auto_ptr<Glib::Error>& error);
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
 
   _WRAP_METHOD(SqlStatementType get_statement_type(), gda_statement_get_statement_type)
   _WRAP_METHOD(bool is_useless() const, gda_statement_is_useless)

Modified: libgdamm/branches/libgdamm-4-0/tools/m4/convert_libgdamm.m4
==============================================================================
--- libgdamm/branches/libgdamm-4-0/tools/m4/convert_libgdamm.m4	(original)
+++ libgdamm/branches/libgdamm-4-0/tools/m4/convert_libgdamm.m4	Mon Jun  9 11:00:50 2008
@@ -1,6 +1,9 @@
 _EQUAL(glong,long)
 _EQUAL(GdaMetaContext*, MetaContext*)
 _EQUAL(GdaServerOperationNode*, ServerOperationNode*)
+_EQUAL(GdaSetGroup*, SetGroup*)
+_EQUAL(GdaSetSource*, SetSource*)
+_EQUAL(GdaSetNode*, SetNode*)
 
 _CONVERSION(`GdaConnectionEvent*',`Glib::RefPtr<ConnectionEvent>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<ConnectionEvent>&', `GdaConnectionEvent*', __CONVERT_REFPTR_TO_P)
@@ -98,11 +101,13 @@
 _CONV_ENUM(Gda,ValueAttribute)
 _CONV_ENUM(Gda,StatementModelUsage)
 _CONV_ENUM(Gda,SqlStatementType)
+_CONV_ENUM(Gda,StatementSqlFlag)
 _CONV_ENUM(Gda,SqlParserMode)
 _CONV_ENUM(Gda,MetaStructFeature)
 
 # Lists
 _CONVERSION(`GSList*',`Glib::SListHandle<Parameter>',__FL2H_SHALLOW)
+_CONVERSION(`GSList*',`Glib::SListHandle<Glib::ustring>',__FL2H_SHALLOW)
 _CONVERSION(`const Glib::SListHandle<Parameter>&',`GSList*',`$3.data()')
 _CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<QueryField> >',__FL2H_SHALLOW)
 _CONVERSION(`const Glib::SListHandle< Glib::RefPtr<QueryField> >&',`GSList*',`$3.data()')



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