pgLab/pglab/OpenDatabase.h
eelke 190a6c04dc Made a start with showing foreignkeys in column list.
Not finished, need to decide what to do with multiple and multi column fkeys.
2017-12-25 10:31:58 +01:00

39 lines
1.1 KiB
C++

#ifndef OPENDATABASE_H
#define OPENDATABASE_H
#include "ConnectionConfig.h"
#include "Expected.h"
#include <memory>
class PgDatabaseCatalog;
class TypeSelectionItemModel;
/** Instances of this class represent a single database on which atleast one
* window is opened. This class is used to track details about that database.
*/
class OpenDatabase {
public:
using OpenDatabaseSPtr = std::shared_ptr<OpenDatabase>;
static Expected<OpenDatabaseSPtr> createOpenDatabase(const ConnectionConfig &cfg);
// using on_createResult_callback = std::function<void(Expected<std::shared_ptr<Pgsql::Result>>, qint64)>;
// void asyncCreateOpenDatabase(const ConnectionConfig &cfg, );
OpenDatabase(const OpenDatabase &) = delete;
OpenDatabase& operator=(const OpenDatabase &) = delete;
~OpenDatabase();
std::shared_ptr<PgDatabaseCatalog> catalogue();
TypeSelectionItemModel* typeSelectionModel();
private:
ConnectionConfig m_config;
std::shared_ptr<PgDatabaseCatalog> m_catalogue;
TypeSelectionItemModel *m_typeSelectionModel = nullptr;
OpenDatabase(const ConnectionConfig& cfg);
bool Init();
};
#endif // OPENDATABASE_H