00001
00002
00003 #ifndef _LIBGDAMM_COMMAND_H
00004 #define _LIBGDAMM_COMMAND_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 <glibmm/object.h>
00032
00033
00034 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00035 extern "C" { typedef struct _GdaCommand GdaCommand; }
00036 #endif
00037
00038 namespace Gnome
00039 {
00040
00041 namespace Gda
00042 {
00043
00049 enum CommandType
00050 {
00051 COMMAND_TYPE_SQL,
00052 COMMAND_TYPE_XML,
00053 COMMAND_TYPE_PROCEDURE,
00054 COMMAND_TYPE_TABLE,
00055 COMMAND_TYPE_SCHEMA,
00056 COMMAND_TYPE_INVALID
00057 };
00058
00059 }
00060
00061 }
00062
00063
00064 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00065 namespace Glib
00066 {
00067
00068 template <>
00069 class Value<Gnome::Gda::CommandType> : public Glib::Value_Enum<Gnome::Gda::CommandType>
00070 {
00071 public:
00072 static GType value_type() G_GNUC_CONST;
00073 };
00074
00075 }
00076 #endif
00077
00078
00079 namespace Gnome
00080 {
00081
00082 namespace Gda
00083 {
00084
00096 enum CommandOptions
00097 {
00098 COMMAND_OPTION_IGNORE_ERRORS = 1,
00099 COMMAND_OPTION_STOP_ON_ERRORS = 1 << 1,
00100 COMMAND_OPTION_BAD_OPTION = 1 << 2
00101 };
00102
00104 inline CommandOptions operator|(CommandOptions lhs, CommandOptions rhs)
00105 { return static_cast<CommandOptions>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00106
00108 inline CommandOptions operator&(CommandOptions lhs, CommandOptions rhs)
00109 { return static_cast<CommandOptions>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00110
00112 inline CommandOptions operator^(CommandOptions lhs, CommandOptions rhs)
00113 { return static_cast<CommandOptions>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00114
00116 inline CommandOptions operator~(CommandOptions flags)
00117 { return static_cast<CommandOptions>(~static_cast<unsigned>(flags)); }
00118
00120 inline CommandOptions& operator|=(CommandOptions& lhs, CommandOptions rhs)
00121 { return (lhs = static_cast<CommandOptions>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00122
00124 inline CommandOptions& operator&=(CommandOptions& lhs, CommandOptions rhs)
00125 { return (lhs = static_cast<CommandOptions>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00126
00128 inline CommandOptions& operator^=(CommandOptions& lhs, CommandOptions rhs)
00129 { return (lhs = static_cast<CommandOptions>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00130
00131 }
00132
00133 }
00134
00135
00136 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00137 namespace Glib
00138 {
00139
00140 template <>
00141 class Value<Gnome::Gda::CommandOptions> : public Glib::Value_Flags<Gnome::Gda::CommandOptions>
00142 {
00143 public:
00144 static GType value_type() G_GNUC_CONST;
00145 };
00146
00147 }
00148 #endif
00149
00150
00151 namespace Gnome
00152 {
00153
00154 namespace Gda
00155 {
00156
00157
00158 class Command
00159 {
00160 public:
00161 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00162 typedef Command CppObjectType;
00163 typedef GdaCommand BaseObjectType;
00164 #endif
00165
00166 Command();
00167
00168
00169 explicit Command(GdaCommand* castitem, bool make_a_copy = false);
00170
00171 Command(const Command& src);
00172 Command& operator=(const Command& src);
00173
00174 ~Command();
00175
00176 GdaCommand* gobj() { return gobject_; }
00177 const GdaCommand* gobj() const { return gobject_; }
00178
00180 GdaCommand* gobj_copy() const;
00181
00182 protected:
00183 GdaCommand* gobject_;
00184
00185 private:
00186
00187
00188 public:
00189
00190 explicit Command(const Glib::ustring& text, CommandType type = COMMAND_TYPE_SQL, CommandOptions options = COMMAND_OPTION_STOP_ON_ERRORS);
00191
00192
00193 Glib::ustring get_text() const;
00194
00195 void set_text(const Glib::ustring& text);
00196
00197 CommandType get_command_type() const;
00198
00199 void set_command_type(CommandType type);
00200
00201 CommandOptions get_options() const;
00202
00203 void set_options(CommandOptions options);
00204
00205 Glib::RefPtr<Transaction> get_transaction();
00206
00207 Glib::RefPtr<const Transaction> get_transaction() const;
00208
00209 void set_transaction(const Glib::RefPtr<Transaction>& xaction);
00210
00211
00212 };
00213
00214 }
00215 }
00216
00217
00218 namespace Glib
00219 {
00220
00226 Gnome::Gda::Command wrap(GdaCommand* object, bool take_copy = false);
00227
00228 }
00229
00230 #endif
00231