GdaDataModelQuery

## GdaDataModelQuery GdaDataModelQuery — An implementation of GdaDataModel based on a SELECT query |

## Synopsis

                GdaDataModelQuery;
                GdaDataModelQueryClass;
                GdaDataModelQueryPrivate;
    GdaDataModel* gda_data_model_query_new      (GdaQuery *query);
    GdaParameterList* gda_data_model_query_get_param_list
                                                (GdaDataModelQuery *model);
    gboolean    gda_data_model_query_refresh    (GdaDataModelQuery *model,
                                                 GError **error);
    gboolean    gda_data_model_query_set_modification_query
                                                (GdaDataModelQuery *model,
                                                 const gchar *query,
                                                 GError **error);

## Object Hierarchy

      GObject
       +----GdaObject
             +----GdaDataModelQuery

## Implemented Interfaces

GdaDataModelQuery implements GdaDataModel.

## Properties

      "delete-query"         gpointer              : Read / Write
      "insert-query"         gpointer              : Read / Write
      "query"                gpointer              : Read / Write / Construct Only
      "update-query"         gpointer              : Read / Write

## Description

The GdaDataModelQuery data model simply stores the values returned by a SELECT query. The connection used to execute the SELECT query (given when the object is constructed) is the same as the one provided th the GdaDict object to which the query relates.

## Details

### GdaDataModelQuery

    typedef struct _GdaDataModelQuery GdaDataModelQuery;

### GdaDataModelQueryClass

    typedef struct {
    	GdaObjectClass             parent_class;
    } GdaDataModelQueryClass;

### GdaDataModelQueryPrivate

    typedef struct _GdaDataModelQueryPrivate GdaDataModelQueryPrivate;

### gda_data_model_query_new ()

    GdaDataModel* gda_data_model_query_new      (GdaQuery *query);

Creates a new GdaDataModel object using the data returned by the execution of the `query` SELECT query.

`query` : | a SELECT query
Returns : | a pointer to the newly created GdaDataModel.

### gda_data_model_query_get_param_list ()

    GdaParameterList* gda_data_model_query_get_param_list
                                                (GdaDataModelQuery *model);

If some parameters are required to execute the SELECT query used in the `model` data model, then creates a new GdaParameterList; otherwise does nothing and returns `NULL`.

`model` : | a GdaDataModelQuery data model
Returns : | a new GdaParameterList object, or `NULL`

### gda_data_model_query_refresh ()

    gboolean    gda_data_model_query_refresh    (GdaDataModelQuery *model,
                                                 GError **error);

(Re)-runs the SELECT query to update the contents of `model`

`model` : | a GdaDataModelQuery data model
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occured

### gda_data_model_query_set_modification_query ()

    gboolean    gda_data_model_query_set_modification_query
                                                (GdaDataModelQuery *model,
                                                 const gchar *query,
                                                 GError **error);

Sets the modification query to be used by `model` to actually perform any change to the dataset in the database.

The provided query (the `query` SQL) must be either a INSERT, UPDATE or DELETE query. It can contain parameters, and the parameters named '_<num>' will be replaced with the value of the <num>th column in `model`'s data set when run.

`model` : | a GdaDataModelQuery data model
`query` : | the SQL code for a query
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occured.

## Properties

### The "`delete-query`" property

      "delete-query"         gpointer              : Read / Write

DELETE Query to be executed to remove data.

### The "`insert-query`" property

      "insert-query"         gpointer              : Read / Write

INSERT Query to be executed to add data.

### The "`query`" property

      "query"                gpointer              : Read / Write / Construct Only

SELECT Query to be executed to populate the model with data.

### The "`update-query`" property

      "update-query"         gpointer              : Read / Write

UPDATE Query to be executed to update data.