Allows to execute SQL-Queries asynchronous.Should be stopped right that:
More...
#include <equerythread.h>
Public Slots |
void | execQuery (QObject *client, QVariant requestId, QString queryString, QString errorMsg, QList< QVariant > bindValues=QList< QVariant >()) |
| Adds a query to the queue.
|
void | cancelQuery () |
void | dbSetup (QString dbname, QString username, QString password, QString host, QString driver) |
Signals |
void | configureDB (QString dbname, QString username, QString password, QString host, QString driver) |
void | addToQueue (QObject *client, QVariant requestId, QString queryString, QString errorMsg, QList< QVariant > bindValues) |
| Adds a new query to the queue of the query worker (Internally used).
|
void | cancel () |
void | result (QObject *client, QVariant requestId, int querySize, QSqlRecord record) |
| Is emitted, if a result for a queued query is fetched.
|
void | setRange (int min, int max) |
void | setValue (int value) |
void | finished (QObject *client, QVariant requestId, bool status) |
| Emitted to indicate the result status of a query.
|
void | allConnected () |
Detailed Description
Allows to execute SQL-Queries asynchronous.
Should be stopped right that:
thread.quit();
thread.wait(1000);
Constructor & Destructor Documentation
EQueryThread::EQueryThread |
( |
QObject * |
parent = 0 | ) |
|
EQueryThread::~EQueryThread |
( |
| ) |
|
Member Function Documentation
void EQueryThread::addToQueue |
( |
QObject * |
client, |
|
|
QVariant |
requestId, |
|
|
QString |
queryString, |
|
|
QString |
errorMsg, |
|
|
QList< QVariant > |
bindValues |
|
) |
| |
|
signal |
Adds a new query to the queue of the query worker (Internally used).
- Note
- This signal is only used to communicate with the QueryWorker.
The query itself is stored in queryString
. To use placeholders, add them in bindValues
. To allow the processing of the results at the connected objects correctly, the requestId
is appended unchanged to emitted result() signal for this query. To display an error message if the query failed, set the errorMsg
to a meaningful message.
void EQueryThread::allConnected |
( |
| ) |
|
|
signal |
void EQueryThread::cancel |
( |
| ) |
|
|
signal |
void EQueryThread::cancelQuery |
( |
| ) |
|
|
slot |
void EQueryThread::configureDB |
( |
QString |
dbname, |
|
|
QString |
username, |
|
|
QString |
password, |
|
|
QString |
host, |
|
|
QString |
driver |
|
) |
| |
|
signal |
used to configure database at QueryWorker
void EQueryThread::dbSetup |
( |
QString |
dbname, |
|
|
QString |
username, |
|
|
QString |
password, |
|
|
QString |
host, |
|
|
QString |
driver |
|
) |
| |
|
slot |
void EQueryThread::execQuery |
( |
QObject * |
client, |
|
|
QVariant |
requestId, |
|
|
QString |
queryString, |
|
|
QString |
errorMsg, |
|
|
QList< QVariant > |
bindValues = QList<QVariant>() |
|
) |
| |
|
slot |
Adds a query to the queue.
Prepares an QSqlQuery with query queryString
. Afterwards it binds all values from bindValues
. This values must be ordered (Placeholder ? not :fieldName). To allow the identification of the result by the client
, use requestId
. The related emit of the result() signal, contains the unchagend requestId
and also the pointer to client
. To display an error message if the query failed, set the errorMsg
to a meaningful message.
void EQueryThread::finished |
( |
QObject * |
client, |
|
|
QVariant |
requestId, |
|
|
bool |
status |
|
) |
| |
|
signal |
Emitted to indicate the result status of a query.
To identify the query, the client
and requestId
is also given.
void EQueryThread::finishedByPass |
( |
QObject * |
client, |
|
|
QVariant |
requestId, |
|
|
bool |
status |
|
) |
| |
|
privateslot |
bool EQueryThread::isStarted |
( |
| ) |
const |
void EQueryThread::result |
( |
QObject * |
client, |
|
|
QVariant |
requestId, |
|
|
int |
querySize, |
|
|
QSqlRecord |
record |
|
) |
| |
|
signal |
Is emitted, if a result for a queued query is fetched.
The client
and requestId
are unchanged and should be used by the caller to identify it's queries.
void EQueryThread::resultByPass |
( |
QObject * |
client, |
|
|
QVariant |
requestId, |
|
|
int |
querySize, |
|
|
QSqlRecord |
record |
|
) |
| |
|
privateslot |
Internally used to by pass the fetched results.
void EQueryThread::run |
( |
| ) |
|
void EQueryThread::setRange |
( |
int |
min, |
|
|
int |
max |
|
) |
| |
|
signal |
void EQueryThread::setRangeByPass |
( |
int |
min, |
|
|
int |
max |
|
) |
| |
|
privateslot |
void EQueryThread::setStarted |
( |
| ) |
|
|
privateslot |
void EQueryThread::setValue |
( |
int |
value | ) |
|
|
signal |
void EQueryThread::setValueByPass |
( |
int |
value | ) |
|
|
privateslot |
bool EQueryThread::waitForStart |
( |
| ) |
|
Member Data Documentation
bool EQueryThread::finishedStartup |
|
private |
this object run's completely at the other thread therefore the communication is done through the event loop with help of signals and slots
The documentation for this class was generated from the following files: