## MgTarget

MgTarget — Represents a target entity within a query.

## Synopsis

    struct      MgTarget;
    guint       mg_target_get_type              (void);
    GObject*    mg_target_new_with_entity       (MgQuery *query,
                                                 MgEntity *entity);
    GObject*    mg_target_new_with_xml_id       (MgQuery *query,
                                                 const gchar *entity_xml_id);
    GObject*    mg_target_new_copy              (MgTarget *orig);
    MgQuery*    mg_target_get_query             (MgTarget *target);
    MgEntity*   mg_target_get_represented_entity
                                                (MgTarget *target);
    void        mg_target_set_alias             (MgTarget *target,
                                                 const gchar *alias);
    const gchar* mg_target_get_alias            (MgTarget *target);

## Object Hierarchy

      GObject
       +----MgBase
             +----MgTarget

## Implemented Interfaces

MgTarget implements MgXmlStorage, MgRenderer and MgReferer.

## Properties

      "prop"                 gpointer             : Read / Write

## Description

A MgTarget object represents an entity (usually a table, as a MgDbTable) which is taking part in a query. For SELECT queries, the targets are the entities listed after the FROM clause; for the INSERT, DELETE and UPDATE queries, there is only one target which is the entity to which the modifications apply.

Within a single SELECT query, there can be more than one MgTarget object representing the same entity for queries making usage of an entity more than one time.

It implements the MgXmlStorage, MgReferer and MgRenderer interfaces.

## Details

### struct MgTarget

    struct MgTarget;

### mg_target_get_type ()

    guint       mg_target_get_type              (void);

Returns : |

### mg_target_new_with_entity ()

    GObject*    mg_target_new_with_entity       (MgQuery *query,
                                                 MgEntity *entity);

Creates a new MgTarget object, specifying the MgEntity to represent

`query` : | a MgQuery object
`entity` : | an object implementing the MgEntity interface
Returns : | the new object

### mg_target_new_with_xml_id ()

    GObject*    mg_target_new_with_xml_id       (MgQuery *query,
                                                 const gchar *entity_xml_id);

Creates a new MgTarget object, specifying the XML id of the MgEntity to represent

`query` : | a MgQuery object
`entity_xml_id` : | the XML Id of an object implementing the MgEntity interface
Returns : | the new object

### mg_target_new_copy ()

    GObject*    mg_target_new_copy              (MgTarget *orig);

Makes a copy of an existing object (copy constructor)

`orig` : | a MgTarget object to copy
Returns : | the new object

### mg_target_get_query ()

    MgQuery*    mg_target_get_query             (MgTarget *target);

Get the MgQuery in which `target` is

`target` : | a MgTarget object
Returns : | the MgQuery object

### mg_target_get_represented_entity ()

    MgEntity*   mg_target_get_represented_entity
                                                (MgTarget *target);

Get the MgEntity object which is represented by `target`

`target` : | a MgTarget object
Returns : | the MgEntity object or NULL if `target` is not active

### mg_target_set_alias ()

    void        mg_target_set_alias             (MgTarget *target,
                                                 const gchar *alias);

Sets `target`'s alias to `alias`

`target` : | a MgTarget object
`alias` : | the alias

### mg_target_get_alias ()

    const gchar* mg_target_get_alias            (MgTarget *target);

Get `target`'s alias

`target` : | a MgTarget object
Returns : | the alias

## Properties

"`prop`" (gpointer : Read / Write) |