GdaConnection

Name

GdaConnection -- Connection management

Synopsis



GdaConnection* gda_connection_new           (CORBA_ORB orb);
GdaConnection* gda_connection_new_from_dsn  (const gchar *dsn_name,
                                             const gchar *username,
                                             const gchar *password);
void        gda_connection_free             (GdaConnection *cnc);
void        gda_connection_set_provider     (GdaConnection *cnc,
                                             gchar *name);
const gchar* gda_connection_get_provider    (GdaConnection *cnc);
gboolean    gda_connection_supports         (GdaConnection *cnc,
                                             GDA_Connection_Feature feature);
void        gda_connection_set_default_db   (GdaConnection *cnc,
                                             gchar *dsn);
gint        gda_connection_open             (GdaConnection *cnc,
                                             const gchar *dsn,
                                             const gchar *user,
                                             const gchar *pwd);
void        gda_connection_close            (GdaConnection *cnc);
GdaRecordset* gda_connection_open_schema    (GdaConnection *cnc,
                                             GDA_Connection_QType t,
                                             ...);
GdaRecordset* gda_connection_open_schema_array
                                            (GdaConnection *cnc,
                                             GDA_Connection_QType t,
                                             GdaConstraint_Element*);
glong       gda_connection_modify_schema    (GdaConnection *cnc,
                                             GDA_Connection_QType t,
                                             ...);
GList*      gda_connection_get_errors       (GdaConnection *cnc);
gint        gda_connection_begin_transaction
                                            (GdaConnection *cnc);
gint        gda_connection_commit_transaction
                                            (GdaConnection *cnc);
gint        gda_connection_rollback_transaction
                                            (GdaConnection *cnc);
GdaRecordset* gda_connection_execute        (GdaConnection *cnc,
                                             gchar *txt,
                                             gulong *reccount,
                                             gulong flags);
gint        gda_connection_start_logging    (GdaConnection *cnc,
                                             gchar *filename);
gint        gda_connection_stop_logging     (GdaConnection *cnc);
gchar*      gda_connection_create_recordset (GdaConnection *cnc,
                                             GdaRecordset *rs);
gint        gda_connection_corba_exception  (GdaConnection *cnc,
                                             CORBA_Environment *ev);
void        gda_connection_add_single_error (GdaConnection *cnc,
                                             GdaError *error);
void        gda_connection_add_error_list   (GdaConnection *cnc,
                                             GList *list);
#define     gda_connection_is_open          (cnc)
#define     gda_connection_get_dsn          (cnc)
#define     gda_connection_get_user         (cnc)
#define     gda_connection_get_password     (cnc)
gchar*      gda_connection_get_version      (GdaConnection *cnc);
gchar*      gda_connection_sql2xml          (GdaConnection *cnc,
                                             const gchar *sql);
gchar*      gda_connection_xml2sql          (GdaConnection *cnc,
                                             const gchar *xml);
void        gda_connection_add_listener     (GdaConnection *cnc,
                                             GdaListener *listener);
void        gda_connection_remove_listener  (GdaConnection *cnc,
                                             GdaListener *listener);

Object Hierarchy


  GtkObject
   +----GdaConnection

Signal Prototypes


"error"     void        user_function      (GdaConnection *gdaconnection,
                                            gpointer arg1,
                                            gpointer user_data);
"warning"   void        user_function      (GdaConnection *gdaconnection,
                                            gpointer arg1,
                                            gpointer user_data);
"open"      void        user_function      (GdaConnection *gdaconnection,
                                            gpointer user_data);
"close"     void        user_function      (GdaConnection *gdaconnection,
                                            gpointer user_data);

Description

Details

gda_connection_new ()

GdaConnection* gda_connection_new           (CORBA_ORB orb);

Allocates space for a client side connection object


gda_connection_new_from_dsn ()

GdaConnection* gda_connection_new_from_dsn  (const gchar *dsn_name,
                                             const gchar *username,
                                             const gchar *password);

Creates a GdaConnection object from the configuration stored for the given data source.


gda_connection_free ()

void        gda_connection_free             (GdaConnection *cnc);

If the connection is open the connection is closed and all associated objects (commands, recordsets, errors) are deleted. The memory is freed. The connection object cannot be used any more.


gda_connection_set_provider ()

void        gda_connection_set_provider     (GdaConnection *cnc,
                                             gchar *name);

Registers name as the provider for this connection. This should be the id of the CORBA server to use


gda_connection_get_provider ()

const gchar* gda_connection_get_provider    (GdaConnection *cnc);

Retuns the provider used for this connection


gda_connection_supports ()

gboolean    gda_connection_supports         (GdaConnection *cnc,
                                             GDA_Connection_Feature feature);

Return information on features supported by the underlying database system.


gda_connection_set_default_db ()

void        gda_connection_set_default_db   (GdaConnection *cnc,
                                             gchar *dsn);

Registers the DSN as the name of the default DB to access when the connection is opened


gda_connection_open ()

gint        gda_connection_open             (GdaConnection *cnc,
                                             const gchar *dsn,
                                             const gchar *user,
                                             const gchar *pwd);

The function activates the correct CORBA server (defined with the #gda_connection_set_provider() function. Then it tries to open the database using the DSN or the default database as a data source. If user or pwd is not NULL, it will overwrite the appropriate entry in the DSN passed as par2. Entries in the DSN have the form <key> = <value> seperated from the database name . Currently the DSN is not parsed.


gda_connection_close ()

void        gda_connection_close            (GdaConnection *cnc);

Closes the connection object and all associated GdaRecordset objects. GdaCommand objects are not closed, but can't be used anymore. Transactions pending on this objects are aborted and an error is returned.


gda_connection_open_schema ()

GdaRecordset* gda_connection_open_schema    (GdaConnection *cnc,
                                             GDA_Connection_QType t,
                                             ...);

Retrieves meta data about the data source to which the connection object is connected. The constraints is a list of enum/string pairs. The end of the list must be marked by the special value GDA_Connection_no_CONSTRAINT


gda_connection_open_schema_array ()

GdaRecordset* gda_connection_open_schema_array
                                            (GdaConnection *cnc,
                                             GDA_Connection_QType t,
                                             GdaConstraint_Element*);

Retrieves meta data about the data source to which the connection object is connected. The elems is an array of Constraint_Element item. The last item must have it's type element set to GDA_Connection_no_CONSTRAINT If elems is NULL, no constraints are used.


gda_connection_modify_schema ()

glong       gda_connection_modify_schema    (GdaConnection *cnc,
                                             GDA_Connection_QType t,
                                             ...);


gda_connection_get_errors ()

GList*      gda_connection_get_errors       (GdaConnection *cnc);

Returns a list of all errors for this connection object. This function also clears the error list. The errors are stored in LIFO order, so the last error which happend is stored as the first element in the list. Advancing the list means to get back in time and retrieve earlier errors.

The farther away from the client the error happens, the later it is in the queue. If an error happens on the client and then in the CORBA layer and then on the server, you will get the server error first.


gda_connection_begin_transaction ()

gint        gda_connection_begin_transaction
                                            (GdaConnection *cnc);

Start a new transaction on cnc


gda_connection_commit_transaction ()

gint        gda_connection_commit_transaction
                                            (GdaConnection *cnc);

Commit a pending transaction on cnc


gda_connection_rollback_transaction ()

gint        gda_connection_rollback_transaction
                                            (GdaConnection *cnc);

Abort and rollback a pending transaction on cnc


gda_connection_execute ()

GdaRecordset* gda_connection_execute        (GdaConnection *cnc,
                                             gchar *txt,
                                             gulong *reccount,
                                             gulong flags);

Executes txt. An internal GdaCommand object is used for execution. This command object is destroyed automatically after the commadn has finished.


gda_connection_start_logging ()

gint        gda_connection_start_logging    (GdaConnection *cnc,
                                             gchar *filename);

This function causes the server to log the statements it executes in filename.


gda_connection_stop_logging ()

gint        gda_connection_stop_logging     (GdaConnection *cnc);

This function stops the database server logs


gda_connection_create_recordset ()

gchar*      gda_connection_create_recordset (GdaConnection *cnc,
                                             GdaRecordset *rs);


gda_connection_corba_exception ()

gint        gda_connection_corba_exception  (GdaConnection *cnc,
                                             CORBA_Environment *ev);


gda_connection_add_single_error ()

void        gda_connection_add_single_error (GdaConnection *cnc,
                                             GdaError *error);


gda_connection_add_error_list ()

void        gda_connection_add_error_list   (GdaConnection *cnc,
                                             GList *list);


gda_connection_is_open()

#define            gda_connection_is_open(cnc)        ((cnc) ? GDA_CONNECTION(cnc)->is_open : FALSE)


gda_connection_get_dsn()

#define            gda_connection_get_dsn(cnc)        ((cnc) ? GDA_CONNECTION(cnc)->database : 0)


gda_connection_get_user()

#define            gda_connection_get_user(cnc)       ((cnc) ? GDA_CONNECTION(cnc)->user : 0)


gda_connection_get_password()

#define            gda_connection_get_password(cnc)   ((cnc) ? GDA_CONNECTION(cnc)->passwd : 0)


gda_connection_get_version ()

gchar*      gda_connection_get_version      (GdaConnection *cnc);

Get the version number of the underlying provider


gda_connection_sql2xml ()

gchar*      gda_connection_sql2xml          (GdaConnection *cnc,
                                             const gchar *sql);

Converts the given SQL command to a GdaXmlQuery


gda_connection_xml2sql ()

gchar*      gda_connection_xml2sql          (GdaConnection *cnc,
                                             const gchar *xml);

Converts the given GdaXmlQuery to a SQL string for the underlying provider


gda_connection_add_listener ()

void        gda_connection_add_listener     (GdaConnection *cnc,
                                             GdaListener *listener);


gda_connection_remove_listener ()

void        gda_connection_remove_listener  (GdaConnection *cnc,
                                             GdaListener *listener);

Signals

The "error" signal

void        user_function                  (GdaConnection *gdaconnection,
                                            gpointer arg1,
                                            gpointer user_data);


The "warning" signal

void        user_function                  (GdaConnection *gdaconnection,
                                            gpointer arg1,
                                            gpointer user_data);


The "open" signal

void        user_function                  (GdaConnection *gdaconnection,
                                            gpointer user_data);


The "close" signal

void        user_function                  (GdaConnection *gdaconnection,
                                            gpointer user_data);