client.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _LIBGDAMM_CLIENT_H
00004 #define _LIBGDAMM_CLIENT_H
00005 
00006 
00007 #include <glibmm.h>
00008 
00009 /* $Id: client.hg,v 1.17 2006/12/23 09:29:35 murrayc Exp $ */
00010 // -*- C++ -*- //
00011 
00012 /* client.h
00013  *
00014  * Copyright 2003 libgdamm Development Team
00015  *
00016  * This library is free software; you can redistribute it and/or
00017  * modify it under the terms of the GNU Library General Public
00018  * License as published by the Free Software Foundation; either
00019  * version 2 of the License, or (at your option) any later version.
00020  *
00021  * This library is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024  * Library General Public License for more details.
00025  *
00026  * You should have received a copy of the GNU Library General Public
00027  * License along with this library; if not, write to the Free
00028  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00029  */
00030 
00031 #include <libgdamm/transactionstatus.h>
00032 #include <libgdamm/connection.h>
00033 //#include <libgda/gda-client.h>
00034 
00035 
00036 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00037 typedef struct _GdaClient GdaClient;
00038 typedef struct _GdaClientClass GdaClientClass;
00039 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00040 
00041 
00042 namespace Gnome
00043 {
00044 
00045 namespace Gda
00046 { class Client_Class; } // namespace Gda
00047 
00048 } // namespace Gnome
00049 namespace Gnome
00050 {
00051 
00052 namespace Gda
00053 {
00054 
00057 class ClientError : public Glib::Error
00058 {
00059 public:
00060   enum Code
00061   {
00062     CLIENT_GENERAL_ERROR
00063   };
00064 
00065   ClientError(Code error_code, const Glib::ustring& error_message);
00066   explicit ClientError(GError* gobject);
00067   Code code() const;
00068 
00069 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00070 private:
00071 
00072 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00073   static void throw_func(GError* gobject);
00074 #else
00075   //When not using exceptions, we just pass the Exception object around without throwing it:
00076   static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
00077 #endif //GLIBMM_EXCEPTIONS_ENABLED
00078 
00079   friend void wrap_init(); // uses throw_func()
00080 #endif
00081 };
00082 
00083 } // namespace Gda
00084 
00085 } // namespace Gnome
00086 
00087 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00088 namespace Glib
00089 {
00090 
00091 template <>
00092 class Value<Gnome::Gda::ClientError::Code> : public Glib::Value_Enum<Gnome::Gda::ClientError::Code>
00093 {
00094 public:
00095   static GType value_type() G_GNUC_CONST;
00096 };
00097 
00098 } // namespace Glib
00099 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00100 
00101 
00102 namespace Gnome
00103 {
00104 
00105 namespace Gda
00106 {
00107 
00108 
00114 enum ClientEvent
00115 {
00116   CLIENT_EVENT_INVALID,
00117   CLIENT_EVENT_ERROR,
00118   CLIENT_EVENT_CONNECTION_OPENED,
00119   CLIENT_EVENT_CONNECTION_CLOSED,
00120   CLIENT_EVENT_TRANSACTION_STARTED,
00121   CLIENT_EVENT_TRANSACTION_COMMITTED,
00122   CLIENT_EVENT_TRANSACTION_CANCELLED
00123 };
00124 
00125 } // namespace Gda
00126 
00127 } // namespace Gnome
00128 
00129 
00130 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00131 namespace Glib
00132 {
00133 
00134 template <>
00135 class Value<Gnome::Gda::ClientEvent> : public Glib::Value_Enum<Gnome::Gda::ClientEvent>
00136 {
00137 public:
00138   static GType value_type() G_GNUC_CONST;
00139 };
00140 
00141 } // namespace Glib
00142 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00143 
00144 
00145 namespace Gnome
00146 {
00147 
00148 namespace Gda
00149 {
00150 
00151 
00152 class ServerOperation;
00153 
00169 class Client : public Glib::Object
00170 {
00171   
00172 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00173 
00174 public:
00175   typedef Client CppObjectType;
00176   typedef Client_Class CppClassType;
00177   typedef GdaClient BaseObjectType;
00178   typedef GdaClientClass BaseClassType;
00179 
00180 private:  friend class Client_Class;
00181   static CppClassType client_class_;
00182 
00183 private:
00184   // noncopyable
00185   Client(const Client&);
00186   Client& operator=(const Client&);
00187 
00188 protected:
00189   explicit Client(const Glib::ConstructParams& construct_params);
00190   explicit Client(GdaClient* castitem);
00191 
00192 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00193 
00194 public:
00195   virtual ~Client();
00196 
00197 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00198   static GType get_type()      G_GNUC_CONST;
00199   static GType get_base_type() G_GNUC_CONST;
00200 #endif
00201 
00203   GdaClient*       gobj()       { return reinterpret_cast<GdaClient*>(gobject_); }
00204 
00206   const GdaClient* gobj() const { return reinterpret_cast<GdaClient*>(gobject_); }
00207 
00209   GdaClient* gobj_copy();
00210 
00211 private:
00212 
00213 protected:
00214   Client();
00215 
00216 public:
00217   
00218   static Glib::RefPtr<Client> create();
00219 
00220   
00244 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00245   Glib::RefPtr<Connection> open_connection(const Glib::ustring& dsn, const Glib::ustring& username, const Glib::ustring& password, ConnectionOptions options = (ConnectionOptions)0);
00246 #else
00247   Glib::RefPtr<Connection> open_connection(const Glib::ustring& dsn, const Glib::ustring& username, const Glib::ustring& password, ConnectionOptions options, std::auto_ptr<Glib::Error>& error);
00248 #endif //GLIBMM_EXCEPTIONS_ENABLED
00249 
00250 
00275 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00276   Glib::RefPtr<Connection> open_connection_from_string(const Glib::ustring& provider_id, const Glib::ustring& cnc_string, const Glib::ustring& username, const Glib::ustring& password, ConnectionOptions options = (ConnectionOptions)0);
00277 #else
00278   Glib::RefPtr<Connection> open_connection_from_string(const Glib::ustring& provider_id, const Glib::ustring& cnc_string, const Glib::ustring& username, const Glib::ustring& password, ConnectionOptions options, std::auto_ptr<Glib::Error>& error);
00279 #endif //GLIBMM_EXCEPTIONS_ENABLED
00280 
00281 
00285   void declare_connection(const Glib::RefPtr<Connection>& cnc);
00286 
00287  //Use a special conversion here, because we should not own any part of the returned GList,
00288  //as specified by the gda_client_get_connections() documentation,
00289  // and because we need to unconst the GList.:
00290   
00291 
00297   Glib::ListHandle< Glib::RefPtr<Connection> > get_connections();
00298   
00304   Glib::ListHandle< Glib::RefPtr<const Connection> > get_connections() const;
00305    
00306   
00319   Glib::RefPtr<Connection> find_connection(const Glib::ustring& dsn, const Glib::ustring& username, const Glib::ustring& password);
00320   
00323   void close_all_connections();
00324 
00325   
00333   void notify_event(const Glib::RefPtr<Connection>& cnc, ClientEvent event, const Glib::RefPtr<ParameterList>& params);
00334 
00335   //TODO: Wrap GdaConnectionEvent as exception?
00336   
00341   void notify_error_event(const Glib::RefPtr<Connection>& cnc, GdaConnectionEvent *error);
00342   
00347   void notify_connection_opened_event(const Glib::RefPtr<Connection>& cnc);
00348   
00353   void notify_connection_closed_event(const Glib::RefPtr<Connection>& cnc);
00354 
00355   
00361   Glib::ustring get_dsn_specs(const Glib::ustring& provider) const;
00362 
00363   
00375   Glib::RefPtr<ServerOperation> prepare_create_database(const Glib::ustring& db_name, const Glib::ustring& provider);
00376   
00383 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00384   bool perform_create_database(const Glib::RefPtr<ServerOperation>& op);
00385 #else
00386   bool perform_create_database(const Glib::RefPtr<ServerOperation>& op, std::auto_ptr<Glib::Error>& error);
00387 #endif //GLIBMM_EXCEPTIONS_ENABLED
00388 
00389 
00401   Glib::RefPtr<ServerOperation> prepare_drop_database(const Glib::ustring& db_name, const Glib::ustring& provider);
00402   
00409 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00410   bool perform_drop_database(const Glib::RefPtr<ServerOperation>& op);
00411 #else
00412   bool perform_drop_database(const Glib::RefPtr<ServerOperation>& op, std::auto_ptr<Glib::Error>& error);
00413 #endif //GLIBMM_EXCEPTIONS_ENABLED
00414 
00415 
00429 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00430   bool begin_transaction(const Glib::ustring& name, TransactionIsolation level);
00431 #else
00432   bool begin_transaction(const Glib::ustring& name, TransactionIsolation level, std::auto_ptr<Glib::Error>& error);
00433 #endif //GLIBMM_EXCEPTIONS_ENABLED
00434 
00435   
00449 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00450   bool commit_transaction(const Glib::ustring& name);
00451 #else
00452   bool commit_transaction(const Glib::ustring& name, std::auto_ptr<Glib::Error>& error);
00453 #endif //GLIBMM_EXCEPTIONS_ENABLED
00454 
00455   
00469 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00470   bool rollback_transaction(const Glib::ustring& name);
00471 #else
00472   bool rollback_transaction(const Glib::ustring& name, std::auto_ptr<Glib::Error>& error);
00473 #endif //GLIBMM_EXCEPTIONS_ENABLED
00474 
00475 
00481   Glib::SignalProxy3< void,const Glib::RefPtr<Connection>&,ClientEvent,const Glib::RefPtr<ParameterList>& > signal_event_notification();
00482 
00483 
00484 public:
00485 
00486 public:
00487   //C++ methods used to invoke GTK+ virtual functions:
00488 #ifdef GLIBMM_VFUNCS_ENABLED
00489 #endif //GLIBMM_VFUNCS_ENABLED
00490 
00491 protected:
00492   //GTK+ Virtual Functions (override these to change behaviour):
00493 #ifdef GLIBMM_VFUNCS_ENABLED
00494 #endif //GLIBMM_VFUNCS_ENABLED
00495 
00496   //Default Signal Handlers::
00497 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00498   virtual void on_event_notification(const Glib::RefPtr<Connection>& cnc, ClientEvent event, const Glib::RefPtr<ParameterList>& params);
00499 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00500 
00501 
00502 };
00503 
00504 } // namespace Gda
00505 } // namespace Gnome
00506 
00507 
00508 namespace Glib
00509 {
00515   Glib::RefPtr<Gnome::Gda::Client> wrap(GdaClient* object, bool take_copy = false);
00516 }
00517 
00518 
00519 #endif /* _LIBGDAMM_CLIENT_H */
00520 

Generated on Sat Feb 10 20:06:25 2007 for libgdamm by  doxygen 1.4.7