![]() | ![]() | ![]() | Libmergeant Reference Manual | ![]() |
---|
MgDbTable — Represents a table or a view in the database
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);
Use this object to query the real structure of the table it represents.
It implements the MgXmlStorage and MgEntity interfaces.
GObject* mg_db_table_new (MgConf *conf);
Creates a new MgDbTable object
conf : | a MgConf object |
Returns : | the new object |
MgDatabase* mg_db_table_get_database (MgDbTable *table);
Get the database to which the table belongs
table : | a MgDbTable object |
Returns : | a MgDatabase pointer |
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 |
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).
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 |
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. |
MgConf* mg_db_table_get_conf (MgDbTable *table);
Get the MgConf to which the table is associated
<< MgDatabase | MgDbField >> |