PgType now inherits from PgNamespaceObject and PgOwnedObject
This commit is contained in:
parent
742fd0a4d3
commit
44358d198a
10 changed files with 37 additions and 54 deletions
|
|
@ -3,34 +3,11 @@
|
|||
#include "Pgsql_Col.h"
|
||||
#include <algorithm>
|
||||
|
||||
//const PgType& PgTypeContainer::getTypeByOid(Oid oid) const
|
||||
//{
|
||||
// auto lb_result = std::lower_bound(m_types.begin(), m_types.end(), oid);
|
||||
// if (lb_result != m_types.end() && lb_result->oid == oid)
|
||||
// return *lb_result;
|
||||
|
||||
// return m_invalidType;
|
||||
//}
|
||||
|
||||
//const PgType& PgTypeContainer::getTypeByName(const QString &name) const
|
||||
//{
|
||||
// auto find_res = std::find(m_types.begin(), m_types.end(), name);
|
||||
|
||||
// if (find_res != m_types.end())
|
||||
// return *find_res;
|
||||
|
||||
// return m_invalidType;
|
||||
//}
|
||||
|
||||
//const PgType& PgTypeContainer::getTypeByIdx(int idx) const
|
||||
//{
|
||||
// return m_types.at(idx);
|
||||
//}
|
||||
|
||||
std::string PgTypeContainer::getLoadQuery() const
|
||||
{
|
||||
return
|
||||
"SELECT oid, format_type(oid, NULL) AS name, typname, typnamespace, typowner, typlen, typbyval, typtype, typcategory, \n"
|
||||
"SELECT oid, format_type(oid, NULL) AS name, typnamespace, typowner, typname, typlen, typbyval, typtype, typcategory, \n"
|
||||
" typispreferred, typisdefined, typdelim, typrelid, typelem, typarray, typinput, typoutput, \n"
|
||||
" typreceive, typsend, typmodin, typmodout, typanalyze, typalign, typstorage, typnotnull, \n"
|
||||
" typbasetype, typtypmod, typndims, typcollation, typdefaultbin, typdefault, typacl \n"
|
||||
|
|
@ -40,10 +17,15 @@ std::string PgTypeContainer::getLoadQuery() const
|
|||
PgType PgTypeContainer::loadElem(const Pgsql::Row &row)
|
||||
{
|
||||
Pgsql::Col col(row);
|
||||
PgType v;
|
||||
col >> v.oid >> v.name >> v.typname >> v.typnamespace >> v.owner >> v.len >> v.byval >> v.type >> v.category
|
||||
Oid type_oid = col.nextValue();
|
||||
QString name = col.nextValue();
|
||||
Oid ns_oid = col.nextValue();
|
||||
Oid owner = col.nextValue();
|
||||
PgType v(m_catalog, type_oid, name, ns_oid);
|
||||
col >> v.typname >> v.len >> v.byval >> v.type >> v.category
|
||||
>> v.ispreferred >> v.isdefined >> v.delim >> v.relid >> v.elem >> v.array >> v.input >> v.output
|
||||
>> v.receive >> v.send >> v.modin >> v.modout >> v.analyze >> v.align >> v.storage >> v.notnull
|
||||
>> v.basetype >> v.typmod >> v.ndims >> v.collation >> v.defaultbin >> v.typdefault >> v.acl;
|
||||
v.setOwnerOid(m_catalog, owner);
|
||||
return v;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue