Managing values

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:

        show_table2 (GdaDataModel * dm)
          gint row_id;
          gint column_id;
          GdaValue *value;
          GdaRow *row;
          gchar *string;
(1)          for (column_id = 0; column_id < gda_data_model_get_n_columns (dm);
            g_print("%s\t",gda_data_model_get_column_title (dm, column_id));
(2)          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);
(3)              for (column_id = 0; column_id < gda_data_model_get_n_columns (dm);
                  value = gda_row_get_value (row, column_id);
(4)                  string=gda_value_stringify (value);
                  g_print ("%s\t", string);
              g_print ("\n");
Loop for writing column names.
Outer loop obtaining rows using gda_data_model_get_row ()
Inner loop obtaining the value using gda_row_get_value () . Notice that gda_row_get_value () doesn't return a const GdaValue, so we have to free it.
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.