GdaClient

Name

GdaClient -- Database client access

Synopsis



struct      GdaClientPrivate;
GdaClient*  gda_client_new                  (void);
GdaConnection* gda_client_open_connection   (GdaClient *client,
                                             const gchar *dsn,
                                             const gchar *username,
                                             const gchar *password);
GdaConnection* gda_client_open_connection_from_string
                                            (GdaClient *client,
                                             const gchar *provider_id,
                                             const gchar *cnc_string);
const GList* gda_client_get_connection_list (GdaClient *client);
GdaConnection* gda_client_find_connection   (GdaClient *client,
                                             const gchar *dsn,
                                             const gchar *username,
                                             const gchar *password);
void        gda_client_close_all_connections
                                            (GdaClient *client);

Description

This class is the main entry point for libgda client applications. It provides the way by which client applications open connections.

Details

struct GdaClientPrivate

struct GdaClientPrivate;


gda_client_new ()

GdaClient*  gda_client_new                  (void);

Create a new GdaClient object, which is the entry point for libgda client applications. This object, once created, can be used for opening new database connections and activating other services available to GDA clients.

Returns : the newly created object.


gda_client_open_connection ()

GdaConnection* gda_client_open_connection   (GdaClient *client,
                                             const gchar *dsn,
                                             const gchar *username,
                                             const gchar *password);

Establish a connection to a data source.

This function is the most common way of opening database connections with libgda.

client : a GdaClient object.
dsn : data source name.
username : user name.
password : password for username.
Returns : the opened connection if successful, NULL if there is an error.


gda_client_open_connection_from_string ()

GdaConnection* gda_client_open_connection_from_string
                                            (GdaClient *client,
                                             const gchar *provider_id,
                                             const gchar *cnc_string);

Open a connection given a provider ID and a connection string. This allows applications to open connections without having to create a data source in the configuration. The format of cnc_string is similar to postgresql and mysql connection strings.

client : a GdaClient object.
provider_id : provider ID to connect to.
cnc_string : connection string.
Returns : the opened connection if successful, NULL if there is an error.


gda_client_get_connection_list ()

const GList* gda_client_get_connection_list (GdaClient *client);

Get the list of all open connections in the given GdaClient. The GList returned is an internal pointer, so DON'T TRY TO FREE IT.

client : a GdaClient object.
Returns : a GList of GdaConnection objects.


gda_client_find_connection ()

GdaConnection* gda_client_find_connection   (GdaClient *client,
                                             const gchar *dsn,
                                             const gchar *username,
                                             const gchar *password);

Look for an open connection given a data source name (per libgda configuration), a username and a password.

This function iterates over the list of open connections in the given GdaClient and looks for one that matches the given data source name, username and password.

client : a GdaClient object.
dsn : data source name.
username : user name.
password : password for username.
Returns : a pointer to the found connection, or NULL if it could not be found.


gda_client_close_all_connections ()

void        gda_client_close_all_connections
                                            (GdaClient *client);

Close all connections opened by the given GdaClient object.

client : a GdaClient object.

See Also

GdaConnection.