Dear Kjell.

I tried your suggestions and some problems are gone. However, I see
some type conversion issue. It looks like
_GdaServerOperationCreateTableArg type is not visible. I tried using
RefPtr instead of plain pointers - same effect. I attached g++ output
and patch. Thanks for any comments. 




On Tue, 2017-05-09 at 19:05 +0200, Kjell Ahlstedt wrote:
> Den 2017-05-09 kl. 05:18, skrev Pavlo Solntsev:
> > hi,
> > I found some mistakes in my code and fixed them. However, I can't
> > figure out where is the problem. I included new patch for my
> > changes as
> > well as log from the compiler. Could someone take a look?
> > Thanks.
> > 
> > 
> 
> The description of gda_server_operation_prepare_create_table() says
> that 
> the "arguments" parameter is a list of
> GdaServerOperationCreateTableArg, 
> but if you look at the code in gda-server-operation.c, you'll see
> that 
> it's really a list of GdaServerOperationCreateTableArg*, i.e. a list
> of 
> pointers. GdaServerOperationCreateTableArg is defined in 
> gda-server-operation.c, hidden from your code. You must use a 
> std::vector<GdaServerOperationCreateTableArg*>.
> 
-- 
- Pavlo Solntsev
---------------------------------------------
Sent from Evolution on GNU/Debian <www.debian.org> id="-x-evo-
selection-start-marker">

diff --git a/libgda/src/serveroperation.ccg b/libgda/src/serveroperation.ccg
index 7062331..7f34bd6 100644
--- a/libgda/src/serveroperation.ccg
+++ b/libgda/src/serveroperation.ccg
@@ -77,6 +77,25 @@ void ServerOperation::set_value_at_as_value(const Glib::ustring& path, const Gli
     ::Glib::Error::throw_exception(gerror);
 }
 
+static Glib::RefPtr<ServerOperation> prepare_create_table(
+        Glib::RefPtr<Connection> &cnc, 
+        const Glib::ustring &table_name,
+        std::vector<GdaServerOperationCreateTableArg* > &arguments)
+{
+    GError* gerror = 0;
+    Glib::RefPtr<ServerOperation> op =
+    Glib::wrap(gda_server_operation_prepare_create_table(
+                cnc.operator->()->gobj(), 
+                table_name.c_str(),
+                Glib::ListHandler<GdaServerOperationCreateTableArg *>::vector_to_list(arguments).data(),
+                &gerror)
+            );   
+
+  if(gerror) ::Glib::Error::throw_exception(gerror);
+
+  return op;
+}
+
 } /* namespace Gda */
 
 } /* namespace Gnome */
diff --git a/libgda/src/serveroperation.hg b/libgda/src/serveroperation.hg
index 079651d..286bbbf 100644
--- a/libgda/src/serveroperation.hg
+++ b/libgda/src/serveroperation.hg
@@ -62,12 +62,17 @@ public:
   _WRAP_ENUM(Type, GdaServerOperationType, NO_GTYPE)
 
   // These are from gda-easy but they fit in here best
-  static Glib::RefPtr<ServerOperation> prepare_create_database(const Glib::ustring& provider,
+   static Glib::RefPtr<ServerOperation> prepare_create_database(const Glib::ustring& provider,
                                                                const Glib::ustring& db_name);
 
-  static Glib::RefPtr<ServerOperation> prepare_drop_database(const Glib::ustring& provider,
+   static Glib::RefPtr<ServerOperation> prepare_drop_database(const Glib::ustring& provider,
                                                              const Glib::ustring& db_name);
 
+   static Glib::RefPtr<ServerOperation> prepare_create_table(
+           Glib::RefPtr<Connection> &cnc, 
+           const Glib::ustring &table_name,
+           std::vector<GdaServerOperationCreateTableArg *> &arguments);
+
   _WRAP_METHOD(void perform_create_table(), gda_server_operation_perform_create_table, errthrow)
   _WRAP_METHOD(void perform_drop_database(const Glib::ustring& provider), gda_server_operation_perform_drop_database, errthrow)
   _WRAP_METHOD(void perform_create_database(const Glib::ustring& provider), gda_server_operation_perform_create_database, errthrow)
diff --git a/tools/m4/convert_libgdamm.m4 b/tools/m4/convert_libgdamm.m4
index 255f651..529015e 100644
--- a/tools/m4/convert_libgdamm.m4
+++ b/tools/m4/convert_libgdamm.m4
@@ -45,6 +45,8 @@ _CONVERSION(`GdaServerProvider*',`Glib::RefPtr<ServerProvider>',`Glib::wrap($3)'
 _CONVERSION(`GdaServerProvider*',`Glib::RefPtr<const ServerProvider>',`Glib::wrap($3)')
 _CONVERSION(`GdaServerOperation*',`Glib::RefPtr<ServerOperation>',`Glib::wrap($3)')
 _CONVERSION(`GdaServerOperation*',`Glib::RefPtr<const ServerOperation>',`Glib::wrap($3)')
+_CONVERSION(`GdaServerOperationCreateTableArg*',`Glib::RefPtr<const ServerOperationCreateTableArg>',`Glib::wrap($3)')
+_CONVERSION(`GdaServerOperationCreateTableArg*',`Glib::RefPtr<ServerOperationCreateTableArg>',`Glib::wrap($3)')
 _CONVERSION(`GdaDataHandler*',`Glib::RefPtr<DataHandler>',`Glib::wrap($3)')
 _CONVERSION(`GdaSqlParser*',`Glib::RefPtr<SqlParser>',`Glib::wrap($3)')
 _CONVERSION(`GdaSqlParser*',`Glib::RefPtr<const SqlParser>',`Glib::wrap($3)')
In file included from /home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/object.h:35:0,
                 from /home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/binding.h:22,
                 from /home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm.h:91,
                 from /home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.cc:4:
/home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/containerhandle_shared.h: In instantiation of ‘struct Glib::Container_Helpers::TypeTraits<_GdaServerOperationCreateTableArg*>’:
/home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/vectorutils.h:533:35:   required from ‘class Glib::ListHandler<_GdaServerOperationCreateTableArg*>’
/home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.cc:99:70:   required from here
/home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/containerhandle_shared.h:95:44: error: invalid use of incomplete type ‘struct _GdaServerOperationCreateTableArg’
   using CType = typename T::BaseObjectType*;
                                            ^
In file included from /home/pavlo/jhbuild/install/include/libgda-6.0/libgda/gda-server-provider.h:30:0,
                 from /home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.h:34,
                 from /home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.cc:6:
/home/pavlo/jhbuild/install/include/libgda-6.0/libgda/gda-server-operation.h:255:16: note: forward declaration of ‘struct _GdaServerOperationCreateTableArg’
 typedef struct _GdaServerOperationCreateTableArg GdaServerOperationCreateTableArg;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/object.h:35:0,
                 from /home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/binding.h:22,
                 from /home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm.h:91,
                 from /home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.cc:4:
/home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/containerhandle_shared.h:96:52: error: invalid use of incomplete type ‘struct _GdaServerOperationCreateTableArg’
   using CTypeNonConst = typename T::BaseObjectType*;
                                                    ^
In file included from /home/pavlo/jhbuild/install/include/libgda-6.0/libgda/gda-server-provider.h:30:0,
                 from /home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.h:34,
                 from /home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.cc:6:
/home/pavlo/jhbuild/install/include/libgda-6.0/libgda/gda-server-operation.h:255:16: note: forward declaration of ‘struct _GdaServerOperationCreateTableArg’
 typedef struct _GdaServerOperationCreateTableArg GdaServerOperationCreateTableArg;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm.h:142:0,
                 from /home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.cc:4:
/home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/vectorutils.h: In instantiation of ‘Glib::Container_Helpers::GListKeeper<Tr>::~GListKeeper() [with Tr = Glib::Container_Helpers::TypeTraits<_GdaServerOperationCreateTableArg*>]’:
/home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.cc:99:96:   required from here
/home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/vectorutils.h:859:27: error: ‘release_c_type’ is not a member of ‘Glib::Container_Helpers::TypeTraits<_GdaServerOperationCreateTableArg*>’
         Tr::release_c_type(static_cast<CTypeNonConst>(node->data));
         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/vectorutils.h: In instantiation of ‘GList* Glib::Container_Helpers::create_glist(typename std::vector<typename Tr::CppType>::const_iterator, typename std::vector<typename Tr::CppType>::const_iterator) [with Tr = Glib::Container_Helpers::TypeTraits<_GdaServerOperationCreateTableArg*>; GList = _GList; typename std::vector<typename Tr::CppType>::const_iterator = __gnu_cxx::__normal_iterator<_GdaServerOperationCreateTableArg* const*, std::vector<_GdaServerOperationCreateTableArg*> >]’:
/home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/vectorutils.h:976:67:   required from ‘static Glib::ListHandler<T, Tr>::GListKeeperType Glib::ListHandler<T, Tr>::vector_to_list(const VectorType&) [with T = _GdaServerOperationCreateTableArg*; Tr = Glib::Container_Helpers::TypeTraits<_GdaServerOperationCreateTableArg*>; Glib::ListHandler<T, Tr>::GListKeeperType = Glib::Container_Helpers::GListKeeper<Glib::Container_Helpers::TypeTraits<_GdaServerOperationCreateTableArg*> >; Glib::ListHandler<T, Tr>::VectorType = std::vector<_GdaServerOperationCreateTableArg*>]’
/home/pavlo/jhbuild/checkout/libgdamm/libgda/libgdamm/serveroperation.cc:99:72:   required from here
/home/pavlo/jhbuild/install/include/glibmm-2.54/glibmm/vectorutils.h:130:41: error: ‘to_c_type’ is not a member of ‘Glib::Container_Helpers::TypeTraits<_GdaServerOperationCreateTableArg*>’
     const void* const item(Tr::to_c_type(*&*--pend));
                            ~~~~~~~~~~~~~^~~~~~~~~~~
mv -f .deps/metastruct.Tpo .deps/metastruct.Plo

_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to