Skip to content

Commit

Permalink
Create Basic DataBase. Adding CMakeLists.txt in dataBase directory
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikpalatynski committed Feb 6, 2024
1 parent c6d9782 commit 8576ab5
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
3 changes: 2 additions & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ project(PasswordManager)

add_library(sqlite3 STATIC ../lib/sqlite3.c)

add_executable(passwordManager main.cpp PasswordManager.cpp DataBase/DataBaseHandler.cpp DataBase/DataBaseCommon.cpp)
add_executable(passwordManager main.cpp PasswordManager.cpp)

target_include_directories(sqlite3 PUBLIC ../lib)
target_link_libraries(passwordManager PRIVATE sqlite3)

add_subdirectory(test)
add_subdirectory(dataBase)
3 changes: 3 additions & 0 deletions source/DataBase/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project(PasswordManager)

target_sources(passwordManager PRIVATE DataBaseHandler.cpp)
10 changes: 0 additions & 10 deletions source/DataBase/DataBaseCommon.cpp

This file was deleted.

19 changes: 12 additions & 7 deletions source/DataBase/DataBaseCommon.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#pragma once

#include <iostream>
#include <vector>

#include <string>
struct DataBaseCommon
{
static const std::vector<std::string> userRecords;
static const std::vector<std::string> passwordRecords;
static constexpr std::vector<std::string> userRecordsRecords{"Username", "Password"};
static constexpr std::vector<std::string> categoriesRecords{"Category"};
static constexpr std::vector<std::string> passwordHistoryRecords{"Creation_Time", "Modify_Time", "Expiry_Time"};
static constexpr std::vector<std::string> passwordRecords{
"User_Id", "Category_Id", "Title", "Username", "Password", "Note", "Url"};

static constexpr std::string dataBasePath{"../../../source/dataBase/password-manager.db"};

static const std::string dataBasePath;
static const std::string users;
static const std::string passwords;
static constexpr std::string users{"Users"};
static constexpr std::string passwords{"Passwords"};
static constexpr std::string passwordHistory{"PasswordHistory"};
static constexpr std::string categories{"Categories"};
};
2 changes: 1 addition & 1 deletion source/DataBase/DataBaseHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ class DataBaseHandler
void executeQuery(const std::string &query);

sqlite3 *database_;
};
};
Binary file modified source/DataBase/password-manager.db
Binary file not shown.
4 changes: 2 additions & 2 deletions source/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <string>

#include "PasswordManager.h"
#include "DataBase/DataBaseHandler.hpp"
#include "DataBase/DataBaseCommon.hpp"
#include "dataBase/DataBaseHandler.hpp"
#include "dataBase/DataBaseCommon.hpp"

int main()
{
Expand Down

0 comments on commit 8576ab5

Please sign in to comment.