More case fixes of filenames.
This commit is contained in:
parent
20af12535e
commit
e71ef2e6df
41 changed files with 258 additions and 123 deletions
53
src/OpenDatabase.cpp
Normal file
53
src/OpenDatabase.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#include "OpenDatabase.h"
|
||||
#include "pgsqldatabasecatalogue.h"
|
||||
#include "PgsqlConn.h"
|
||||
#include "typeselectionitemmodel.h"
|
||||
|
||||
Expected<OpenDatabase*> OpenDatabase::createOpenDatabase(const ConnectionConfig &cfg)
|
||||
{
|
||||
OpenDatabase *odb = new OpenDatabase(cfg, nullptr);
|
||||
if (odb->Init()) {
|
||||
|
||||
|
||||
}
|
||||
return odb;
|
||||
//return Expected<ConnectionConfig>::fromException(std::out_of_range("Invalid row"));
|
||||
}
|
||||
|
||||
OpenDatabase::OpenDatabase(const ConnectionConfig& cfg, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_config(cfg)
|
||||
, m_catalogue(new PgsqlDatabaseCatalogue)
|
||||
{
|
||||
}
|
||||
|
||||
OpenDatabase::~OpenDatabase()
|
||||
{
|
||||
delete m_catalogue;
|
||||
}
|
||||
|
||||
bool OpenDatabase::Init()
|
||||
{
|
||||
Pgsql::Connection conn;
|
||||
auto kw = m_config.getKeywords();
|
||||
auto vals = m_config.getValues();
|
||||
if (conn.connect(kw, vals, 0)) {
|
||||
m_catalogue->loadAll(conn);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
PgsqlDatabaseCatalogue* OpenDatabase::catalogue()
|
||||
{
|
||||
return m_catalogue;
|
||||
}
|
||||
|
||||
|
||||
TypeSelectionItemModel* OpenDatabase::typeSelectionModel()
|
||||
{
|
||||
if (m_typeSelectionModel == nullptr) {
|
||||
m_typeSelectionModel = new TypeSelectionItemModel(nullptr);
|
||||
m_typeSelectionModel->setTypeList(m_catalogue->types());
|
||||
}
|
||||
return m_typeSelectionModel;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue