Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

KDB::Database Class Reference

Central access point to all functionality of the single database. More...

#include <database.h>

Inheritance diagram for KDB::Database:

KDB::Object KDB::QObject List of all members.

Public Methods

 Database (const Database & base)
virtual ~Database ()
TablePtr newTable (const QString &name)
 creates a new table for the current database. More...

TablePtr getTable (const QString &name)
 returns an existing table by name, or 0L if the table does not exists.

TableList tables (bool system = false)
 return the list of available tables. More...

QStringList tableNames (bool system = false)
 return a list of names of available tables. More...

bool removeTable (const QString &name)
 removes a table from the database. More...

QueryPtr newQuery (const QString &name, const QString &SQL = QString::null)
 creates a new query. More...

QueryPtr getQuery (const QString &name)
 returns an existing query by name, or 0L if the query does not exists.

QueryList queries ()
 return the list of available queries.

QStringList queryNames ()
 return the list of names of available queries.

bool removeQuery (const QString &name)
 removes a query from the database.

RecordsetPtr openRecordset (const QString &SQL)
 creates a recordset based on a given query. More...

unsigned long long execute (const QString &SQL)
 exec a command query. More...

bool open ()
void close ()
bool isOpen ()

Signals

void tableAdded ( Table * )
void tableRemoved ( Table * )
void tableChanged ( Table * )
void queryAdded ( Query * )
void queryRemoved ( Query * )
void queryChanged ( Query * )
void changed ()
void closed ()
void opened ()

Protected Slots

void tableCreated ( Table * )

Friends

class  Connection

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.

Author(s):
Alessandro Praduroux <pradu@thekompany.com> , Michael Koch <m_kock@bigfoot.de>
Version:
kdbcore 0.0.2


Constructor & Destructor Documentation

Database ( const Database & base )
 

virtual ~Database ( ) [virtual]
 


Member Function Documentation

void changed ( ) [signal]
 

void close ( )
 

void closed ( ) [signal]
 

unsigned long long execute ( const QString & SQL )
 

exec a command query.

returns the number of records affected

QueryPtr getQuery ( const QString & name )
 

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

TablePtr getTable ( const QString & name )
 

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

bool isOpen ( )
 

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

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

TablePtr newTable ( const QString & name )
 

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()

bool open ( )
 

RecordsetPtr openRecordset ( const QString & SQL )
 

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

void opened ( ) [signal]
 

QueryList queries ( )
 

return the list of available queries.

void queryAdded ( Query * ) [signal]
 

void queryChanged ( Query * ) [signal]
 

QStringList queryNames ( )
 

return the list of names of available queries.

void queryRemoved ( Query * ) [signal]
 

bool removeQuery ( const QString & name )
 

removes a query from the database.

bool removeTable ( const QString & name )
 

removes a table from the database.

This means that the table is dropped, and all the content is erased

void tableAdded ( Table * ) [signal]
 

void tableChanged ( Table * ) [signal]
 

void tableCreated ( Table * ) [protected, slot]
 

QStringList tableNames ( bool system = false )
 

return a list of names of available tables.

tables whose name begins with "__" ( so called system tables) will be returned only if system = true

void tableRemoved ( Table * ) [signal]
 

TableList tables ( bool system = false )
 

return the list of available tables.

tables whose name begins with "__" ( so called system tables) will be returned only if system = true


Friends And Related Function Documentation

class Connection [friend]
 


The documentation for this class was generated from the following file:
Generated at Fri Sep 29 16:32:22 2000 for KDB by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000