Virtual methods for providers

Synchronous / asynchronous mode
Multi threaded environment
Methods - provider's information
get_name() - mandatory
get_version() - mandatory
get_server_version() - mandatory
supports_feature()
Methods - connection management
open_connection() - mandatory
close_connection() - mandatory
get_database()
Methods - DDL queries
supports_operation()
create_operation()
render_operation()
perform_operation()
Methods - transactions management
begin_transaction()
commit_transaction()
rollback_transaction()
add_savepoint()
rollback_savepoint()
delete_savepoint()
Methods - DML queries
create_parser()
statement_to_sql()
statement_prepare()
statement_execute() - mandatory
Methods - data representation
get_data_handler()
get_def_dbms_type()
escape_string()
unescape_string()
Methods - metadata
Important note about SQL identifiers
_info()
_btypes()
schemata() and _schemata()
tables_views() and _tables_views()
columns() and _columns()
constraints_tab() and _constraints_tab()
constraints_ref() and _constraints_ref()
key_columns() and _key_columns()
Methods - misc.
cancel()
create_connection()
is_busy()

Database providers usually (that is except for virtual providers explained later) subclass the GdaServerProvider class and implement at least the mandatory virtual methods.

Virtual providers are database providers when the database engine accessed does not support SQL (or supports it poorly), such as Berkeley databases or MDB (or even LDAP). These provider's implementation's design is to create GdaDataModel data model objects and make each of them appear as a named table once the connection is opened. For example the MDB provider creates a read-only data model for each table in an MDB file and make it appear using the original table name used in MS Access (the tables cannot be modified but it is possible to use all SQLite's SQL to make SELECT queries).

Virtual providers inherit the GdaVproviderDataModel class and not the GdaServerProvider as "normal" providers do, and the number of virtual methods to implement is very limited: only the get_name(), get_version(), get_server_version(), open_connection() and get_database() should be implemented, optionnally the close_connection() can also be implemented.

To implement a virtual provider, one can copy the contents of the providers/skel-implementation/models directory, change all references to "models" with the correct provider name, and implement the missing parts, using if necessary the BDB an MDB providers' implementations as examples.

Synchronous / asynchronous mode

All the provider's commands are executed in a synchronous mode (the caller is blocked until the provider's method terminates). However some virtual methods have the task_id, async_cb and cb_data which can be set when an asynchronous mode is required; asynchronous mode is requested if and only if the async_cb is not NULL.

When an asynchronous mode is requested, the method should return a temporary result and set a task identifier into the task_id parameter if not NULL.

When the provider's method terminates, it then should call the function passed as async_cb with the cb_data as last parameters.