![]() |
![]() |
![]() |
GNOME Data Access 4.0 manual | ![]() |
---|---|---|---|---|
GdaServerOperation* gda_server_operation_new (GdaServerOperationType op_type, const gchar *xml_file); 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_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); gboolean gda_compute_dml_statements (GdaConnection *cnc, GdaStatement *select_stmt, gboolean require_pk, GdaStatement **insert_stmt, GdaStatement **update_stmt, GdaStatement **delete_stmt, GError **error); GdaSqlStatement* gda_compute_select_statement_from_update (GdaStatement *update_stmt, GError **error); GdaSqlExpr* gda_compute_unique_table_row_condition (GdaSqlStatementSelect *stsel, GdaMetaTable *mtable, gboolean require_pk, GError **error);
The methods mentionned in this section are reserved for database providers implementatins and should not bu used by developers outside that scope.
GdaServerOperation* gda_server_operation_new (GdaServerOperationType op_type, const gchar *xml_file);
IMPORTANT NOTE: Using this funtion is not the recommended way of creating a GdaServerOperation object, the
correct way is to use gda_server_provider_create_operation()
; this method is reserved for the database provider's
implementation.
Creates a new GdaServerOperation object from the xml_file
specifications
The xml_file
must respect the DTD described in the "libgda-server-operation.dtd" file: its top
node must be a <serv_op> tag.
|
|
|
a file which has the specifications for the GdaServerOperation object to create |
Returns : |
a new GdaServerOperation object |
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.
|
|
Returns : |
a GdaSqlParser |
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
|
a GdaServerProvider object |
|
a GdaConnection object which will be used to perform an action, or NULL
|
|
a GdaServerOperation object |
|
a place to store an error, or NULL
|
Returns : |
TRUE if no error occurred |
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
|
a server provider. |
|
a GdaConnection object, or NULL
|
|
a GType |
|
a DBMS type definition |
Returns : |
a GdaDataHandler, or NULL
|
GdaDataHandler* gda_server_provider_handler_find (GdaServerProvider *prov, GdaConnection *cnc, GType g_type, const gchar *dbms_type);
|
|
|
|
|
|
|
|
Returns : |
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);
|
|
|
|
|
|
Returns : |
gchar* gda_server_provider_load_file_contents (const gchar *inst_dir, const gchar *data_dir, const gchar *filename);
|
|
|
|
|
|
Returns : |
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.
|
a GdaConnection object |
|
an opaque structure, known only to the provider for which cnc is opened
|
|
function to call when the connection closes and data needs to be destroyed
|
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
|
a GdaConnection object |
Returns : |
the pointer to the opaque structure set using gda_connection_internal_set_provider_data()
|
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!
|
a GdaConnection object. |
|
is stored internally, so you don't need to unref it. |
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.
|
a GdaConnection object. |
|
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.
|
void gda_connection_clear_events_list (GdaConnection *cnc);
This function lets you clear the list of GdaConnectionEvent's of the given connection.
|
a GdaConnection object. |
GdaConnectionEvent* gda_connection_event_new (GdaConnectionEventType type);
Creates a new unitialized event object. This class is used for communicating events from the different providers to the clients.
|
the type of event |
Returns : |
the event object. |
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.
|
a GdaConnectionEvent object |
|
the severity of the event |
void gda_connection_event_set_description (GdaConnectionEvent *event, const gchar *description);
Sets event
's description
. This function should not be called directly.
|
a GdaConnectionEvent. |
|
a description. |
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
|
a GdaConnectionEvent. |
|
a 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
|
a GdaConnectionEvent |
|
a code |
void gda_connection_event_set_source (GdaConnectionEvent *event, const gchar *source);
Sets event
's source
; this function should not be called directly
|
a GdaConnectionEvent. |
|
a source. |
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.
|
a GdaConnectionEvent. |
|
SQL state. |
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
.
|
a GdaConnection object |
|
a GdaStatement object |
|
a prepared statement object (as a GdaPStmt object, or more likely a descendant) |
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.
|
a GdaConnection object |
|
a GdaStatement object |
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()
.
|
a GdaConnection object |
|
a GdaStatement object |
Returns : |
the prepared statement, or NULL if no association exists
|
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 transactional 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.
|
a GdaConnection |
|
name of the parent transaction, or NULL
|
|
transaction's name, or NULL
|
|
isolation level. |
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 transactional 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.
|
a GdaConnection |
|
transaction's name, or NULL
|
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 transactional 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.
|
a GdaConnection |
|
transaction's name, or NULL
|
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 transactional status of the connection
|
a GdaConnection |
|
a GdaStatement which has been executed |
|
|
|
a GdaConnectionEvent if the execution failed, or NULL
|
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 transactional 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.
|
a GdaConnection |
|
name of the parent transaction, or NULL
|
|
savepoint's name, or NULL
|
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 transactional 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.
|
a GdaConnection |
|
savepoint's name, or NULL
|
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 transactional 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.
|
a GdaConnection |
|
savepoint's name, or NULL
|
void gda_connection_internal_change_transaction_state (GdaConnection *cnc, GdaTransactionStatusState newstate);
Internal functions to be called by database providers to force a transaction status change.
|
a GdaConnection
newstate
|
|
gboolean gda_compute_dml_statements (GdaConnection *cnc, GdaStatement *select_stmt, gboolean require_pk, GdaStatement **insert_stmt, GdaStatement **update_stmt, GdaStatement **delete_stmt, GError **error);
Creates an INSERT, an UPDATE and a DELETE statement from a SELECT statement
using the database metadata available in cnc
's meta store.
|
a GdaConnection |
|
a SELECT GdaStatement (compound statements not handled) |
|
TRUE if the created statement have to use a primary key |
|
a place to store the created INSERT statement, or NULL
|
|
a place to store the created UPDATE statement, or NULL
|
|
a place to store the created DELETE statement, or NULL
|
|
a place to store errors, or NULL
|
Returns : |
TRUE if no error occurred |
GdaSqlStatement* gda_compute_select_statement_from_update (GdaStatement *update_stmt, GError **error);
Computes a SELECT statement which selects all the rows the update_stmt
would update. Beware
however that this GdaSqlStatement does not select anything (ie it would be rendered as "SELECT FROM ... WHERE ...")
and before being useable, one needs to add some fields to actually select.
|
an UPDATE statement |
|
a place to store errors, or NULL
|
Returns : |
; a new GdaStatement if no error occurred, or NULL otherwise
|
GdaSqlExpr* gda_compute_unique_table_row_condition (GdaSqlStatementSelect *stsel, GdaMetaTable *mtable, gboolean require_pk, GError **error);
Computes a GdaSqlExpr expression which can be used in the WHERE clause of an UPDATE
or DELETE statement when a row from the result of the stsel
statement has to be modified.
|
a GdaSqlSelectStatement |
|
a GdaMetaTable |
|
set to TRUE if a primary key ir required |
|
a place to store errors, or NULL
|
Returns : |
a new GdaSqlExpr, or NULL if an error occurred.
|