Gda.Config

g GObject.Object GObject.Object Gda.Config Gda.Config GObject.Object->Gda.Config

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

can_modify_system_config ()

class

define_dsn (info)

class

dsn_needs_authentication (dsn_name)

class

error_quark ()

class

get ()

class

get_dsn_info (dsn_name)

class

get_dsn_info_at_index (index)

class

get_dsn_info_index (dsn_name)

class

get_nb_dsn ()

class

get_provider (provider_name)

class

get_provider_info (provider_name)

class

list_dsn ()

class

list_providers ()

class

remove_dsn (dsn_name)

Virtual Methods

Inherited:

GObject.Object (7)

do_dsn_added (new_dsn)

do_dsn_changed (dsn)

do_dsn_removed (old_dsn)

do_dsn_to_be_removed (old_dsn)

Properties

Name

Type

Flags

Short Description

system-filename

str

r/w

File to use for system-wide DSN list

user-filename

str

r/w

File to use for per-user DSN list

Signals

Inherited:

GObject.Object (1)

Name

Short Description

dsn-added

Gets emitted whenever a new DSN has been defined

dsn-changed

Gets emitted whenever a DSN’s definition has been changed

dsn-removed

Gets emitted whenever a DSN has been removed

dsn-to-be-removed

Gets emitted whenever a DSN is about to be removed

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

object

GObject.Object

r

Class Details

class Gda.Config(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gda.ConfigClass

classmethod can_modify_system_config()
Returns:

True if system-wide configuration can be modified

Return type:

bool

Tells if the global (system) configuration can be modified (considering system permissions and settings)

classmethod define_dsn(info)
Parameters:

info (Gda.DsnInfo) – a pointer to a filled Gda.DsnInfo structure

Raises:

GLib.Error

Returns:

True if no error occurred

Return type:

bool

Add or update a DSN from the definition in info.

This method may fail with a %GDA_CONFIG_ERROR domain error (see the Gda.ConfigError error codes).

classmethod dsn_needs_authentication(dsn_name)
Parameters:

dsn_name (str) – the name of a DSN, in the “[<username>[:<password>]@]<DSN>” format

Returns:

True if an authentication is needed

Return type:

bool

Tells if the data source identified as dsn_name needs any authentication. If a <username> and optionally a <password> are specified, they are ignored.

classmethod error_quark()
Return type:

int

classmethod get()
Returns:

a non None pointer to the unique Gda.Config

Return type:

Gda.Config

Get a pointer to the global (unique) Gda.Config object. This functions increments the reference count of the object, so you need to call GObject.Object.unref() on it once finished.

classmethod get_dsn_info(dsn_name)
Parameters:

dsn_name (str) – the name of the DSN to look for

Returns:

a pointer to read-only Gda.DsnInfo structure, or None if not found

Return type:

Gda.DsnInfo

Get information about the DSN named dsn_name.

dsn_name's format is “[<username>[:<password>]@]<DSN>” (if <username> and optionally <password> are provided, they are ignored). Also see the Gda.dsn_split() utility function.

classmethod get_dsn_info_at_index(index)
Parameters:

index (int) – an index

Returns:

the pointer or None if no DSN exists at position index

Return type:

Gda.DsnInfo

Get a pointer to a read-only Gda.DsnInfo at the index position

classmethod get_dsn_info_index(dsn_name)
Parameters:

dsn_name (str) – a DSN

Returns:

the index or -1 if not found

Return type:

int

Get the index (starting at 0) of the DSN named dsn_name

classmethod get_nb_dsn()
Returns:

the number of defined DSN

Return type:

int

Get the number of defined DSN

classmethod get_provider(provider_name)
Parameters:

provider_name (str) – a database provider

Raises:

GLib.Error

Returns:

a pointer to the Gda.ServerProvider, or None if an error occurred

Return type:

Gda.ServerProvider

Get a pointer to the session-wide Gda.ServerProvider for the provider named provider_name. The caller must not call GObject.Object.unref() on the returned object.

This method may fail with a %GDA_CONFIG_ERROR domain error (see the Gda.ConfigError error codes).

classmethod get_provider_info(provider_name)
Parameters:

provider_name (str) – a database provider

Returns:

a pointer to read-only Gda.ProviderInfo structure, or None if not found

Return type:

Gda.ProviderInfo

Get some information about the a database provider (adapter) named

classmethod list_dsn()
Returns:

a new Gda.DataModel

Return type:

Gda.DataModel

Get a Gda.DataModel representing all the configured DSN, and keeping itself up to date with the changes in the declared DSN.

The returned data model is composed of the following columns:

  • DSN name

  • Provider name

  • Description

  • Connection string

  • Username if it exists

classmethod list_providers()
Returns:

a new Gda.DataModel

Return type:

Gda.DataModel

Get a Gda.DataModel representing all the installed database providers.

The returned data model is composed of the following columns:

  • Provider name

  • Description

  • DSN parameters

  • Authentication parameters

  • File name of the plugin

classmethod remove_dsn(dsn_name)
Parameters:

dsn_name (str) – the name of the DSN to remove

Raises:

GLib.Error

Returns:

True if no error occurred

Return type:

bool

Remove the DSN named dsn_name.

This method may fail with a %GDA_CONFIG_ERROR domain error (see the Gda.ConfigError error codes).

do_dsn_added(new_dsn) virtual
Parameters:

new_dsn (Gda.DsnInfo) –

do_dsn_changed(dsn) virtual
Parameters:

dsn (Gda.DsnInfo) –

do_dsn_removed(old_dsn) virtual
Parameters:

old_dsn (Gda.DsnInfo) –

do_dsn_to_be_removed(old_dsn) virtual
Parameters:

old_dsn (Gda.DsnInfo) –

Signal Details

Gda.Config.signals.dsn_added(config, new_dsn)
Signal Name:

dsn-added

Flags:

RUN_FIRST

Parameters:

Gets emitted whenever a new DSN has been defined

Gda.Config.signals.dsn_changed(config, dsn)
Signal Name:

dsn-changed

Flags:

RUN_FIRST

Parameters:

Gets emitted whenever a DSN’s definition has been changed

Gda.Config.signals.dsn_removed(config, old_dsn)
Signal Name:

dsn-removed

Flags:

RUN_FIRST

Parameters:

Gets emitted whenever a DSN has been removed

Gda.Config.signals.dsn_to_be_removed(config, old_dsn)
Signal Name:

dsn-to-be-removed

Flags:

RUN_FIRST

Parameters:

Gets emitted whenever a DSN is about to be removed

Property Details

Gda.Config.props.system_filename
Name:

system-filename

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

File to use for system-wide DSN list. When changed, the whole list of DSN will be reloaded.

Gda.Config.props.user_filename
Name:

user-filename

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

File to use for per-user DSN list. When changed, the whole list of DSN will be reloaded.