[libgdamm] ServerOperation: Use _WRAP_METHOD() for perform_*() methods.



commit 5a421c71b59d704a6926397fcf744d3ae55194ab
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Apr 26 16:48:01 2017 +0200

    ServerOperation: Use _WRAP_METHOD() for perform_*() methods.
    
    And remove the bool return type. It is useless to return false and also
    throw an exception.

 libgda/src/serveroperation.ccg |   35 -----------------------------------
 libgda/src/serveroperation.hg  |    8 ++++----
 2 files changed, 4 insertions(+), 39 deletions(-)
---
diff --git a/libgda/src/serveroperation.ccg b/libgda/src/serveroperation.ccg
index ca40b52..2c206f1 100644
--- a/libgda/src/serveroperation.ccg
+++ b/libgda/src/serveroperation.ccg
@@ -55,30 +55,6 @@ Glib::RefPtr<ServerOperation> ServerOperation::prepare_drop_database(const Glib:
   return op;
 }
 
-bool ServerOperation::perform_drop_database(const Glib::ustring& provider)
-{
-  GError* gerror = 0;
-  bool retval =
-    static_cast<bool>(gda_server_operation_perform_drop_database(gobj(), provider.c_str(), &gerror));
-
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-
-  return retval;
-}
-
-bool ServerOperation::perform_create_database(const Glib::ustring& provider)
-{
-  GError* gerror = 0;
-  bool retval =
-    static_cast<bool>(gda_server_operation_perform_create_database(gobj(), provider.c_str(), &gerror));
-
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-
-  return retval;
-}
-
 Value ServerOperation::get_value_at(const Glib::ustring& path) const
 {
   Value retval;
@@ -98,17 +74,6 @@ void ServerOperation::set_value_at_as_value(const Glib::ustring& path, const Gli
     ::Glib::Error::throw_exception(gerror);
 }
 
-bool ServerOperation::perform_create_table()
-{
-    GError *error = 0;
-    bool res;
-    res = gda_server_operation_perform_create_table(gobj(),&error);
-    if(error) ::Glib::Error::throw_exception(error);
-
-    return res;
-}
-
-
 } /* namespace Gda */
 
 } /* namespace Gnome */
diff --git a/libgda/src/serveroperation.hg b/libgda/src/serveroperation.hg
index 15ab121..8b7774d 100644
--- a/libgda/src/serveroperation.hg
+++ b/libgda/src/serveroperation.hg
@@ -64,13 +64,13 @@ public:
   // These are from gda-easy but they fit in here best
   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,
                                                              const Glib::ustring& db_name);
 
-  bool perform_create_table();
-  bool perform_drop_database(const Glib::ustring& provider);
-  bool perform_create_database(const Glib::ustring& provider);
+  _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)
 
   // The C version of these take varargs for some reason.
   _WRAP_METHOD_DOCS_ONLY(gda_server_operation_get_value_at)


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