00001
00002
00003 #ifndef _LIBGDAMM_DICTCONSTRAINT_H
00004 #define _LIBGDAMM_DICTCONSTRAINT_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include <libgdamm/object.h>
00032 #include <libgdamm/xmlstorage.h>
00033 #include <libgdamm/dicttable.h>
00034 #include <libgdamm/dictfield.h>
00035 #include <libgdamm/dicttype.h>
00036 #include <libgdamm/referer.h>
00037
00038
00039 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00040 typedef struct _GdaDictConstraint GdaDictConstraint;
00041 typedef struct _GdaDictConstraintClass GdaDictConstraintClass;
00042 #endif
00043
00044
00045 namespace Gnome
00046 {
00047
00048 namespace Gda
00049 { class DictConstraint_Class; }
00050
00051 }
00052 namespace Gnome
00053 {
00054
00055 namespace Gda
00056 {
00057
00063 enum DictConstraintType
00064 {
00065 PRIMARY_KEY,
00066 FOREIGN_KEY,
00067 UNIQUE,
00068 NOT_NULL,
00069 CHECK_EXPR,
00070 CHECK_IN_LIST,
00071 CHECK_SETOF_LIST,
00072 UNKNOWN
00073 };
00074
00075 }
00076
00077 }
00078
00079
00080 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00081 namespace Glib
00082 {
00083
00084 template <>
00085 class Value<Gnome::Gda::DictConstraintType> : public Glib::Value_Enum<Gnome::Gda::DictConstraintType>
00086 {
00087 public:
00088 static GType value_type() G_GNUC_CONST;
00089 };
00090
00091 }
00092 #endif
00093
00094
00095 namespace Gnome
00096 {
00097
00098 namespace Gda
00099 {
00100
00104 enum DictConstraintFkAction
00105 {
00106 FK_ACTION_CASCADE,
00107 FK_ACTION_SET_NULL,
00108 FK_ACTION_SET_DEFAULT,
00109 FK_ACTION_SET_VALUE,
00110 FK_ACTION_NO_ACTION
00111 };
00112
00113 }
00114
00115 }
00116
00117
00118 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00119 namespace Glib
00120 {
00121
00122 template <>
00123 class Value<Gnome::Gda::DictConstraintFkAction> : public Glib::Value_Enum<Gnome::Gda::DictConstraintFkAction>
00124 {
00125 public:
00126 static GType value_type() G_GNUC_CONST;
00127 };
00128
00129 }
00130 #endif
00131
00132
00133 namespace Gnome
00134 {
00135
00136 namespace Gda
00137 {
00138
00139
00140 class Connection;
00141
00150 class DictConstraint
00151 : public Gda::Object,
00152 public XmlStorage,
00153 public Referer
00154 {
00155
00156 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00157
00158 public:
00159 typedef DictConstraint CppObjectType;
00160 typedef DictConstraint_Class CppClassType;
00161 typedef GdaDictConstraint BaseObjectType;
00162 typedef GdaDictConstraintClass BaseClassType;
00163
00164 private: friend class DictConstraint_Class;
00165 static CppClassType dictconstraint_class_;
00166
00167 private:
00168
00169 DictConstraint(const DictConstraint&);
00170 DictConstraint& operator=(const DictConstraint&);
00171
00172 protected:
00173 explicit DictConstraint(const Glib::ConstructParams& construct_params);
00174 explicit DictConstraint(GdaDictConstraint* castitem);
00175
00176 #endif
00177
00178 public:
00179 virtual ~DictConstraint();
00180
00181 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00182 static GType get_type() G_GNUC_CONST;
00183 static GType get_base_type() G_GNUC_CONST;
00184 #endif
00185
00187 GdaDictConstraint* gobj() { return reinterpret_cast<GdaDictConstraint*>(gobject_); }
00188
00190 const GdaDictConstraint* gobj() const { return reinterpret_cast<GdaDictConstraint*>(gobject_); }
00191
00193 GdaDictConstraint* gobj_copy();
00194
00195 private:
00196
00197
00198 protected:
00199
00200
00201 explicit DictConstraint(const Glib::RefPtr<DictTable>& table, DictConstraintType type);
00202 explicit DictConstraint(const Glib::RefPtr<DictDatabase>& db);
00203
00204 public:
00205
00206 static Glib::RefPtr<DictConstraint> create(const Glib::RefPtr<DictTable>& table, DictConstraintType type);
00207
00208
00209 static Glib::RefPtr<DictConstraint> create(const Glib::RefPtr<DictDatabase>& db);
00210
00211
00215 DictConstraintType get_constraint_type() const;
00216
00217
00218
00222 Glib::RefPtr<DictTable> get_table();
00223
00227 Glib::RefPtr<const DictTable> get_table() const;
00228
00229
00234 bool uses_field(const Glib::RefPtr<const DictField>& field) const;
00235
00236
00237
00238
00243 void pkey_set_fields(const GSList *fields);
00244
00249 GSList* pkey_get_fields();
00250
00251
00252
00260 void fkey_set_fields(const GSList *pairs);
00261
00262
00267 Glib::RefPtr<DictTable> fkey_get_ref_table();
00268
00273 Glib::RefPtr<const DictTable> fkey_get_ref_table() const;
00274
00275
00276
00283 GSList* fkey_get_fields() const;
00284
00289 void fkey_set_actions(DictConstraintFkAction on_update, DictConstraintFkAction on_delete);
00290
00295 void fkey_get_actions(DictConstraintFkAction& on_update, DictConstraintFkAction& on_delete);
00296
00297
00298
00299
00302 void unique_set_fields(const GSList *fields);
00303
00307 GSList* unique_get_fields() const;
00308
00309
00310
00311 void not_null_set_field(const Glib::RefPtr<DictField>& field);
00312
00313
00314 Glib::RefPtr<DictField> not_null_get_field();
00315
00316 Glib::RefPtr<const DictField> not_null_get_field() const;
00317
00318
00319
00320
00321 public:
00322
00323 public:
00324
00325 #ifdef GLIBMM_VFUNCS_ENABLED
00326 #endif //GLIBMM_VFUNCS_ENABLED
00327
00328 protected:
00329
00330 #ifdef GLIBMM_VFUNCS_ENABLED
00331 #endif //GLIBMM_VFUNCS_ENABLED
00332
00333
00334 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00335 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00336
00337
00338 };
00339
00340 }
00341 }
00342
00343
00344 namespace Glib
00345 {
00351 Glib::RefPtr<Gnome::Gda::DictConstraint> wrap(GdaDictConstraint* object, bool take_copy = false);
00352 }
00353
00354
00355 #endif
00356