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.GType
type- Returns:
a
Gda.DataHandler
which must not be modified or destroyed.- Return type:
Obtain a pointer to a
Gda.DataHandler
which can manageGObject.Value
values 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
None
if 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:
True
if the gda type can be handled- Return type:
Checks wether the
Gda.DataHandler
is 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
, orNone
if no such value can be created.- Return type:
Creates a new
GObject.Value
which 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.Value
orNone
) – the value to be converted to a string, orNone
- Returns:
the new string, or
None
if 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
None
or is of type GDA_TYPE_NULL, or is aGObject.TYPE_STRING
andGObject.Value.get_string
() returnsNone
, the returned string is “None
".
- get_str_from_value(value)¶
- Parameters:
value (
GObject.Value
orNone
) – the value to be converted to a string, orNone
- Returns:
the new string, or
None
if 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
None
or 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.Value
orNone
on error- Return type:
Creates a new
GObject.Value
which 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.Value
is of type GDA_TYPE_NULL; if the sql string does not correspond to a valid SQL string for the requested type, then theNone
is returned.
- get_value_from_str(str, type)¶
- Parameters:
type (
GObject.GType
) – aGObject.GType
- Returns:
the new
GObject.Value
orNone
on error- Return type:
Creates a new
GObject.Value
which 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.Value
is of type GDA_TYPE_NULL; if the str string does not correspond to a valid string for the requested type, thenNone
is 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:
True
if the gda type can be handled- Return type:
Checks wether the
Gda.DataHandler
is 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
, orNone
if no such value can be created.- Return type:
Creates a new
GObject.Value
which 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.Value
orNone
) – the value to be converted to a string, orNone
- Returns:
the new string, or
None
if 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
None
or is of type GDA_TYPE_NULL, or is aGObject.TYPE_STRING
andGObject.Value.get_string
() returnsNone
, the returned string is “None
".
- do_get_str_from_value(value) virtual¶
- Parameters:
value (
GObject.Value
orNone
) – the value to be converted to a string, orNone
- Returns:
the new string, or
None
if 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
None
or 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.Value
orNone
on error- Return type:
Creates a new
GObject.Value
which 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.Value
is of type GDA_TYPE_NULL; if the sql string does not correspond to a valid SQL string for the requested type, then theNone
is returned.
- do_get_value_from_str(str, type) virtual¶
- Parameters:
type (
GObject.GType
) – aGObject.GType
- Returns:
the new
GObject.Value
orNone
on error- Return type:
Creates a new
GObject.Value
which 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.Value
is of type GDA_TYPE_NULL; if the str string does not correspond to a valid string for the requested type, thenNone
is returned.Note: the str string must be in the current locale representation