class Connector

base interaction class for plugins. More...

Contains pure virtuals
Full nameKDB::Connector
Definition#include <connector.h>
InheritsKDB::Object [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods


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 (const Connector& c)

 ~Connector ()

[virtual]

void  close ()

[virtual]

closes the connection to the database backend

bool  connect ()

[pure virtual]

opens the connection to the database backend

QStringList  databases ()

[pure virtual]

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

QStringList  tables ()

[pure virtual]

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

RowList  fields (const QString & tableName)

[pure virtual]

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

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)

[pure virtual]

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

bool  createDatabase (const QString & name)

[pure virtual]

creates an empty database

bool  dropDatabase (const QString & name)

[pure virtual]

drops a database with all its content

bool  createTable (const Table & tab)

[pure virtual]

creates a table with the characteristic of the given one

bool  dropTable (const QString & name)

[pure virtual]

remove a table in the currend database deleting all its content

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

[pure virtual]

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

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

[pure virtual]

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

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

[pure virtual]

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

Connector *  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)

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

[pure virtual]

returns the corresponding KDB datatype for the given native one

QString  KDBToNative (DataType type)

[pure virtual]

returns the corresponding native datatype for the given KDB one

Handler * query (const QString &SQL)

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

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

[pure virtual]

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

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

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

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]

void  setConnected (bool conn)

[ protected: ]

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