I'm trying to create a class that is tasked with creating the link between Postgres and c++. I'm trying to make the worker a static item so that I can use it in any function without modifying it so I don't have to keep instantiating it, but I don't know how to declare it as I keep getting errors
I would appreciate if you guys could help me find a way to properly declare the worker
The code in the picture:
#pragma once
#include <string>
#include <pqxx/pqxx>
#pragma once
#include <string>
#include <pqxx/pqxx>
class DBLink
{
public:
DBLink();
static pqxx::work worker = worker(connectionObject);
private:
std::string connectionString = "host=ec2-54-74-35-87.eu-west-1.compute.amazonaws.com port=5432 dbname=d8iolcesns1bj4 user=pktunepcutgdqh password=7e3eeef2e01e0d8ae555c7236b1c3375789259dfb6acba41225cc4f55394836c";
pqxx::connection connectionObject;
virtual void function() = 0;
};