Re: [gnome-db] Gda_Value_Stringify of a double
- From: Juan Pablo <jpdborgna yahoo com ar>
- To: Murray Cumming <murrayc murrayc com>
- Cc: gnome-db-list gnome org
- Subject: Re: [gnome-db] Gda_Value_Stringify of a double
- Date: Mon, 23 Oct 2006 12:35:12 -0300
El lun, 23-10-2006 a las 15:13 +0200, Murray Cumming escribió:
> On Mon, 2006-10-23 at 09:51 -0300, Juan Pablo wrote:
> > Hello list.
> > When i use this function with a gda value double, it generates a 2
> > decimal number, rounding it up. For example, 0.895 double becomes "0.90"
> > string.
> > I would like to have 4 decimas. Is this a parameter?
>
> I can't see what possible use this function has:
>
Its usefull if you have a timestamp (for instance) and want to show it
in a gtk_tree_view. I use a G_TYPE_STRING for the column type.
Saludos, Juan Pablo.
> /**
> * gda_value_stringify
> * @value: a #GValue.
> *
> * Converts a GValue to its string representation which is a human
> readable value. Note that the
> * returned string does not take into account the current locale of the
> user (on the contrary to the
> * #GdaDataHandler objects).
> *
> * Dates are converted in a YYYY-MM-DD format.
> *
> * Returns: a new string, or %NULL if the conversion cannot be done.
> Free the value with a g_free() when you've finished
> * using it.
> */
>
> It says that string is meant to be human-readable, but it ignores the
> current locale, and it makes assumptions about the numeric formatting
> wanted. So it's no use for actually showing to a human. I suggest that
> it be marked as "useful only for debugging, and not for showing values
> in your user interface."
>
> > Meanwhile, i made a function wich does the same BUT it uses a static
> > buffer for the return and the format is parametrizable. No need to use
> > intermediate variables which needs to be freed.
> > Is there any reason to not to do so with gda_value_stringify? (the
> > static char part) If the string is needed on a new var you just strdup
> > it.
>
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]