26 lines
740 B
C++
26 lines
740 B
C++
#include "PgDatabaseContainer.h"
|
|
#include "Pgsql_Connection.h"
|
|
#include "Pgsql_Col.h"
|
|
|
|
|
|
std::string PgDatabaseContainer::getLoadQuery() const
|
|
{
|
|
return "SELECT oid,datname,datdba,encoding,datcollate,datctype,datistemplate,datallowconn,"
|
|
"datconnlimit,dattablespace,datacl FROM pg_database";
|
|
}
|
|
|
|
void PgDatabaseContainer::load(const Pgsql::Result &res)
|
|
{
|
|
const int n_rows = res.rows();
|
|
m_container.clear();
|
|
m_container.reserve(n_rows);
|
|
for (auto row : res) {
|
|
Pgsql::Col col(row);
|
|
PgDatabase v;
|
|
col >> v.oid >> v.name >> v.dba >> v.encoding >> v.collate >> v.ctype >> v.isTemplate
|
|
>> v.allowConn >> v.connLimit >> v.tablespace >> v.acl;
|
|
m_container.push_back(v);
|
|
}
|
|
std::sort(m_container.begin(), m_container.end());
|
|
}
|
|
|