Settings DB

This commit is contained in:
2026-02-09 16:10:47 +03:00
parent b3aa4d088a
commit 6387b41f9b
9 changed files with 176 additions and 59 deletions

View File

@@ -2,6 +2,7 @@
#include <QThread>
#include <QMessageBox>
#include "specialmessagebox.h"
ProviderDBLMS::ProviderDBLMS(QObject *parent) :
QObject(parent),
@@ -25,6 +26,46 @@ void ProviderDBLMS::slot_TryDisConnectionFromDB()
DisConnectionFromDB();
}
void ProviderDBLMS::slot_CheckDB()
{
CheckResult result;
result.resDriver = ProviderDBLMS::checkDriverQPSQLavailable();
result.resUser = this->checkUserLMSexist();
result.resDB = this->checkDataBaseLMSexist();
emit signal_CheckDBResult(result);
}
void ProviderDBLMS::slot_RepareDB(CheckResult result)
{
if(!result.resUser)
{
if(!this->createUser())
{
result.resUser = false;
emit signal_RepareDBResult(result);
}
else
result.resUser = true;
}
if(!result.resDB)
{
if(!this->createDB())
{
result.resDB = false;
emit signal_RepareDBResult(result);
}
else
result.resDB = true;
}
emit signal_RepareDBResult(result);
}
bool ProviderDBLMS::ConnectionToDB()
{
mtxAccess.lock();
@@ -103,12 +144,12 @@ DataBaseSettings ProviderDBLMS::getDBSettings()
bool ProviderDBLMS::setUserPasswordPostgres(QString userName, QString password)
{
return dbLMS->setUserPasswordPostgres(userName, password);
return InterfaceDataBaseLMS::setUserPasswordPostgres(userName, password);
}
bool ProviderDBLMS::checkDriverQPSQLavailable()
{
return dbLMS->checkDriverQPSQLavailable();
return InterfaceDataBaseLMS::checkDriverQPSQLavailable();
}
bool ProviderDBLMS::checkUserLMSexist()