Moved several files from pglab project to pglablib
This commit is contained in:
parent
206d734ff5
commit
f4538069cb
44 changed files with 45 additions and 44 deletions
|
|
@ -1,44 +0,0 @@
|
|||
#include "PgAuthIdContainer.h"
|
||||
#include "Pgsql_Connection.h"
|
||||
#include "PgDatabaseCatalog.h"
|
||||
|
||||
std::string PgAuthIdContainer::getLoadQuery() const
|
||||
{
|
||||
std::string result =
|
||||
"SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, "
|
||||
" rolcanlogin, rolreplication, rolconnlimit, rolvaliduntil";
|
||||
auto cat = m_catalogue.lock();
|
||||
if (cat && cat->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);
|
||||
auto cat = m_catalogue.lock();
|
||||
bool with_rls = (cat && cat->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());
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue