## MgResultSet

MgResultSet — Encapsulates a result set returned by the execution of a SELECT statement

## Synopsis

    struct      MgResultSet;
    guint       mg_resultset_get_type           (void);
    GObject*    mg_resultset_new                (MgServer *srv,
                                                 GdaCommand *cmd,
                                                 GdaDataModel *model);
    gint        mg_resultset_get_nbtuples       (MgResultSet *rs);
    gint        mg_resultset_get_nbcols         (MgResultSet *rs);
    gchar*      mg_resultset_get_item           (MgResultSet *rs,
                                                 gint row,
                                                 gint col);
    const GdaValue* mg_resultset_get_gdavalue   (MgResultSet *rs,
                                                 gint row,
                                                 gint col);
    const gchar* mg_resultset_get_col_name      (MgResultSet *rs,
                                                 gint col);
    void        mg_resultset_set_col_name       (MgResultSet *rs,
                                                 gint col,
                                                 const gchar *name);
    GdaDataModel* mg_resultset_get_data_model   (MgResultSet *rs);
    gboolean    mg_resultset_check_model        (MgResultSet *rs,
                                                 gint nbcols,
                                                 ...);
    gboolean    mg_resultset_check_data_model   (GdaDataModel *model,
                                                 gint nbcols,
                                                 ...);
    gchar*      mg_resultset_get_row_as_string  (MgResultSet *rs,
                                                 MgQuery *query,
                                                 gint row,
                                                 gchar *sep);

## Object Hierarchy

      GObject
       +----MgBase
             +----MgResultSet

## Properties

      "prop"                 gpointer             : Read / Write

## Signal Prototypes

    "dummy"     void        user_function      (MgResultSet *mgresultset,
                                                gpointer user_data);

## Description

Objects of this class are created by the MgServer object in return of the execution of a SELECT statement (using the `mg_server_do_query()` function call). Acces to individual data is done through this object.

## Details

### struct MgResultSet

    struct MgResultSet;

### mg_resultset_get_type ()

    guint       mg_resultset_get_type           (void);

Returns : |

### mg_resultset_new ()

    GObject*    mg_resultset_new                (MgServer *srv,
                                                 GdaCommand *cmd,
                                                 GdaDataModel *model);

Creates a new MgResultSet object

`srv` : | a MgServer object
`cmd` : | the GdaCommand which returned a result (stored in `model`)
`model` : | the GdaDataModel result
Returns : | the new object

### mg_resultset_get_nbtuples ()

    gint        mg_resultset_get_nbtuples       (MgResultSet *rs);

Fetch the number of tuples (rows) in the resultset

`rs` : | a MgResultSet object
Returns : | the number of tuples

### mg_resultset_get_nbcols ()

    gint        mg_resultset_get_nbcols         (MgResultSet *rs);

Fetch the number of columns of a resultset

`rs` : | a MgResultSet object
Returns : | the number of columns

### mg_resultset_get_item ()

    gchar*      mg_resultset_get_item           (MgResultSet *rs,
                                                 gint row,
                                                 gint col);

Get a textual version of an item in the resultset, situated at (row, col).

`rs` : | a MgResultSet object
`row` : |
`col` : |
Returns : | a new string.

### mg_resultset_get_gdavalue ()

    const GdaValue* mg_resultset_get_gdavalue   (MgResultSet *rs,
                                                 gint row,
                                                 gint col);

Get an item in the resultset, situated at (row, col) as a GdaValue.

`rs` : | a MgResultSet object
`row` : |
`col` : |
Returns : | the item as a GdaValue

### mg_resultset_get_col_name ()

    const gchar* mg_resultset_get_col_name      (MgResultSet *rs,
                                                 gint col);

Get a column name from a resultset.

`rs` : | a MgResultSet object
`col` : |
Returns : | the column's name

### mg_resultset_set_col_name ()

    void        mg_resultset_set_col_name       (MgResultSet *rs,
                                                 gint col,
                                                 const gchar *name);

Set a resultset's column's name

`rs` : | a MgResultSet object
`col` : |
`name` : |

### mg_resultset_get_data_model ()

    GdaDataModel* mg_resultset_get_data_model   (MgResultSet *rs);

Get `rs`'s associated GdaDataModel

`rs` : | a MgResultSet object
Returns : | the GdaDataModel

### mg_resultset_check_model ()

    gboolean    mg_resultset_check_model        (MgResultSet *rs,
                                                 gint nbcols,
                                                 ...);

Check the column types of a resultset.

`rs` : | a MgResultSet object
`nbcols` : | the requested number of columns
`...` : | `nbcols` arguments of type GdaValueType or -1 (if any data type is accepted)
Returns : | TRUE if the resultset's columns match the provided data types and number

### mg_resultset_check_data_model ()

    gboolean    mg_resultset_check_data_model   (GdaDataModel *model,
                                                 gint nbcols,
                                                 ...);

Check the column types of a GdaDataModel.

`model` : | a GdaDataModel object
`nbcols` : | the requested number of columns
`...` : | `nbcols` arguments of type GdaValueType or -1 (if any data type is accepted)
Returns : | TRUE if the data model's columns match the provided data types and number

### mg_resultset_get_row_as_string ()

    gchar*      mg_resultset_get_row_as_string  (MgResultSet *rs,
                                                 MgQuery *query,
                                                 gint row,
                                                 gchar *sep);

Creates a string representing, for the specified `row`, the visible fields `query`, separated by `sep`. `query` is usually the query which has been used to create the resultset.

`rs` : | a MgResultSet object
`query` : | a MgQuery object
`row` : |
`sep` : |
Returns : | a new string, or `NULL` if an error occured.

## Properties

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

## Signals

### The "dummy" signal

    void        user_function                  (MgResultSet *mgresultset,
                                                gpointer user_data);

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