Re: [gnome-db] how to print selected row in gnome_db_raw_grid?



2008/9/23 paragasu <paragasu gmail com>

gda_data_model_iter_get_value_at is in V4

can i do g_printf("%s", value) ?


No, you can't because value is a pointer to a GValue structure, not a
string.




i am always confuse with the datatype GValue.. how to make sure it is
of type char or integer?


use G_VALUE_TYPE (value), for example:
if (G_VALUE_TYPE (value)  == G_TYPE_STRING)
    g_print ("%s\n", g_value_get_string (value));

You can also use gda_value_stringify(value) which will return a string to be
used for debug purposes.




using try and error. i manage to print the value using

list = GDA_PARAMETER_LIST (iter)->parameters;
param = GDA_PARAMETER (g_slist_nth_data (list, 0));
str = gda_parameter_get_value_str (param);

i am not sure it is the best way. is there any other better way i can
do it in V3?


It's the correct way. The returned string should take into account your
locale settings as well.




thank you


You're welcome!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]