# class Connection | Manages the connection state to a SQL engine. More...
Full name | `KDB::Connection`
Definition | `#include <connection.h>`
Inherits | KDB::Object [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- virtual ~Connection ()
- bool open ()
- void close (bool destructive = true)
- bool isConnected ()
- bool saveStatus ()
- void setSaveStatus (bool status)
- void setUser (const QString &name)
- QString user ()
- QString plugin ()
- void setPassword (const QString &pwd, bool save = false)
- QString password ()
- QString host ()
- int port ()
- QString prettyPrint ()
- Database * openDatabase (const QString &name)
- Database * findDatabase (const QString &name)
- Database * createDatabase (const QString &name)
- bool dropDatabase (const QString &name)
- DatabaseList databases ()
- DatabaseIterator begin ()
- void saveToConfig ( KConfigBase *config, int number = 0)
- void beginTransaction ()
- void commit ()
- void rollback ()

#### Public Slots

- void slotDeleteYourself ()

#### Signals

- void closing (KDB::Connection *)
- void opened ()
- void databaseAdded ( QString )
- void databaseRemoved ( QString )

## Detailed Description

Manages the connection state to a SQL engine.

Basically stores all authentication tokens and opens/closes connection as needed.

It is also a collection of database objects, allowing

- traversal of all databases (DatabaseIterator and databases )
- retrieval by name (findDatabase )
- creation of new databases (createDatabase )

~Connection () | ### ~Connection

[virtual]

bool open () | ### open

Connect to the host. If username and password are missing, pops up a dialog to ask them. If the connection is open, nothing is actually done. Returns true if the connection has been succesfully opened, false otherwise.

void close (bool destructive = true) | ### close

Disconnects from the host. all databases are closed. unless destructive == false, the connection is deleted right after the call

bool isConnected () | ### isConnected

Returns true if a successful connection has been established.

bool saveStatus () | ### saveStatus

Returns true if a the connection will be saved in config files

void setSaveStatus (bool status) | ### setSaveStatus

sets the save status for this connection. If the save status is true, the connection will be saved in kdbrc

void setUser (const QString &name) | ### setUser

Sets the user for this connection. The change will not take place until a disconnect/connect is made.

QString user () | ### user

Returns the user for this connection.

QString plugin () | ### plugin

Returns the plugin name of this connection.

void setPassword (const QString &pwd, bool save = false) | ### setPassword

Sets the password for this connection. The change will not take place until a disconnect/connect is made. Passing QString::null will force the connection to ask for the password next time open is called.

QString password () | ### password

Returns the password for this connection.

QString host () | ### host

Returns the host name for this connection.

int port () | ### port

Returns the port number for this connection.

QString prettyPrint () | ### prettyPrint

Returns a complete description of the connection.

Database * openDatabase (const QString &name) | ### openDatabase

Open a database by name.

Database * findDatabase (const QString &name) | ### findDatabase

Return a database by name. If no database with this name exists it returns 0L.

Database * createDatabase (const QString &name) | ### createDatabase

Creates a new database in the current connection.

bool dropDatabase (const QString &name) | ### dropDatabase

Drops a database

DatabaseList databases () | ### databases

Return a list of all available databases.

DatabaseIterator begin () | ### begin

Return an iterator that points to the first database.

void saveToConfig ( KConfigBase *config, int number = 0) | ### saveToConfig

saves this connection to the given config file, with an optional connection number. The config file must exists and must refer to the correct section.

void beginTransaction () | ### beginTransaction

start a transaction for the current connection an error is raised if the underlying DBMS does not support transactions

void commit () | ### commit

end the current transaction and save all the changes to the database. an error is raised if the underlying DBMS does not support transactions or if there isn't any transaction started

void rollback () | ### rollback

end the current transaction and drop all changes made up to now. an error is raised if the underlying DBMS does not support transactions or if there isn't any transaction started

void slotDeleteYourself () | ### slotDeleteYourself

[slot]

void closing (KDB::Connection *) | ### closing

[signal]

void opened () | ### opened

[signal]

void databaseAdded ( QString ) | ### databaseAdded

[signal]

void databaseRemoved ( QString ) | ### databaseRemoved

[signal]

- Version: kdbcore 0.0.2
- Author: Alessandro Praduroux <pradu@thekompany.com>
- Generated: root@sparc.ports.openbsd.org on Wed May 2 09:48:14 2001, using kdoc 2.0a53.