GdaServerProvider

GdaServerProvider — Base class for implementing new providers

Synopsis




            GdaServerProvider;
const gchar* gda_server_provider_get_version
                                            (GdaServerProvider *provider);
GdaServerProviderInfo* gda_server_provider_get_info
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);
gboolean    gda_server_provider_open_connection
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaQuarkList *params,
                                             const gchar *username,
                                             const gchar *password);
gboolean    gda_server_provider_reset_connection
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);
gboolean    gda_server_provider_close_connection
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);
const gchar* gda_server_provider_get_server_version
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);
const gchar* gda_server_provider_get_database
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);
gboolean    gda_server_provider_change_database
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *name);
gchar*      gda_server_provider_get_specs   (GdaServerProvider *provider,
                                             GdaClientSpecsType action_type);
gboolean    gda_server_provider_perform_action_params
                                            (GdaServerProvider *provider,
                                             GdaParameterList *params,
                                             GdaClientSpecsType action_type,
                                             GError **error);
gboolean    gda_server_provider_create_database_cnc
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *name);
gboolean    gda_server_provider_drop_database_cnc
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *name);
gboolean    gda_server_provider_create_table
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *table_name,
                                             const GList *attributes_list,
                                             const GList *index_list);
gboolean    gda_server_provider_drop_table  (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *table_name);
gboolean    gda_server_provider_create_index
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const GdaDataModelIndex *index,
                                             const gchar *table_name);
gboolean    gda_server_provider_drop_index  (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *index_name,
                                             gboolean primary_key,
                                             const gchar *table_name);
GList*      gda_server_provider_execute_command
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaCommand *cmd,
                                             GdaParameterList *params);
gchar*      gda_server_provider_get_last_insert_id
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaDataModel *recset);
gboolean    gda_server_provider_begin_transaction
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaTransaction *xaction);
gboolean    gda_server_provider_commit_transaction
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaTransaction *xaction);
gboolean    gda_server_provider_rollback_transaction
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaTransaction *xaction);
gboolean    gda_server_provider_supports    (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaConnectionFeature feature);
GdaDataModel* gda_server_provider_get_schema
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaConnectionSchema schema,
                                             GdaParameterList *params,
                                             GError **error);
GdaBlob*    gda_server_provider_create_blob (GdaServerProvider *provider,
                                             GdaConnection *cnc);
GdaBlob*    gda_server_provider_fetch_blob_by_id
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *sql_id);
GdaDataHandler* gda_server_provider_get_data_handler_gda
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaValueType for_type);
GdaDataHandler* gda_server_provider_get_data_handler_dbms
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *for_type);
GdaValue*   gda_server_provider_string_to_value
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *string,
                                             GdaValueType prefered_type,
                                             gchar **dbms_type);
gchar*      gda_server_provider_value_to_sql_string
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaValue *from);
const gchar* gda_server_provider_get_default_dbms_type
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaValueType gda_type);

Object Hierarchy


  GObject
   +----GdaServerProvider

Description

Details

GdaServerProvider

typedef struct _GdaServerProvider GdaServerProvider;


gda_server_provider_get_version ()

const gchar* gda_server_provider_get_version
                                            (GdaServerProvider *provider);

Get the version of the given provider.

provider : a GdaServerProvider object.
Returns : a string containing the version identification.

gda_server_provider_get_info ()

GdaServerProviderInfo* gda_server_provider_get_info
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);

Retreive some information specific to the provider. The returned GdaServerProviderInfo structure must not be modified

provider : a GdaServerProvider object.
cnc : a GdaConnection, or NULL
Returns : a GdaServerProviderInfo pointer or NULL if an error occured

gda_server_provider_open_connection ()

gboolean    gda_server_provider_open_connection
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaQuarkList *params,
                                             const gchar *username,
                                             const gchar *password);

Tries to open a new connection on the given GdaServerProvider object.

provider : a GdaServerProvider object.
cnc : a GdaConnection object.
params :
username : user name for logging in.
password : password for authentication.
Returns : a newly-allocated GdaServerConnection object, or NULL if it fails.

gda_server_provider_reset_connection ()

gboolean    gda_server_provider_reset_connection
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);

Calls the reset_connection method implementation on the given GdaServerProvider.

provider : A GdaServerProvider object.
cnc : The connection to be reset.
Returns : TRUE if successful, FALSE otherwise.

gda_server_provider_close_connection ()

gboolean    gda_server_provider_close_connection
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);

provider :
cnc :
Returns :

gda_server_provider_get_server_version ()

const gchar* gda_server_provider_get_server_version
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);

provider :
cnc :
Returns :

gda_server_provider_get_database ()

const gchar* gda_server_provider_get_database
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc);

Proxy the call to the get_database method on the GdaServerProvider class to the corresponding provider.

provider : a GdaServerProvider object.
cnc : a GdaConnection object.
Returns : the name of the current database.

gda_server_provider_change_database ()

gboolean    gda_server_provider_change_database
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *name);

Proxy the call to the change_database method on the " GdaServerProvider class to the corresponding provider.

provider : a GdaServerProvider object.
cnc : a GdaConnection object.
name : database name.
Returns : TRUE if successful, FALSE otherwise.

gda_server_provider_get_specs ()

gchar*      gda_server_provider_get_specs   (GdaServerProvider *provider,
                                             GdaClientSpecsType action_type);

Fetch a list of parameters required to create a database for the specific provider provider.

The list of parameters is returned as an XML string listing each paraleter, its type, its name, etc.

provider : a GdaServerProvider object
action_type : what action the specs are for
Returns : a new XML string, or NULL if provider does not implement that method.

gda_server_provider_perform_action_params ()

gboolean    gda_server_provider_perform_action_params
                                            (GdaServerProvider *provider,
                                             GdaParameterList *params,
                                             GdaClientSpecsType action_type,
                                             GError **error);

Performs a specific action specified by the action_type argument using the parameters listed in params (the list of parameters may have been obtained using the gda_server_provider_get_specs() method).

provider : a GdaServerProvider object
params : a list of parameters required to create a database
action_type : action to perform
error : a place to store an error, or NULL
Returns : TRUE if no error occured

gda_server_provider_create_database_cnc ()

gboolean    gda_server_provider_create_database_cnc
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *name);

Creates a database named name using the cnc connection.

provider : a GdaServerProvider object.
cnc : a GdaConnection object.
name : database name.
Returns : TRUE if successful, FALSE otherwise.

gda_server_provider_drop_database_cnc ()

gboolean    gda_server_provider_drop_database_cnc
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *name);

Destroy the database named name using the cnc connection.

provider : a GdaServerProvider object.
cnc : a GdaConnection object.
name : database name.
Returns : TRUE if successful, FALSE otherwise.

gda_server_provider_create_table ()

gboolean    gda_server_provider_create_table
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *table_name,
                                             const GList *attributes_list,
                                             const GList *index_list);

Proxy the call to the create_table method on the GdaServerProvider class to the corresponding provider.

provider : a GdaServerProvider object.
cnc : a GdaConnection object.
table_name : name of the table to create.
attributes_list : list of GdaColumn for all fields in the table.
index_list : list of GdaDataModelIndex for all (additional) indexes in the table.
Returns : TRUE if successful, FALSE otherwise.

gda_server_provider_drop_table ()

gboolean    gda_server_provider_drop_table  (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *table_name);

Proxy the call to the drop_table method on the GdaServerProvider class to the corresponding provider.

provider : a GdaServerProvider object.
cnc : a GdaConnection object.
table_name : name of the table to remove.
Returns : TRUE if successful, FALSE otherwise.

gda_server_provider_create_index ()

gboolean    gda_server_provider_create_index
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const GdaDataModelIndex *index,
                                             const gchar *table_name);

Proxy the call to the create_index method on the GdaServerProvider class to the corresponding provider.

provider : a GdaServerProvider object.
cnc : a GdaConnection object.
index : a GdaDataModelIndex object containing all index information.
table_name : name of the table to create index for.
Returns : TRUE if successful, FALSE otherwise.

gda_server_provider_drop_index ()

gboolean    gda_server_provider_drop_index  (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *index_name,
                                             gboolean primary_key,
                                             const gchar *table_name);

Proxy the call to the drop_index method on the GdaServerProvider class to the corresponding provider.

provider : a GdaServerProvider object.
cnc : a GdaConnection object.
index_name : name of the index to remove.
primary_key : if index is a PRIMARY KEY.
table_name : name of the table index to remove from.
Returns : TRUE if successful, FALSE otherwise.

gda_server_provider_execute_command ()

GList*      gda_server_provider_execute_command
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaCommand *cmd,
                                             GdaParameterList *params);

provider :
cnc :
cmd :
params :
Returns :

gda_server_provider_get_last_insert_id ()

gchar*      gda_server_provider_get_last_insert_id
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaDataModel *recset);

Retrieve from the given GdaServerProvider the ID of the last inserted row. A connection must be specified, and, optionally, a result set. If not NULL, the provider should try to get the last insert ID for the given result set.

provider : a GdaServerProvider object.
cnc : connection to act upon.
recset : resultset to get the last insert ID from.
Returns : a string representing the ID of the last inserted row, or NULL if an error occurred or no row has been inserted. It is the caller's reponsibility to free the returned string.

gda_server_provider_begin_transaction ()

gboolean    gda_server_provider_begin_transaction
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaTransaction *xaction);

provider :
cnc :
xaction :
Returns :

gda_server_provider_commit_transaction ()

gboolean    gda_server_provider_commit_transaction
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaTransaction *xaction);

provider :
cnc :
xaction :
Returns :

gda_server_provider_rollback_transaction ()

gboolean    gda_server_provider_rollback_transaction
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaTransaction *xaction);

provider :
cnc :
xaction :
Returns :

gda_server_provider_supports ()

gboolean    gda_server_provider_supports    (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaConnectionFeature feature);

provider :
cnc :
feature :
Returns :

gda_server_provider_get_schema ()

GdaDataModel* gda_server_provider_get_schema
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaConnectionSchema schema,
                                             GdaParameterList *params,
                                             GError **error);

provider :
cnc :
schema :
params :
error :
Returns :

gda_server_provider_create_blob ()

GdaBlob*    gda_server_provider_create_blob (GdaServerProvider *provider,
                                             GdaConnection *cnc);

Creates a BLOB (Binary Large OBject) with read/write access.

provider : a server provider.
cnc : a GdaConnection object.
Returns : a new GdaBlob object, or NULL if the database (or the libgda's provider) does not support BLOBS

gda_server_provider_fetch_blob_by_id ()

GdaBlob*    gda_server_provider_fetch_blob_by_id
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *sql_id);

Fetch an existing BLOB (Binary Large OBject) using its SQL ID.

provider : a server provider.
cnc : a GdaConnection object.
sql_id : the SQL ID of the blob to fetch
Returns : a new GdaBlob object, or NULL if the database (or the libgda's provider) does not support BLOBS

gda_server_provider_get_data_handler_gda ()

GdaDataHandler* gda_server_provider_get_data_handler_gda
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaValueType for_type);

Find a GdaDataHandler object to manipulate data of type for_type.

provider : a server provider.
cnc : a GdaConnection object, or NULL
for_type : a GdaValueType
Returns : a GdaDataHandler, or NULL if the provider does not support the requested for_type data type or for_type is GDA_VALUE_TYPE_NULL

gda_server_provider_get_data_handler_dbms ()

GdaDataHandler* gda_server_provider_get_data_handler_dbms
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *for_type);

Find a GdaDataHandler object to manipulate data of type for_type.

provider : a server provider.
cnc : a GdaConnection object, or NULL
for_type : a DBMS type definition
Returns : a GdaDataHandler, or NULL if the provider does not know about the for_type type

gda_server_provider_string_to_value ()

GdaValue*   gda_server_provider_string_to_value
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             const gchar *string,
                                             GdaValueType prefered_type,
                                             gchar **dbms_type);

Use provider to create a new GdaValue from a single string representation.

The prefered_type can optionnaly ask provider to return a GdaValue of the requested type (but if such a value can't be created from string, then NULL is returned); pass GDA_VALUE_TYPE_UNKNOWN if any returned type is acceptable.

The returned value is either a new GdaValue or NULL in the following cases: - string cannot be converted to prefered_type type - the provider does not handle prefered_type - the provider could not make a GdaValue from string

provider : a server provider.
cnc : a GdaConnection object.
string : the SQL string to convert to a value
prefered_type : a GdaValueType
dbms_type :
Returns : a new GdaValue, or NULL

gda_server_provider_value_to_sql_string ()

gchar*      gda_server_provider_value_to_sql_string
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaValue *from);

Produces a fully quoted and escaped string from a GdaValue

provider : a server provider.
cnc : a GdaConnection object, or NULL
from : GdaValue to convert from
Returns : escaped and quoted value or NULL if not supported.

gda_server_provider_get_default_dbms_type ()

const gchar* gda_server_provider_get_default_dbms_type
                                            (GdaServerProvider *provider,
                                             GdaConnection *cnc,
                                             GdaValueType gda_type);

Get the name of the most common data type which has gda_type GDA type

provider : a server provider.
cnc : a GdaConnection object or NULL
gda_type : a GdaValueType value type
Returns : the name of the DBMS type, or NULL