31 lines
823 B
C++
31 lines
823 B
C++
|
|
#include "PgAttributeContainer.h"
|
|||
|
|
#include "Pgsql_Col.h"
|
|||
|
|
|
|||
|
|
std::string PgAttributeContainer::getLoadQuery() const
|
|||
|
|
{
|
|||
|
|
return
|
|||
|
|
"SELECT attrelid, attname, atttypid, attstattarget, \n"
|
|||
|
|
" attnum, attndims, atttypmod, attnotnull, atthasdef, \n"
|
|||
|
|
" attcollation, attacl, attoptions \n"
|
|||
|
|
" FROM pg_catalog.pg_attribute";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
PgAttribute PgAttributeContainer::loadElem(const Pgsql::Row &row)
|
|||
|
|
{
|
|||
|
|
Pgsql::Col col(row);
|
|||
|
|
PgAttribute v;
|
|||
|
|
col >> v.relid >> v.name >> v.typid >> v.stattarget
|
|||
|
|
>> v.num >> v.ndims >> v.typmod >> v.notnull >> v.hasdef
|
|||
|
|
>> v.collation >> v.acl >> v.options;
|
|||
|
|
return v;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
std::vector<PgAttribute> PgAttributeContainer::getColumnsForRelation(Oid oid) const
|
|||
|
|
{
|
|||
|
|
std::vector<PgAttribute> result;
|
|||
|
|
for (const auto &e : m_container)
|
|||
|
|
if (e.relid == oid)
|
|||
|
|
result.push_back(e);
|
|||
|
|
return result;
|
|||
|
|
}
|