PgAttribute loading + ColummnTableModel

Required enchancement to PgContainer to make multifield key work.
This commit is contained in:
eelke 2017-12-12 20:13:53 +01:00
parent f9caadb59e
commit e9d72d391d
32 changed files with 698 additions and 99 deletions

35
pglab/PgAttribute.h Normal file
View file

@ -0,0 +1,35 @@
#ifndef PGATTRIBUTE_H
#define PGATTRIBUTE_H
#include "Pgsql_declare.h"
#include <QString>
#include <libpq-fe.h>
#include <tuple>
class PgAttribute {
public:
using Key = std::tuple<Oid, int16_t>;
// Oid oid = InvalidOid;
Oid relid = InvalidOid;
QString name;
Oid typid = InvalidOid;
int32_t stattarget = 0;
int16_t num = 0;
int32_t ndims = 0; // array dimensions
int32_t typmod = -1;
bool notnull = false;
bool hasdef = false;
Oid collation = InvalidOid;
QString acl;
QString options;
bool operator==(Key _k) const { return relid == std::get<0>(_k) && num == std::get<1>(_k); }
bool operator==(const QString &n) const { return name == n; }
bool operator<(Key _k) const { return relid < std::get<0>(_k) || (relid == std::get<0>(_k) && num < std::get<1>(_k)); }
bool operator<(const PgAttribute &rhs) const { return relid < rhs.relid || (relid == rhs.relid && num < rhs.num); }
};
#endif // PGATTRIBUTE_H