pg_classes can be loaded now, used in TablesTableModel for overview of tables in database.
This commit is contained in:
parent
43e6042794
commit
6466062cc8
23 changed files with 524 additions and 173 deletions
33
pglab/PgClassContainer.cpp
Normal file
33
pglab/PgClassContainer.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "PgClassContainer.h"
|
||||
#include "Pgsql_Connection.h"
|
||||
#include "Pgsql_Col.h"
|
||||
|
||||
std::string PgClassContainer::getLoadQuery() const
|
||||
{
|
||||
return "SELECT oid, relname, relnamespace, reltype, reloftype, "
|
||||
" relowner, relam, relfilenode, reltablespace, relpages, "
|
||||
" reltuples, reltoastrelid, relisshared, relpersistence, "
|
||||
" relkind, relhasoids, relispopulated, relfrozenxid, relrelminmxid "
|
||||
" relacl, reloptions \n"
|
||||
"FROM pg_catalog.pg_class";
|
||||
}
|
||||
|
||||
void PgClassContainer::load(const Pgsql::Result &res)
|
||||
{
|
||||
const int n_rows = res.rows();
|
||||
m_container.clear();
|
||||
m_container.reserve(n_rows);
|
||||
for (auto row : res) {
|
||||
Pgsql::Col col(row);
|
||||
PgClass v;
|
||||
col >> v.oid >> v.name >> v.relnamespace >> v.type >> v.oftype
|
||||
>> v.owner >> v.am >> v.filenode >> v.tablespace >> v.pages_est
|
||||
>> v.tuples_est >> v.toastrelid >> v.isshared >> v.persistence
|
||||
>> v.kind >> v.hasoids >> v.ispopulated >> v.frozenxid >> v.minmxid
|
||||
>> v.acl >> v.options;
|
||||
|
||||
m_container.push_back(v);
|
||||
}
|
||||
std::sort(m_container.begin(), m_container.end());
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue