gnomemm r1858 - in libgdamm/trunk: . libgda/src



Author: jhs
Date: Mon Dec 15 10:26:02 2008
New Revision: 1858
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1858&view=rev

Log:
2008-12-15  Johannes Schmid  <jschmid openismus com>

	* libgda/src/connection.ccg:
	* libgda/src/connection.hg:
	Use gda_execute_non_select_command() instead of hardcoding
	
	* libgda/src/serveroperation.ccg:
	* libgda/src/serveroperation.hg:
	Add gda_perform_create/drop_database and gda_prepare_create/drop_database from
	gda-easy

Modified:
   libgdamm/trunk/ChangeLog
   libgdamm/trunk/libgda/src/connection.hg
   libgdamm/trunk/libgda/src/serveroperation.ccg
   libgdamm/trunk/libgda/src/serveroperation.hg

Modified: libgdamm/trunk/libgda/src/connection.hg
==============================================================================
--- libgdamm/trunk/libgda/src/connection.hg	(original)
+++ libgdamm/trunk/libgda/src/connection.hg	Mon Dec 15 10:26:02 2008
@@ -152,12 +152,11 @@
 
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   int statement_execute_non_select(const Glib::RefPtr<Statement>& stmt);
-  int statement_execute_non_select(const Glib::ustring& sql);
 #else
   int statement_execute_non_select(const Glib::RefPtr<Statement>& stmt, std::auto_ptr<Glib::Error>& error);
-  int statement_execute_non_select(const Glib::ustring& sql, std::auto_ptr<Glib::Error>& error);
 #endif //GLIBMM_EXCEPTIONS_ENABLED  
-
+  _WRAP_METHOD(int statement_execute_non_select(const Glib::ustring& sql), gda_execute_non_select_command, errthrow);
+  
   //Note that we do not add a non-const version of this because the documentation says that it should not be modified:
   _WRAP_METHOD(Glib::RefPtr<const TransactionStatus> get_transaction_status() const, gda_connection_get_transaction_status, errthrow, refreturn)
 

Modified: libgdamm/trunk/libgda/src/serveroperation.ccg
==============================================================================
--- libgdamm/trunk/libgda/src/serveroperation.ccg	(original)
+++ libgdamm/trunk/libgda/src/serveroperation.ccg	Mon Dec 15 10:26:02 2008
@@ -22,6 +22,7 @@
 
 #include <libgda/gda-server-operation.h>
 #include <libgda/gda-enum-types.h>
+#include <libgda/gda-easy.h>
 #include <libgdamm/connection.h>
 
 namespace Gnome
@@ -30,13 +31,97 @@
 namespace Gda
 {
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<ServerOperation> ServerOperation::prepare_create_database(const Glib::ustring& provider,
+                                                                       const Glib::ustring& db_name)
+#else
+Glib::RefPtr<ServerOperation> ServerOperation::prepare_create_database(const Glib::ustring& provider,
+                                                                       const Glib::ustring& db_name,
+                                                                       std::auto_ptr<Glib::Error>& error)
+#endif
+{
+  GError* gerror = 0;
+  Glib::RefPtr<ServerOperation> op = 
+    Glib::wrap(gda_prepare_create_database(provider.c_str(), db_name.c_str(), &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 op;   
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<ServerOperation> ServerOperation::prepare_drop_database(const Glib::ustring& provider,
+                                                                     const Glib::ustring& db_name)
+#else
+Glib::RefPtr<ServerOperation> ServerOperation::prepare_drop_database(const Glib::ustring& provider,
+                                                                     const Glib::ustring& db_name,
+                                                                     std::auto_ptr<Glib::Error>& error)
+#endif
+{
+  GError* gerror = 0;
+  Glib::RefPtr<ServerOperation> op = 
+    Glib::wrap(gda_prepare_drop_database(provider.c_str(), db_name.c_str(), &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 op;   
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool ServerOperation::perform_drop_database(const Glib::ustring& provider)
+#else
+bool ServerOperation::perform_drop_database(const Glib::ustring& provider,
+                                            std::auto_ptr<Glib::Error>& error)
+#endif
+{
+  GError* gerror = 0;
+  bool retval = 
+    static_cast<bool>(gda_perform_drop_database(provider.c_str(), gobj(), &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
+bool ServerOperation::perform_create_database(const Glib::ustring& provider)
+#else
+bool ServerOperation::perform_create_database(const Glib::ustring& provider,
+                                              std::auto_ptr<Glib::Error>& error)
+#endif
+{
+  GError* gerror = 0;
+  bool retval = 
+    static_cast<bool>(gda_perform_create_database(provider.c_str(), gobj(), &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;
+}
+
 Value ServerOperation::get_value_at(const Glib::ustring& path) const
 {
   Value retval;
   const GValue* value = gda_server_operation_get_value_at(const_cast<GdaServerOperation*>(gobj()), "%s", path.c_str());
   retval.init(value);
   return retval;
-}
+}  
 
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
 void ServerOperation::set_value_at(const Glib::ustring& path, const Glib::ustring& value)

Modified: libgdamm/trunk/libgda/src/serveroperation.hg
==============================================================================
--- libgdamm/trunk/libgda/src/serveroperation.hg	(original)
+++ libgdamm/trunk/libgda/src/serveroperation.hg	Mon Dec 15 10:26:02 2008
@@ -58,6 +58,33 @@
   _CLASS_GOBJECT(ServerOperation, GdaServerOperation, GDA_SERVER_OPERATION, Glib::Object, GObject)
 
 public:
+  // These are from gda-easy but they fit in here best
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  static Glib::RefPtr<ServerOperation> prepare_create_database(const Glib::ustring& provider,
+                                                               const Glib::ustring& db_name);
+#else
+  static Glib::RefPtr<ServerOperation> prepare_create_database(const Glib::ustring& provider,
+                                                               const Glib::ustring& db_name,
+                                                               std::auto_ptr<Glib::Error>& error);
+#endif    
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  static Glib::RefPtr<ServerOperation> prepare_drop_database(const Glib::ustring& provider,
+                                                             const Glib::ustring& db_name);
+#else
+  static Glib::RefPtr<ServerOperation> prepare_drop_database(const Glib::ustring& provider,
+                                                             const Glib::ustring& db_name,
+                                                             std::auto_ptr<Glib::Error>& error);
+#endif 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  bool perform_drop_database(const Glib::ustring& provider);
+  bool perform_create_database(const Glib::ustring& provider);
+#else
+  bool perform_drop_database(const Glib::ustring& provider,
+                             std::auto_ptr<Glib::Error>& error);
+  bool perform_create_database(const Glib::ustring& provider,
+                               std::auto_ptr<Glib::Error>& error);
+#endif 
+
   // The C version of these take varargs for some reason.
   _WRAP_METHOD_DOCS_ONLY(gda_server_operation_get_value_at)
   Value get_value_at(const Glib::ustring& path_format) const;



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