Misc API

Misc API — Methods dedicated to implementing providers

Synopsis

GdaSqlParser*       gda_server_provider_internal_get_parser
                                                        (GdaServerProvider *prov);

gboolean            gda_server_provider_perform_operation_default
                                                        (GdaServerProvider *provider,
                                                         GdaConnection *cnc,
                                                         GdaServerOperation *op,
                                                         GError **error);
GdaDataHandler*     gda_server_provider_get_data_handler_default
                                                        (GdaServerProvider *provider,
                                                         GdaConnection *cnc,
                                                         GType type,
                                                         const gchar *dbms_type);

GdaDataHandler*     gda_server_provider_handler_find    (GdaServerProvider *prov,
                                                         GdaConnection *cnc,
                                                         GType g_type,
                                                         const gchar *dbms_type);
void                gda_server_provider_handler_declare (GdaServerProvider *prov,
                                                         GdaDataHandler *dh,
                                                         GdaConnection *cnc,
                                                         GType g_type,
                                                         const gchar *dbms_type);

gchar*              gda_server_provider_find_file       (GdaServerProvider *prov,
                                                         const gchar *inst_dir,
                                                         const gchar *filename);
gchar*              gda_server_provider_load_file_contents
                                                        (const gchar *inst_dir,
                                                         const gchar *data_dir,
                                                         const gchar *filename);

void                gda_connection_internal_set_provider_data
                                                        (GdaConnection *cnc,
                                                         gpointer data,
                                                         GDestroyNotify destroy_func);
gpointer            gda_connection_internal_get_provider_data
                                                        (GdaConnection *cnc);
void                gda_virtual_connection_internal_set_provider_data
                                                        (GdaVirtualConnection *vcnc,
                                                         gpointer data,
                                                         GDestroyNotify destroy_func);
gpointer            gda_virtual_connection_internal_get_provider_data
                                                        (GdaVirtualConnection *cnc);

void                gda_connection_add_event            (GdaConnection *cnc,
                                                         GdaConnectionEvent *event);
GdaConnectionEvent* gda_connection_add_event_string     (GdaConnection *cnc,
                                                         const gchar *str,
                                                         ...);
void                gda_connection_clear_events_list    (GdaConnection *cnc);
GdaConnectionEvent* gda_connection_event_new            (GdaConnectionEventType type);
void                gda_connection_event_set_event_type (GdaConnectionEvent *event,
                                                         GdaConnectionEventType type);
void                gda_connection_event_set_description
                                                        (GdaConnectionEvent *event,
                                                         const gchar *description);
void                gda_connection_event_set_code       (GdaConnectionEvent *event,
                                                         glong code);
void                gda_connection_event_set_gda_code   (GdaConnectionEvent *event,
                                                         GdaConnectionEventCode code);
void                gda_connection_event_set_source     (GdaConnectionEvent *event,
                                                         const gchar *source);
void                gda_connection_event_set_sqlstate   (GdaConnectionEvent *event,
                                                         const gchar *sqlstate);

void                gda_connection_add_prepared_statement
                                                        (GdaConnection *cnc,
                                                         GdaStatement *gda_stmt,
                                                         GdaPStmt *prepared_stmt);
void                gda_connection_del_prepared_statement
                                                        (GdaConnection *cnc,
                                                         GdaStatement *gda_stmt);
GdaPStmt*           gda_connection_get_prepared_statement
                                                        (GdaConnection *cnc,
                                                         GdaStatement *gda_stmt);

void                gda_connection_internal_transaction_started
                                                        (GdaConnection *cnc,
                                                         const gchar *parent_trans,
                                                         const gchar *trans_name,
                                                         GdaTransactionIsolation isol_level);
void                gda_connection_internal_transaction_rolledback
                                                        (GdaConnection *cnc,
                                                         const gchar *trans_name);
void                gda_connection_internal_transaction_committed
                                                        (GdaConnection *cnc,
                                                         const gchar *trans_name);
void                gda_connection_internal_statement_executed
                                                        (GdaConnection *cnc,
                                                         GdaStatement *stmt,
                                                         GdaSet *params,
                                                         GdaConnectionEvent *error);
void                gda_connection_internal_savepoint_added
                                                        (GdaConnection *cnc,
                                                         const gchar *parent_trans,
                                                         const gchar *svp_name);
void                gda_connection_internal_savepoint_rolledback
                                                        (GdaConnection *cnc,
                                                         const gchar *svp_name);
void                gda_connection_internal_savepoint_removed
                                                        (GdaConnection *cnc,
                                                         const gchar *svp_name);
void                gda_connection_internal_change_transaction_state
                                                        (GdaConnection *cnc,
                                                         GdaTransactionStatusState newstate);

Description

The methods mentionned in this section are reserved for database providers implementatins and should not bu used by developers outside that scope.

Details

gda_server_provider_internal_get_parser ()

GdaSqlParser*       gda_server_provider_internal_get_parser
                                                        (GdaServerProvider *prov);

This is a factory method to get a unique instance of a GdaSqlParser object for each GdaServerProvider object Don't unref() it.

prov :

Returns :

a GdaSqlParser

gda_server_provider_perform_operation_default ()

gboolean            gda_server_provider_perform_operation_default
                                                        (GdaServerProvider *provider,
                                                         GdaConnection *cnc,
                                                         GdaServerOperation *op,
                                                         GError **error);

Performs the operation described by op, using the SQL from the rendering of the operation

provider :

a GdaServerProvider object

cnc :

a GdaConnection object which will be used to perform an action, or NULL

op :

a GdaServerOperation object

error :

a place to store an error, or NULL

Returns :

TRUE if no error occurred

gda_server_provider_get_data_handler_default ()

GdaDataHandler*     gda_server_provider_get_data_handler_default
                                                        (GdaServerProvider *provider,
                                                         GdaConnection *cnc,
                                                         GType type,
                                                         const gchar *dbms_type);

Provides the implementation when the default Libgda's data handlers must be used

provider :

a server provider.

cnc :

a GdaConnection object, or NULL

type :

dbms_type :

a DBMS type definition

Returns :

a GdaDataHandler, or NULL

gda_server_provider_handler_find ()

GdaDataHandler*     gda_server_provider_handler_find    (GdaServerProvider *prov,
                                                         GdaConnection *cnc,
                                                         GType g_type,
                                                         const gchar *dbms_type);

prov :

cnc :

g_type :

dbms_type :

Returns :


gda_server_provider_handler_declare ()

void                gda_server_provider_handler_declare (GdaServerProvider *prov,
                                                         GdaDataHandler *dh,
                                                         GdaConnection *cnc,
                                                         GType g_type,
                                                         const gchar *dbms_type);

prov :

dh :

cnc :

g_type :

dbms_type :


gda_server_provider_find_file ()

gchar*              gda_server_provider_find_file       (GdaServerProvider *prov,
                                                         const gchar *inst_dir,
                                                         const gchar *filename);

prov :

inst_dir :

filename :

Returns :


gda_server_provider_load_file_contents ()

gchar*              gda_server_provider_load_file_contents
                                                        (const gchar *inst_dir,
                                                         const gchar *data_dir,
                                                         const gchar *filename);

inst_dir :

data_dir :

filename :

Returns :


gda_connection_internal_set_provider_data ()

void                gda_connection_internal_set_provider_data
                                                        (GdaConnection *cnc,
                                                         gpointer data,
                                                         GDestroyNotify destroy_func);

Note: calling this function more than once will not make it call destroy_func on any previously set opaque data, you'll have to do it yourself.

cnc :

a GdaConnection object

data :

an opaque structure, known only to the provider for which cnc is opened

destroy_func :

function to call when the connection closes and data needs to be destroyed

gda_connection_internal_get_provider_data ()

gpointer            gda_connection_internal_get_provider_data
                                                        (GdaConnection *cnc);

Get the opaque pointer previously set using gda_connection_internal_set_provider_data(). If it's not set, then add a connection event and returns NULL

cnc :

a GdaConnection object

Returns :

the pointer to the opaque structure set using gda_connection_internal_set_provider_data()

gda_virtual_connection_internal_set_provider_data ()

void                gda_virtual_connection_internal_set_provider_data
                                                        (GdaVirtualConnection *vcnc,
                                                         gpointer data,
                                                         GDestroyNotify destroy_func);

Note: calling this function more than once will not make it call destroy_func on any previously set opaque data, you'll have to do it yourself.

vcnc :

data :

destroy_func :


gda_virtual_connection_internal_get_provider_data ()

gpointer            gda_virtual_connection_internal_get_provider_data
                                                        (GdaVirtualConnection *cnc);

Get the opaque pointer previously set using gda_virtual_connection_internal_set_provider_data(). If it's not set, then add a connection event and returns NULL

cnc :

Returns :


gda_connection_add_event ()

void                gda_connection_add_event            (GdaConnection *cnc,
                                                         GdaConnectionEvent *event);

Adds an event to the given connection. This function is usually called by providers, to inform clients of events that happened during some operation.

As soon as a provider (or a client, it does not matter) calls this function with an event object which is an error, the connection object emits the "error" signal, to which clients can connect to be informed of events.

WARNING: the reference to the event object is stolen by this function!

cnc :

a GdaConnection object.

event :

is stored internally, so you don't need to unref it.

gda_connection_add_event_string ()

GdaConnectionEvent* gda_connection_add_event_string     (GdaConnection *cnc,
                                                         const gchar *str,
                                                         ...);

Adds a new error to the given connection object. This is just a convenience function that simply creates a GdaConnectionEvent and then calls gda_server_connection_add_error.

cnc :

a GdaConnection object.

str :

a format string (see the printf(3) documentation).

... :

the arguments to insert in the error message.

Returns :

a new GdaConnectionEvent object, however the caller does not hold a reference to the returned object, and if need be the caller must call g_object_ref() on it.

gda_connection_clear_events_list ()

void                gda_connection_clear_events_list    (GdaConnection *cnc);

This function lets you clear the list of GdaConnectionEvent's of the given connection.

cnc :

a GdaConnection object.

gda_connection_event_new ()

GdaConnectionEvent* gda_connection_event_new            (GdaConnectionEventType type);

type :

Returns :


gda_connection_event_set_event_type ()

void                gda_connection_event_set_event_type (GdaConnectionEvent *event,
                                                         GdaConnectionEventType type);

Sets event's severity (from a simple notice to a fatal event) This function should not be called directly.

event :

a GdaConnectionEvent object

type :

the severity of the event

gda_connection_event_set_description ()

void                gda_connection_event_set_description
                                                        (GdaConnectionEvent *event,
                                                         const gchar *description);

Sets event's description. This function should not be called directly.

event :

a GdaConnectionEvent.

description :

a description.

gda_connection_event_set_code ()

void                gda_connection_event_set_code       (GdaConnectionEvent *event,
                                                         glong code);

Sets event's code: the code is specific to the provider being used. If you want to have a common understanding of the event codes, use gda_connection_event_get_gda_code() instead.

This function should not be called directly

event :

a GdaConnectionEvent.

code :

a code.

gda_connection_event_set_gda_code ()

void                gda_connection_event_set_gda_code   (GdaConnectionEvent *event,
                                                         GdaConnectionEventCode code);

Sets event's gda code: that code is standardized by the libgda library. If you want to specify the corresponding provider specific code, use gda_connection_event_get_code() or gda_connection_event_get_sqlstate() instead.

This function should not be called directly

event :

a GdaConnectionEvent

code :

a code

gda_connection_event_set_source ()

void                gda_connection_event_set_source     (GdaConnectionEvent *event,
                                                         const gchar *source);

Sets event's source; this function should not be called directly

event :

a GdaConnectionEvent.

source :

a source.

gda_connection_event_set_sqlstate ()

void                gda_connection_event_set_sqlstate   (GdaConnectionEvent *event,
                                                         const gchar *sqlstate);

Changes the SQLSTATE code of event, this function should not be called directly

Sets event's SQL state.

event :

a GdaConnectionEvent.

sqlstate :

SQL state.

gda_connection_add_prepared_statement ()

void                gda_connection_add_prepared_statement
                                                        (GdaConnection *cnc,
                                                         GdaStatement *gda_stmt,
                                                         GdaPStmt *prepared_stmt);

Declares that prepared_stmt is a prepared statement object associated to gda_stmt within the connection (meaning the connection increments the reference counter of prepared_stmt).

If gda_stmt changes or is destroyed, the the association will be lost and the connection will lose the reference it has on prepared_stmt.

cnc :

a GdaConnection object

gda_stmt :

a GdaStatement object

prepared_stmt :

a prepared statement object (as a GdaPStmt object, or more likely a descendant)

gda_connection_del_prepared_statement ()

void                gda_connection_del_prepared_statement
                                                        (GdaConnection *cnc,
                                                         GdaStatement *gda_stmt);

Removes any prepared statement associated to gda_stmt in cnc: this undoes what gda_connection_add_prepared_statement() does.

cnc :

a GdaConnection object

gda_stmt :

a GdaStatement object

gda_connection_get_prepared_statement ()

GdaPStmt*           gda_connection_get_prepared_statement
                                                        (GdaConnection *cnc,
                                                         GdaStatement *gda_stmt);

Retreives a pointer to an object representing a prepared statement for gda_stmt within cnc. The association must have been done using gda_connection_add_prepared_statement().

cnc :

a GdaConnection object

gda_stmt :

a GdaStatement object

Returns :

the prepared statement, or NULL if no association exists

gda_connection_internal_transaction_started ()

void                gda_connection_internal_transaction_started
                                                        (GdaConnection *cnc,
                                                         const gchar *parent_trans,
                                                         const gchar *trans_name,
                                                         GdaTransactionIsolation isol_level);

cnc :

parent_trans :

trans_name :

isol_level :


gda_connection_internal_transaction_rolledback ()

void                gda_connection_internal_transaction_rolledback
                                                        (GdaConnection *cnc,
                                                         const gchar *trans_name);

cnc :

trans_name :


gda_connection_internal_transaction_committed ()

void                gda_connection_internal_transaction_committed
                                                        (GdaConnection *cnc,
                                                         const gchar *trans_name);

cnc :

trans_name :


gda_connection_internal_statement_executed ()

void                gda_connection_internal_statement_executed
                                                        (GdaConnection *cnc,
                                                         GdaStatement *stmt,
                                                         GdaSet *params,
                                                         GdaConnectionEvent *error);

cnc :

stmt :

params :

error :


gda_connection_internal_savepoint_added ()

void                gda_connection_internal_savepoint_added
                                                        (GdaConnection *cnc,
                                                         const gchar *parent_trans,
                                                         const gchar *svp_name);

cnc :

parent_trans :

svp_name :


gda_connection_internal_savepoint_rolledback ()

void                gda_connection_internal_savepoint_rolledback
                                                        (GdaConnection *cnc,
                                                         const gchar *svp_name);

cnc :

svp_name :


gda_connection_internal_savepoint_removed ()

void                gda_connection_internal_savepoint_removed
                                                        (GdaConnection *cnc,
                                                         const gchar *svp_name);

cnc :

svp_name :


gda_connection_internal_change_transaction_state ()

void                gda_connection_internal_change_transaction_state
                                                        (GdaConnection *cnc,
                                                         GdaTransactionStatusState newstate);

cnc :

newstate :