PgAttribute loading + ColummnTableModel
Required enchancement to PgContainer to make multifield key work.
This commit is contained in:
parent
f9caadb59e
commit
e9d72d391d
32 changed files with 698 additions and 99 deletions
30
pglab/PgAttributeContainer.cpp
Normal file
30
pglab/PgAttributeContainer.cpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue