# class toConnectionProvider

This class is used to implement new database providers. More...

Contains pure virtuals
Definition | `#include <toconnection.h>`
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- toConnectionProvider (const QString &provider)
- virtual ~toConnectionProvider ()
- const QString & provider (void) const
- virtual toConnection::connectionImpl * connection (toConnection *conn)
- virtual std::list<QString> modes (void)
- virtual std::list<QString> hosts (void)
- virtual std::list<QString> databases (const QString &host, const QString &user, const QString &pwd)
- virtual QWidget * configurationTab (QWidget *parent)
- const QString & config (const QString &tag,const QString &def)
- void setConfig (const QString &tag,const QString &value)

#### Public Static Methods

- static toConnectionProvider & fetchProvider (const QString &provider)
- static std::list<QString> providers ()
- static std::list<QString> modes (const QString &provider)
- static toConnection::connectionImpl * connection (const QString &provider,toConnection *conn)
- static std::list<QString> hosts (const QString &provider)
- static std::list<QString> databases (const QString &provider,const QString &host, const QString &user,const QString &pwd)

## Detailed Description

This class is used to implement new database providers.

toConnectionProvider (const QString &provider)

### toConnectionProvider

Create a new provider with the specified name.

Parameters:

provider | Name of the provider.

~toConnectionProvider ()

### ~toConnectionProvider

[virtual]

Destructor.

const QString & provider (void)

### provider

[const]

Get name of provider.

toConnection::connectionImpl * connection (toConnection *conn)

### connection

[pure virtual]

Create an implementation of a connection to this database.

Returns: A connection implementation created with new.

std::list<QString> modes (void)

### modes

[virtual]

List the available modes for this database.

Returns: A list of modes that the connection implementation understands.

std::list<QString> hosts (void)

### hosts

[virtual]

List the available hosts this database provider knows about.

Returns: A list of hosts.

std::list<QString> databases (const QString &host, const QString &user, const QString &pwd)

### databases

[pure virtual]

List the available databases this provider knows about for a given host.

Parameters:

host | Host to return connections for.
user | That might be needed.
password | That might be needed.

Returns: A list of databases available for a given host.

toConnectionProvider & fetchProvider (const QString &provider)

### fetchProvider

[static]

Get the provider object for a given provider name.

Parameters:

provider | Name of provider.

Returns: Reference to provider object.

std::list<QString> providers ()

### providers

[static]

Get a list of names for providers.

std::list<QString> modes (const QString &provider)

### modes

[static]

Get a list of modes for a given provider.

toConnection::connectionImpl * connection (const QString &provider,toConnection *conn)

### connection

[static]

Implement a connection for a given provider.

Parameters:

provider | Provider to implement.
conn | Connection to create implementation for.

std::list<QString> hosts (const QString &provider)

### hosts

[static]

Get a list of hosts this provider knows about.

std::list<QString> databases (const QString &provider,const QString &host, const QString &user,const QString &pwd)

### databases

[static]

Get a list of databases for a given provider and host.

Parameters:

provider | Provider to fetch databases for.
host | Host to fetch databases for.
user | That might be needed.
password | That might be needed.

Returns: List of known databases.

QWidget * configurationTab (QWidget *parent)

### configurationTab

[virtual]

Create and return configuration tab for this connectiontype. The returned widget should also be a childclass of toSettingTab.

Returns: A pointer to the widget containing the setup tab for this tool or NULL of no settings are available.

const QString & config (const QString &tag,const QString &def)

### config

Get connection specific settings.

Setting names are hierachical separated by ':' instead of '/' usually used in filenames. As an example all settings for the tool 'Example' would be under the 'Example:{settingname}' name.

Parameters:

tag | The name of the configuration setting.
def | Contents of this setting.

void setConfig (const QString &tag,const QString &value)

### setConfig

Change connectionspecific setting. Depending on the implementation this can change the contents on disk or not.

Setting names are hierachical separated by ':' instead of '/' usually used in filenames. As an example all settings for the tool 'Example' would be under the 'Example:{settingname}' name.

Parameters:

tag | The name of the configuration setting.
def | Default value of the setting, if it is not available.