Functions

  alphanum_to_text (text)
  binary_copy (boxed)
  binary_free (boxed)
  blob_copy (boxed)
  blob_free (boxed)
  completion_list_get (cnc, sql, start, end)
  compute_dml_statements (cnc, select_stmt, require_pk, insert_stmt, update_stmt, delete_stmt)
  data_handler_get_default (for_type)
  data_model_error_quark ()
  default_escape_string (string)
  default_unescape_string (string)
  dsn_split (string, out_dsn, out_username, out_password)
  g_type_from_string (str)
  g_type_to_string (type)
  geometricpoint_copy (boxed)
  geometricpoint_free (boxed)
  get_application_exec_path (app_name)
  identifier_equal (id1, id2)
  identifier_hash (id)
  init ()
  locale_changed ()
  log_disable ()
  log_enable ()
  log_is_enabled ()
  mutex_free (mutex)
  mutex_lock (mutex)
  mutex_trylock (mutex)
  mutex_unlock (mutex)
  parse_formatted_date (gdate, value, first, second, third, sep)
  parse_formatted_time (timegda, value, sep)
  parse_formatted_timestamp (timestamp, value, first, second, third, sep)
  parse_iso8601_date (gdate, value)
  parse_iso8601_time (timegda, value)
  parse_iso8601_timestamp (timestamp, value)
  rewrite_statement_for_null_parameters (stmt, params, out_stmt)
  rfc1738_decode (string)
  rfc1738_encode (string)
  select_alter_select_for_empty (stmt)
  sql_error_quark ()
  sql_identifier_quote (id, cnc, prov, meta_store_convention, force_quotes)
  sql_identifier_split (id)
  sql_operation_operator_from_string (op)
  sql_operation_operator_to_string (op)
  sql_select_join_type_to_string (type)
  string_to_binary (str)
  string_to_blob (str)
  text_to_alphanum (text)
  time_copy (boxed)
  time_free (boxed)
  timestamp_copy (boxed)
  timestamp_free (boxed)
  utility_check_data_model (model, types)
  utility_data_model_dump_data_to_xml (model, parent, cols, rows, use_col_ids)
  utility_data_model_find_column_description (model, field_name)
  utility_holder_load_attributes (holder, node, sources)
  value_compare (value1, value2)
  value_differ (value1, value2)
  value_stringify (value)

Details

Gda.alphanum_to_text(text)
Parameters:text (str) – a string
Returns:text if conversion succeeded or None if an error occurred
Return type:str

Does the opposite of Gda.text_to_alphanum(), in the same string

Gda.binary_copy(boxed)
Parameters:boxed (object or None) – source to get a copy from.
Returns:a newly allocated Gda.Binary which contains a copy of information in boxed.

Free-function: Gda.Binary.free

Return type:object or None

Creates a new Gda.Binary structure from an existing one.

Gda.binary_free(boxed)
Parameters:boxed (object or None) – Gda.Binary to free.

Deallocates all memory associated to the given Gda.Binary.

Gda.blob_copy(boxed)
Parameters:boxed (object or None) – source to get a copy from.
Returns:a newly allocated Gda.Blob which contains a copy of information in boxed.

Free-function: Gda.Blob.free

Return type:object or None

Creates a new Gda.Blob structure from an existing one.

Gda.blob_free(boxed)
Parameters:boxed (object or None) – Gda.Blob to free.

Deallocates all memory associated to the given Gda.Blob.

Gda.completion_list_get(cnc, sql, start, end)
Parameters:
  • cnc (Gda.Connection) – a Gda.Connection object
  • sql (str) – a partial SQL statement which is the context of the completion proposal
  • start (int) – starting position within sql of the “token” to complete (starts at 0)
  • end (int) – ending position within sql of the “token” to complete
Returns:

a new array of strings, or None (use GLib.strfreev() to free the returned array)

Return type:

[str] or None

Creates an array of strings (terminated by a None) corresponding to possible completions. If no completion is available, then the returned array contains just one None entry, and if it was not possible to try to compute a completions list, then None is returned.

Gda.compute_dml_statements(cnc, select_stmt, require_pk, insert_stmt, update_stmt, delete_stmt)
Parameters:
Raises:

GLib.Error

Returns:

True if no error occurred

Return type:

bool

Creates an INSERT, an UPDATE and a DELETE statement from a SELECT statement using the database metadata available in cnc’s meta store. Each statements are computed only if the corresponding place to store the created statement is not None.

Gda.data_handler_get_default(for_type)
Parameters:for_type (GObject.GType) – a GObject.GType type
Returns:a Gda.DataHandler which must not be modified or destroyed.
Return type:Gda.DataHandler

Obtain a pointer to a Gda.DataHandler which can manage GObject.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 type

New in version 4.2.3.

Gda.data_model_error_quark()
Return type:int
Gda.default_escape_string(string)
Parameters:string (str) – string to escape
Returns:a new string
Return type:str

Escapes string to make it understandable by a DBMS. The escape method is very common and replaces any occurrence of “’” with “’‘” and “" with “\”

Gda.default_unescape_string(string)
Parameters:string (str) – string to unescape
Returns:a new unescaped string, or None in an error was found in string
Return type:str

Do the reverse of Gda.default_escape_string(): transforms any “’‘” into “’”, any “\” into “" and any “'” into “’”.

Gda.dsn_split(string, out_dsn, out_username, out_password)
Parameters:
  • string (str) – a string in the “[<username>[:<password>]@]<DSN>” form
  • out_dsn (str) – a place to store the new string containing the <DSN> part
  • out_username (str) – a place to store the new string containing the <username> part
  • out_password (str) – a place to store the new string containing the <password> part

Extract the DSN, username and password from string. in string, the various parts are strings which are expected to be encoded using an RFC 1738 compliant encoding. If they are specified, the returned username and password strings are correctly decoded.

out_username and out_password may be set to None depending on string’s format.

Gda.g_type_from_string(str)
Parameters:str (str) – the name of a GObject.GType, as returned by Gda.g_type_to_string().
Returns:the GObject.GType represented by the given str, or GObject.TYPE_INVALID if not found
Return type:GObject.GType

Converts a named type to ts GObject.GType type (also see the Gda.g_type_to_string() function).

This function is a wrapper around the GObject.type_from_name() function, but also recognizes some type synonyms such as:

Gda.g_type_to_string(type)
Parameters:type (GObject.GType) – Type to convert from.
Returns:the GDA’s string representing the given GObject.GType or the name returned by GObject.type_name.
Return type:str

Converts a GObject.GType to its string representation (use Gda.g_type_from_string() for the operation in the other direction).

This function wraps GObject.type_name() but for common types it provides an easier to understand and remember name. For Example the GObject.TYPE_STRING is converted to “string” whereas GObject.type_name() converts it to “gchararray”.

Gda.geometricpoint_copy(boxed)
Parameters:boxed (object or None) –
Return type:object or None
Gda.geometricpoint_free(boxed)
Parameters:boxed (object or None) –
Gda.get_application_exec_path(app_name)
Parameters:app_name (str) – the name of the application to find
Returns:the path as a new string, or None if the application cannot be found
Return type:str

Find the path to the application identified by app_name. For example if the application is “gda-sql”, then calling this function will return “/your/prefix/bin/gda-sql-5.0” if Libgda is installed in the “/your/prefix” prefix (which would usually be “/usr”), and for the ABI version 5.0.

Gda.identifier_equal(id1, id2)
Parameters:
  • id1 (str) – an identifier string
  • id2 (str) – an identifier string
Returns:

True if id1 and id2 are equal.

Return type:

bool

Does the same as strcmp(id1, id2), but handles the case where id1 and/or id2 are enclosed in double quotes. can also be used in hash tables as a GLib.EqualFunc.

Gda.identifier_hash(id)
Parameters:id (str) – an identifier string
Returns:a new hash
Return type:int

computes a hash string from id, to be used in hash tables as a GLib.HashFunc

Gda.init()

Initializes the GDA library, must be called prior to any Libgda usage.

Please note that if you call setlocale() to modify the current locale, you should also call Gda.locale_changed() before using Libgda again.

Gda.locale_changed()

Call this function whenever the setlocale() function has been called to change the current locale; this function is first called by Gda.init() so you don’t need to call it if you have set the locale before calling Gda.init().

Failing to call this function after having changed the current locale may result in Libgda reverting to the previous set locale.

New in version 4.2.3.

Gda.log_disable()

Disables GDA logs.

Gda.log_enable()

Enables GDA logs.

Gda.log_is_enabled()
Returns:whether GDA logs are enabled (True or False).
Return type:bool
Gda.mutex_free(mutex)
Parameters:mutex (GLib.RecMutex) –
Gda.mutex_lock(mutex)
Parameters:mutex (GLib.RecMutex) –
Gda.mutex_trylock(mutex)
Parameters:mutex (GLib.RecMutex) –
Return type:bool
Gda.mutex_unlock(mutex)
Parameters:mutex (GLib.RecMutex) –
Gda.parse_formatted_date(gdate, value, first, second, third, sep)
Parameters:
  • gdate (GLib.Date) – a pointer to a GLib.Date structure which will be filled
  • value (str) – a string to be parsed
  • first (GLib.DateDMY) – a GLib.DateDMY specifying which of year, month or day appears first (in the first bytes) in value
  • second (GLib.DateDMY) – a GLib.DateDMY specifying which of year, month or day appears second (in the first bytes) in value
  • third (GLib.DateDMY) – a GLib.DateDMY specifying which of year, month or day appears third (in the first bytes) in value
  • sep (int) – spcifies the expected separator character bewteen year, month and day (for example ‘-‘)
Returns:

True if value has been sucessfuly parsed as a valid date (see GLib.Date.valid()).

Return type:

bool

This function is similar to Gda.parse_iso8601_date() (with first being GLib.DateDMY.YEAR, second being GLib.DateDMY.MONTH, third being GLib.DateDMY.DAY and sep being ‘-‘) but allows one to specify the expected date format.

New in version 5.2.

Gda.parse_formatted_time(timegda, value, sep)
Parameters:
  • timegda (Gda.Time) – a pointer to a Gda.Time structure which will be filled
  • value (str) – a string
  • sep (int) – the time separator, usually ‘:’. If equal to 0, then the expexted format will be HHMMSS…
Returns:

True if no error occurred

Return type:

bool

New in version 5.2.

Gda.parse_formatted_timestamp(timestamp, value, first, second, third, sep)
Parameters:
  • timestamp (Gda.Timestamp) – a pointer to a #GdaTimeStamp structure which will be filled
  • value (str) – a string to be parsed
  • first (GLib.DateDMY) – a GLib.DateDMY specifying which of year, month or day appears first (in the first bytes) in value
  • second (GLib.DateDMY) – a GLib.DateDMY specifying which of year, month or day appears second (in the first bytes) in value
  • third (GLib.DateDMY) – a GLib.DateDMY specifying which of year, month or day appears third (in the first bytes) in value
  • sep (int) – spcifies the expected separator character bewteen year, month and day (for example ‘-‘)
Returns:

True if value has been sucessfuly parsed as a valid date (see GLib.Date.valid()).

Return type:

bool

This function is similar to Gda.parse_iso8601_timestamp() (with first being GLib.DateDMY.YEAR, second being GLib.DateDMY.MONTH, third being GLib.DateDMY.DAY and sep being ‘-‘) but allows one to specify the expected date format.

New in version 5.2.

Gda.parse_iso8601_date(gdate, value)
Parameters:
Returns:

True if value has been sucessfuly parsed as a valid date (see GLib.Date.valid()).

Return type:

bool

Extracts date parts from value, and sets gdate’s contents

Accepted date format is “YYYY-MM-DD” (more or less than 4 digits for years and less than 2 digits for month and day are accepted). Years must be in the 1-65535 range, a limitation imposed by GLib.Date.

Gda.parse_iso8601_time(timegda, value)
Parameters:
  • timegda (Gda.Time) – a pointer to a Gda.Time structure which will be filled
  • value (str) – a string
Returns:

True if no error occurred

Return type:

bool

Extracts time parts from value, and sets timegda’s contents

Accepted date format is “HH:MM:SS’.ms [TZ]’” where TZ is +hour or -hour

Gda.parse_iso8601_timestamp(timestamp, value)
Parameters:
  • timestamp (Gda.Timestamp) – a pointer to a #GdaTimeStamp structure which will be filled
  • value (str) – a string
Returns:

True if value has been sucessfuly parsed as a valid timestamp (see GLib.Date.valid())

Return type:

bool

Extracts date and time parts from value, and sets timestamp’s contents

Accepted date format is “YYYY-MM-DD HH:MM:SS’.ms [TZ]’” where TZ is +hour or -hour

Gda.rewrite_statement_for_null_parameters(stmt, params, out_stmt)
Parameters:
Raises:

GLib.Error

Returns:

True if stmt needs to be transformed to handle None parameters, and False otherwise

Return type:

bool

Modifies stmt to take into account any parameter which might be None: if stmt contains the equivalent of “xxx = <parameter definition>” and if that parameter is in params and its value is of type GDA_TYPE_NUL, then that part is replaced with “xxx IS None”. It also handles the “xxx IS NOT None” transformation.

For example the following SELECT:

SELECT * FROM data WHERE id = ##id::int::null AND name = ##name::string in case the “id” parameter is set to None, is converted to:

SELECT * FROM data WHERE id IS NULL AND name = ##name::string if out_stmt is not None, then it will contain:

  • the modified statement if some modifications were required and no error occured (the function returns True)
  • None if no modification to stmt were required and no erro occurred (the function returns False)
  • None if an error occured (the function returns True)

This function is used by provider’s implementations to make sure one can use parameters with None values in statements without having to rewrite statements, as database usually don’t consider that “xxx = None” is the same as “xxx IS None” when using parameters.

New in version 4.2.9.

Gda.rfc1738_decode(string)
Parameters:string (str) – a string to decode
Returns:True if no error occurred.
Return type:bool

Decodes string using the RFC 1738 recommendations: the

<>”#%{}|\^~[]’`;/?:@=& and space characters are replaced by “%%ab” where ab is the hexadecimal number corresponding to the character. string should respect the RFC 1738 encoding. If this is not the case (for example if there is a “%2z” because 2z is not an hexadecimal value), then the part with the problem is not decoded, and the function returns False.

string is decoded in place, no new string gets created.

Gda.rfc1738_encode(string)
Parameters:string (str) – a string to encode
Returns:a new string
Return type:str

Encodes string using the RFC 1738 recommendations: the

<>”#%{}|\^~[]’`;/?:@=& and space characters are replaced by “%%ab” where ab is the hexadecimal number corresponding to the character.

Gda.select_alter_select_for_empty(stmt)
Parameters:stmt (Gda.Statement) – a SELECT Gda.Statement
Raises:GLib.Error
Returns:a new Gda.Statement
Return type:Gda.Statement

Creates a new Gda.Statement, selecting the same data as stmt, but which always returns an empty (no row) data model. This is use dy database providers’ implementations.

Gda.sql_error_quark()
Return type:int
Gda.sql_identifier_quote(id, cnc, prov, meta_store_convention, force_quotes)
Parameters:
Returns:

the representation of id ready to be used in SQL statement, as a new string, or None if id is in a wrong format

Return type:

str

Use this function for any SQL identifier to make sure that: <itemizedlist> <listitem> <para>it is correctly formatted to be used with cnc (if cnc is None, then some default SQL quoting rules will be applied, similar to PostgreSQL’s way) if for_meta_store is False; </para> </listitem> <listitem> <para>it is correctly formatted to be used with the Gda.MetaStore’s object associated to cnc is for_meta_store is True. </para> </listitem> </itemizedlist>

The force_quotes allow some control of how to interpret id: if False, then id will be left unchanged most of the time (except for example if it’s a reserved keyword), otherwise if force_quotes is True, then the returned string will most probably have quotes around it to request that the database keep the case sensitiveness (but again, this may vary depending on the database being accessed through cnc).

For example, the following table gives the result of this function depending on the arguments when cnc is None (and prov is also None): <table frame=”all”> <tgroup cols=”6” colsep=”1” rowsep=”1” align=”justify”> <thead> <row> <entry>id</entry> <entry>for_meta_store=:obj:False, force_quotes=:obj:False</entry> <entry>for_meta_store=:obj:True, force_quotes=:obj:False</entry> <entry>for_meta_store=:obj:False, force_quotes=:obj:True</entry> <entry>for_meta_store=:obj:True, force_quotes=:obj:True</entry> <entry>remark</entry> </row> </thead> <tbody> <row> <entry>”double word”</entry> <entry>”double word”</entry> <entry>”double word”</entry> <entry>”double word”</entry> <entry>”double word”</entry> <entry>non allowed character in SQL identifier</entry> </row> <row> <entry>”CapitalTest”</entry> <entry>”CapitalTest”</entry> <entry>”CapitalTest”</entry> <entry>”CapitalTest”</entry> <entry>”CapitalTest”</entry> <entry>Mixed case SQL identifier, already quoted</entry> </row> <row> <entry>CapitalTest</entry> <entry>CapitalTest</entry> <entry>capitaltest</entry> <entry>”CapitalTest”</entry> <entry>”CapitalTest”</entry> <entry>Mixed case SQL identifier, non quoted</entry> </row> <row> <entry>”mytable”</entry> <entry>”mytable”</entry> <entry>mytable</entry> <entry>”mytable”</entry> <entry>mytable</entry> <entry>All lowser case, quoted</entry> </row> <row> <entry>mytable</entry> <entry>mytable</entry> <entry>mytable</entry> <entry>”mytable”</entry> <entry>mytable</entry> <entry>All lowser case</entry> </row> <row> <entry>MYTABLE</entry> <entry>MYTABLE</entry> <entry>mytable</entry> <entry>”MYTABLE”</entry> <entry>”MYTABLE”</entry> <entry>All upper case</entry> </row> <row> <entry>”MYTABLE”</entry> <entry>”MYTABLE”</entry> <entry>”MYTABLE”</entry> <entry>”MYTABLE”</entry> <entry>”MYTABLE”</entry> <entry>All upper case, quoted</entry> </row> <row> <entry>desc</entry> <entry>”desc”</entry> <entry>”desc”</entry> <entry>”desc”</entry> <entry>”desc”</entry> <entry>SQL reserved keyword</entry> </row> <row> <entry>5ive</entry> <entry>”5ive”</entry> <entry>”5ive”</entry> <entry>”5ive”</entry> <entry>”5ive”</entry> <entry>SQL identifier starting with a digit</entry> </row> </tbody> </tgroup> </table>

Here are a few examples of when and how to use this function: <itemizedlist> <listitem> <para> When creating a table, the user has entered the table name, this function can be used to create a valid SQL identifier from the user provided table name: <programlisting> str *user_sqlid=… str *valid_sqlid = Gda.sql_identifier_quote (user_sqlid, cnc, None, False, False); str *sql = g_strdup_printf (“CREATE TABLE %s …”, valid_sqlid); GLib.free (valid_sqlid); </programlisting> Note that this is an illustration and creating a table should be sone using a Gda.ServerOperation object. </para> </listitem> <listitem> <para> When updating the meta data associated to a table which has been created with the code above: <programlisting> GObject.Value table_name_value = { 0 }; str column_names[] = { (str)”table_name” }; GObject.Value column_values[] = { &table_name_value }; Gda.MetaContext mcontext = { (str)”_tables”, 1, column_names, column_values }; GObject.Value.init (&amp;table_name_value, GObject.TYPE_STRING); GObject.Value.take_string (&amp;table_name_value, Gda.sql_identifier_quote (user_sqlid, cnc, None, True, False); Gda.Connection.update_meta_store (cnc, &amp;mcontext, None); GObject.Value.reset (&amp;table_name_value); </programlisting> </para> </listitem> <listitem> <para> When using a Gda.MetaStruct object to fetch information about a table (which has been created with the code above): <programlisting> GObject.Value table_name_value = { 0 }; GObject.Value.init (&amp;table_name_value, GObject.TYPE_STRING); GObject.Value.take_string (&amp;table_name_value, Gda.sql_identifier_quote (user_sqlid, cnc, None, True, False); Gda.MetaDbObject *dbo; dbo = Gda.MetaStruct.complement (mstruct, Gda.MetaDbObjectType.TABLE, None, None, &amp;table_name_value, None); GObject.Value.reset (&amp;table_name_value); </programlisting> </para> </listitem> </itemizedlist>

Note that id must not be a composed SQL identifier (such as “mytable.mycolumn” which should be treated as the “mytable” and “mycolumn” SQL identifiers). If unsure, use Gda.sql_identifier_split().

Also note that if cnc is None, then it’s possible to pass an non None prov to have a result specific to prov.

For more information, see the <link linkend=”gen:sql_identifiers”>SQL identifiers and abstraction</link> and <link linkend=”information_schema:sql_identifiers”>SQL identifiers in meta data</link> sections.

New in version 4.0.3.

Gda.sql_identifier_split(id)
Parameters:id (str) – an SQL identifier
Returns:a new None-terminated array of strings, or None (use GLib.strfreev() to free the returned array)
Return type:[str] or None

Splits id into an array of it sub parts. id’s format has to be “<part>[.<part>[…]]” where each part is either a text surrounded by double quotes which can contain upper and lower cases or an SQL identifier in lower case.

For example the <![CDATA[“test."ATable"”]]> string will result in the array: {“test”, “"ATable"”, None}

Gda.sql_operation_operator_from_string(op)
Parameters:op (str) –
Return type:Gda.SqlOperatorType
Gda.sql_operation_operator_to_string(op)
Parameters:op (Gda.SqlOperatorType) –
Return type:str
Gda.sql_select_join_type_to_string(type)
Parameters:type (Gda.SqlSelectJoinType) –
Return type:str
Gda.string_to_binary(str)
Parameters:str (str or None) – a string to convert, or None
Returns:a new Gda.Binary if no error were found in str, or None otherwise
Return type:Gda.Binary

Performs the reverse of Gda.Binary.to_string() (note that for any “\xyz” succession of 4 characters where “xyz” represents a valid octal value, the resulting read value will be modulo 256).

I str is None, then an empty (i.e. where the data part is None) Gda.Binary is created and returned.

Gda.string_to_blob(str)
Parameters:str (str) – a string to convert
Returns:a new #gdaBlob if no error were found in str, or None otherwise
Return type:Gda.Blob

Performs the reverse of Gda.Blob.to_string().

Gda.text_to_alphanum(text)
Parameters:text (str) – the text to convert
Returns:a new string
Return type:str

The “encoding” consists in replacing non alphanumeric character with the string “__gdaXX” where XX is the hex. representation of the non alphanumeric str.

Gda.time_copy(boxed)
Parameters:boxed (object or None) –
Return type:object or None
Gda.time_free(boxed)
Parameters:boxed (object or None) –
Gda.timestamp_copy(boxed)
Parameters:boxed (object or None) –
Return type:object or None
Gda.timestamp_free(boxed)
Parameters:boxed (object or None) –
Gda.utility_check_data_model(model, types)
Parameters:
Returns:

True if the data model’s columns match the provided data types and number

Return type:

bool

Check the column types of a Gda.DataModel.

New in version 4.2.6.

Gda.utility_data_model_dump_data_to_xml(model, parent, cols, rows, use_col_ids)
Parameters:
  • model (Gda.DataModel) – a Gda.DataModel
  • parent (libxml2.NodePtr) – the parent XML node
  • cols ([int] or None) – an array containing which columns of model will be exported, or None for all columns
  • rows ([int] or None) – an array containing which rows of model will be exported, or None for all rows
  • use_col_ids (bool) – set to True to add column ID information
Returns:

True if no error occurred

Return type:

bool

Dump the data in a Gda.DataModel into a libxml2.NodePtr (as used in libxml).

Warning: this function uses a Gda.DataModelIter iterator, and if model does not offer a random access (check using Gda.DataModel.get_access_flags()), the iterator will be the same as normally used to access data in model previously to calling this method, and this iterator will be moved (point to another row).

Gda.utility_data_model_find_column_description(model, field_name)
Parameters:
Returns:

The field’s description, or None if description is not set

Return type:

str

Finds the description of a field into Metadata from a Gda.DataModel.

Gda.utility_holder_load_attributes(holder, node, sources)
Parameters:
Raises:

GLib.Error

Returns:

True if no error occurred

Return type:

bool

Note: this method may set the “source” custom string property

Gda.value_compare(value1, value2)
Parameters:
Returns:

if both values have the same type, returns 0 if both contain the same value, an integer less than 0 if value1 is less than value2 or an integer greater than 0 if value1 is greater than value2.

Return type:

int

Compares two values of the same type, with the exception that a value of any type can be compared to a GDA_TYPE_NULL value, specifically:

  • if value1 and value2 are both GDA_TYPE_NULL values then the returned value is 0
  • if value1 is a GDA_TYPE_NULL value and value2 is of another type then the returned value is -1
  • if value1 is of another type and value2 is a GDA_TYPE_NULL value then the returned value is 1
  • in all other cases, value1 and value2 must be of the same type and their values are compared
Gda.value_differ(value1, value2)
Parameters:
Returns:

a non 0 value if value1 and value2 differ, and 0 if they are equal

Return type:

int

Tells if two values are equal or not, by comparing memory representations. Unlike Gda.value_compare(), the returned value is boolean, and gives no idea about ordering.

The two values must be of the same type, with the exception that a value of any type can be compared to a GDA_TYPE_NULL value, specifically:

  • if value1 and value2 are both GDA_TYPE_NULL values then the returned value is 0
  • if value1 is a GDA_TYPE_NULL value and value2 is of another type then the returned value is 1
  • if value1 is of another type and value2 is a GDA_TYPE_NULL value then the returned value is 1
  • in all other cases, value1 and value2 must be of the same type and their values are compared
Gda.value_stringify(value)
Parameters:value (GObject.Value) – a GObject.Value.
Returns:a new string, or None if the conversion cannot be done. Free the value with a GLib.free() when you’ve finished using it.
Return type:str

Converts a GObject.Value to its string representation which is a human readable value. Note that the returned string does not take into account the current locale of the user (on the contrary to the Gda.DataHandler objects). Using this function should be limited to debugging and values serialization purposes.

Output is in the “C” locale for numbers, and dates are converted in a YYYY-MM-DD format.