Re: [gnome-db] gda_value_new_from string()



On Sun, 2006-05-14 at 14:45 +0200, Murray Cumming wrote:
On Sun, 2006-05-14 at 15:38 +1000, Bas Driessen wrote:
> Hello,
> 
> Trying to get my applications to work with libgda CVS HEAD. Question
> regarding function gda_value_new_from string(). I have a line like
> this in my code:
> 
> values = g_list_append(values, gda_value_new_from_string(dataValue,
> gda_column_get_gda_type(fa)));
> 
> This transforms a string to a GdaValue using the correct type.
> 
> Compiled with libgda  CVS HEAD, this is failing now in most instances.
> Looking into gda_value_new_from_string(), it mostly fails the
> condition:
> 
> if (g_value_type_transformable(G_TYPE_STRING, type))
> 
> If my type is G_TYPE_STRING, all works OK, but if my type is
> G_TYPE_INT for instance, this test fails.
> 
> How can I get this to work again? How can I get a string (=char*)
> converted to a GValue of G_TYPE_INT?

I wonder how this would be suppose to work, if at all? Should the string
be human-readable (and therefore in the current locale.) or as used in a
SQL statement?

Whenever I see "string representation" in the libgda documentation, I
need to see either "in the current locale", "in the SQL syntax", "in the
C locale", or something similar.
 

Thanks Murray, but this DID work before the GdaValue->GValue changes where introduced, so whatever was used then (local or SQL syntax) could be used again.

So what strategy would you use if you want to convert a string to a GValue of G_TYPE_INT for instance?



Attachment: signature.asc
Description: This is a digitally signed message part



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