client.h
Go to the documentation of this file.00001
00002
00003 #ifndef _LIBGDAMM_CLIENT_H
00004 #define _LIBGDAMM_CLIENT_H
00005
00006 #include <glibmm.h>
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <libgdamm/transaction.h>
00031 #include <libgdamm/connection.h>
00032
00033
00034
00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00036 typedef struct _GdaClient GdaClient;
00037 typedef struct _GdaClientClass GdaClientClass;
00038 #endif
00039
00040
00041 namespace Gnome
00042 {
00043
00044 namespace Gda
00045 { class Client_Class; }
00046
00047 }
00048 namespace Gnome
00049 {
00050
00051 namespace Gda
00052 {
00053
00059 enum ClientEvent
00060 {
00061 CLIENT_EVENT_INVALID,
00062 CLIENT_EVENT_ERROR,
00063 CLIENT_EVENT_CONNECTION_OPENED,
00064 CLIENT_EVENT_CONNECTION_CLOSED,
00065 CLIENT_EVENT_TRANSACTION_STARTED,
00066 CLIENT_EVENT_TRANSACTION_COMMITTED,
00067 CLIENT_EVENT_TRANSACTION_CANCELLED
00068 };
00069
00070 }
00071
00072 }
00073
00074
00075 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00076 namespace Glib
00077 {
00078
00079 template <>
00080 class Value<Gnome::Gda::ClientEvent> : public Glib::Value_Enum<Gnome::Gda::ClientEvent>
00081 {
00082 public:
00083 static GType value_type() G_GNUC_CONST;
00084 };
00085
00086 }
00087 #endif
00088
00089
00090 namespace Gnome
00091 {
00092
00093 namespace Gda
00094 {
00095
00096
00097 class Client : public Glib::Object
00098 {
00099
00100 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00101
00102 public:
00103 typedef Client CppObjectType;
00104 typedef Client_Class CppClassType;
00105 typedef GdaClient BaseObjectType;
00106 typedef GdaClientClass BaseClassType;
00107
00108 private: friend class Client_Class;
00109 static CppClassType client_class_;
00110
00111 private:
00112
00113 Client(const Client&);
00114 Client& operator=(const Client&);
00115
00116 protected:
00117 explicit Client(const Glib::ConstructParams& construct_params);
00118 explicit Client(GdaClient* castitem);
00119
00120 #endif
00121
00122 public:
00123 virtual ~Client();
00124
00125 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00126 static GType get_type() G_GNUC_CONST;
00127 static GType get_base_type() G_GNUC_CONST;
00128 #endif
00129
00131 GdaClient* gobj() { return reinterpret_cast<GdaClient*>(gobject_); }
00132
00134 const GdaClient* gobj() const { return reinterpret_cast<GdaClient*>(gobject_); }
00135
00137 GdaClient* gobj_copy();
00138
00139 private:
00140
00141 protected:
00142 Client();
00143
00144 public:
00145
00146 static Glib::RefPtr<Client> create();
00147
00148
00149 Glib::RefPtr<Connection> open_connection(const Glib::ustring& dsn, const Glib::ustring& username, const Glib::ustring& password, ConnectionOptions options = (ConnectionOptions)0);
00150
00151 Glib::RefPtr<Connection> open_connection_from_string(const Glib::ustring& provider_id, const Glib::ustring& cnc_string, ConnectionOptions options = (ConnectionOptions)0);
00152
00153
00154
00155
00156
00157 Glib::ListHandle< Glib::RefPtr<Connection> > get_connection_list();
00158
00159 Glib::ListHandle< Glib::RefPtr<const Connection> > get_connection_list() const;
00160
00161
00162 Glib::RefPtr<Connection> find_connection(const Glib::ustring& dsn, const Glib::ustring& username, const Glib::ustring& password);
00163
00164 void close_all_connections();
00165
00166
00167 void notify_event(const Glib::RefPtr<Connection>& cnc, ClientEvent event, const ParameterList& params);
00168
00169 void notify_error_event(const Glib::RefPtr<Connection>& cnc, GdaError *error);
00170
00171 void notify_connection_opened_event(const Glib::RefPtr<Connection>& cnc);
00172
00173
00174 void notify_transaction_started_event(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Transaction>& xaction);
00175
00176 void notify_transaction_committed_event(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Transaction>& xaction);
00177
00178 void notify_transaction_cancelled_event(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Transaction>& xaction);
00179
00180
00181 bool begin_transaction(const Glib::RefPtr<Transaction>& xaction);
00182
00183 bool commit_transaction(const Glib::RefPtr<Transaction>& xaction);
00184
00185 bool rollback_transaction(const Glib::RefPtr<Transaction>& xaction);
00186
00187
00188
00189
00190
00191 public:
00192
00193 public:
00194
00195
00196 protected:
00197
00198
00199
00200
00201
00202 };
00203
00204 }
00205 }
00206
00207
00208 namespace Glib
00209 {
00215 Glib::RefPtr<Gnome::Gda::Client> wrap(GdaClient* object, bool take_copy = false);
00216 }
00217
00218
00219 #endif
00220