Overview of triggers extended with function name and arguments.

Did a lot of refactoring on the catalog to keep things clean.
This commit is contained in:
eelke 2018-11-18 19:30:45 +01:00
parent 35813ae926
commit fcb191f2cc
44 changed files with 797 additions and 404 deletions

View file

@ -1,14 +1,12 @@
#include "PgAuthIdContainer.h"
#include "Pgsql_Connection.h"
#include "PgDatabaseCatalog.h"
#include "Pgsql_Col.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)
if (minimumVersion(90500))
result += ", rolbypassrls";
result += "\n"
@ -16,29 +14,14 @@ std::string PgAuthIdContainer::getLoadQuery() const
return result;
}
void PgAuthIdContainer::load(const Pgsql::Result &res)
PgAuthId PgAuthIdContainer::loadElem(const Pgsql::Row &row)
{
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());
}
Pgsql::Col col(row);
PgAuthId v;
col >> v.oid >> v.name >> v.super >> v.inherit >> v.createRole >> v.createDB
>> v.canlogin >> v.replication >> v.connLimit >> v.validUntil;
if (minimumVersion(90500))
col >> v.bypassRls;
return v;
}