Bunch of raw pointers replaced with smart pointers of references.

This commit is contained in:
eelke 2017-12-09 20:21:22 +01:00
parent 5a199c9138
commit ea035f58c8
20 changed files with 67 additions and 79 deletions

View file

@ -1,18 +1,16 @@
#include "PgAuthIdContainer.h"
#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)
auto cat = m_catalogue.lock();
if (cat && cat->serverVersion() >= 90500)
result += ", rolbypassrls";
result += "\n"
"FROM pg_authid";
return result;
@ -23,7 +21,8 @@ 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);
auto cat = m_catalogue.lock();
bool with_rls = (cat && cat->serverVersion() >= 90500);
for (auto row : res) {
PgAuthId v;
v.oid << row.get(0); // InvalidOid;