| GNOME Data Access manual |
|---|
Values returned by functions of managing data are GdaValue objects. GdaValue class has many functions to access data, so we show the most important ones of them:
There are many functions to know what is the type of a value and to manage values, that can be seen in GdaValue class.
We will return to the examples about last section to notice some important details:
void
show_table2 (GdaDataModel * dm)
{
gint row_id;
gint column_id;
GdaValue *value;
GdaRow *row;
gchar *string;
for (column_id = 0; column_id < gda_data_model_get_n_columns (dm);
column_id++)
g_print("%s\t",gda_data_model_get_column_title (dm, column_id));
g_print("\n");
for (row_id = 0; row_id < gda_data_model_get_n_rows (dm); row_id++) {
row = (GdaRow *) gda_data_model_get_row (dm, row_id);
for (column_id = 0; column_id < gda_data_model_get_n_columns (dm);
column_id++) {
value = gda_row_get_value (row, column_id);
string=gda_value_stringify (value);
g_print ("%s\t", string);
g_free(string);
}
g_print ("\n");
}
}
![]() |
Loop for writing column names. |
![]() |
Outer loop obtaining rows using
|
![]() |
Inner loop obtaining the value using
|
![]() |
We have the difference here. As you can see above, gda_value_stringify () does not return a const gchar *, so you have to free it. First way is quite attractive but it is not good. |
| << Managing data models | Managing transactions >> |