![]() | ![]() | ![]() | Libmergeant Reference Manual | ![]() |
---|
MgResultSet — Encapsulates a result set returned by the execution of a SELECT statement
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);
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.
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 |
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 |
gint mg_resultset_get_nbcols (MgResultSet *rs);
Fetch the number of columns of a resultset
rs : | a MgResultSet object |
Returns : | the number of columns |
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. |
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 |
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 |
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 : |
GdaDataModel* mg_resultset_get_data_model (MgResultSet *rs);
Get rs's associated GdaDataModel
rs : | a MgResultSet object |
Returns : | the GdaDataModel |
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 |
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 |
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. |
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. |
<< MgServer | MgServerDataType >> |