[gnome-db] GdaValue



	Now that we don't have to save a few bytes for
	marshalling/demarshalling values, we could move the translation
	of the values to their types to the gda_value_get_xxx functions.

	From the postgres backend i always get the values represented as
	strings, then translate them to their type (integer, long,
	double,...) and then, the client does the reverse translation to
	get the string i got!

	May be other providers can get directly the data in its
	corresponding type, but let me explain what we can do to
	GdaValue.

		* Add a new field to GdaValue -> gchar *as_string

		* Add a flag that tells us if the correct value is the
		one in as_string, the one in the union or both are ok.

		* Add gda_value_new_from_string (gchar *as_string,
		GdaValueType type) and gda_value_set_from_string with
		teh same parameters.

		* Add a new function to map from string+type to its
		native type.

	Then, if the client asks for the stringified representation of
	the value, we check the flag. If the string is ok, return it, if
	not, do the normal processing, save the string in as_string, set
	the BOTH_VALID flag and return the string.

	If the client asks or the value in its native type, again check
	the flag. If the value in the union is not valid, process teh
	string to get, save and return it. Again, set the BOTH_VALID
	flag.

	When gda_value_new_from_string or set_from string are called,
	they set the string represention and the flag STRING_VALID.

	When gda_value_set_xxx is called, they set the corresponding
	value in the union and set the flag to UNION_VALID.

	May be i'm missing the point, but i think that this can
	improve performance and offers some more flexibility to
	providers: they can translate themselves the values to a common
	string representation among providers or just set the values
	using their native type.

	What do you think?


-- 
Gonzalo Paniagua Javier <gonzalo gnome-db org>
http://www.gnome-db.org/~gonzalo/




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