Class for database support. More...
#include <dbmodule.h>
Public Member Functions | |
DBModule (QObject *parent=0) | |
Standard constructor. | |
virtual | ~DBModule () |
Destructor. | |
void | connect (const KockpitAuthObj &authobj) |
Establish database conection. | |
void | disconnect () |
Destroy existing connection. | |
void | build (QList< KockpitUnitMap * > *kuml, const KockpitBaseObj &baseobj) |
Build kockpit units. | |
bool | entryExists (KockpitUnitMap *kunit) |
Check entry existence. | |
void | createEntry (KockpitUnitMap *kunit) |
Create database entry. | |
void | deleteEntry (KockpitUnitMap *kunit) |
Delete database entry. | |
void | modifyEntry (KockpitUnitMap *kunit) |
Modify database entry. | |
Private Attributes | |
QString | conid |
Static Private Attributes | |
static QString | buildBaseQuery = "SELECT %1 FROM %2 WHERE %3" |
Unprepared statement to build kockpit units. | |
static QString | createBaseQuery = "INSERT INTO %1 (%2) VALUES (%3)" |
Unprepared statement to create kockpit units. | |
static QString | deleteBaseQuery = "DELETE FROM %1 WHERE %2" |
Unprepared statement to delete kockpit units. | |
static QString | modifyBaseQuery = "UPDATE %1 SET %2 WHERE %3" |
Unprepared statement to modify kockpit units. |
Class for database support.
This class is needed for relational database support for kockpit.
DBModule::DBModule | ( | QObject * | parent = 0 |
) | [inline] |
Standard constructor.
virtual DBModule::~DBModule | ( | ) | [inline, virtual] |
Destructor.
void DBModule::build | ( | QList< KockpitUnitMap * > * | kuml, | |
const KockpitBaseObj & | baseobj | |||
) | [virtual] |
Build kockpit units.
In dependency of the type which is specified in the basobj structure objects will be created and filled with the datasource attribute values.
kuml | pointer to List of pointers to KockpitUnitMap objects (could be KockpitUser or KockpitGroup objects. | |
baseobj | This structure specifies the type of the object which should be filled with attribute values. |
Implements KockpitModule.
void DBModule::connect | ( | const KockpitAuthObj & | authobj | ) | [virtual] |
Establish database conection.
With this function a connection to the database specified with authobj is esablished.
authobj | This structure specfifies the connection parameters. |
Implements KockpitModule.
void DBModule::createEntry | ( | KockpitUnitMap * | kunit | ) | [virtual] |
Create database entry.
This function creates an entry in the database. For this task a query will be build. The database fields are determined by the AttributeMaps.
kunit | Pointer to KockpitUnitMap. |
Implements KockpitModule.
void DBModule::deleteEntry | ( | KockpitUnitMap * | kunit | ) | [virtual] |
Delete database entry.
This function deletes an entry from the database. For this task a query will be build. The database fields are determined by the AttributeMaps.
kunit | Pointer to KockpitUnitMap. |
Implements KockpitModule.
void DBModule::disconnect | ( | ) | [virtual] |
Destroy existing connection.
Implements KockpitModule.
bool DBModule::entryExists | ( | KockpitUnitMap * | kunit | ) |
Check entry existence.
This function checks if the object referenced by kunit already exists in database.
kunit | Pointer to KockpitUnitMap. |
void DBModule::modifyEntry | ( | KockpitUnitMap * | kunit | ) | [virtual] |
Modify database entry.
This function modifies an entry in the database. For this task a query will be build. The database fields are determined by the AttributeMaps.
kunit | Pointer to KockpitUnitMap. |
Implements KockpitModule.
QString DBModule::buildBaseQuery = "SELECT %1 FROM %2 WHERE %3" [static, private] |
Unprepared statement to build kockpit units.
QString DBModule::conid [private] |
QString DBModule::createBaseQuery = "INSERT INTO %1 (%2) VALUES (%3)" [static, private] |
Unprepared statement to create kockpit units.
QString DBModule::deleteBaseQuery = "DELETE FROM %1 WHERE %2" [static, private] |
Unprepared statement to delete kockpit units.
QString DBModule::modifyBaseQuery = "UPDATE %1 SET %2 WHERE %3" [static, private] |
Unprepared statement to modify kockpit units.