# class Connector | base interaction class for plugins. More...
Contains pure virtuals
Full name | `KDB::Connector`
Definition | `#include <connector.h>`
Inherits | KDB::Object [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- Connector ()
- Connector (const Connector& c)
- virtual ~Connector ()
- virtual void close ()
- virtual bool connect ()
- virtual QStringList databases ()
- virtual QStringList tables ()
- virtual RowList fields (const QString & tableName)
- virtual KDB_ULONG execute (const QString &sql)
- virtual bool createDatabase (const QString & name)
- virtual bool dropDatabase (const QString & name)
- virtual bool createTable (const Table & tab)
- virtual bool dropTable (const QString & name)
- virtual bool appendField (const QString &table, Field *f)
- virtual bool removeField (const QString &table, const QString &field)
- virtual bool changeField (const QString &table, Field *f)
- virtual Connector * clone ()
- virtual bool setCurrentDatabase (const QString &name)
- virtual DataType nativeToKDB (const QString &type)
- virtual QString KDBToNative (DataType type)
- virtual Handler * query (const QString &SQL)
- virtual Query * createQueryObject (QObject *parent = 0L, const char *name = 0L, const QString &sql = QString::null)
- virtual void beginTransaction ()
- virtual void commit ()
- virtual void rollback ()
- void setHost (const QString & host)
- void setPort (int port)
- void setUser (const QString & user)
- void setPassword (const QString & pwd)
- QString host () const
- int port () const
- QString user () const
- QString password () const
- bool isConnected () const

#### Protected Methods

- void setConnected (bool conn)

## Detailed Description

This is the base class for the interaction between kdbcore and the various plugins. It should be subclassed by plugins, but should not be used by the client programs

Connector () | ### Connector

Connector (const Connector& c) | ### Connector

~Connector () | ### ~Connector

[virtual]

void close () | ### close

[virtual]

closes the connection to the database backend

bool connect () | ### connect

[pure virtual]

opens the connection to the database backend

Reimplemented from QObject.

QStringList databases () | ### databases

[pure virtual]

returns the list of the available databases for the current open connection

QStringList tables () | ### tables

[pure virtual]

returns the list of the available tables for the current open database

RowList fields (const QString & tableName) | ### fields

[pure virtual]

returns the list of the fields for the given table for the current open database. The rows must contain:

- field name
- datatype, native form
- size, where applicable
- precision, where applicable
- Null constraint (Y/N)
- Default value
- referential constraint
- comment

the only mandatory fields are field name, datatype and size. All other values can be present if the DBMS is able to give them

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

[pure virtual]

executes an SQL statement. The return value is the number of rows affected by the statement

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

[pure virtual]

creates an empty database

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

[pure virtual]

drops a database with all its content

bool createTable (const Table & tab) | ### createTable

[pure virtual]

creates a table with the characteristic of the given one

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

[pure virtual]

remove a table in the currend database deleting all its content

bool appendField (const QString &table, Field *f) | ### appendField

[pure virtual]

append a file to a table. the underlying DBMS must issue an alter here

bool removeField (const QString &table, const QString &field) | ### removeField

[pure virtual]

remove a field from a table. the underlying DBMS must issue an alter here

bool changeField (const QString &table, Field *f) | ### changeField

[pure virtual]

change the definition of a field of the given table. the underlying DBMS must issue an alter here

Connector * clone () | ### clone

[pure virtual]

clones the current object. If the object holds an open connection, the resulting connector must be open too.

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

[pure virtual]

set the operational database for the current connector. From this point all the methods will affect the selected database

DataType nativeToKDB (const QString &type) | ### nativeToKDB

[pure virtual]

returns the corresponding KDB datatype for the given native one

QString KDBToNative (DataType type) | ### KDBToNative

[pure virtual]

returns the corresponding native datatype for the given KDB one

Handler * query (const QString &SQL) | ### query

[pure virtual]

executes a select to the backend and returns an handler to the result

Query * createQueryObject (QObject *parent = 0L, const char *name = 0L, const QString &sql = QString::null) | ### createQueryObject

[virtual]

Create a query object. Plugins can override some functions of the class Query to take advantage of some specific optimizations. This is entirely optional, default implementations with a meaningful behaviour are provided in the kdedb core library

void beginTransaction () | ### beginTransaction

[pure virtual]

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

void commit () | ### commit

[pure virtual]

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

[pure virtual]

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 setHost (const QString & host) | ### setHost

void setPort (int port) | ### setPort

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

void setPassword (const QString & pwd) | ### setPassword

QString host () | ### host

[const]

int port () | ### port

[const]

QString user () | ### user

[const]

QString password () | ### password

[const]

bool isConnected () | ### isConnected

[const]

void setConnected (bool conn) | ### setConnected

[protected]

must be called by subclasses when a connection to the backend is established

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