## GdaVirtualConnection GdaVirtualConnection — Base class for all virtual connection objects |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    struct              GdaVirtualConnection;
    GdaConnection *     gda_virtual_connection_open         (GdaVirtualProvider *virtual_provider,
                                                             GError **error);
    GdaConnection *     gda_virtual_connection_open_extended
                                                            (GdaVirtualProvider *virtual_provider,
                                                             GdaConnectionOptions options,
                                                             GError **error);

    void                gda_virtual_connection_internal_set_provider_data
                                                            (GdaVirtualConnection *vcnc,
                                                             gpointer data,
                                                             GDestroyNotify destroy_func);
    gpointer            gda_virtual_connection_internal_get_provider_data
                                                            (GdaVirtualConnection *vcnc);

## Object Hierarchy

      GObject
       +----GdaConnection
             +----GdaVirtualConnection
                   +----GdaVconnectionDataModel

## Implemented Interfaces

GdaVirtualConnection implements GdaLockable.

## Description

This is a base virtual class for all virtual connection implementations.

## Details

### struct GdaVirtualConnection

    struct GdaVirtualConnection;

### gda_virtual_connection_open ()

    GdaConnection *     gda_virtual_connection_open         (GdaVirtualProvider *virtual_provider,
                                                             GError **error);

Creates and opens a new virtual connection using the `virtual_provider` provider. The returned value is a new GdaVirtualConnection which needs to be used to actually add some contents to the virtual connection.

`virtual_provider` : | a GdaVirtualProvider object
`error` : | a place to store errors, or `NULL`
Returns : | a new GdaConnection object, or `NULL` if an error occurred

### gda_virtual_connection_open_extended ()

    GdaConnection *     gda_virtual_connection_open_extended
                                                            (GdaVirtualProvider *virtual_provider,
                                                             GdaConnectionOptions options,
                                                             GError **error);

Creates and opens a new virtual connection using the `virtual_provider` provider. If `options` contains the `GDA_CONNECTION_OPTIONS_THREAD_ISOLATED` flag, then the returned connection will be a thread wrapped connection, and the actual (wrapped) virtual connection can be obtained through the "gda-virtual-connection" user property (use `g_object_get_data()` to get it).

The returned value is a new GdaVirtualConnection which needs to be used to actually add some contents to the virtual connection.

`virtual_provider` : | a GdaVirtualProvider object
`options` : | a set of options to specify the new connection
`error` : | a place to store errors, or `NULL`
Returns : | a new GdaConnection object, or `NULL` if an error occurred

### gda_virtual_connection_internal_set_provider_data ()

    void                gda_virtual_connection_internal_set_provider_data
                                                            (GdaVirtualConnection *vcnc,
                                                             gpointer data,
                                                             GDestroyNotify destroy_func);

Note: calling this function more than once will not make it call `destroy_func` on any previously set opaque `data`, you'll have to do it yourself.

`vcnc` : | a GdaConnection object
`data` : | an opaque structure, known only to the provider for which `vcnc` is opened
`destroy_func` : | function to call when the connection closes and `data` needs to be destroyed

### gda_virtual_connection_internal_get_provider_data ()

    gpointer            gda_virtual_connection_internal_get_provider_data
                                                            (GdaVirtualConnection *vcnc);

Get the opaque pointer previously set using `gda_virtual_connection_internal_set_provider_data()`. If it's not set, then add a connection event and returns `NULL`

`vcnc` : | a GdaConnection object
Returns : | the pointer to the opaque structure set using `gda_virtual_connection_internal_set_provider_data()`