MgDbTable

Name

MgDbTable -- Represents a table or a view in the database

Synopsis



#define     MG_DB_TABLE_TYPE
#define     MG_DB_TABLE                     (obj)
#define     IS_MG_DB_TABLE                  (obj)
#define     MG_DB_TABLE_CLASS               (klass)
struct      MgDbTable;
guint       mg_db_table_get_type            (void);
GObject*    mg_db_table_new                 (MgConf *conf);
MgDatabase* mg_db_table_get_database        (MgDbTable *table);
gboolean    mg_db_table_is_view             (MgDbTable *table);
const GSList* mg_db_table_get_parents       (MgDbTable *table);
GSList*     mg_db_table_get_constraints     (MgDbTable *table);
MgDbConstraint* mg_db_table_get_pk_constraint
                                            (MgDbTable *table);
MgConf*     mg_db_table_get_conf            (MgDbTable *table);
gboolean    mg_db_table_update_dbms_data    (MgDbTable *table,
                                             GError **error);

Object Hierarchy


  GObject
   +----MgBase
         +----MgDbTable

Implemented Interfaces

MgDbTable implements MgXmlStorage and MgEntity.

Properties


  "database"             gpointer             : Read / Write

Signal Prototypes


"templ-signal"
            void        user_function      (MgDbTable *mgdbtable,
                                            gpointer user_data);

Description

Use this object to query the real structure of the table it represents.

It implements the MgXmlStorage and MgEntity interfaces.

Details

MG_DB_TABLE_TYPE

#define MG_DB_TABLE_TYPE          (mg_db_table_get_type())


MG_DB_TABLE()

#define MG_DB_TABLE(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, mg_db_table_get_type(), MgDbTable)

obj :


IS_MG_DB_TABLE()

#define IS_MG_DB_TABLE(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, mg_db_table_get_type ())

obj :


MG_DB_TABLE_CLASS()

#define MG_DB_TABLE_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, mg_db_table_get_type (), MgDbTableClass)

klass :


struct MgDbTable

struct MgDbTable;


mg_db_table_get_type ()

guint       mg_db_table_get_type            (void);

Returns :


mg_db_table_new ()

GObject*    mg_db_table_new                 (MgConf *conf);

Creates a new MgDbTable object

conf :

a MgConf object

Returns :

the new object


mg_db_table_get_database ()

MgDatabase* mg_db_table_get_database        (MgDbTable *table);

Get the database to which the table belongs

table :

a MgDbTable object

Returns :

a MgDatabase pointer


mg_db_table_is_view ()

gboolean    mg_db_table_is_view             (MgDbTable *table);

Does the object represent a view rather than a table?

table :

a MgDbTable object

Returns :

TRUE if it is a view


mg_db_table_get_parents ()

const GSList* mg_db_table_get_parents       (MgDbTable *table);

Get the parent tables of the table given as argument. This is significant only for DBMS which support tables inheritance (like PostgreSQL for example).

table :

a MgDbTable object

Returns :

a constant list of MgDbTable objects


mg_db_table_get_constraints ()

GSList*     mg_db_table_get_constraints     (MgDbTable *table);

Get all the constraints which apply to the given table (each constraint can represent a NOT NULL, a primary key or foreign key or a check constraint.

table :

a MgDbTable object

Returns :

a new list of MgDbConstraint objects


mg_db_table_get_pk_constraint ()

MgDbConstraint* mg_db_table_get_pk_constraint
                                            (MgDbTable *table);

Get the primary key constraint of table, if there is any. If several MgDbConstraint represent a primary key constraint for table, then the first one in the list of constraints is returned.

table :

a MgDbTable object

Returns :

a MgDbConstraint object or NULL.


mg_db_table_get_conf ()

MgConf*     mg_db_table_get_conf            (MgDbTable *table);

Get the MgConf to which the table is associated

table :

a MgDbTable object

Returns :

the MgConf object


mg_db_table_update_dbms_data ()

gboolean    mg_db_table_update_dbms_data    (MgDbTable *table,
                                             GError **error);

table :

error :

Returns :

Properties

"database" (gpointer : Read / Write)

Signals

The "templ-signal" signal

void        user_function                  (MgDbTable *mgdbtable,
                                            gpointer user_data);

mgdbtable :

the object which received the signal.

user_data :

user data set when the signal handler was connected.