From bc12dc602032ec8ef17f049482f012e0851f6bfc Mon Sep 17 00:00:00 2001 From: eleonore12345 Date: Sat, 14 Sep 2024 00:32:37 +0200 Subject: [PATCH] suite sqlmanager --- src/SQLmanager.cpp | 46 +++++++++++++++++++++++++++++++++++++++------- src/SQLmanager.h | 2 +- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/SQLmanager.cpp b/src/SQLmanager.cpp index fbc3212..f61d1dc 100644 --- a/src/SQLmanager.cpp +++ b/src/SQLmanager.cpp @@ -1,3 +1,5 @@ +//database file location to read in the json? + //deployer SLmanager implementation // Copyright (C) 2024 Jean-Cloud // GNU General Public License v3 @@ -6,20 +8,50 @@ #include #include #include +#include #include "Service.h" +#include "SQLmanager.h" using namespace std; -//constructor and destructor inlin +//constructor +SQLmanager::SQLmanager() +{ + sqlite3 *db; + char *zErrMsg = 0; + int rc; -//services -vector GetServices() const; -const Service * FindServiceByUsername(string aUsername) const; -const Service * FindServiceByID(int aUserID) const; + rc = sqlite3_open("test.db", &db); + + if(rc) { + cerr << "Error. Database cannot be opened." << endl << sqlite3_errmsg(db) << endl; + } else { + cout << "Database opened" << endl; + } + sqlite3_close(db); +} + +//destructor inline + +//public methods +vector SQLmanager::GetServices() const +{ + +} +const Service * SQLmanager::FindServiceByUsername(string aUsername) const +{ + +} +const Service * SQLmanager::FindServiceByID(int aUserID) const +{ + +} //list FindServicesByServer(string aServer) const; -int isServiceOnServer(string serviceUsername); +int SQLmanager::isServiceOnServer(string serviceUsername) +{ + +} -vector services; diff --git a/src/SQLmanager.h b/src/SQLmanager.h index ecf8f9f..10602ff 100644 --- a/src/SQLmanager.h +++ b/src/SQLmanager.h @@ -15,7 +15,7 @@ using namespace std; class SQLmanager { public: - SQLmanager(){} + SQLmanager(); ~SQLmanager(){} //services vector GetServices() const;