Version upgrade 4.00 #45
|
@ -48,6 +48,8 @@ set(PROJECT_SOURCES
|
|||
|
||||
main_lib.h
|
||||
|
||||
globals/db_names.h
|
||||
globals/db_names.cpp
|
||||
globals/global_configs.h
|
||||
globals/global_configs.cpp
|
||||
|
||||
|
|
13
logdoctor/globals/db_names.cpp
Normal file
13
logdoctor/globals/db_names.cpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
#include "db_names.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace DatabasesNames {
|
||||
|
||||
const QString data{ "LogsData" };
|
||||
|
||||
const QString hashes{ "FilesHashes" };
|
||||
|
||||
} // namespace GlobalConfigs
|
21
logdoctor/globals/db_names.h
Normal file
21
logdoctor/globals/db_names.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef LOGDOCTOR__GLOBALS__DB_NAMES_H
|
||||
#define LOGDOCTOR__GLOBALS__DB_NAMES_H
|
||||
|
||||
|
||||
class QString;
|
||||
|
||||
|
||||
//! DatabasesNames
|
||||
/*!
|
||||
Names of the databases
|
||||
*/
|
||||
namespace DatabasesNames {
|
||||
|
||||
extern const QString data;
|
||||
|
||||
extern const QString hashes;
|
||||
|
||||
} // namespace DatabasesNames
|
||||
|
||||
|
||||
#endif // LOGDOCTOR__GLOBALS__DB_NAMES_H
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "main_lib.h"
|
||||
|
||||
#include "globals/db_names.h"
|
||||
#include "globals/global_configs.h"
|
||||
|
||||
#include "customs/treewidgetitems.h"
|
||||
|
@ -290,6 +291,8 @@ void MainWindow::closeEvent( QCloseEvent *event )
|
|||
if ( this->db_do_backup && this->db_edited ) {
|
||||
this->backupDatabase();
|
||||
}
|
||||
QSqlDatabase::removeDatabase( DatabasesNames::data );
|
||||
QSqlDatabase::removeDatabase( DatabasesNames::hashes );
|
||||
// save splitters sizes => this->ui->splitter_StatsCount->sizes();
|
||||
}
|
||||
|
||||
|
@ -2032,6 +2035,8 @@ void MainWindow::makeInitialChecks()
|
|||
}
|
||||
|
||||
if ( ok ) {
|
||||
QSqlDatabase::addDatabase( "QSQLITE", DatabasesNames::data );
|
||||
QSqlDatabase::addDatabase( "QSQLITE", DatabasesNames::hashes );
|
||||
// statistics' database
|
||||
if ( ! CheckSec::checkCollectionDatabase( this->db_data_path + "/collection.db" ) ) {
|
||||
// checks failed, abort
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include "hash.h"
|
||||
|
||||
#include "globals/db_names.h"
|
||||
|
||||
#include "utilities/checks.h"
|
||||
#include "utilities/gzip.h"
|
||||
#include "utilities/io.h"
|
||||
|
@ -31,12 +33,7 @@ bool HashOps::loadUsedHashesLists( const std::string& db_path ) noexcept
|
|||
bool successful{ true };
|
||||
const QString db_name{ QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1ul ) ) };
|
||||
|
||||
QSqlDatabase db;
|
||||
if ( QSqlDatabase::contains("qt_sql_default_connection") ) {
|
||||
db = QSqlDatabase::database("qt_sql_default_connection");
|
||||
} else {
|
||||
db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
}
|
||||
QSqlDatabase db{ QSqlDatabase::database(DatabasesNames::hashes) };
|
||||
db.setDatabaseName( QString::fromStdString( db_path ) );
|
||||
|
||||
if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) {
|
||||
|
@ -184,10 +181,11 @@ bool HashOps::insertUsedHashes( const std::string& db_path, const std::vector<st
|
|||
{
|
||||
bool successful{ true };
|
||||
|
||||
const QString db_name{ QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1ul ) ) };
|
||||
QSqlDatabase db{ QSqlDatabase::addDatabase("QSQLITE") };
|
||||
QSqlDatabase db{ QSqlDatabase::database(DatabasesNames::hashes) };
|
||||
db.setDatabaseName( QString::fromStdString( db_path ) );
|
||||
|
||||
const QString db_name{ QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1ul ) ) };
|
||||
|
||||
if ( ! CheckSec::checkDatabaseFile( db_path, db_name ) ) {
|
||||
successful &= false;
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include "parser.h"
|
||||
|
||||
#include "globals/db_names.h"
|
||||
|
||||
#include "utilities/checks.h"
|
||||
#include "utilities/gzip.h"
|
||||
#include "utilities/io.h"
|
||||
|
@ -239,7 +241,7 @@ void CraplogParser::storeLogLines()
|
|||
QString db_path{ QString::fromStdString( this->db_data_path ) };
|
||||
QString db_name{ QString::fromStdString( this->db_data_path.substr( this->db_data_path.find_last_of( '/' ) + 1ul ) ) };
|
||||
|
||||
QSqlDatabase db{ QSqlDatabase::addDatabase("QSQLITE") };
|
||||
QSqlDatabase db{ QSqlDatabase::database(DatabasesNames::data) };
|
||||
db.setDatabaseName( db_path );
|
||||
|
||||
if ( ! CheckSec::checkDatabaseFile( this->db_data_path, db_name ) ) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include "checks.h"
|
||||
|
||||
#include "globals/db_names.h"
|
||||
|
||||
#include "modules/dialogs.h"
|
||||
|
||||
#include "utilities/io.h"
|
||||
|
@ -212,12 +214,7 @@ bool checkCollectionDatabase( const std::string& db_path ) noexcept
|
|||
const QString db_name{ QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1 ) ) };
|
||||
const std::vector<QString> ws_names{ "apache", "nginx", "iis" };
|
||||
|
||||
QSqlDatabase db;
|
||||
if ( QSqlDatabase::contains("qt_sql_default_connection") ) {
|
||||
db = QSqlDatabase::database("qt_sql_default_connection");
|
||||
} else {
|
||||
db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
}
|
||||
QSqlDatabase db{ QSqlDatabase::database(DatabasesNames::data) };
|
||||
db.setDatabaseName( QString::fromStdString( db_path ) );
|
||||
|
||||
// check the existence
|
||||
|
@ -397,12 +394,7 @@ bool checkHashesDatabase( const std::string& db_path ) noexcept
|
|||
const QString db_name{ QString::fromStdString( db_path.substr( db_path.find_last_of( '/' ) + 1 ) ) };
|
||||
const std::vector<QString> ws_names { "apache", "nginx", "iis" };
|
||||
|
||||
QSqlDatabase db;
|
||||
if ( QSqlDatabase::contains("qt_sql_default_connection") ) {
|
||||
db = QSqlDatabase::database("qt_sql_default_connection");
|
||||
} else {
|
||||
db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
}
|
||||
QSqlDatabase db{ QSqlDatabase::database(DatabasesNames::hashes) };
|
||||
db.setDatabaseName( QString::fromStdString( db_path ) );
|
||||
|
||||
// check the existence
|
||||
|
|
Loading…
Reference in a new issue