Builds on windows again

This commit is contained in:
eelke 2017-11-26 13:07:21 +01:00
parent 33cf39b799
commit bebb3391c3
160 changed files with 138 additions and 117 deletions

View file

@ -0,0 +1,45 @@
#include "PgAuthIdContainer.h"
#include "Pgsql_Connection.h"
#include "PgDatabaseCatalogue.h"
PgAuthIdContainer::PgAuthIdContainer(PgDatabaseCatalogue *cat)
: PgContainer<PgAuthId>(cat)
{}
std::string PgAuthIdContainer::getLoadQuery() const
{
std::string result =
"SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, "
" rolcanlogin, rolreplication, rolconnlimit, rolvaliduntil";
if (m_catalogue->serverVersion() >= 90500)
result += ", rolbypassrls";
result += "\n"
"FROM pg_authid";
return result;
}
void PgAuthIdContainer::load(const Pgsql::Result &res)
{
const int n_rows = res.rows();
m_container.clear();
m_container.reserve(n_rows);
bool with_rls = (m_catalogue->serverVersion() >= 90500);
for (auto row : res) {
PgAuthId v;
v.oid << row.get(0); // InvalidOid;
v.name << row.get(1);
v.super << row.get(2);
v.inherit << row.get(3);
v.createRole << row.get(4);
v.createDB << row.get(5);
v.canlogin << row.get(6);
v.replication << row.get(7);
v.connLimit << row.get(8);
v.validUntil << row.get(9);
v.bypassRls = with_rls ? (bool)row.get(10) : false;
// QDateTime
m_container.push_back(v);
}
std::sort(m_container.begin(), m_container.end());
}