pgLab/pglablib/PgClassContainer.cpp
eelke fcb191f2cc Overview of triggers extended with function name and arguments.
Did a lot of refactoring on the catalog to keep things clean.
2018-11-18 19:30:45 +01:00

34 lines
1.1 KiB
C++

#include "PgClassContainer.h"
#include "Pgsql_Connection.h"
#include "Pgsql_Col.h"
#include "PgDatabaseCatalog.h"
#include "PgNamespaceContainer.h"
#include <iterator>
std::string PgClassContainer::getLoadQuery() const
{
return "SELECT oid, relname, relnamespace, reltype, reloftype, "
" relowner, relam, relfilenode, reltablespace, relpages, "
" reltuples, reltoastrelid, relisshared, relpersistence, "
" relkind, relhasoids, relispopulated, relfrozenxid, relminmxid, "
" relacl, reloptions \n"
"FROM pg_catalog.pg_class";
}
PgClass PgClassContainer::loadElem(const Pgsql::Row &row)
{
Pgsql::Col col(row);
PgClass v;
col >> v.oid >> v.name >> v.relnamespace >> v.type >> v.oftype
>> v.owner >> v.am >> v.filenode >> v.tablespace >> v.pages_est
>> v.tuples_est >> v.toastrelid >> v.isshared >> v.persistence
>> v.kind >> v.hasoids >> v.ispopulated >> v.frozenxid >> v.minmxid
>> v.acl >> v.options;
auto&& ns = m_catalog.namespaces()->getByKey(v.relnamespace);
if (ns) {
v.relnamespace_name = ns->name;
v.system_namespace = ns->isSystemCatalog();
}
return v;
}