# class Database | Central access point to all functionality of the single database. More...
Full name | `KDB::Database`
Definition | `#include <database.h>`
Inherits | KDB::Object [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- Database (const Database & base)
- virtual ~Database ()
- TablePtr newTable (const QString &name)
- TablePtr getTable (const QString &name)
- TableList tables (bool system = false)
- QStringList tableNames (bool system = false)
- bool removeTable (const QString &name)
- QueryPtr newQuery (const QString &name, const QString &SQL = QString::null)
- QueryPtr getQuery (const QString &name)
- QueryList queries ()
- QStringList queryNames ()
- bool removeQuery (const QString &name)
- RecordsetPtr openRecordset (const QString &SQL)
- KDB_ULONG execute (const QString &SQL)
- bool open ()
- void close ()
- bool isOpen ()

#### Signals

- void tableAdded ( QString )
- void tableRemoved ( QString )
- void queryAdded ( QString )
- void queryRemoved ( QString )
- void changed ()
- void closed ()
- void opened ()

#### Protected Slots

- void tableCreated ( KDB::Table * )

## Detailed Description

Central access point to all functionality of the single database.

That means it provides a list of all queries and tables, and is able to execute a command query and to return a recordset for a given query.

Tables and queries can be accessed by name, and the class can provide collection objects for both.

Database (const Database & base) | ### Database

~Database () | ### ~Database

[virtual]

TablePtr newTable (const QString &name) | ### newTable

creates a new table for the current database. please note that the table is not yet part of the database until you call KDB::Table::create

TablePtr getTable (const QString &name) | ### getTable

returns an existing table by name, or 0L if the table does not exists

TableList tables (bool system = false) | ### tables

return the list of available tables. tables whose name begins with "__" ( so called system tables) will be returned only if system = true

QStringList tableNames (bool system = false) | ### tableNames

return a list of names of available tables. tables whose name begins with "__" ( so called system tables) will be returned only if system = true

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

removes a table from the database. This means that the table is dropped, and all the content is erased

QueryPtr newQuery (const QString &name, const QString &SQL = QString::null) | ### newQuery

creates a new query

Parameters:

name | this is the name of the query
SQL | this is the sql executed by the query. if it is not given, the query can be built with addTable, addField and so on

QueryPtr getQuery (const QString &name) | ### getQuery

returns an existing query by name, or 0L if the query does not exists

QueryList queries () | ### queries

return the list of available queries

QStringList queryNames () | ### queryNames

return the list of names of available queries

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

removes a query from the database.

RecordsetPtr openRecordset (const QString &SQL) | ### openRecordset

creates a recordset based on a given query. if the query fails, 0L is returned. you can then check errorMessage() to get a specific error message

KDB_ULONG execute (const QString &SQL) | ### execute

exec a command query. returns the number of records affected

bool open () | ### open

void close () | ### close

bool isOpen () | ### isOpen

void tableAdded ( QString ) | ### tableAdded

[signal]

void tableRemoved ( QString ) | ### tableRemoved

[signal]

void queryAdded ( QString ) | ### queryAdded

[signal]

void queryRemoved ( QString ) | ### queryRemoved

[signal]

void changed () | ### changed

[signal]

void closed () | ### closed

[signal]

void opened () | ### opened

[signal]

void tableCreated ( KDB::Table * ) | ### tableCreated

[protected slots slot]

- 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.