The catalogue now loads the list of databases en there is a table model that can show this data.
This commit is contained in:
parent
a9430bca1a
commit
20af12535e
22 changed files with 504 additions and 118 deletions
35
src/PgDatabaseContainer.cpp
Normal file
35
src/PgDatabaseContainer.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include "PgDatabaseContainer.h"
|
||||
#include "PgsqlConn.h"
|
||||
|
||||
PgDatabaseContainer::PgDatabaseContainer()
|
||||
{}
|
||||
|
||||
std::string PgDatabaseContainer::getLoadQuery() const
|
||||
{
|
||||
return "SELECT oid,datname,datdba,encoding,datcollate,datctype,datistemplate,datallowcon,"
|
||||
"datconnlimit,dattablespace,datacl FROM pg_database";
|
||||
}
|
||||
|
||||
void PgDatabaseContainer::load(const Pgsql::Result &res)
|
||||
{
|
||||
const int n_rows = res.getRows();
|
||||
m_container.clear();
|
||||
m_container.reserve(n_rows);
|
||||
for (auto row : res) {
|
||||
PgDatabase v;
|
||||
v.oid = row.get(0); // InvalidOid;
|
||||
v.name = row.get(1);
|
||||
v.dba = row.get(2); // owner?
|
||||
v.encoding = row.get(3);
|
||||
v.collate = row.get(4);
|
||||
v.ctype = row.get(5);
|
||||
v.isTemplate = row.get(6);
|
||||
v.allowConn = row.get(7);
|
||||
v.connLimit = row.get(8);
|
||||
v.tablespace = row.get(9);
|
||||
v.acl = row.get(10);
|
||||
m_container.push_back(v);
|
||||
}
|
||||
std::sort(m_container.begin(), m_container.end());
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue