Data conversions

GdaDataHandler — Interface which provides data handling (conversions) capabilities
GdaHanderString — Default handler for string values
GdaHanderBoolean — Default handler for boolean values
GdaHanderTime — Default handler for time values
GdaHanderNumerical — Default handler for numeric values
GdaHanderBin — Default handler for binary values
GdaHanderType — Default handler for GType values

A single piece of data can have several representations depending on its usage: a string representation, an SQL representation and of course a GValue representation. Conversions from one representation to the other is DBMS dependent as each database can have its own SQL representation rules. The GdaDataHandler object's purpose is to do all these conversions in a easy way. Except when mentioned otherwise, conversions take into account locale settings and DBMS specifications.

To convert a data, one needs to instantiate a new data handler from one of the many classes which implement this interface, or better to get a pointer to a GdaDataHandler object (no need to unref() it after usage, data handler objects are stateless), and so to obtain such a pointer one can:

  • Use the gda_data_handler_get_default(): the returned data handler is a generic one and should not be used to convert data to use with any connection, but only to have a portable way of storing and loading data in a locale independent fashion (for serialization purposes).

  • Ask a GdaServerProvider object for one using the gda_server_provider_get_data_handler_g_type() or gda_server_provider_get_data_handler_dbms(): the returned data handler can then safely be used to convert any data to be used with any connection relying on the GdaServerProvider object.