Moved several files from pglab project to pglablib
This commit is contained in:
parent
206d734ff5
commit
f4538069cb
44 changed files with 45 additions and 44 deletions
|
|
@ -1,36 +0,0 @@
|
|||
#include "PgAttributeContainer.h"
|
||||
#include "Pgsql_Col.h"
|
||||
|
||||
//SELECT attname, pg_get_expr(adbin, adrelid) AS def_value
|
||||
//FROM pg_attribute
|
||||
// JOIN pg_attrdef ON attrelid=adrelid AND attnum=adnum
|
||||
//WHERE atthasdef=true
|
||||
|
||||
std::string PgAttributeContainer::getLoadQuery() const
|
||||
{
|
||||
return R"__(
|
||||
SELECT attrelid, attname, atttypid, attstattarget,
|
||||
attnum, attndims, atttypmod, attnotnull, atthasdef,
|
||||
attcollation, attacl, attoptions, pg_get_expr(adbin, adrelid) AS def_value
|
||||
FROM pg_catalog.pg_attribute
|
||||
LEFT JOIN pg_attrdef ON attrelid=adrelid AND attnum=adnum)__";
|
||||
}
|
||||
|
||||
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 >> v.defaultValue;
|
||||
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