Skip to content

Commit

Permalink
New DataManagment division into fetching and inserting methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikpalatynski committed Mar 5, 2024
1 parent 91a5c28 commit fbebf6e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
1 change: 1 addition & 0 deletions source/DataBase/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
project(PasswordManager)

target_include_directories(passwordManager PRIVATE DataBase/interface)
target_include_directories(passwordManager PRIVATE DataBase/common)

target_sources(passwordManager PRIVATE
DataBaseConnection.cpp DataBaseManager.cpp QueryOperationBuilder.cpp)
17 changes: 8 additions & 9 deletions source/DataBase/common/DataBaseCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
#include <string>
#include <vector>

namespace dataBase::common
{
namespace dataBase::common {

static constexpr char dataBasePath[] =
"../../../source/dataBase/password-manager.db";
static constexpr char users[] = "Users";
static constexpr char passwords[] = "Passwords";
static constexpr char passwordHistory[] = "PasswordHistory";
static constexpr char categories[] = "Categories";
static constexpr char dataBasePath[] =
"../../../source/dataBase/password-manager.db";
static constexpr char users[] = "Users";
static constexpr char passwords[] = "Passwords";
static constexpr char passwordHistory[] = "PasswordHistory";
static constexpr char categories[] = "Categories";

}; // namespace dataBase::common
}; // namespace dataBase::common
12 changes: 4 additions & 8 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include "DataBase/common/DataBaseRequest.hpp"
#include "PasswordManager.h"

int main()
{
int main() {
std::string password = "haslo";
PasswordManager passwordManager(password);

Expand All @@ -27,12 +26,9 @@ int main()

auto result = dbManager->executeAndGetOperation(request);

if (result.empty())
std::cout << "result empty" << std::endl;
if (!result.empty())
{
for (const auto &el : result)
{
if (result.empty()) std::cout << "result empty" << std::endl;
if (!result.empty()) {
for (const auto &el : result) {
std::cout << el << std::endl;
}
}
Expand Down

0 comments on commit fbebf6e

Please sign in to comment.