Re: [gnome-db] Gda_Value_Stringify of a double

2006/10/24, Vivien Malerba <vmalerba gmail com>:
On 10/24/06, Murray Cumming <murrayc murrayc com> wrote:
> On Tue, 2006-10-24 at 15:14 +0200, Vivien Malerba wrote:
> > > 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."
> > >
> >
> > It is also very usefull when you want to save a value in an (XML for
> > example) file and you need to be able to read it back even if the
> > locale has changed.
> OK. I think we can call that "serialization", in a canonical
> locale-independent human-readable format.
> Both uses should be mentioned in the documentation. And the
> documentation should clearly state that it's not for showing in your
> application's UI.

I'll make that clear in the doc.

> > If you want to take into account the locale, then you should use the
> > GdaDataHandler which both takes into account the locale and any syntax
> > specific to a DBMS. GdaDataHandler objects are created and managed by
> > each provider and you can use them just after having obtained a
> > pointer to one using gda_server_provider_get_data_handler_gtype() or
> > gda_server_provider_get_data_handler_dbms().
> Is there documentation, or an example, of this somewhere?

There is only the gtk-doc generated documentation, section "Data
conversions"; the GdaDataHandler object is fairly easy to use.

Well, you may want to add in the doc, that gda_value_stringify
function use the g_value_transform function inside, if the GValue type
has a registered function to converto to a String the it use that
function, if not uses a hard coded convertion in that function.

Then, if you want to convert i.e. a double to a string using you own
way, you can register your function in GLib using
g_value_register_transform_func, this override the actual conversion
in libgda (internaly cheks first if there is a function registered to
convert the given GValue type to a String)

Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (entrámite, pero para los
cuates: LIBRE)

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