Gda.DataHandler¶
- Implementations:
Gda.HandlerBin,Gda.HandlerBoolean,Gda.HandlerNumerical,Gda.HandlerString,Gda.HandlerTime,Gda.HandlerType
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class Gda.DataHandler¶
- Bases:
- Structure:
- classmethod get_default(for_type)¶
- Parameters:
for_type (
GObject.GType) – aGObject.GTypetype- Returns:
a
Gda.DataHandlerwhich must not be modified or destroyed.- Return type:
Obtain a pointer to a
Gda.DataHandlerwhich can manageGObject.Valuevalues of type for_type. The returned data handler will be adapted to use the current locale information (for example dates will be formatted taking into account the locale).The returned pointer is
Noneif there is no default data handler available for the for_type data typeNew in version 4.2.3.
- accepts_g_type(type)¶
- Parameters:
type (
GObject.GType) – aGObject.GType- Returns:
Trueif the gda type can be handled- Return type:
Checks wether the
Gda.DataHandleris able to handle the gda type given as argument.
- get_descr()¶
- Returns:
the description
- Return type:
Get a short description of the
Gda.DataHandler
- get_sane_init_value(type)¶
- Parameters:
type (
GObject.GType) – aGObject.GType- Returns:
the new
GObject.Value, orNoneif no such value can be created.- Return type:
Creates a new
GObject.Valuewhich holds a sane initial value to be used if no value is specifically provided. For example for a simple string, this would return a new value containing the “” string.
- get_sql_from_value(value)¶
- Parameters:
value (
GObject.ValueorNone) – the value to be converted to a string, orNone- Returns:
the new string, or
Noneif an error occurred- Return type:
Creates a new string which is an SQL representation of the given value, the returned string can be used directly in an SQL statement. For example if value is a
GObject.TYPE_STRING, then the returned string will be correctly quoted. Note however that it is a better practice to use variables in statements instead of value literals, see the ‘GdaSqlParser [GdaSqlParser.description]’ for more information.If the value is
Noneor is of type GDA_TYPE_NULL, or is aGObject.TYPE_STRINGandGObject.Value.get_string() returnsNone, the returned string is “None".
- get_str_from_value(value)¶
- Parameters:
value (
GObject.ValueorNone) – the value to be converted to a string, orNone- Returns:
the new string, or
Noneif an error occurred- Return type:
Creates a new string which is a “user friendly” representation of the given value (in the user’s locale, specially for the dates). If the value is
Noneor is of type GDA_TYPE_NULL, the returned string is a copy of “” (empty string).Note: the returned value will be in the current locale representation.
- get_value_from_sql(sql, type)¶
- Parameters:
type (
GObject.GType) – aGObject.GType
- Returns:
the new
GObject.ValueorNoneon error- Return type:
Creates a new
GObject.Valuewhich represents the SQL value given as argument. This is the opposite of the functionGda.DataHandler.get_sql_from_value(). The type argument is used to determine the real data type requested for the returned value.If the sql string is
None, then the returnedGObject.Valueis of type GDA_TYPE_NULL; if the sql string does not correspond to a valid SQL string for the requested type, then theNoneis returned.
- get_value_from_str(str, type)¶
- Parameters:
type (
GObject.GType) – aGObject.GType
- Returns:
the new
GObject.ValueorNoneon error- Return type:
Creates a new
GObject.Valuewhich represents the str value given as argument. This is the opposite of the functionGda.DataHandler.get_str_from_value(). The type argument is used to determine the real data type requested for the returned value.If the str string is
None, then the returnedGObject.Valueis of type GDA_TYPE_NULL; if the str string does not correspond to a valid string for the requested type, thenNoneis returned.Note: the str string must be in the current locale representation
- do_accepts_g_type(type) virtual¶
- Parameters:
type (
GObject.GType) – aGObject.GType- Returns:
Trueif the gda type can be handled- Return type:
Checks wether the
Gda.DataHandleris able to handle the gda type given as argument.
- do_get_descr() virtual¶
- Returns:
the description
- Return type:
Get a short description of the
Gda.DataHandler
- do_get_sane_init_value(type) virtual¶
- Parameters:
type (
GObject.GType) – aGObject.GType- Returns:
the new
GObject.Value, orNoneif no such value can be created.- Return type:
Creates a new
GObject.Valuewhich holds a sane initial value to be used if no value is specifically provided. For example for a simple string, this would return a new value containing the “” string.
- do_get_sql_from_value(value) virtual¶
- Parameters:
value (
GObject.ValueorNone) – the value to be converted to a string, orNone- Returns:
the new string, or
Noneif an error occurred- Return type:
Creates a new string which is an SQL representation of the given value, the returned string can be used directly in an SQL statement. For example if value is a
GObject.TYPE_STRING, then the returned string will be correctly quoted. Note however that it is a better practice to use variables in statements instead of value literals, see the ‘GdaSqlParser [GdaSqlParser.description]’ for more information.If the value is
Noneor is of type GDA_TYPE_NULL, or is aGObject.TYPE_STRINGandGObject.Value.get_string() returnsNone, the returned string is “None".
- do_get_str_from_value(value) virtual¶
- Parameters:
value (
GObject.ValueorNone) – the value to be converted to a string, orNone- Returns:
the new string, or
Noneif an error occurred- Return type:
Creates a new string which is a “user friendly” representation of the given value (in the user’s locale, specially for the dates). If the value is
Noneor is of type GDA_TYPE_NULL, the returned string is a copy of “” (empty string).Note: the returned value will be in the current locale representation.
- do_get_value_from_sql(sql, type) virtual¶
- Parameters:
type (
GObject.GType) – aGObject.GType
- Returns:
the new
GObject.ValueorNoneon error- Return type:
Creates a new
GObject.Valuewhich represents the SQL value given as argument. This is the opposite of the functionGda.DataHandler.get_sql_from_value(). The type argument is used to determine the real data type requested for the returned value.If the sql string is
None, then the returnedGObject.Valueis of type GDA_TYPE_NULL; if the sql string does not correspond to a valid SQL string for the requested type, then theNoneis returned.
- do_get_value_from_str(str, type) virtual¶
- Parameters:
type (
GObject.GType) – aGObject.GType
- Returns:
the new
GObject.ValueorNoneon error- Return type:
Creates a new
GObject.Valuewhich represents the str value given as argument. This is the opposite of the functionGda.DataHandler.get_str_from_value(). The type argument is used to determine the real data type requested for the returned value.If the str string is
None, then the returnedGObject.Valueis of type GDA_TYPE_NULL; if the str string does not correspond to a valid string for the requested type, thenNoneis returned.Note: the str string must be in the current locale representation