Gda.QuarkList

Fields

None

Methods

class

new ()

class

new_from_string (string)

add_from_string (string, cleanup)

clear ()

copy ()

find (name)

foreach (func, *user_data)

free ()

protect_values ()

remove (name)

Details

class Gda.QuarkList
classmethod new()
Returns:

the newly created Gda.QuarkList.

Free-function: Gda.QuarkList.free

Return type:

Gda.QuarkList

Creates a new Gda.QuarkList, which is a set of key->value pairs, very similar to GLib’s GLib.HashTable, but with the only purpose to make easier the parsing and creation of data source connection strings.

classmethod new_from_string(string)
Parameters:

string (str) – a string.

Returns:

the newly created Gda.QuarkList.

Free-function: Gda.QuarkList.free

Return type:

Gda.QuarkList

Creates a new Gda.QuarkList given a string.

string must be a semi-colon separated list of “<key>=<value>” strings (for example “DB_NAME=notes;USERNAME=alfred”). Each key and value must respect the RFC 1738 recommendations: the

<>”#%{}|\^~[]’`;/?:@=& and space characters are replaced by “%%ab” where ab is the hexadecimal number corresponding to the character (for example the “DB_NAME=notes;USERNAME=al%%20fred” string will specify a username as “al fred”). If this formalism is not respected, then some unexpected results may occur.

add_from_string(string, cleanup)
Parameters:
  • string (str) – a string.

  • cleanup (bool) – whether to cleanup the previous content or not.

string must be a semi-colon separated list of “<key>=<value>” strings (for example “DB_NAME=notes;USERNAME=alfred”). Each key and value must respect the RFC 1738 recommendations: the

<>”#%{}|\^~[]’`;/?:@=& and space characters are replaced by “%%ab” where ab is the hexadecimal number corresponding to the character (for example the “DB_NAME=notes;USERNAME=al%%20fred” string will specify a username as “al fred”). If this formalism is not respected, then some unexpected results may occur.

Adds new key->value pairs from the given string. If cleanup is set to True, the previous contents will be discarded before adding the new pairs.

clear()

Removes all strings in the given Gda.QuarkList.

copy()
Returns:

a newly allocated Gda.QuarkList with a copy of the data in self.

Return type:

Gda.QuarkList

Creates a new Gda.QuarkList from an existing one.

find(name)
Parameters:

name (str) – the name of the value to search for.

Returns:

the value associated with the given key if found, or None if not found.

Return type:

str

Searches for the value identified by name in the given Gda.QuarkList. For protected values (authentification data), don’t forget to call Gda.QuarkList.protect_values() when you don’t need them anymore (when needed again, they will be unmangled again).

foreach(func, *user_data)
Parameters:
  • func (GLib.HFunc) – the function to call for each key/value pair

  • user_data (object or None) – user data to pass to the function

Calls the given function for each of the key/value pairs in self. The function is passed the key and value of each pair, and the given user_data parameter. self may not be modified while iterating over it.

free()

Releases all memory occupied by the given Gda.QuarkList.

protect_values()

Call this function to get rid of the clear version of the value associated to name.

New in version 5.2.0.

remove(name)
Parameters:

name (str) – an entry name.

Removes an entry from the Gda.QuarkList, given its name.