2006/3/15, Murray Cumming <[EMAIL PROTECTED]>:
You're right, but gdouble yes, then:
Who is using the GdaNumeric to store values?
Why don't store gdouble or gfloat when the providers return a value?
The client just nead to test if is it a double or a float using G_VALUE_TYPE(value) to know the returned type.
When I work in the port of GdaValue to GValue, I'll try to not modify the API for it, and not modify the provider's code; now and view the changes, and if not exist a good reazon to keep the actual API, I can simplify it. For example, I can use GDate enstead GdaDate and allow the client to use the GLib API to manipulate dates; and this apply to all the types like GdaNumeric, GdaTime and GdaMoney.
May elliminate the G_VALUE_TYPE_* #define, and use only the G_VALUE_TYPE, derive some types like GdaMoney form gfloat and others, to allow the client still know if is getting a Money type from the server and manipulate usign the standart locate functions to print or stringify it; of course this changes afact directly to the providers but may, in the future, create a more consistent API to use Values.
-- On Wed, 2006-03-15 at 14:00 -0600, Daniel Espinosa wrote:
>
>
> 2006/3/15, Murray Cumming <[EMAIL PROTECTED]>:
> On Wed, 2006-03-15 at 13:33 +0100, Vivien Malerba wrote:
> > On 3/15/06, Juan Pablo <[EMAIL PROTECTED]> wrote:
> > > With v=(GdaValue *)
> > >
> gda_data_model_get_value_at(dm,gda_data_model_get_column_position(dm,"stock1a"),0);
> > > i get a numeric (from database) and i want to use it like
> this (in the
> > > ideal world...)
> > >
> gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(widget,"stock1a")),
> > > gda_value_get_double(v));
> > > But it is numeric, so im afraid i have to stringify it and
> then
> > > g_strotod it (it works but its ugly).
> > >
> > > ¿Is there any direct way to do it?
> >
> > For the moment you need to either use a string
> representation, or
> > build your own gdouble value from the GdaNumeric structure.
> >
> > However, I've added in my local working repository a
> function to
> > transform a GdaValue into another one called
> g_value_transform() which
> > you'll be able to use instead (but I've not yet committed
> it).
>
> Some kind of get_value_numeric_as_double() would be a lot
> simpler.
>
> GdaNumeric contains a string representation of the number
> (presumably as
> per the C locale, hopefully). At the moment, I need to parse
> that string
> representation to a double myself.
>
> Why it is used the GdaNumeric structure?
>
> Is realy necesary?
>
> If we think about that GdaValue is a GValue, you can store a long
> value and get transform, etc.
I don't believe that a long can store a floating point value (with a
decimal point).
You're right, but gdouble yes, then:
Who is using the GdaNumeric to store values?
Why don't store gdouble or gfloat when the providers return a value?
The client just nead to test if is it a double or a float using G_VALUE_TYPE(value) to know the returned type.
When I work in the port of GdaValue to GValue, I'll try to not modify the API for it, and not modify the provider's code; now and view the changes, and if not exist a good reazon to keep the actual API, I can simplify it. For example, I can use GDate enstead GdaDate and allow the client to use the GLib API to manipulate dates; and this apply to all the types like GdaNumeric, GdaTime and GdaMoney.
May elliminate the G_VALUE_TYPE_* #define, and use only the G_VALUE_TYPE, derive some types like GdaMoney form gfloat and others, to allow the client still know if is getting a Money type from the server and manipulate usign the standart locate functions to print or stringify it; of course this changes afact directly to the providers but may, in the future, create a more consistent API to use Values.
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (entrámite, pero para los cuates: LIBRE)
_______________________________________________ gnome-db-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gnome-db-list
