![]() | ![]() | ![]() | Libmergeant Reference Manual | ![]() |
---|
MgEntityMgEntity — Interface to represent a generic entity (for tables, views or queries) |
MgEntity; GType mg_entity_get_type (void); GSList* mg_entity_get_all_fields (MgEntity *iface); GSList* mg_entity_get_visible_fields (MgEntity *iface); MgField* mg_entity_get_field_by_name (MgEntity *iface, const gchar *name); MgField* mg_entity_get_field_by_xml_id (MgEntity *iface, const gchar *xml_id); MgField* mg_entity_get_field_by_index (MgEntity *iface, gint index); gint mg_entity_get_field_index (MgEntity *iface, MgField *field); void mg_entity_add_field (MgEntity *iface, MgField *field); void mg_entity_add_field_before (MgEntity *iface, MgField *field, MgField *field_before); void mg_entity_swap_fields (MgEntity *iface, MgField *field1, MgField *field2); void mg_entity_remove_field (MgEntity *iface, MgField *field); gboolean mg_entity_is_writable (MgEntity *iface); GSList* mg_entity_get_parameters (MgEntity *iface); MgContext* mg_entity_get_exec_context (MgEntity *iface);
"field-added" void user_function (MgEntity *mgentity, gpointer arg1, gpointer user_data); "field-removed" void user_function (MgEntity *mgentity, gpointer arg1, gpointer user_data); "field-updated" void user_function (MgEntity *mgentity, gpointer arg1, gpointer user_data); "fields-order-changed" void user_function (MgEntity *mgentity, gpointer user_data);
GSList* mg_entity_get_all_fields (MgEntity *iface);
Get a new list containing all the DbField objects held within the object implementing the MgEntity interface.
iface : | an object implementing the MgEntity interface |
Returns : | the new list. |
GSList* mg_entity_get_visible_fields (MgEntity *iface);
Same as mg_entity_get_all_fields() but returns only the visible fields, the ones which are not hidden (this makes sense only for queries, not for DBMS tables where there are no hidden fields).
The returned list nodes are in the order in which the fields are within the entity.
iface : | an object implementing the MgEntity interface |
Returns : | the new list. |
MgField* mg_entity_get_field_by_name (MgEntity *iface, const gchar *name);
Get a MgField using its name. The notion of "field name" is the string returned by mg_field_get_name() on each of the fields composing iface. However, if that definition does not return any field, then each particular implementation of iface may try to give an extra definition to the notion of "field name".
For instance, in the case of the MgQuery object, the mg_field_get_name() is used as a first try to find a field, and if that fails, then the object tries to find fields from their SQL naming.
In the case where there can be more than one field with the same name (depending on iface's implementation), then the returned value is NULL.
MgField* mg_entity_get_field_by_xml_id (MgEntity *iface, const gchar *xml_id);
iface : | an object implementing the MgEntity interface |
xml_id : | |
Returns : | the requested MgField |
MgField* mg_entity_get_field_by_index (MgEntity *iface, gint index);
iface : | an object implementing the MgEntity interface |
index : | |
Returns : | the requested MgField or NULL if the index is out of bounds |
gint mg_entity_get_field_index (MgEntity *iface, MgField *field);
Get the position of the field in the given entity. Positions start at 0. field MUST be a visible field.
void mg_entity_add_field (MgEntity *iface, MgField *field);
Add field to iface's fields (at the end of the list)
void mg_entity_add_field_before (MgEntity *iface, MgField *field, MgField *field_before);
Add field to iface's fields, before field_before if it is not NULL, or at the end if field_before is NULL.
void mg_entity_swap_fields (MgEntity *iface, MgField *field1, MgField *field2);
gboolean mg_entity_is_writable (MgEntity *iface);
Tells if the real entity (the corresponding DBMS object) represented by iface can be written to.
iface : | an object implementing the MgEntity interface |
Returns : | TRUE if it is possible to write to iface |
GSList* mg_entity_get_parameters (MgEntity *iface);
Get a list of parameters required before iface can be used. Usualy this function is used with queries to grab the required parameters before executing a query.
iface : | an object implementing the MgEntity interface |
Returns : | a new list of MgParameter objects. iface DOES NOT hold any reference to any of the listed parameter. |
void user_function (MgEntity *mgentity, gpointer arg1, gpointer user_data);
mgentity : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
void user_function (MgEntity *mgentity, gpointer arg1, gpointer user_data);
mgentity : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
void user_function (MgEntity *mgentity, gpointer arg1, gpointer user_data);
mgentity : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
void user_function (MgEntity *mgentity, gpointer user_data);
mgentity : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
<< MgDataEntry | MgField >> |