| Top |  |  |  |  | 
The GdaServerProvider class is a virtual class which all the DBMS providers must inherit, and implement its virtual methods.
See the Virtual methods for providers section for more information about how to implement the virtual methods.
void (*GdaServerProviderAsyncCallback) (GdaServerProvider *provider,GdaConnection *cnc,guint task_id,gboolean result_status,const GError *error,gpointer data);
Function to be called by Libgda when the associated asynchronous method invoked finishes.
void (*GdaServerProviderExecCallback) (GdaServerProvider *provider,GdaConnection *cnc,guint task_id,GObject *result_obj,const GError *error,gpointer data);
Function to be called by Libgda when the associated asynchronous method invoked finishes
const gchar *
gda_server_provider_get_name (GdaServerProvider *provider);
Get the name (identifier) of the provider
const gchar *
gda_server_provider_get_version (GdaServerProvider *provider);
Get the version of the provider.
const gchar * gda_server_provider_get_server_version (GdaServerProvider *provider,GdaConnection *cnc);
Get the version of the database to which the connection is opened.
gboolean gda_server_provider_supports_operation (GdaServerProvider *provider,GdaConnection *cnc,GdaServerOperationType type,GdaSet *options);
Tells if provider
 supports the type
 of operation on the cnc
 connection, using the
(optional) options
 parameters.
| provider | a GdaServerProvider object | |
| cnc | a GdaConnection object which would be used to perform an action, or  | [allow-none] | 
| type | the type of operation requested | |
| options | a list of named parameters, or  | [allow-none] | 
GdaServerOperation * gda_server_provider_create_operation (GdaServerProvider *provider,GdaConnection *cnc,GdaServerOperationType type,GdaSet *options,GError **error);
Creates a new GdaServerOperation object which can be modified in order to perform the type
 type of
action. The options
 can contain:
| provider | a GdaServerProvider object | |
| cnc | a GdaConnection object which will be used to perform an action, or  | [allow-none] | 
| type | the type of operation requested | |
| options | a list of parameters or  | [allow-none] | 
| error | a place to store an error, or  | [allow-none] | 
a new GdaServerOperation object, or NULL in the provider does not support the type
type of operation or if an error occurred. 
gchar * gda_server_provider_render_operation (GdaServerProvider *provider,GdaConnection *cnc,GdaServerOperation *op,GError **error);
Creates an SQL statement (possibly using some specific extensions of the DBMS) corresponding to the
op
 operation. Note that the returned string may actually contain more than one SQL statement.
This function's purpose is mainly informative to get the actual SQL code which would be executed to perform
the operation; to actually perform the operation, use gda_server_provider_perform_operation().
| provider | a GdaServerProvider object | |
| cnc | a GdaConnection object which will be used to render the action, or  | [allow-none] | 
| op | a GdaServerOperation object | |
| error | a place to store an error, or  | [allow-none] | 
gboolean gda_server_provider_perform_operation (GdaServerProvider *provider,GdaConnection *cnc,GdaServerOperation *op,GError **error);
Performs the operation described by op
. Note that op
 is not destroyed by this method
and can be reused.
| provider | a GdaServerProvider object | |
| cnc | a GdaConnection object which will be used to perform the action, or  | [allow-none] | 
| op | a GdaServerOperation object | |
| error | a place to store an error, or  | [allow-none] | 
GdaSqlParser * gda_server_provider_create_parser (GdaServerProvider *provider,GdaConnection *cnc);
Creates a new GdaSqlParser object which is adapted to provider
 (and possibly depending on
cnc
 for the actual database version).
If prov
 does not have its own parser, then NULL is returned, and a general SQL parser can be obtained
using gda_sql_parser_new().
gboolean gda_server_provider_supports_feature (GdaServerProvider *provider,GdaConnection *cnc,GdaConnectionFeature feature);
Tests if a feature is supported
| provider | a GdaServerProvider object | |
| cnc | a GdaConnection object, or  | [allow-none] | 
| feature | GdaConnectionFeature feature to test | 
GdaDataHandler * gda_server_provider_get_data_handler_g_type (GdaServerProvider *provider,GdaConnection *cnc,GType for_type);
Find a GdaDataHandler object to manipulate data of type for_type
. The returned object must not be modified.
| provider | a server provider. | |
| cnc | a GdaConnection object, or  | [allow-none] | 
| for_type | a GType | 
a GdaDataHandler, or NULL if the provider does not support the requested for_type
data type. 
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
.
Note: this function is currently very poorly implemented by database providers.
| provider | a server provider. | |
| cnc | a GdaConnection object, or  | [allow-none] | 
| for_type | a DBMS type definition | 
GValue * gda_server_provider_string_to_value (GdaServerProvider *provider,GdaConnection *cnc,const gchar *string,GType preferred_type,gchar **dbms_type);
Use provider
 to create a new GValue from a single string representation. 
The preferred_type
 can optionally ask provider
 to return a GValue of the requested type 
(but if such a value can't be created from string
, then NULL is returned); 
pass G_TYPE_INVALID if any returned type is acceptable.
The returned value is either a new GValue or NULL in the following cases:
string
 cannot be converted to preferred_type
 type
the provider does not handle preferred_type
the provider could not make a GValue from string
If dbms_type
 is not NULL, then if will contain a constant string representing
the database type used for the conversion if the conversion was successfull, or NULL
otherwise.
| provider | a server provider. | |
| cnc | a GdaConnection object, or  | [allow-none] | 
| string | the SQL string to convert to a value | |
| preferred_type | a GType, or G_TYPE_INVALID | |
| dbms_type | place to get the actual database type used if the conversion succeeded, or  | [allow-none] | 
gchar * gda_server_provider_value_to_sql_string (GdaServerProvider *provider,GdaConnection *cnc,GValue *from);
Produces a fully quoted and escaped string from a GValue
| provider | a server provider. | |
| cnc | a GdaConnection object, or  | [allow-none] | 
| from | GValue to convert from | 
const gchar * gda_server_provider_get_default_dbms_type (GdaServerProvider *provider,GdaConnection *cnc,GType type);
Get the name of the most common data type which has type
 type.
The returned value may be NULL either if the provider does not implement that method, or if
there is no DBMS data type which could contain data of the g_type
 type (for example NULL may be
returned if a DBMS has integers only up to 4 bytes and a G_TYPE_INT64 is requested).
| provider | a server provider. | |
| cnc | a GdaConnection object or  | [allow-none] | 
| type | a GType value type | 
gchar * gda_server_provider_escape_string (GdaServerProvider *provider,GdaConnection *cnc,const gchar *str);
Escapes str
 for use within an SQL command (to avoid SQL injection attacks). Note that the returned value still needs
to be enclosed in single quotes before being used in an SQL statement.
| provider | a server provider. | |
| cnc | a GdaConnection object, or  | [allow-none] | 
| str | a string to escape | 
gchar * gda_server_provider_unescape_string (GdaServerProvider *provider,GdaConnection *cnc,const gchar *str);
Unescapes str
 for use within an SQL command. This is the exact opposite of gda_server_provider_escape_string().
| provider | a server provider. | |
| cnc | a GdaConnection object, or  | [allow-none] | 
| str | a string to escape | 
typedef struct {
	GObjectClass parent_class;
	/* provider information */
	GThread                 * limiting_thread; /* if not NULL, then using the provider will be limited to this thread */
	const gchar           *(* get_name)              (GdaServerProvider *provider);
	const gchar           *(* get_version)           (GdaServerProvider *provider);
	const gchar           *(* get_server_version)    (GdaServerProvider *provider, GdaConnection *cnc);
	gboolean               (* supports_feature)      (GdaServerProvider *provider, GdaConnection *cnc,
							  GdaConnectionFeature feature);
	/* types and values manipulation */
	GdaDataHandler        *(* get_data_handler)      (GdaServerProvider *provider, GdaConnection *cnc,
							  GType g_type, const gchar *dbms_type);
	const gchar           *(*get_def_dbms_type)      (GdaServerProvider *provider, GdaConnection *cnc, GType g_type);
	gchar                 *(*escape_string)          (GdaServerProvider *provider, GdaConnection *cnc, const gchar *str);
	gchar                 *(*unescape_string)        (GdaServerProvider *provider, GdaConnection *cnc, const gchar *str);
	/* connections management */
	gboolean               (* open_connection)       (GdaServerProvider *provider, GdaConnection *cnc,
							  GdaQuarkList *params, GdaQuarkList *auth,
							  guint *task_id, GdaServerProviderAsyncCallback async_cb, 
							  gpointer cb_data);
	gboolean               (* close_connection)      (GdaServerProvider *provider, GdaConnection *cnc);
	
	const gchar           *(* get_database)          (GdaServerProvider *provider, GdaConnection *cnc);
	/* operations */
	gboolean               (* supports_operation)    (GdaServerProvider *provider, GdaConnection *cnc, 
							  GdaServerOperationType type, GdaSet *options);
	GdaServerOperation    *(* create_operation)      (GdaServerProvider *provider, GdaConnection *cnc, 
							  GdaServerOperationType type, GdaSet *options, GError **error);
	gchar                 *(* render_operation)      (GdaServerProvider *provider, GdaConnection *cnc, 
							  GdaServerOperation *op, GError **error);
	gboolean               (* perform_operation)     (GdaServerProvider *provider, GdaConnection *cnc, 
							  GdaServerOperation *op, 
							  guint *task_id, GdaServerProviderAsyncCallback async_cb, 
							  gpointer cb_data, GError **error);
	
	/* transactions */
	gboolean                (* begin_transaction)    (GdaServerProvider *provider, GdaConnection *cnc,
							  const gchar *name, GdaTransactionIsolation level, GError **error);
	gboolean                (* commit_transaction)   (GdaServerProvider *provider, GdaConnection *cnc,
							  const gchar *name, GError **error);
	gboolean                (* rollback_transaction) (GdaServerProvider *provider, GdaConnection *cnc,
							  const gchar *name, GError **error);
	gboolean                (* add_savepoint)        (GdaServerProvider *provider, GdaConnection *cnc,
							  const gchar *name, GError **error);
	gboolean                (* rollback_savepoint)   (GdaServerProvider *provider, GdaConnection *cnc,
							  const gchar *name, GError **error);
	gboolean                (* delete_savepoint)     (GdaServerProvider *provider, GdaConnection *cnc,
							  const gchar *name, GError **error);
	/* GdaStatement */
	GdaSqlParser           *(* create_parser)        (GdaServerProvider *provider, GdaConnection *cnc);
	
	/**
	 * statement_to_sql:
	 * @cnc: a #GdaConnection object
	 * @stmt: a #GdaStatement object
	 * @params: (allow-none): a #GdaSet object (which can be obtained using gda_statement_get_parameters()), or %NULL
	 * @flags: SQL rendering flags, as #GdaStatementSqlFlag OR'ed values
	 * @params_used: (allow-none) (element-type Gda.Holder) (out) (transfer container): a place to store the list of individual #GdaHolder objects within @params which have been used
	 * @error: a place to store errors, or %NULL
	 *
	 * Renders @stmt as an SQL statement, adapted to the SQL dialect used by @cnc
	 *
	 * Returns: a new string, or %NULL if an error occurred
	 */
	gchar                  *(* statement_to_sql)     (GdaServerProvider *provider, GdaConnection *cnc, 
							  GdaStatement *stmt, GdaSet *params, GdaStatementSqlFlag flags,
							  GSList **params_used, GError **error);
	gboolean                (* statement_prepare)    (GdaServerProvider *provider, GdaConnection *cnc,
							  GdaStatement *stmt, GError **error);
	GObject                *(* statement_execute)    (GdaServerProvider *provider, GdaConnection *cnc, 
							  GdaStatement *stmt, GdaSet *params, 
							  GdaStatementModelUsage model_usage, 
							  GType *col_types, GdaSet **last_inserted_row, 
							  guint *task_id, GdaServerProviderExecCallback exec_cb, 
							  gpointer cb_data, GError **error);
	/* Misc */
	gboolean                (* is_busy)              (GdaServerProvider *provider, GdaConnection *cnc, GError **error);
	gboolean                (* cancel)               (GdaServerProvider *provider, GdaConnection *cnc, 
							  guint task_id, GError **error);
	GdaConnection          *(* create_connection)    (GdaServerProvider *provider);
	/* meta data reporting */
	GdaServerProviderMeta      meta_funcs;
	/* distributed transaction */
	GdaServerProviderXa       *xa_funcs; /* it is a pointer! => set to %NULL if unsupported by provider */
	/* SQL identifiers quoting */
	gchar                  *(* identifier_quote)    (GdaServerProvider *provider, GdaConnection *cnc,
							 const gchar *id,
							 gboolean for_meta_store, gboolean force_quotes);
	/* Async. handling */
	gboolean                (*handle_async)         (GdaServerProvider *provider, GdaConnection *cnc, GError **error);
	GdaSqlStatement        *(*statement_rewrite)    (GdaServerProvider *provider, GdaConnection *cnc,
							 GdaStatement *stmt, GdaSet *params, GError **error);
} GdaServerProviderClass;
typedef struct {
	/* _information_schema_catalog_name */
	gboolean (*_info)            (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	/* _builtin_data_types */
	gboolean (*_btypes)          (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	/* _udt */
	gboolean (*_udt)             (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*udt)              (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *udt_catalog, const GValue *udt_schema);
	/* _udt_columns */
	gboolean (*_udt_cols)        (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*udt_cols)         (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *udt_catalog, const GValue *udt_schema, const GValue *udt_name);
	/* _enums */
	gboolean (*_enums)           (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*enums)            (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *udt_catalog, const GValue *udt_schema, const GValue *udt_name);
	/* _domains */
	gboolean (*_domains)         (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*domains)          (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *domain_catalog, const GValue *domain_schema);
	/* _domain_constraints */
	gboolean (*_constraints_dom) (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*constraints_dom)  (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *domain_catalog, const GValue *domain_schema, const GValue *domain_name);
	/* _element_types */
	gboolean (*_el_types)        (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*el_types)         (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *specific_name);
	/* _collations */
	gboolean (*_collations)       (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*collations)        (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				       const GValue *collation_catalog, const GValue *collation_schema, 
				       const GValue *collation_name_n);
	/* _character_sets */
	gboolean (*_character_sets)  (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*character_sets)   (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *chset_catalog, const GValue *chset_schema, const GValue *chset_name_n);
	/* _schemata */
	gboolean (*_schemata)        (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*schemata)         (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error, 
				      const GValue *catalog_name, const GValue *schema_name_n);
	/* _tables or _views */
	gboolean (*_tables_views)    (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*tables_views)     (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *table_catalog, const GValue *table_schema, const GValue *table_name_n);
	/* _columns */
	gboolean (*_columns)         (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*columns)          (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *table_catalog, const GValue *table_schema, const GValue *table_name);
	/* _view_column_usage */
	gboolean (*_view_cols)       (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*view_cols)        (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *view_catalog, const GValue *view_schema, const GValue *view_name);
	/* _table_constraints */
	gboolean (*_constraints_tab) (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*constraints_tab)  (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error, 
				      const GValue *table_catalog, const GValue *table_schema, const GValue *table_name,
				      const GValue *constraint_name_n);
	/* _referential_constraints */
	gboolean (*_constraints_ref) (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*constraints_ref)  (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *table_catalog, const GValue *table_schema, const GValue *table_name, 
				      const GValue *constraint_name);
	/* _key_column_usage */
	gboolean (*_key_columns)     (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*key_columns)      (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *table_catalog, const GValue *table_schema, const GValue *table_name, 
				      const GValue *constraint_name);
	/* _check_column_usage */
	gboolean (*_check_columns)   (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*check_columns)    (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *table_catalog, const GValue *table_schema, const GValue *table_name, 
				      const GValue *constraint_name);
	/* _triggers */
	gboolean (*_triggers)        (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*triggers)         (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *table_catalog, const GValue *table_schema, const GValue *table_name);
	/* _routines */
	gboolean (*_routines)       (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*routines)        (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				     const GValue *routine_catalog, const GValue *routine_schema, 
				     const GValue *routine_name_n);
	/* _routine_columns */
	gboolean (*_routine_col)     (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*routine_col)      (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *rout_catalog, const GValue *rout_schema, const GValue *rout_name);
	/* _parameters */
	gboolean (*_routine_par)     (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*routine_par)      (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *rout_catalog, const GValue *rout_schema, const GValue *rout_name);
	/* _table_indexes */
	gboolean (*_indexes_tab)     (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*indexes_tab)      (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error, 
				      const GValue *table_catalog, const GValue *table_schema, const GValue *table_name,
				      const GValue *index_name_n);
	/* _index_column_usage */
	gboolean (*_index_cols)      (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error);
	gboolean (*index_cols)       (GdaServerProvider *prov, GdaConnection *cnc, GdaMetaStore *meta, GdaMetaContext *ctx, GError **error,
				      const GValue *table_catalog, const GValue *table_schema, const GValue *table_name, const GValue *index_name);
} GdaServerProviderMeta;
These methods must be implemented by providers to update a connection's associated metadata (in a GdaMetaStore object), see the Virtual methods for providers/Methods - metadata for more information.