![]() | ![]() | ![]() | libgda API reference | ![]() |
---|
GdaConnection* gda_connection_new (CORBA_ORB orb); GdaConnection* gda_connection_new_from_dsn (constgchar *dsn_name, constgchar *username, constgchar *password);void gda_connection_free (GdaConnection *cnc);void gda_connection_set_provider (GdaConnection *cnc,gchar *name); constgchar * 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, constgchar *dsn, constgchar *user, constgchar *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, constgchar *sql);gchar * gda_connection_xml2sql (GdaConnection *cnc, constgchar *xml);void gda_connection_add_listener (GdaConnection *cnc, GdaListener *listener);void gda_connection_remove_listener (GdaConnection *cnc, GdaListener *listener);
GdaConnection* gda_connection_new (CORBA_ORB orb);
Allocates space for a client side connection object
orb : | the ORB |
Returns : | the pointer to the allocated object |
GdaConnection* gda_connection_new_from_dsn (constgchar *dsn_name, constgchar *username, constgchar *password);
Creates a GdaConnection object from the configuration stored for the given data source.
dsn_name : | Data source name |
username : | User name |
password : | Password |
Returns : | an GdaConnection object already connected to the underlying database. |
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.
cnc : | the connection |
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
cnc : | connection object |
name : | name of the provider |
constgchar * gda_connection_get_provider (GdaConnection *cnc);
Retuns the provider used for this connection
cnc : | Connection object |
Returns : | a reference to the provider name |
gboolean gda_connection_supports (GdaConnection *cnc,GDA_Connection_Feature feature);
Return information on features supported by the underlying database system.
cnc : | the connection object |
feature : | feature to be tested |
Returns : | whether the requested feature is supported or not |
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
cnc : | the connection object |
dsn : | the DSN of the default database |
gint gda_connection_open (GdaConnection *cnc, constgchar *dsn, constgchar *user, constgchar *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.
cnc : | the connection object which describes the server and the database name to which the connection shuld be opened |
dsn : | The DSN of the database. Can be NULL. |
user : | The username for authentication to the database. Can be NULL. |
pwd : | The password for authentication to the database. Can be NULL. |
Returns : | 0 on success, -1 on error |
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.
cnc : | The connection object which should be closed |
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
cnc : | Connection object |
t : | Query type |
... : | Constraint values |
Returns : | The recordset which holds the results. |
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.
cnc : | Connection object |
t : | Query type |
Param3 : | |
Returns : | The recordset which holds the results. |
glong gda_connection_modify_schema (GdaConnection *cnc,GDA_Connection_QType t, ...);
cnc : | |
t : | |
... : | |
Returns : |
|
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.
cnc : | the connection object |
Returns : | a |
gint gda_connection_begin_transaction (GdaConnection *cnc);
Start a new transaction on cnc
cnc : | the connection object |
Returns : | 0 if everything is okay, -1 on error |
gint gda_connection_commit_transaction (GdaConnection *cnc);
Commit a pending transaction on cnc
cnc : | the connection object |
Returns : | 0 if everything is okay, -1 on error |
gint gda_connection_rollback_transaction (GdaConnection *cnc);
Abort and rollback a pending transaction on cnc
cnc : | the connection object |
Returns : | 0 if everything is okay, -1 on error |
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.
cnc : | the connection |
txt : | the statement to execute |
reccount : | a pointer to a gulong. The number of affected records is stored in the space where the pointer points to |
flags : | falgs (currently unused |
Returns : | a recordset on success or NULL on error. |
gint gda_connection_start_logging (GdaConnection *cnc,gchar *filename);
This function causes the server to log the statements it executes in filename.
cnc : | the connection |
filename : | the name of the logfile |
Returns : | -1 on error and 0 if everything is okay |
gint gda_connection_stop_logging (GdaConnection *cnc);
This function stops the database server logs
cnc : | the connection |
Returns : | -1 on error and 0 if everything is okay |
gchar * gda_connection_create_recordset (GdaConnection *cnc, GdaRecordset *rs);
cnc : | |
rs : | |
Returns : |
|
gint gda_connection_corba_exception (GdaConnection *cnc,CORBA_Environment *ev);
cnc : | |
ev : | |
Returns : |
|
void gda_connection_add_single_error (GdaConnection *cnc, GdaError *error);
cnc : | a connection |
error : | error object |
void gda_connection_add_error_list (GdaConnection *cnc,GList *list);
cnc : | |
list : |
|
#define gda_connection_is_open(cnc) ((cnc) ? GDA_CONNECTION(cnc)->is_open : FALSE)
cnc : |
|
#define gda_connection_get_dsn(cnc) ((cnc) ? GDA_CONNECTION(cnc)->database : 0)
cnc : |
|
#define gda_connection_get_user(cnc) ((cnc) ? GDA_CONNECTION(cnc)->user : 0)
cnc : |
|
#define gda_connection_get_password(cnc) ((cnc) ? GDA_CONNECTION(cnc)->passwd : 0)
cnc : |
|
gchar * gda_connection_get_version (GdaConnection *cnc);
Get the version number of the underlying provider
cnc : | connection |
Returns : |
|
gchar * gda_connection_sql2xml (GdaConnection *cnc, constgchar *sql);
Converts the given SQL command to a
cnc : | connection |
sql : | SQL string |
Returns : |
|
gchar * gda_connection_xml2sql (GdaConnection *cnc, constgchar *xml);
Converts the given
cnc : | connection |
xml : | |
Returns : |
|
void gda_connection_add_listener (GdaConnection *cnc, GdaListener *listener);
cnc : | |
listener : |
|
void gda_connection_remove_listener (GdaConnection *cnc, GdaListener *listener);
cnc : | |
listener : |
|
<<< GdaConnectionPool | GdaExport >>> |