GdaQuery

## GdaQuery GdaQuery — Represents any kind of DML query |

## Synopsis

                GdaQuery;
    enum        GdaQueryType;
    GObject*    gda_query_new                   (GdaDict *dict);
    GObject*    gda_query_new_copy              (GdaQuery *orig,
                                                 GHashTable *replacements);
    GObject*    gda_query_new_from_sql          (GdaDict *dict,
                                                 const gchar *sql,
                                                 GError **error);
    void        gda_query_declare_condition     (GdaQuery *query,
                                                 GdaQueryCondition *cond);
    void        gda_query_undeclare_condition   (GdaQuery *query,
                                                 GdaQueryCondition *cond);
    void        gda_query_set_query_type        (GdaQuery *query,
                                                 GdaQueryType type);
    GdaQueryType gda_query_get_query_type       (GdaQuery *query);
    const gchar* gda_query_get_query_type_string
                                                (GdaQuery *query);
    gboolean    gda_query_is_select_query       (GdaQuery *query);
    gboolean    gda_query_is_insert_query       (GdaQuery *query);
    gboolean    gda_query_is_update_query       (GdaQuery *query);
    gboolean    gda_query_is_delete_query       (GdaQuery *query);
    gboolean    gda_query_is_modif_query        (GdaQuery *query);
    void        gda_query_set_sql_text          (GdaQuery *query,
                                                 const gchar *sql,
                                                 GError **error);
    const gchar* gda_query_get_sql_text         (GdaQuery *query);
    GdaQuery*   gda_query_get_parent_query      (GdaQuery *query);
    GdaQueryField* gda_query_get_field_by_ref_field
                                                (GdaQuery *query,
                                                 GdaQueryTarget *target,
                                                 GdaEntityField *ref_field,
                                                 GdaEntityFieldState field_state);
    GdaQueryField* gda_query_get_first_field_for_target
                                                (GdaQuery *query,
                                                 GdaQueryTarget *target);
    GSList*     gda_query_get_sub_queries       (GdaQuery *query);
    void        gda_query_add_param_source      (GdaQuery *query,
                                                 GdaDataModel *param_source);
    void        gda_query_del_param_source      (GdaQuery *query,
                                                 GdaDataModel *param_source);
    const GSList* gda_query_get_param_sources   (GdaQuery *query);
    void        gda_query_add_sub_query         (GdaQuery *query,
                                                 GdaQuery *sub_query);
    void        gda_query_del_sub_query         (GdaQuery *query,
                                                 GdaQuery *sub_query);
    GSList*     gda_query_get_targets           (GdaQuery *query);
    gboolean    gda_query_add_target            (GdaQuery *query,
                                                 GdaQueryTarget *target,
                                                 GError **error);
    void        gda_query_del_target            (GdaQuery *query,
                                                 GdaQueryTarget *target);
    GdaQueryTarget* gda_query_get_target_by_xml_id
                                                (GdaQuery *query,
                                                 const gchar *xml_id);
    GdaQueryTarget* gda_query_get_target_by_alias
                                                (GdaQuery *query,
                                                 const gchar *alias_or_name);
    GSList*     gda_query_get_target_pkfields   (GdaQuery *query,
                                                 GdaQueryTarget *target);
    GSList*     gda_query_get_joins             (GdaQuery *query);
    GdaQueryJoin* gda_query_get_join_by_targets (GdaQuery *query,
                                                 GdaQueryTarget *target1,
                                                 GdaQueryTarget *target2);
    gboolean    gda_query_add_join              (GdaQuery *query,
                                                 GdaQueryJoin *join);
    void        gda_query_del_join              (GdaQuery *query,
                                                 GdaQueryJoin *join);
    GdaQueryCondition* gda_query_get_condition  (GdaQuery *query);
    void        gda_query_set_condition         (GdaQuery *query,
                                                 GdaQueryCondition *cond);
    GdaQueryField* gda_query_add_field_from_sql (GdaQuery *query,
                                                 const gchar *field,
                                                 GError **error);
    void        gda_query_set_order_by_field    (GdaQuery *query,
                                                 GdaQueryField *field,
                                                 gint order,
                                                 gboolean ascendant);
    gint        gda_query_get_order_by_field    (GdaQuery *query,
                                                 GdaQueryField *field,
                                                 gboolean *ascendant);
    GSList*     gda_query_get_all_fields        (GdaQuery *query);
    GdaQueryField* gda_query_get_field_by_sql_naming
                                                (GdaQuery *query,
                                                 const gchar *sql_naming);
    GdaQueryField* gda_query_get_field_by_sql_naming_fields
                                                (GdaQuery *query,
                                                 const gchar *sql_name,
                                                 GSList *fields_list);
    GSList*     gda_query_get_fields_by_target  (GdaQuery *query,
                                                 GdaQueryTarget *target,
                                                 gboolean visible_fields_only);
    GSList*     gda_query_get_main_conditions   (GdaQuery *query);
    void        gda_query_append_condition      (GdaQuery *query,
                                                 GdaQueryCondition *cond,
                                                 gboolean append_as_and);
    GSList*     gda_query_expand_all_field      (GdaQuery *query,
                                                 GdaQueryTarget *target);
    void        gda_query_order_fields_using_join_conds
                                                (GdaQuery *query);

## Object Hierarchy

      GObject
       +----GdaObject
             +----GdaQueryObject
                   +----GdaQuery

## Implemented Interfaces

GdaQuery implements GdaXmlStorage, GdaReferer, GdaEntity and GdaRenderer.

## Properties

      "auto-clean"           gboolean              : Read / Write
      "cond-serial"          guint                 : Read
      "field-serial"         guint                 : Read
      "really-all-fields"    gpointer              : Read
      "target-serial"        guint                 : Read

## Signal Prototypes

    "condition-changed"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer user_data);
    "join-added"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);
    "join-removed"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);
    "join-updated"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);
    "sub-query-added"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);
    "sub-query-removed"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);
    "sub-query-updated"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);
    "target-added"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);
    "target-removed"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);
    "target-updated"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);
    "type-changed"
                void        user_function      (GdaQuery *gdaquery,
                                                gpointer user_data);

## Description

Any query (which can be of any type, see the GdaQueryType enum) can be represented by a GdaQuery object. Also a query may require some parameters to be provided before in can be executed; each parameter is then represented by a GdaParameter object, and parameters required for a query are organised within a GdaParameterList object.

It implements the GdaEntity, GdaXmlStorage, GdaReferer and GdaRenderer interfaces.

## Details

### GdaQuery

    typedef struct _GdaQuery GdaQuery;

### enum GdaQueryType

    typedef enum {
            GDA_QUERY_TYPE_SELECT,
    	GDA_QUERY_TYPE_INSERT,
    	GDA_QUERY_TYPE_UPDATE,
    	GDA_QUERY_TYPE_DELETE,
            GDA_QUERY_TYPE_UNION,
            GDA_QUERY_TYPE_INTERSECT,
    	GDA_QUERY_TYPE_EXCEPT,
            GDA_QUERY_TYPE_NON_PARSED_SQL
    } GdaQueryType;

### gda_query_new ()

    GObject*    gda_query_new                   (GdaDict *dict);

Creates a new GdaQuery object

`dict` : | a GdaDict object
Returns : | the new object

### gda_query_new_copy ()

    GObject*    gda_query_new_copy              (GdaQuery *orig,
                                                 GHashTable *replacements);

Copy constructor

`orig` : | a GdaQuery to make a copy of
`replacements` : | a hash table to store replacements, or `NULL`
Returns : | a the new copy of `orig`

### gda_query_new_from_sql ()

    GObject*    gda_query_new_from_sql          (GdaDict *dict,
                                                 const gchar *sql,
                                                 GError **error);

Creates a new GdaQuery object and fills its structure by parsing the `sql`. If the parsing failed, then the returned query is of type GDA_QUERY_TYPE_NON_PARSED_SQL.

To be parsed successfully, the expected SQL must respect the SQL standard; some extensions have been added to be able to define variables within the SQL statement. See the introduction to the GdaQuery for more information.

The `error` is set only if the SQL statement parsing produced an error; there is always a new GdaQuery object which is returned.

`dict` : | a GdaDict object
`sql` : | an SQL statement
`error` : | location to store error, or `NULL`
Returns : | a new GdaQuery

### gda_query_declare_condition ()

    void        gda_query_declare_condition     (GdaQuery *query,
                                                 GdaQueryCondition *cond);

Declares the existence of a new condition to `query`. All the GdaQueryCondition objects MUST be declared to the corresponding GdaQuery object for the library to work correctly. Once `cond` has been declared, `query` does not hold any reference to `cond`.

This functions is called automatically from each gda_query_condition_new* function, and it should not be necessary to call it except for classes extending the GdaQueryCondition class.

`query` : | a GdaQuery object
`cond` : | a GdaQueryCondition object

### gda_query_undeclare_condition ()

    void        gda_query_undeclare_condition   (GdaQuery *query,
                                                 GdaQueryCondition *cond);

Explicitely ask `query` to forget about the existence of `cond`. This function is used by the GdaQueryCondition implementation, and should not be called directly

`query` : | a GdaQuery object
`cond` : | a GdaQueryCondition object

### gda_query_set_query_type ()

    void        gda_query_set_query_type        (GdaQuery *query,
                                                 GdaQueryType type);

Sets the type of `query`

`query` : | a GdaQuery object
`type` : | the new type of query

### gda_query_get_query_type ()

    GdaQueryType gda_query_get_query_type       (GdaQuery *query);

Get the type of a query

`query` : | a GdaQuery object
Returns : | the type of `query`

### gda_query_get_query_type_string ()

    const gchar* gda_query_get_query_type_string
                                                (GdaQuery *query);

Get the type of a query as a human readable string

`query` : | a GdaQuery object
Returns : | a string for the type of `query`

### gda_query_is_select_query ()

    gboolean    gda_query_is_select_query       (GdaQuery *query);

Tells if `query` is a SELECTION query (a simple SELECT, UNION, INTERSECT or EXCEPT);

`query` : | a # GdaQuery object
Returns : | TRUE if `query` is a selection query

### gda_query_is_insert_query ()

    gboolean    gda_query_is_insert_query       (GdaQuery *query);

Tells if `query` is a INSERT query.

`query` : | a # GdaQuery object
Returns : | TRUE if `query` is an insertion query

### gda_query_is_update_query ()

    gboolean    gda_query_is_update_query       (GdaQuery *query);

Tells if `query` is a UPDATE query.

`query` : | a # GdaQuery object
Returns : | TRUE if `query` is an update query

### gda_query_is_delete_query ()

    gboolean    gda_query_is_delete_query       (GdaQuery *query);

Tells if `query` is a DELETE query.

`query` : | a # GdaQuery object
Returns : | TRUE if `query` is an delete query

### gda_query_is_modif_query ()

    gboolean    gda_query_is_modif_query        (GdaQuery *query);

Tells if `query` is a modification query (a simple UPDATE, DELETE, INSERT).; pure SQL queries are not handled and will always return FALSE.

`query` : | a # GdaQuery object
Returns : | TRUE if `query` is a modification query

### gda_query_set_sql_text ()

    void        gda_query_set_sql_text          (GdaQuery *query,
                                                 const gchar *sql,
                                                 GError **error);

Defines `query`'s contents from an SQL statement. The SQL text is parsed and the internal query structured is built from that; the query type is also set. If the SQL text cannot be parsed, then the internal structure of the query is emptied and the query type is set to GDA_QUERY_TYPE_NON_PARSED_SQL.

To be parsed successfully, the expected SQL must respect the SQL standard; some extensions have been added to be able to define variables within the SQL statement. See the introduction to the GdaQuery for more information.

`query` : | a # GdaQuery object
`sql` : | the SQL statement
`error` : | location to store parsing error, or `NULL`

### gda_query_get_sql_text ()

    const gchar* gda_query_get_sql_text         (GdaQuery *query);

Obtain a new string representing the SQL version of the query.

WARNING: the returned SQL statement may contain some extensions which allow for the definition of variables (see the introduction to the GdaQuery for more information). As such the returned SQL cannot be executed as it may provoque errors. To get an executable statement, use the GdaRenderer interface's methods.

`query` : | a GdaQuery object
Returns : | the new string

### gda_query_get_parent_query ()

    GdaQuery*   gda_query_get_parent_query      (GdaQuery *query);

Get the parent query of `query`

`query` : | a GdaQuery object
Returns : | the parent query, or NULL if `query` does not have any parent

### gda_query_get_field_by_ref_field ()

    GdaQueryField* gda_query_get_field_by_ref_field
                                                (GdaQuery *query,
                                                 GdaQueryTarget *target,
                                                 GdaEntityField *ref_field,
                                                 GdaEntityFieldState field_state);

Finds the first GdaQueryField object in `query` which represents `ref_field`. The returned object will be a GdaQueryFieldField object which represents `ref_field`.

If `target` is specified, then the returned field will be linked to that GdaQueryTarget object.

`query` : | a GdaQuery object
`target` : | a GdaQueryTarget, or `NULL`
`ref_field` : | a GdaEntityField object
`field_state` : | tells about the status of the requested field
Returns : | a GdaQueryFieldField object or `NULL`

### gda_query_get_first_field_for_target ()

    GdaQueryField* gda_query_get_first_field_for_target
                                                (GdaQuery *query,
                                                 GdaQueryTarget *target);

Finds the first occurence of a GdaQueryFieldField object whose target is `target` in `query`

`query` : | a GdaQuery object
`target` : |
Returns : | the requested field, or `NULL`

### gda_query_get_sub_queries ()

    GSList*     gda_query_get_sub_queries       (GdaQuery *query);

Get a list of all the sub-queries managed by `query`

`query` : | a GdaQuery object
Returns : | a new list of the sub-queries

### gda_query_add_param_source ()

    void        gda_query_add_param_source      (GdaQuery *query,
                                                 GdaDataModel *param_source);

Tells `query` that `param_source` is a query which potentially will constraint the possible values of one or more of `query`'s parameters. This implies that `query` keeps a reference on `param_source`.

`query` : | a GdaQuery object
`param_source` : | a GdaDataModel object

### gda_query_del_param_source ()

    void        gda_query_del_param_source      (GdaQuery *query,
                                                 GdaDataModel *param_source);

Tells `query` that it should no longer take care of `param_source`. The parameters which depend on `param_source` will still depend on it, though.

`query` : | a GdaQuery object
`param_source` : | a GdaDataModel object

### gda_query_get_param_sources ()

    const GSList* gda_query_get_param_sources   (GdaQuery *query);

Get a list of the parameter source queries that are references as such by `query`.

`query` : | a GdaQuery object
Returns : | the list of GdaQuery objects

### gda_query_add_sub_query ()

    void        gda_query_add_sub_query         (GdaQuery *query,
                                                 GdaQuery *sub_query);

Add `sub_query` to `query`. Sub queries are managed by their parent query, and as such they are destroyed when their parent query is destroyed.

`query` : | a GdaQuery object
`sub_query` : | a GdaQuery object

### gda_query_del_sub_query ()

    void        gda_query_del_sub_query         (GdaQuery *query,
                                                 GdaQuery *sub_query);

Removes `sub_query` from `query`. `sub_query` MUST be present within `query`.

`query` : | a GdaQuery object
`sub_query` : | a GdaQuery object

### gda_query_get_targets ()

    GSList*     gda_query_get_targets           (GdaQuery *query);

Get a list of all the targets used in `query`

`query` : | a GdaQuery object
Returns : | a new list of the targets

### gda_query_add_target ()

    gboolean    gda_query_add_target            (GdaQuery *query,
                                                 GdaQueryTarget *target,
                                                 GError **error);

Adds a target to `query`. A target represents a entity (it can actually be a table, a view, or another query) which `query` will use.

For a SELECT query, the targets appear after the FROM clause. The targets can be joined two by two using GdaQueryJoin objects

For UPDATE, DELETE or INSERT queries, there can be only ONE GdaQueryTarget object which is the one where the data modifications are performed.

For UNION and INTERSECT queries, there is no possible GdaQueryTarget object.

`query` : | a GdaQuery object
`target` : | a GdaQueryTarget to add to `query`
`error` : | location to store error, or `NULL`
Returns : | TRUE if no error occurred

### gda_query_del_target ()

    void        gda_query_del_target            (GdaQuery *query,
                                                 GdaQueryTarget *target);

Removes `target` from `query`. `target` MUST be present within `query`. Warning: All the joins and fields which depended on `target` are also removed.

`query` : | a GdaQuery object
`target` : | a GdaQueryTarget object

### gda_query_get_target_by_xml_id ()

    GdaQueryTarget* gda_query_get_target_by_xml_id
                                                (GdaQuery *query,
                                                 const gchar *xml_id);

Get a pointer to a GdaQueryTarget (which must be within `query`) using its XML Id

`query` : | a GdaQuery object
`xml_id` : | the XML Id of the requested GdaQueryTarget object
Returns : | the GdaQueryTarget object, or NULL if not found

### gda_query_get_target_by_alias ()

    GdaQueryTarget* gda_query_get_target_by_alias
                                                (GdaQuery *query,
                                                 const gchar *alias_or_name);

Get a pointer to a GdaQueryTarget (which must be within `query`) using its alias (if not found then `alias_or_name` is interpreted as the target name)

`query` : | a GdaQuery object
`alias_or_name` : | the alias or name
Returns : | the GdaQueryTarget object, or NULL if not found

### gda_query_get_target_pkfields ()

    GSList*     gda_query_get_target_pkfields   (GdaQuery *query,
                                                 GdaQueryTarget *target);

Makes a list of the GdaQueryField objects which represent primary key fields of the entity represented by `target`.

If the entity represented by `target` does not have any primary key, or if the primary key's fields are not present in `query`, then the returned value is `NULL`.

`query` : | a GdaQuery object
`target` : | a GdaQueryTarget object
Returns : | a new GSList, or `NULL`.

### gda_query_get_joins ()

    GSList*     gda_query_get_joins             (GdaQuery *query);

Get a list of all the joins used in `query`

`query` : | a GdaQuery object
Returns : | a new list of the joins

### gda_query_get_join_by_targets ()

    GdaQueryJoin* gda_query_get_join_by_targets (GdaQuery *query,
                                                 GdaQueryTarget *target1,
                                                 GdaQueryTarget *target2);

Find a join in `query` which joins the `target1` and `target2` targets

`query` : | a GdaQuery object
`target1` : | a GdaQueryTarget object
`target2` : | a GdaQueryTarget object
Returns : | the GdaQueryJoin object, or `NULL`

### gda_query_add_join ()

    gboolean    gda_query_add_join              (GdaQuery *query,
                                                 GdaQueryJoin *join);

Add a join to `query`. A join is defined by the two GdaQueryTarget objects it joins and by a join condition which MUST ONLY make use of fields of the two entities represented by the targets.

For any given couple of GdaQueryTarget objects, there can exist ONLY ONE GdaQueryJoin which joins the two.

`query` : | a GdaQuery object
`join` : | a GdaQueryJoin object
Returns : | TRUE on success, and FALSE otherwise

### gda_query_del_join ()

    void        gda_query_del_join              (GdaQuery *query,
                                                 GdaQueryJoin *join);

Removes `join` from `query`. `join` MUST be present within `query`.

`query` : | a GdaQuery object
`join` : | a GdaQueryJoin object

### gda_query_get_condition ()

    GdaQueryCondition* gda_query_get_condition  (GdaQuery *query);

Get the query's associated condition

`query` : | a GdaQuery object
Returns : | the GdaQueryCondition object

### gda_query_set_condition ()

    void        gda_query_set_condition         (GdaQuery *query,
                                                 GdaQueryCondition *cond);

Sets the query's associated condition; if there was already a query condition, then the old one is trashed first.

Pass `NULL` as the `cond` argument to remove any query condition

`query` : | a GdaQuery object
`cond` : | a GdaQueryCondition object, or `NULL` to remove condition

### gda_query_add_field_from_sql ()

    GdaQueryField* gda_query_add_field_from_sql (GdaQuery *query,
                                                 const gchar *field,
                                                 GError **error);

Parses `field` and if it represents a valid SQL expression for a field, then add it to `query`.

`query` : | a GdaQuery object
`field` : | a SQL expression
`error` : | place to store the error, or `NULL`
Returns : | a new GdaQueryField object, or `NULL`

### gda_query_set_order_by_field ()

    void        gda_query_set_order_by_field    (GdaQuery *query,
                                                 GdaQueryField *field,
                                                 gint order,
                                                 gboolean ascendant);

Sets `field` to be used in the ORDER BY clause (using the `order` and `ascendant` attributes) if `order` >= 0. If `order` < 0, then `field` will not be used in the ORDER BY clause.

`query` : | a GdaQuery
`field` : | a GdaQueryField which is in `query`
`order` : | the order in the list of ORDER BY fields (starts at 0), or -1
`ascendant` : | TRUE to sort ascending

### gda_query_get_order_by_field ()

    gint        gda_query_get_order_by_field    (GdaQuery *query,
                                                 GdaQueryField *field,
                                                 gboolean *ascendant);

Tells if `field` (which MUST be in `query`) is part of the ORDER BY clause.

`query` : | a GdaQuery
`field` : | a GdaQueryField which is in `query`
`ascendant` : | if not `NULL`, will be set TRUE if ascendant sorting and FALSE otherwise
Returns : | -1 if no, and the order where it appears in the ORDER BY list otherwise

### gda_query_get_all_fields ()

    GSList*     gda_query_get_all_fields        (GdaQuery *query);

Fetch a list of all the fields of `query`: the ones which are visible, and the ones which are not visible and are not internal query fields.

`query` : | a GdaQuery object
Returns : | a new list of fields

### gda_query_get_field_by_sql_naming ()

    GdaQueryField* gda_query_get_field_by_sql_naming
                                                (GdaQuery *query,
                                                 const gchar *sql_naming);

`query` : | a GdaQuery object
`sql_naming` : |
Returns : |

### gda_query_get_field_by_sql_naming_fields ()

    GdaQueryField* gda_query_get_field_by_sql_naming_fields
                                                (GdaQuery *query,
                                                 const gchar *sql_name,
                                                 GSList *fields_list);

`query` : | a GdaQuery object
`sql_name` : | the SQL naming for the requested field
`fields_list` : | an explicit list of fields to search into
Returns : |

### gda_query_get_fields_by_target ()

    GSList*     gda_query_get_fields_by_target  (GdaQuery *query,
                                                 GdaQueryTarget *target,
                                                 gboolean visible_fields_only);

Get a list of all the GdaQueryField objects in `query` which depent on the existance of `target`.

`query` : | a GdaQuery object
`target` : | a GdaQueryTarget object representing a target in `query`
`visible_fields_only` : |
Returns : | a new list of GdaQueryField objects

### gda_query_get_main_conditions ()

    GSList*     gda_query_get_main_conditions   (GdaQuery *query);

Makes a list of all the conditions (part of the WHERE clause) which are always verified by `query` when it is executed.

Examples: if the WHERE clause is: --> "A and B" then the list will contains {A, B} --> "A and (B or C)" it will contain {A, B or C} --> "A and (B and not C)", it will contain {A, B, not C}

`query` : | a GdaQuery object
Returns : | a new list of GdaQueryCondition objects

### gda_query_append_condition ()

    void        gda_query_append_condition      (GdaQuery *query,
                                                 GdaQueryCondition *cond,
                                                 gboolean append_as_and);

Appends the `cond` object to `query`'s condition. If `query` does not yet have any condition, then the result is the same as `gda_query_set_condition()`; otherwise, `cond` is added to `query`'s condition, using the AND operator if `append_as_and` is TRUE, and an OR operator if `append_as_and` is FALSE.

`query` : | a GdaQuery object
`cond` : | a GdaQueryCondition object
`append_as_and` : | mode of append if there is already a query condition

### gda_query_expand_all_field ()

    GSList*     gda_query_expand_all_field      (GdaQuery *query,
                                                 GdaQueryTarget *target);

Converts each visible "target.*" (GdaQueryFieldAll) field into its list of fields. For example "t1.*" becomes "t1.a, t1.b" if table t1 is composed of fields "a" and "b". The original GdaQueryFieldAll field is not removed, but simply rendered non visible.

The returned list must be free'd by the caller using `g_slist_free()`.

`query` : | a GdaQuery object
`target` : | a GdaQueryTarget, or `NULL`
Returns : | a new list of the GdaQueryField objects which have been created

### gda_query_order_fields_using_join_conds ()

    void        gda_query_order_fields_using_join_conds
                                                (GdaQuery *query);

Re-orders the fields in `query` using the joins' conditions: for each join condition, the used query fields are grouped together near the 1st visible field.

`query` : | a GdaQuery object

## Properties

### The "`auto-clean`" property

      "auto-clean"           gboolean              : Read / Write

Determines if the query tries to clean unused objects.

Default value: TRUE

### The "`cond-serial`" property

      "cond-serial"          guint                 : Read

Allowed values: >= 1

Default value: 1

### The "`field-serial`" property

      "field-serial"         guint                 : Read

Allowed values: >= 1

Default value: 1

### The "`really-all-fields`" property

      "really-all-fields"    gpointer              : Read

### The "`target-serial`" property

      "target-serial"        guint                 : Read

Allowed values: >= 1

Default value: 1

## Signals

### The "condition-changed" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The "join-added" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "join-removed" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "join-updated" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "sub-query-added" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "sub-query-removed" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "sub-query-updated" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "target-added" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "target-removed" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "target-updated" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer arg1,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

### The "type-changed" signal

    void        user_function                  (GdaQuery *gdaquery,
                                                gpointer user_data);

`dbquery` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.