35 lines
1.2 KiB
C++
35 lines
1.2 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;
|
|
|
|
col.getAsArray<QString>(std::back_inserter(v.acl), Pgsql::NullHandling::Ignore);
|
|
col.getAsArray<QString>(std::back_inserter(v.options), Pgsql::NullHandling::Ignore);
|
|
|
|
auto cat = m_catalogue.lock();
|
|
auto ns = cat->namespaces()->getByKey(v.relnamespace);
|
|
v.relnamespace_name = ns.name;
|
|
v.system_namespace = ns.isSystemCatalog();
|
|
return v;
|
|
}
|