The GdaServerProvider class

The GdaServerProvider(3) is the class you should implement for adding a new provider. This class is just a typical GObject-based class, with a set of virtual methods, that are the ones that you must implement. These virtual methods are declared in the class structure, in the gda-server-provider.h file. They are explained in detail in the following subsections.


open_connection

Sets up the connection to the database back-end using the parameters received as arguments and returns a boolean TRUE if the connection is successfully established, otherwise FALSE.


close_connection

Frees the resources allocated for the connection and returns TRUE if everything is ok


get_database

Returns the name of the currently open database for a given connection.


change_database

Change the database being used in the active connection.


create_database

Creates a new database whose name is received in a parameter.


drop_database

Drops an existing database whose name is received in a parameter.


execute_command

Executes a command and returns a GList of GdaDataModel(3) with the results.


begin_transaction

Initiates a transaction if the DB back-end supports transactions.


commit_transaction

Commits a transaction if the DB back-end supports transactions.


rollback_transaction

Rollback a transaction if the DB back-end supports transactions.


supports

Tests if a given feature is supported by the provider and the DB back-end. You can view the list of features in gda-connection.h, enumeration GdaConnectionFeature.


get_schema

Returns a GdaDataModel(3) with the schema information requested. You can view the list of features in gda-connection.h, enumeration GdaConnectionSchema. This schema information is what describes the objects in the database, and is the way applications can manage the structure of several database systems without knowing anything about their specific way of retrieving this information.

The get_schema virtual method gets a GdaConnectionSchema argument, which describes the kind of schema the client making the call is interested in, along with a GdaParameterList argument, which contains the list of arguments sent by the user to explicitly provide more information for the search.

The information to be returned for each schema, along with the supported parameters, is described in the following table.

Table 1. Standard Schema and supported parameters

Object typeGDA identifierSupported ParametersReturned fields
DatabasesGDA_CONNECTION_SCHEMA_DATABASES name
Schemas (also namespaces), a feature supported by Postgres which allows to define multiple domains within a single databaseGDA_CONNECTION_SCHEMA_NAMESPACES name
TablesGDA_CONNECTION_SCHEMA_TABLES"name" (name of table, optional)name, owner, comments, SQL definition
Tables' parentsGDA_CONNECTION_SCHEMA_PARENT_TABLES"name" (name of table, optional)name, order of inheritance
ViewsGDA_CONNECTION_SCHEMA_VIEWS"name" (name of view, optional)name, owner, comments, SQL definition
Table (or view) fieldsGDA_CONNECTION_SCHEMA_FIELDS"name" (name of table (or view), required)name, type, size, scale, not null?, primary key?, unique index?, references, default value
SequencesGDA_CONNECTION_SCHEMA_SEQUENCES"name" (name of sequence, optional)name, owner, comments, SQL definition
ProceduresGDA_CONNECTION_SCHEMA_PROCEDURES"name" (name of procedure, optional)name, unique id, owner, comments, return type, number of arguments, arguments types (arguments types in the order, separated by spaces) and SQL definition. For the arguments where any type is accepted, '-' is returned as type.
AggregatesGDA_CONNECTION_SCHEMA_AGGREGATES"name" (name of aggregate, optional)name, unique id, owner, comments, return type, argument type, SQL definition. If the argument can be of any type, then '-' is returned as type.
TypesGDA_CONNECTION_SCHEMA_TYPES"name" (name of type, optional)name, owner, comments, GDA type