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



> gda_value_stringify(value)

assume that i know, the value return is string, then i can simply use
this function so i can print
(GValue to gchar) the string.  but there is no function to conver
GValue to gint or gfloat..
the only function i can think of is gda_value_numeric but it doesn't do that.

so assume that i know, that i have a double datatypes inside my table
column, how i can get
the value and assign it in a gdouble variable ?

for example, if gchar,

i can simply
gchar *str;
str = gda_value_stringfy ();

thanks..

On 9/23/08, Vivien Malerba <vmalerba gmail com> wrote:
> 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]