00001
00002
00003
#ifndef _LIBGDAMM_CONNECTION_H
00004
#define _LIBGDAMM_CONNECTION_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/serverprovider.h>
00031
#include <libgdamm/transaction.h>
00032
#include <libgdamm/error.h>
00033
#include <libgdamm/datamodel.h>
00034
#include <libgda/gda-connection.h>
00035
00036
00037
#ifndef DOXYGEN_SHOULD_SKIP_THIS
00038
typedef struct _GdaConnection GdaConnection;
00039
typedef struct _GdaConnectionClass GdaConnectionClass;
00040
#endif
00041
00042
00043
namespace Gnome
00044 {
00045
00046 namespace Gda
00047 {
class Connection_Class; }
00048
00049 }
00050
namespace Gnome
00051 {
00052
00053
namespace Gda
00054 {
00055
00056
00057 class Connection :
public Glib::Object
00058 {
00059
00060
#ifndef DOXYGEN_SHOULD_SKIP_THIS
00061
00062
public:
00063
typedef Connection CppObjectType;
00064
typedef Connection_Class CppClassType;
00065
typedef GdaConnection BaseObjectType;
00066
typedef GdaConnectionClass BaseClassType;
00067
00068
private:
friend class Connection_Class;
00069
static CppClassType connection_class_;
00070
00071
private:
00072
00073
Connection(
const Connection&);
00074
Connection& operator=(
const Connection&);
00075
00076
protected:
00077
explicit Connection(
const Glib::ConstructParams& construct_params);
00078
explicit Connection(GdaConnection* castitem);
00079
00080
#endif
00081
00082
public:
00083
virtual ~Connection();
00084
00085
#ifndef DOXYGEN_SHOULD_SKIP_THIS
00086
static GType get_type() G_GNUC_CONST;
00087
static GType get_base_type() G_GNUC_CONST;
00088
#endif
00089
00091 GdaConnection*
gobj() {
return reinterpret_cast<GdaConnection*>(gobject_); }
00092
00094 const GdaConnection*
gobj()
const {
return reinterpret_cast<GdaConnection*>(gobject_); }
00095
00096 GdaConnection*
gobj_copy();
00097
00098
private:
00099
00100
protected:
00101
explicit Connection(GdaClient* client,
const Glib::RefPtr<ServerProvider>& provider,
const Glib::ustring& dsn,
const Glib::ustring& username,
const Glib::ustring& password);
00102
00103
public:
00104
00105
static Glib::RefPtr<Connection> create(GdaClient* client,
const Glib::RefPtr<ServerProvider>& provider,
const Glib::ustring& dsn,
const Glib::ustring& username,
const Glib::ustring& password);
00106
00107
00108
bool close();
00109
00110
bool is_open();
00111
00112
00113 GdaClient*
get_client();
00114
00115
void set_client(GdaClient *client);
00116
00117
00118
Glib::ustring get_database() const;;
00119
00120 Glib::ustring get_dsn() const;
00121
00122 Glib::ustring get_cnc_string() const;
00123
00124 Glib::ustring get_provider() const;
00125
00126 Glib::ustring get_username() const;
00127
00128 Glib::ustring get_password() const;
00129
00130
00131
void add_error(const Glib::RefPtr<
Error>& error);
00132
00133
void add_error_list(GList *error_list);
00134
00135
00136
bool change_database(const Glib::ustring& name);
00137
00138
bool create_database(const Glib::ustring& name);
00139
00140
bool drop_database (const Glib::ustring& name);
00141
00142
00143 GList* execute_command(GdaCommand *cmd, GdaParameterList *params);
00144
00145 Glib::RefPtr<
DataModel> execute_single_command(GdaCommand *cmd, GdaParameterList *params);
00146
00147
int execute_non_query(GdaCommand *cmd, GdaParameterList *params);
00148
00149
00150
bool begin_transaction(const Glib::RefPtr<
Transaction>& transaction);
00151
00152
bool commit_transaction(const Glib::RefPtr<
Transaction>& transaction);
00153
00154
bool rollback_transaction(const Glib::RefPtr<
Transaction>& transaction);
00155
00156
00157
00158
00159
bool supports(GdaConnectionFeature feature);
00160
00161
00162 Glib::RefPtr<
DataModel> get_schema(GdaConnectionSchema schema, GdaParameterList *params);
00163
00164
00169 Glib::SignalProxy1<
void,GList*> signal_error();
00170
00171
00172 public:
00173
00174 public:
00175
00176
00177 protected:
00178
00179
00180
00181 virtual
void on_error(GList* error_list);
00182
00183
00184 };
00185
00186 }
00187 }
00188
00189
00190 namespace Glib
00191 {
00193
Glib::RefPtr<Gnome::Gda::Connection> wrap(GdaConnection* object,
bool take_copy =
false);
00194 }
00195
00196
00197
#endif
00198