gda-connection-private

gda-connection-private

Types and Values

Object Hierarchy

    GBoxed
    ╰── GdaServerProviderConnectionData

Description

Functions

gda_connection_internal_set_provider_data ()

void
gda_connection_internal_set_provider_data
                               (GdaConnection *cnc,
                                GdaServerProviderConnectionData *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.

Note: destroy_func , needs to free the memory associated to data , if necessary.

Parameters

cnc

a GdaConnection object

 

data

a GdaServerProviderConnectionData, which can be extended as needed by 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_error ()

GdaServerProviderConnectionData *
gda_connection_internal_get_provider_data_error
                               (GdaConnection *cnc,
                                GError **error);

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

Parameters

cnc

a GdaConnection object

 

error

a place to store errors, or NULL.

[nullable]

Returns

the pointer to the opaque structure set using gda_connection_internal_set_provider_data(), or NULL.

[nullable]

Since: 5.0.2


gda_connection_internal_get_worker ()

GdaWorker *
gda_connection_internal_get_worker (GdaServerProviderConnectionData *data);

Retreive a pointer to the GdaWorker used internally by the connection. This function is reserved to database provider's implementation and should not be used otherwise.

Parameters

data

a GdaServerProviderConnectionData, or NULL.

[nullable]

Returns

the GdaWorker, or NULL.

[transfer none]


gda_connection_point_available_event ()

GdaConnectionEvent *
gda_connection_point_available_event (GdaConnection *cnc,
                                      GdaConnectionEventType type);

Use this method to get a pointer to the next available connection event which can then be customized and taken into account using gda_connection_add_event().

Parameters

cnc

a GdaConnection object

 

type

a GdaConnectionEventType

 

Returns

a pointer to the next available connection event, or NULL if event should be ignored.

[transfer full]

Since: 4.2


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!

Parameters

cnc

a GdaConnection object.

 

event

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

[transfer full]

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.

Parameters

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.

[transfer none]


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.

Parameters

cnc

a GdaConnection object.

 

gda_connection_internal_transaction_started ()

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

Internal functions to be called by database providers when a transaction has been started to keep track of the transaction status of the connection.

Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.

Parameters

cnc

a GdaConnection

 

parent_trans

name of the parent transaction, or NULL.

[nullable]

trans_name

transaction's name, or NULL

 

isol_level

isolation level.

 

gda_connection_internal_transaction_rolledback ()

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

Internal functions to be called by database providers when a transaction has been rolled back to keep track of the transaction status of the connection

Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.

Parameters

cnc

a GdaConnection

 

trans_name

transaction's name, or NULL.

[nullable]

gda_connection_internal_transaction_committed ()

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

Internal functions to be called by database providers when a transaction has been committed to keep track of the transaction status of the connection

Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.

Parameters

cnc

a GdaConnection

 

trans_name

transaction's name, or NULL.

[nullable]

gda_connection_internal_statement_executed ()

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

Internal functions to be called by database providers when a statement has been executed to keep track of the transaction status of the connection

Parameters

cnc

a GdaConnection

 

stmt

a GdaStatement which has been executed

 

params

execution's parameters.

[nullable]

error

a GdaConnectionEvent if the execution failed, or NULL.

[transfer none]

gda_connection_internal_savepoint_added ()

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

Internal functions to be called by database providers when a savepoint has been added to keep track of the transaction status of the connection

Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.

Parameters

cnc

a GdaConnection

 

parent_trans

name of the parent transaction, or NULL.

[nullable]

svp_name

savepoint's name, or NULL

 

gda_connection_internal_savepoint_rolledback ()

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

Internal functions to be called by database providers when a savepoint has been rolled back to keep track of the transaction status of the connection

Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.

Parameters

cnc

a GdaConnection

 

svp_name

savepoint's name, or NULL.

[nullable]

gda_connection_internal_savepoint_removed ()

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

Internal functions to be called by database providers when a savepoint has been removed to keep track of the transaction status of the connection

Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.

Parameters

cnc

a GdaConnection

 

svp_name

savepoint's name, or NULL.

[nullable]

gda_connection_internal_change_transaction_state ()

void
gda_connection_internal_change_transaction_state
                               (GdaConnection *cnc,
                                GdaTransactionStatusState newstate);

Internal function to be called by database providers to force a transaction status change.

Parameters

cnc

a GdaConnection

 

newstate

the new state

 

gda_connection_internal_reset_transaction_status ()

void
gda_connection_internal_reset_transaction_status
                               (GdaConnection *cnc);

Internal function to be called by database providers to reset the transaction status.

Parameters

cnc

a GdaConnection

 

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 .

Parameters

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.

Parameters

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);

Retrieves 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().

Parameters

cnc

a GdaConnection object

 

gda_stmt

a GdaStatement object

 

Returns

the prepared statement, or NULL if no association exists.

[transfer none]


gda_connection_open_sqlite ()

GdaConnection *
gda_connection_open_sqlite (const gchar *directory,
                            const gchar *filename,
                            gboolean auto_unlink);

Opens an SQLite connection even if the SQLite provider is not installed, to be used by database providers which need a temporary database to store some information.

Parameters

directory

the directory the database file will be in, or NULL for the default TMP directory.

[nullable]

filename

the database file name

 

auto_unlink

if TRUE, then the database file will be removed afterwards

 

Returns

a new GdaConnection, or NULL if an error occurred.

[transfer full]

Types and Values

GdaServerProviderConnectionData

typedef struct {
	GdaWorker *    GSEAL(worker);
	GDestroyNotify GSEAL(provider_data_destroy_func);
	gpointer       GSEAL(pad1);
	gpointer       GSEAL(pad2);
} GdaServerProviderConnectionData;

Opaque structure extended by database providers to store per-connection information (usually C handles to the connection as required by the C API they use).

Note: worker part is created in _gda_server_provider_open_connection() by the provider itself, which allows it to either create a GdaWorker for each connection, or create only one GdaWorker for all connections (if the underlying for example does not support multi-threading at all)