MgResultSet

Name

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

Synopsis



#define     MG_RESULTSET_TYPE
#define     MG_RESULTSET                    (obj)
#define     MG_RESULTSET_CLASS              (klass)
#define     IS_MG_RESULTSET                 (obj)
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,
                                             ...);

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

MG_RESULTSET_TYPE

#define MG_RESULTSET_TYPE          (mg_resultset_get_type())


MG_RESULTSET()

#define MG_RESULTSET(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, mg_resultset_get_type(), MgResultSet)

obj :


MG_RESULTSET_CLASS()

#define MG_RESULTSET_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, mg_resultset_get_type (), MgResultSetClass)

klass :


IS_MG_RESULTSET()

#define IS_MG_RESULTSET(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, mg_resultset_get_type ())

obj :


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

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.