Builds on windows again
This commit is contained in:
parent
33cf39b799
commit
bebb3391c3
160 changed files with 138 additions and 117 deletions
85
pglab/PgTypeContainer.cpp
Normal file
85
pglab/PgTypeContainer.cpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#include "PgTypeContainer.h"
|
||||
#include "Pgsql_Connection.h"
|
||||
#include <algorithm>
|
||||
|
||||
PgTypeContainer::PgTypeContainer(PgDatabaseCatalogue *cat)
|
||||
: PgContainer<PgType>(cat)
|
||||
{}
|
||||
|
||||
|
||||
//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()
|
||||
{
|
||||
return
|
||||
"SELECT oid, typname, typnamespace, typowner, 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"
|
||||
"FROM pg_type";
|
||||
}
|
||||
|
||||
void PgTypeContainer::load(const Pgsql::Result &res)
|
||||
{
|
||||
const int n_rows = res.rows();
|
||||
m_container.clear();
|
||||
m_container.reserve(n_rows);
|
||||
for (auto row : res) {
|
||||
PgType v;
|
||||
v.oid << row.get(0); // InvalidOid;
|
||||
v.typname << row.get(1); //. operator QString(); // "name";"NO"
|
||||
v.typnamespace << row.get(2); // InvalidOid;//"oid";"NO"
|
||||
v.typowner << row.get(3); // InvalidOid;//"oid";"NO"
|
||||
v.typlen << row.get(4); // -1;//"smallint";"NO"
|
||||
v.typbyval << row.get(5); // false;//"boolean";"NO"
|
||||
v.typtype << row.get(6);//""char"";"NO"
|
||||
v.typcategory << row.get(7);//""char"";"NO"
|
||||
v.typispreferred << row.get(8); //false;//"boolean";"NO"
|
||||
v.typisdefined << row.get(9); //false;//"boolean";"NO"
|
||||
v.typdelim << row.get(10); //""char"";"NO"
|
||||
v.typrelid << row.get(11); // InvalidOid;//"oid";"NO"
|
||||
v.typelem << row.get(12); // InvalidOid;//"oid";"NO"
|
||||
v.typarray << row.get(13); // InvalidOid;//"oid";"NO"
|
||||
v.typinput << row.get(14);//regproc";"NO"
|
||||
v.typoutput << row.get(15);//"regproc";"NO"
|
||||
v.typreceive << row.get(16);//"regproc";"NO"
|
||||
v.typsend << row.get(17);//"regproc";"NO"
|
||||
v.typmodin << row.get(18);//"regproc";"NO"
|
||||
v.typmodout << row.get(19);//"regproc";"NO"
|
||||
v.typanalyze << row.get(20);//"regproc";"NO"
|
||||
v.typalign << row.get(21); // //""char"";"NO"
|
||||
v.typstorage << row.get(22); //""char"";"NO"
|
||||
v.typnotnull << row.get(23); //"boolean";"NO"
|
||||
v.typbasetype << row.get(24); //"oid";"NO"
|
||||
v.typtypmod << row.get(25); //-1;//"integer";"NO"
|
||||
v.typndims << row.get(26); //"integer";"NO"
|
||||
v.typcollation << row.get(27); //InvalidOid;//"oid";"NO"
|
||||
v.typdefaultbin << row.get(28);//"pg_node_tree";"YES"
|
||||
v.typdefault << row.get(29);//"text";"YES"
|
||||
v.typacl << row.get(30);//"ARRAY";"YES"
|
||||
m_container.push_back(v);
|
||||
}
|
||||
std::sort(m_container.begin(), m_container.end());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue