Loading...
Searching...
No Matches
Go to the documentation of this file.
2#include "tkvsdatabasepool.h"
3#include "tsqldatabasepool.h"
4#include <TActionThread>
5#include <TSystemGlobal>
6#include <TStdErrSystemLogger>
7#include <TStdOutLogger>
8#include <TWebApplication>
14#define TF_CLI_MAIN(STATICFUNCTION) \
15 int main(int argc, char *argv[]) \
17 class Thread : public TActionThread { \
19 Thread() : TActionThread(0), returnCode(0) { } \
20 volatile int returnCode; \
25 returnCode = STATICFUNCTION(); \
26 commitTransactions(); \
27 for (auto it = sqlDatabases.begin(); it != sqlDatabases.end(); ++it) { \
28 it.value().database().close(); \
30 for (auto it = kvsDatabases.begin(); it != kvsDatabases.end(); ++it) { \
33 QEventLoop eventLoop; \
34 while (eventLoop.processEvents()) { } \
37 TWebApplication app(argc, argv); \
38 Tf::setupSystemLogger(new TStdErrSystemLogger); \
39 Tf::setupQueryLogger(); \
40 app.setMultiProcessingModule(TWebApplication::Thread); \
41 int idx = QCoreApplication::arguments().indexOf("-e"); \
42 QString env = (idx > 0) ? QCoreApplication::arguments().value(idx + 1) : QString("product"); \
43 app.setDatabaseEnvironment(env); \
45 QObject::connect(&thread, SIGNAL(finished()), &app, SLOT(quit())); \
48 Tf::releaseAppLoggers(); \
49 Tf::releaseQueryLogger(); \
50 return thread.returnCode; \