gda-config

Name

gda-config -- Functions to access the underlying configuration database

Synopsis



#define     GDA_CONFIG_SECTION_DATASOURCES
#define     GDA_CONFIG_SECTION_LAST_CONNECTIONS
#define     GDA_CONFIG_SECTION_LOG
#define     GDA_CONFIG_KEY_MAX_LAST_CONNECTIONS
gchar*      gda_config_get_string           (const gchar *path);
gint        gda_config_get_int              (const gchar *path);
gdouble     gda_config_get_float            (const gchar *path);
gboolean    gda_config_get_boolean          (const gchar *path);
void        gda_config_set_string           (const gchar *path,
                                             const gchar *new_value);
void        gda_config_set_int              (const gchar *path,
                                             gint new_value);
void        gda_config_set_float            (const gchar *path,
                                             gdouble new_value);
void        gda_config_set_boolean          (const gchar *path,
                                             gboolean new_value);
void        gda_config_remove_section       (const gchar *path);
void        gda_config_remove_key           (const gchar *path);
gboolean    gda_config_has_section          (const gchar *path);
gboolean    gda_config_has_key              (const gchar *path);
void        gda_config_commit               (void);
void        gda_config_rollback             (void);
GList*      gda_config_list_sections        (const gchar *path);
GList*      gda_config_list_keys            (const gchar *path);
void        gda_config_free_list            (GList *list);
#define     GDA_PROVIDER_TYPE               (srv)
#define     GDA_PROVIDER_NAME               (srv)
#define     GDA_PROVIDER_COMMENT            (srv)
#define     GDA_PROVIDER_LOCATION           (srv)
#define     GDA_PROVIDER_REPO_ID            (srv)
#define     GDA_PROVIDER_USERNAME           (srv)
#define     GDA_PROVIDER_HOSTNAME           (srv)
#define     GDA_PROVIDER_DOMAIN             (srv)
#define     GDA_PROVIDER_DSN_PARAMS         (srv)
GdaProvider* gda_provider_new               (void);
GdaProvider* gda_provider_copy              (GdaProvider *provider);
void        gda_provider_free               (GdaProvider *provider);
GList*      gda_provider_list               (void);
void        gda_provider_free_list          (GList *list);
GdaProvider* gda_provider_find_by_name      (const gchar *name);
GList*      gda_list_datasources            (void);
GList*      gda_list_datasources_for_provider
                                            (gchar *name);
#define     GDA_DSN_GDA_NAME                (dsn)
#define     GDA_DSN_PROVIDER                (dsn)
#define     GDA_DSN_DSN                     (dsn)
#define     GDA_DSN_DESCRIPTION             (dsn)
#define     GDA_DSN_USERNAME                (dsn)
#define     GDA_DSN_CONFIG                  (dsn)
#define     gda_dsn_new                     ()
void        gda_dsn_free                    (GdaDsn *dsn);
GdaDsn*     gda_dsn_copy                    (GdaDsn *dsn);
GdaDsn*     gda_dsn_find_by_name            (const gchar *dsn_name);
void        gda_dsn_set_name                (GdaDsn *dsn,
                                             const gchar *name);
void        gda_dsn_set_provider            (GdaDsn *dsn,
                                             const gchar *provider);
void        gda_dsn_set_dsn                 (GdaDsn *dsn,
                                             const gchar *dsn_str);
void        gda_dsn_set_description         (GdaDsn *dsn,
                                             const gchar *description);
void        gda_dsn_set_username            (GdaDsn *dsn,
                                             const gchar *username);
void        gda_dsn_set_config              (GdaDsn *dsn,
                                             const gchar *config);
void        gda_dsn_set_global              (GdaDsn *dsn,
                                             gboolean is_global);
gboolean    gda_dsn_save                    (GdaDsn *dsn);
gboolean    gda_dsn_remove                  (GdaDsn *dsn);
GList*      gda_dsn_list                    (void);
void        gda_dsn_free_list               (GList *list);
void        gda_config_save_last_connection (const gchar *gda_name,
                                             const gchar *username);

Description

This module provides an abstraction of all the access to the underlying configuration database. Currently, this means gda-config is just a wrapper around the GConf API, but we want to keep this design just in case we want later to change this (thus only having to change this module), as well as to allow other people to write their libgda implementations for other operating systems/environments.

Details

GDA_CONFIG_SECTION_DATASOURCES

#define GDA_CONFIG_SECTION_DATASOURCES       "/apps/gda/Datasources"


GDA_CONFIG_SECTION_LAST_CONNECTIONS

#define GDA_CONFIG_SECTION_LAST_CONNECTIONS  "/apps/gda/LastConnections"


GDA_CONFIG_SECTION_LOG

#define GDA_CONFIG_SECTION_LOG               "/apps/gda/Log"


GDA_CONFIG_KEY_MAX_LAST_CONNECTIONS

#define GDA_CONFIG_KEY_MAX_LAST_CONNECTIONS  "/apps/gda/MaxLastConnections"


gda_config_get_string ()

gchar*      gda_config_get_string           (const gchar *path);

Gets the value of the specified configuration entry as a string. You are then responsible to free the returned string


gda_config_get_int ()

gint        gda_config_get_int              (const gchar *path);

Gets the value of the specified configuration entry as an integer


gda_config_get_float ()

gdouble     gda_config_get_float            (const gchar *path);

Gets the value of the specified configuration entry as a float


gda_config_get_boolean ()

gboolean    gda_config_get_boolean          (const gchar *path);

Gets the value of the specified configuration entry as a boolean


gda_config_set_string ()

void        gda_config_set_string           (const gchar *path,
                                             const gchar *new_value);

Sets the given configuration entry to contain a string


gda_config_set_int ()

void        gda_config_set_int              (const gchar *path,
                                             gint new_value);

Sets the given configuration entry to contain an integer


gda_config_set_float ()

void        gda_config_set_float            (const gchar *path,
                                             gdouble new_value);

Sets the given configuration entry to contain a float


gda_config_set_boolean ()

void        gda_config_set_boolean          (const gchar *path,
                                             gboolean new_value);

Sets the given configuration entry to contain a boolean


gda_config_remove_section ()

void        gda_config_remove_section       (const gchar *path);

Remove the given section from the configuration database


gda_config_remove_key ()

void        gda_config_remove_key           (const gchar *path);

Remove the given entry from the configuration database


gda_config_has_section ()

gboolean    gda_config_has_section          (const gchar *path);

Checks whether the given section exists in the configuration system


gda_config_has_key ()

gboolean    gda_config_has_key              (const gchar *path);

Check whether the given key exists in the configuration system


gda_config_commit ()

void        gda_config_commit               (void);

Commits all changes made to the configuration system. This means that all buffered data (that is, modified data not yet written to the configuration database), if any, is actually written to disk


gda_config_rollback ()

void        gda_config_rollback             (void);

Discards all changes made to the configuration system.


gda_config_list_sections ()

GList*      gda_config_list_sections        (const gchar *path);

Return a GList containing the names of all the sections available under the given root directory.

To free the returned value, you can use gda_config_free_list


gda_config_list_keys ()

GList*      gda_config_list_keys            (const gchar *path);

Returns a list of all keys that exist under the given path.

To free the returned value, you can use gda_config_free_list


gda_config_free_list ()

void        gda_config_free_list            (GList *list);

Free all memory used by the given GList, which must be the return value from either gda_config_list_sections and gda_config_list_keys


GDA_PROVIDER_TYPE()

#define GDA_PROVIDER_TYPE(srv)       ((srv) ? (srv)->type : NULL)


GDA_PROVIDER_NAME()

#define GDA_PROVIDER_NAME(srv)       ((srv) ? (srv)->name : NULL)


GDA_PROVIDER_COMMENT()

#define GDA_PROVIDER_COMMENT(srv)    ((srv) ? (srv)->comment : NULL)


GDA_PROVIDER_LOCATION()

#define GDA_PROVIDER_LOCATION(srv)   ((srv) ? (srv)->location : NULL)


GDA_PROVIDER_REPO_ID()

#define GDA_PROVIDER_REPO_ID(srv)    ((srv) ? (srv)->repo_id : NULL)


GDA_PROVIDER_USERNAME()

#define GDA_PROVIDER_USERNAME(srv)   ((srv) ? (srv)->username : NULL)


GDA_PROVIDER_HOSTNAME()

#define GDA_PROVIDER_HOSTNAME(srv)   ((srv) ? (srv)->hostname : NULL)


GDA_PROVIDER_DOMAIN()

#define GDA_PROVIDER_DOMAIN(srv)     ((srv) ? (srv)->domain : NULL)


GDA_PROVIDER_DSN_PARAMS()

#define GDA_PROVIDER_DSN_PARAMS(srv) ((srv) ? (srv)->dsn_params : NULL)


gda_provider_new ()

GdaProvider* gda_provider_new               (void);

Allocates memory for a new GdaProvider object and initializes struct members.


gda_provider_copy ()

GdaProvider* gda_provider_copy              (GdaProvider *provider);

Make a deep copy of all the data needed to describe a GDA provider.


gda_provider_free ()

void        gda_provider_free               (GdaProvider *provider);

Frees the memory allocated with gda_provider_new and the memory allocated to struct members.


gda_provider_list ()

GList*      gda_provider_list               (void);

Searches the CORBA database for GDA providers and returns a Glist of GdaProvider structs.


gda_provider_free_list ()

void        gda_provider_free_list          (GList *list);

Frees a list of GdaProvider structures previously returned by a call to gda_provider_list


gda_provider_find_by_name ()

GdaProvider* gda_provider_find_by_name      (const gchar *name);

Returns a GdaProvider structure describing the given provider. This function searches all the providers present on your system and tries to find the specified provider.


gda_list_datasources ()

GList*      gda_list_datasources            (void);

Lists all datasources configured on the system. You can then call gda_config_free_list to free the returned list


gda_list_datasources_for_provider ()

GList*      gda_list_datasources_for_provider
                                            (gchar *name);

Returns a list of the names of all data sources set up for the given provider.


GDA_DSN_GDA_NAME()

#define GDA_DSN_GDA_NAME(dsn)    ((dsn) ? (dsn)->gda_name : 0)


GDA_DSN_PROVIDER()

#define GDA_DSN_PROVIDER(dsn)    ((dsn) ? (dsn)->provider : 0)


GDA_DSN_DSN()

#define GDA_DSN_DSN(dsn)         ((dsn) ? (dsn)->dsn_str : 0)


GDA_DSN_DESCRIPTION()

#define GDA_DSN_DESCRIPTION(dsn) ((dsn) ? (dsn)->description : 0)


GDA_DSN_USERNAME()

#define GDA_DSN_USERNAME(dsn)    ((dsn) ? (dsn)->username : 0)


GDA_DSN_CONFIG()

#define GDA_DSN_CONFIG(dsn)      ((dsn) ? (dsn)->config : 0)


gda_dsn_new()

#define  gda_dsn_new() g_new0(GdaDsn, 1)


gda_dsn_free ()

void        gda_dsn_free                    (GdaDsn *dsn);

Release all memory occupied by the given GdaDsn structure


gda_dsn_copy ()

GdaDsn*     gda_dsn_copy                    (GdaDsn *dsn);

Make an exact copy of the given GdaDsn structure.


gda_dsn_find_by_name ()

GdaDsn*     gda_dsn_find_by_name            (const gchar *dsn_name);

Search in the database for the given data source, and return detailed information about it


gda_dsn_set_name ()

void        gda_dsn_set_name                (GdaDsn *dsn,
                                             const gchar *name);

Set the name for the given GdaDsn structure


gda_dsn_set_provider ()

void        gda_dsn_set_provider            (GdaDsn *dsn,
                                             const gchar *provider);

Set the provider for the given GdaDsn structure


gda_dsn_set_dsn ()

void        gda_dsn_set_dsn                 (GdaDsn *dsn,
                                             const gchar *dsn_str);

Set the connection string for the given GdaDsn structure. This string is DBMS-independent, so you must take care when filling it in. The best way to guess about the allowed parameters in this string for each provider is to obtain the GdaProvider structure for the provider you want to use, and query the list of available parameters by calling the GDA_PROVIDER_DSN_PARAMS macro, which returns a GList on which each node is a string containing the name of one parameter.

For example, a connection string to connect to a PostgreSQL database might look like this:

"DATABASE=my_database;HOST=localhost

to connect to the database "my_database" at the local machine. On the other hand, a string for connecting a gda-default's database, might look like:

"DIRECTORY=/home/me/database"


gda_dsn_set_description ()

void        gda_dsn_set_description         (GdaDsn *dsn,
                                             const gchar *description);

Set the description string for the given GdaDsn structure.


gda_dsn_set_username ()

void        gda_dsn_set_username            (GdaDsn *dsn,
                                             const gchar *username);

Set the username for the given GdaDsn structure. When using this, the gda-client library would use this user name when you try to connect to this data source without specifying a user name in the call to gda_connection_open


gda_dsn_set_config ()

void        gda_dsn_set_config              (GdaDsn *dsn,
                                             const gchar *config);


gda_dsn_set_global ()

void        gda_dsn_set_global              (GdaDsn *dsn,
                                             gboolean is_global);


gda_dsn_save ()

gboolean    gda_dsn_save                    (GdaDsn *dsn);

Saves the given data source into the GDA configuration


gda_dsn_remove ()

gboolean    gda_dsn_remove                  (GdaDsn *dsn);

Remove the given data source (that is, the one described in the given GdaDsn structure) from the configuration database


gda_dsn_list ()

GList*      gda_dsn_list                    (void);

Returns a list of all available data sources. The returned value is a GList of GdaDsn structures


gda_dsn_free_list ()

void        gda_dsn_free_list               (GList *list);

Free the given list, which should be a list of GdaDsn structures, as returned by gda_dsn_list


gda_config_save_last_connection ()

void        gda_config_save_last_connection (const gchar *gda_name,
                                             const gchar *username);

Adds an entry to the 'Last Connections' configuration section. This section is read by top level clients, such as the GnomeDbLogin widget in GNOME-DB to show the user a list of the last successful connections.