Configuration

Configuration — Access/Management of libgda configuration

Synopsis




                    GdaConfig;
GdaConfig*          gda_config_get                      (void);

                    GdaDataSourceInfo;
GdaDataSourceInfo*  gda_config_get_dsn                  (const gchar *dsn_name);
gboolean            gda_config_define_dsn               (const GdaDataSourceInfo *info,
                                                         GError **error);
gboolean            gda_config_remove_dsn               (const gchar *dsn_name,
                                                         GError **error);
GdaDataModel*       gda_config_list_dsn                 (void);
gint                gda_config_get_nb_dsn               (void);
gint                gda_config_get_dsn_index            (const gchar *dsn_name);
GdaDataSourceInfo*  gda_config_get_dsn_at_index         (gint index);
gboolean            gda_config_can_modify_system_config (void);

                    GdaProviderInfo;
GdaProviderInfo*    gda_config_get_provider_info        (const gchar *provider_name);
GdaServerProvider*  gda_config_get_provider_object      (const gchar *provider_name,
                                                         GError **error);
GdaDataModel*       gda_config_list_providers           (void);

Object Hierarchy


  GObject
   +----GdaConfig

Properties


  "system-file"              gchararray            : Read / Write
  "user-file"                gchararray            : Read / Write

Signals


  "dsn-added"                                      : Run First
  "dsn-changed"                                    : Run First
  "dsn-removed"                                    : Run First
  "dsn-to-be-removed"                              : Run First

Description

The functions in this section allow applications an easy access to the libgda configuration, thus making them able to access the list of data sources configured in the system, for instance.

Upon initialization, a single instance GdaConfig object is created, and no other will need to be created. A pointer to this object can be obtained with gda_config_get().

Details

GdaConfig

typedef struct _GdaConfig GdaConfig;


gda_config_get ()

GdaConfig*          gda_config_get                      (void);

Get a pointer to the global GdaConfig object

Returns : a non NULL pointer to a GdaConfig

GdaDataSourceInfo

typedef struct {
        gchar    *name;
        gchar    *provider;
        gchar    *description;
        gchar    *cnc_string;
        gchar    *auth_string;
        gboolean  is_system;
} GdaDataSourceInfo;


gda_config_get_dsn ()

GdaDataSourceInfo*  gda_config_get_dsn                  (const gchar *dsn_name);

Get information about the DSN named dsn_name

dsn_name : the name of the DSN to look for
Returns : a a pointer to read-only GdaDataSourceInfo structure, or NULL if not found

gda_config_define_dsn ()

gboolean            gda_config_define_dsn               (const GdaDataSourceInfo *info,
                                                         GError **error);

Add or update a DSN from the definition in info

info : a pointer to a filled GdaDataSourceInfo structure
error : a place to store errors, or NULL
Returns : TRUE if no error occurred

gda_config_remove_dsn ()

gboolean            gda_config_remove_dsn               (const gchar *dsn_name,
                                                         GError **error);

Add or update a DSN from the definition in info

dsn_name : the name of the DSN to remove
error : a place to store errors, or NULL
Returns : TRUE if no error occurred

gda_config_list_dsn ()

GdaDataModel*       gda_config_list_dsn                 (void);

Get a GdaDataModel 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

Returns : a new GdaDataModel

gda_config_get_nb_dsn ()

gint                gda_config_get_nb_dsn               (void);

Get the number of defined DSN

Return: the number of defined DSN

Returns :

gda_config_get_dsn_index ()

gint                gda_config_get_dsn_index            (const gchar *dsn_name);

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

dsn_name :
Returns : the index or -1 if not found

gda_config_get_dsn_at_index ()

GdaDataSourceInfo*  gda_config_get_dsn_at_index         (gint index);

Get a pointer to a read-only GdaDataSourceInfo at the index position

index :
Returns : the pointer or NULL if no DSN exists at position index

gda_config_can_modify_system_config ()

gboolean            gda_config_can_modify_system_config (void);

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

Returns : TRUE if system-wide configuration can be modified

GdaProviderInfo

typedef struct {
        gchar             *id;
        gchar             *location;
        gchar             *description;
        GdaSet            *dsn_params;  /* Specs to create a DSN */
	GdaSet            *auth_params; /* Specs to authenticate a client */
} GdaProviderInfo;


gda_config_get_provider_info ()

GdaProviderInfo*    gda_config_get_provider_info        (const gchar *provider_name);

Get some information about the a database provider (adaptator) named provider_name

provider_name :
Returns : a pointer to read-only GdaProviderInfo structure, or NULL if not found

gda_config_get_provider_object ()

GdaServerProvider*  gda_config_get_provider_object      (const gchar *provider_name,
                                                         GError **error);

Get a pointer to the session-wide GdaServerProvider for the provider named provider_name

provider_name :
error : a place to store errors, or NULL
Returns : a pointer to the GdaServerProvider, or NULL if an error occurred

gda_config_list_providers ()

GdaDataModel*       gda_config_list_providers           (void);

Get a GdaDataModel representing all the installed database providers.

The returned data model is composed of the following columns:

  • Provider name

  • Description

  • DSN parameters

  • Authentification parameters

  • File

Returns : a new GdaDataModel

Property Details

The "system-file" property

  "system-file"              gchararray            : Read / Write

Default value: NULL


The "user-file" property

  "user-file"                gchararray            : Read / Write

Default value: NULL

Signal Details

The "dsn-added" signal

void                user_function                      (GdaConfig *gdaconfig,
                                                        gpointer   arg1,
                                                        gpointer   user_data)      : Run First

gdaconfig : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.

The "dsn-changed" signal

void                user_function                      (GdaConfig *gdaconfig,
                                                        gpointer   arg1,
                                                        gpointer   user_data)      : Run First

gdaconfig : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.

The "dsn-removed" signal

void                user_function                      (GdaConfig *gdaconfig,
                                                        gpointer   arg1,
                                                        gpointer   user_data)      : Run First

gdaconfig : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.

The "dsn-to-be-removed" signal

void                user_function                      (GdaConfig *gdaconfig,
                                                        gpointer   arg1,
                                                        gpointer   user_data)      : Run First

gdaconfig : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.