gda-server-provider-impl

gda-server-provider-impl

Functions

Types and Values

Description

Functions

gda_server_provider_set_impl_functions ()

void
gda_server_provider_set_impl_functions
                               (GdaServerProviderClass *klass,
                                GdaServerProviderFunctionsType type,
                                gpointer functions_set);

Upon creation, used by provider's implementors to set the implementation functions. Passing NULL as the functions_set has no effect.

If some pointers of functions_set are NULL, they are replaced by functions from the parent class of provider .

Warning: this function must only be called once for each different values of type and for each klass

Parameters

klass

a GdaServerProviderClass object

 

type

a GdaServerProviderFunctionsType type

 

functions_set

a pointer to the function set, or NULL.

[allow-none]

Since: 6.0


gda_server_provider_get_impl_functions_for_class ()

gpointer
gda_server_provider_get_impl_functions_for_class
                               (GObjectClass *klass,
                                GdaServerProviderFunctionsType type);

Types and Values

enum GdaServerProviderFunctionsType

Represents the different types of sets of virtual functions which can be implemented for each provider

Members

GDA_SERVER_PROVIDER_FUNCTIONS_BASE

   

GDA_SERVER_PROVIDER_FUNCTIONS_META

   

GDA_SERVER_PROVIDER_FUNCTIONS_XA

   

GDA_SERVER_PROVIDER_FUNCTIONS_MAX

   

GdaServerProviderBase

typedef struct {
	/* functions called from any 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);
	GdaWorker          *(* create_worker)         (GdaServerProvider *provider, gboolean for_cnc);
	GdaConnection      *(* create_connection)     (GdaServerProvider *provider); /* may be NULL */
	GdaSqlParser       *(* create_parser)         (GdaServerProvider *provider, GdaConnection *cnc); /* may be NULL */
	GdaDataHandler     *(* get_data_handler)      (GdaServerProvider *provider, GdaConnection *cnc, /* may be NULL */
						       GType g_type, const gchar *dbms_type);
	const gchar        *(* get_def_dbms_type)     (GdaServerProvider *provider, GdaConnection *cnc, GType g_type); /* may be NULL */
	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);
	/**
	 * statement_to_sql:
	 * @provider: a #GdaServerProvider
	 * @cnc: a #GdaConnection
	 * @stmt: a #GdaStatement
	 * @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);
	/**
	 * identifier_quote:
	 * @provider: a #GdaServerProvider
	 * @cnc: (allow-none): a #GdaConnection, or %NULL
	 * @id: a string
	 * @for_meta_store: if %TRUE, then the result have to respect the #GdaMetaStore convention
	 * @force_quotes: if %TRUE, then quotes have to be added
	 *
	 * Create a new string in which @id can be used in an SQL statement, for example by adding quotes if
	 * it is a reserved keyword, or if it is case sensitive.
	 *
	 * If not %NULL, @cnc can either be opened or closed.
	 *
	 * Returns: (transfer full): a new string
	 */
	gchar              *(* identifier_quote)     (GdaServerProvider *provider, GdaConnection *cnc, /* may be NULL */
						      const gchar *id,
						      gboolean for_meta_store, gboolean force_quotes);

	GdaSqlStatement    *(* statement_rewrite)    (GdaServerProvider *provider, GdaConnection *cnc,
						      GdaStatement *stmt, GdaSet *params, GError **error);
	/**
	 * open_connection:
	 * @provider: a #GdaServerProvider
	 * @cnc: a #GdaConnection
	 * @params: (transfer none): a #GdaQuarkList containing the connection parameters (HOST, DATABASE, etc.)
	 * @auth: (transfer none) (allow-none): a #GdaQuarkList containing the connection authentification parameters (USERNAME, PASSWORD, etc.), or %NULL
	 *
	 * Open the connection. @params and @auth must be left unchanged.
	 *
	 * Returns: %TRUE if the connection was opened.
	 */
	gboolean      (* open_connection)       (GdaServerProvider *provider, GdaConnection *cnc,
						 GdaQuarkList *params, GdaQuarkList *auth);
	gboolean      (* prepare_connection)    (GdaServerProvider *provider, GdaConnection *cnc,
						 GdaQuarkList *params, GdaQuarkList *auth);
	gboolean      (* close_connection)      (GdaServerProvider *provider, GdaConnection *cnc);
	gchar        *(* escape_string)         (GdaServerProvider *provider, GdaConnection *cnc, const gchar *str); /* may be NULL */
	gchar        *(* unescape_string)       (GdaServerProvider *provider, GdaConnection *cnc, const gchar *str); /* may be NULL */
	gboolean      (* perform_operation)     (GdaServerProvider *provider, GdaConnection *cnc, /* may be NULL */
						 GdaServerOperation *op, GError **error);
	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);
	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, GError **error);
} GdaServerProviderBase;

Functions implementing basic features.

A pointer to this structure is returned by _gda_server_provider_get_impl_functions() when requesting GDA_SERVER_PROVIDER_FUNCTIONS_BASE functions.


GdaServerProviderMeta

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.


enum GdaServerProviderMetaType

Members

GDA_SERVER_META__INFO

   

GDA_SERVER_META__BTYPES

   

GDA_SERVER_META__UDT

   

GDA_SERVER_META_UDT

   

GDA_SERVER_META__UDT_COLS

   

GDA_SERVER_META_UDT_COLS

   

GDA_SERVER_META__ENUMS

   

GDA_SERVER_META_ENUMS

   

GDA_SERVER_META__DOMAINS

   

GDA_SERVER_META_DOMAINS

   

GDA_SERVER_META__CONSTRAINTS_DOM

   

GDA_SERVER_META_CONSTRAINTS_DOM

   

GDA_SERVER_META__EL_TYPES

   

GDA_SERVER_META_EL_TYPES

   

GDA_SERVER_META__COLLATIONS

   

GDA_SERVER_META_COLLATIONS

   

GDA_SERVER_META__CHARACTER_SETS

   

GDA_SERVER_META_CHARACTER_SETS

   

GDA_SERVER_META__SCHEMATA

   

GDA_SERVER_META_SCHEMATA

   

GDA_SERVER_META__TABLES_VIEWS

   

GDA_SERVER_META_TABLES_VIEWS

   

GDA_SERVER_META__COLUMNS

   

GDA_SERVER_META_COLUMNS

   

GDA_SERVER_META__VIEW_COLS

   

GDA_SERVER_META_VIEW_COLS

   

GDA_SERVER_META__CONSTRAINTS_TAB

   

GDA_SERVER_META_CONSTRAINTS_TAB

   

GDA_SERVER_META__CONSTRAINTS_REF

   

GDA_SERVER_META_CONSTRAINTS_REF

   

GDA_SERVER_META__KEY_COLUMNS

   

GDA_SERVER_META_KEY_COLUMNS

   

GDA_SERVER_META__CHECK_COLUMNS

   

GDA_SERVER_META_CHECK_COLUMNS

   

GDA_SERVER_META__TRIGGERS

   

GDA_SERVER_META_TRIGGERS

   

GDA_SERVER_META__ROUTINES

   

GDA_SERVER_META_ROUTINES

   

GDA_SERVER_META__ROUTINE_COL

   

GDA_SERVER_META_ROUTINE_COL

   

GDA_SERVER_META__ROUTINE_PAR

   

GDA_SERVER_META_ROUTINE_PAR

   

GDA_SERVER_META__INDEXES_TAB

   

GDA_SERVER_META_INDEXES_TAB

   

GDA_SERVER_META__INDEX_COLS

   

GDA_SERVER_META_INDEX_COLS

   

GdaServerProviderXa

typedef struct {
	gboolean (*xa_start)    (GdaServerProvider *prov, GdaConnection *cnc, const GdaXaTransactionId *trx, GError **error);

	gboolean (*xa_end)      (GdaServerProvider *prov, GdaConnection *cnc, const GdaXaTransactionId *trx, GError **error);
	gboolean (*xa_prepare)  (GdaServerProvider *prov, GdaConnection *cnc, const GdaXaTransactionId *trx, GError **error);

	gboolean (*xa_commit)   (GdaServerProvider *prov, GdaConnection *cnc, const GdaXaTransactionId *trx, GError **error);
	gboolean (*xa_rollback) (GdaServerProvider *prov, GdaConnection *cnc, const GdaXaTransactionId *trx, GError **error);

	GList   *(*xa_recover)  (GdaServerProvider *prov, GdaConnection *cnc, GError **error);
} GdaServerProviderXa;

Functions implementing distributed transactions.