Moved several files from pglab project to pglablib

This commit is contained in:
eelke 2017-12-29 10:21:10 +01:00
parent 206d734ff5
commit f4538069cb
44 changed files with 45 additions and 44 deletions

37
pglablib/PgAttribute.h Normal file
View file

@ -0,0 +1,37 @@
#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;
QString defaultValue; ///< Comes from pg_attrdef table
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