Virtual connections

GdaVirtualProvider — Base class for all virtual provider objects
GdaVproviderDataModel — Virtual provider for connections based on a list of GdaDataModel
GdaVproviderHub — Virtual provider for connections based on other connection
GdaVirtualConnection — Base class for all virtual connection objects
GdaVconnectionDataModel — Virtual connection based on a list of GdaDataModel
GdaVconnectionHub — Virtual connection which bind together connections
GdaLdapConnection — LDAP connection objects

Introduction to virtual connections

Libgda implements so called virtual connections which are used like normal GdaConnection objects (open, close, execute SQL commands, etc) but which in fact don't access any real DBMS.

Virtual connections allow one to use SQL to work on data when it is normally not available, such as sorting data physically stored in CSV or XML files.

A virtual connection is not created in the same way as for a normal connection:

Here is an example of code on how to create a virtual connection using the GdaVproviderDataModel virtual provider:

GdaConnection *cnc;
GdaVirtualProvider *provider;

provider = gda_vprovider_data_model_new ();
cnc = gda_virtual_connection_open (provider, NULL);
    

Some examples of virtual connections usage can be found in the source distribution of Libgda in:

  • samples/Virtual

  • samples/DirDataModel

  • samples/F-Spot

  • testing/virtual-test.c

  • testing/virtual-test-2.c

Note that virtual connections have some inherent limitations [1]due to the implementation.



[1] As virtual connections are implemented using SQLite's virtual table features, the SQL dialect which can be used is the SQLite one (see the SQL as Understood By SQLite page), and there are a few limitations inherent to this implementation (see link for more information).

Also note that it is possible to create temporary tables in virtual connections using "CREATE TEMP TABLE..." statements, but the contents of such tables will be lost once the connection is closed.