Revision f12670e9
Von Christian Ehringfeld vor mehr als 8 Jahren hinzugefügt
src/database.cpp | ||
---|---|---|
using namespace CuteEntityManager;
|
||
|
||
Database::Database(QSqlDatabase database, bool loggerActivated, bool logQueries,
|
||
bool logErrors) {
|
||
bool logErrors, MsgType type) {
|
||
this->database = database;
|
||
this->init();
|
||
this->connectionName = this->database.connectionName();
|
||
this->initLogger(loggerActivated, logQueries, logErrors);
|
||
this->initLogger(loggerActivated, logQueries, logErrors, type);
|
||
}
|
||
|
||
Database::Database(QString databaseType, QString connectionName,
|
||
QString hostname,
|
||
QString databasename,
|
||
QString username, QString password, qint64 port, bool loggerActivated,
|
||
bool logQueries, bool logErrors, QString databaseOptions) {
|
||
bool logQueries, bool logErrors, QString databaseOptions, MsgType type) {
|
||
this->database = QSqlDatabase::addDatabase(databaseType, connectionName);
|
||
this->connectionName = connectionName;
|
||
if (!hostname.isEmpty()) {
|
||
... | ... | |
this->database.setConnectOptions(databaseOptions);
|
||
}
|
||
this->init();
|
||
this->initLogger(loggerActivated, logQueries, logErrors);
|
||
this->initLogger(loggerActivated, logQueries, logErrors, type);
|
||
}
|
||
|
||
void Database::init() {
|
||
... | ... | |
QSqlDriver::Transactions);
|
||
}
|
||
|
||
void Database::initLogger(bool activated, bool logQueries, bool logErrors) {
|
||
void Database::initLogger(bool activated, bool logQueries, bool logErrors,
|
||
MsgType type) {
|
||
this->logQueries = logQueries;
|
||
this->logErrors = logErrors;
|
||
if (activated) {
|
||
this->logger = new Logger(QDir::currentPath() + "/db" + this->connectionName +
|
||
".log");
|
||
".log", type);
|
||
}
|
||
}
|
||
|
Auch abrufbar als: Unified diff
some logger stuff