GdaSelect

GdaSelect — Filtering data from GdaDataModel

Synopsis




struct      GdaSelectPrivate;
GdaDataModel* gda_select_new                (void);
void        gda_select_add_source           (GdaSelect *sel,
                                             const gchar *name,
                                             GdaDataModel *source);
void        gda_select_set_sql              (GdaSelect *sel,
                                             const gchar *sql);
gboolean    gda_select_run                  (GdaSelect *sel);

Description

Details

struct GdaSelectPrivate

struct GdaSelectPrivate;


gda_select_new ()

GdaDataModel* gda_select_new                (void);

Creates a new GdaSelect object, which allows programs to filter GdaDataModel's based on a given SQL SELECT command.

A GdaSelect is just another GdaDataModel-based class, so it can be used in the same way any other data model class is.

Returns : the newly created object.

gda_select_add_source ()

void        gda_select_add_source           (GdaSelect *sel,
                                             const gchar *name,
                                             GdaDataModel *source);

Adds a data model as a source of data for the GdaSelect object. When the select object is run (via gda_select_run), it will parse the SQL and get the required data from the source data models.

sel : a GdaSelect object.
name : name to identify the data model (usually a table name).
source : a GdaDataModel from which to get data.

gda_select_set_sql ()

void        gda_select_set_sql              (GdaSelect *sel,
                                             const gchar *sql);

Sets the SQL command to be used on the given GdaSelect object for filtering rows from the source data model (which is set with gda_select_set_source).

sel : a GdaSelect object.
sql : the SQL command to be used for filtering rows.

gda_select_run ()

gboolean    gda_select_run                  (GdaSelect *sel);

Runs the query and fills in the GdaSelect object with the rows that matched the SQL command (which can be set with gda_select_set_sql) associated with this GdaSelect object.

After calling this function, if everything is successful, the GdaSelect object will contain the matched rows, which can then be accessed like a normal GdaDataModel.

sel : a GdaSelect object.
Returns : TRUE if successful, FALSE if there was an error.