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
|
|
@ -1,5 +1,5 @@
|
||||||
#include "DatabasesTableModel.h"
|
#include "DatabasesTableModel.h"
|
||||||
#include "PgDatabaseCatalogue.h"
|
#include "PgDatabaseCatalog.h"
|
||||||
#include "PgDatabaseContainer.h"
|
#include "PgDatabaseContainer.h"
|
||||||
#include "PgAuthIdContainer.h"
|
#include "PgAuthIdContainer.h"
|
||||||
#include "ResultTableModelUtil.h"
|
#include "ResultTableModelUtil.h"
|
||||||
|
|
@ -11,7 +11,7 @@ DatabasesTableModel::DatabasesTableModel(QObject *parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabasesTableModel::setDatabaseList(std::shared_ptr<const PgDatabaseCatalogue> cat)
|
void DatabasesTableModel::setDatabaseList(std::shared_ptr<const PgDatabaseCatalog> cat)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_catalog = cat;
|
m_catalog = cat;
|
||||||
|
|
@ -115,7 +115,7 @@ QVariant DatabasesTableModel::getData(const QModelIndex &index) const
|
||||||
v = db.name;
|
v = db.name;
|
||||||
break;
|
break;
|
||||||
case DbaCol:
|
case DbaCol:
|
||||||
v = getRoleDisplayString(m_catalog, db.dba);
|
v = getRoleDisplayString(*m_catalog, db.dba);
|
||||||
break;
|
break;
|
||||||
case EncodingCol:
|
case EncodingCol:
|
||||||
// todo lookup encoding name
|
// todo lookup encoding name
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class PgDatabaseContainer;
|
class PgDatabaseContainer;
|
||||||
class PgDatabaseCatalogue;
|
class PgDatabaseCatalog;
|
||||||
|
|
||||||
/** Class for displaying the list of databases of a server in a QTableView
|
/** Class for displaying the list of databases of a server in a QTableView
|
||||||
*
|
*
|
||||||
|
|
@ -23,7 +23,7 @@ public:
|
||||||
|
|
||||||
explicit DatabasesTableModel(QObject *parent);
|
explicit DatabasesTableModel(QObject *parent);
|
||||||
|
|
||||||
void setDatabaseList(std::shared_ptr<const PgDatabaseCatalogue> cat);
|
void setDatabaseList(std::shared_ptr<const PgDatabaseCatalog> cat);
|
||||||
|
|
||||||
// Header:
|
// Header:
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
|
|
@ -36,7 +36,7 @@ public:
|
||||||
virtual QVariant getData(const QModelIndex &index) const override;
|
virtual QVariant getData(const QModelIndex &index) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<const PgDatabaseCatalogue> m_catalog;
|
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
|
||||||
std::shared_ptr<const PgDatabaseContainer> m_databases;
|
std::shared_ptr<const PgDatabaseContainer> m_databases;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "OpenDatabase.h"
|
#include "OpenDatabase.h"
|
||||||
#include "PgDatabaseCatalogue.h"
|
#include "PgDatabaseCatalog.h"
|
||||||
#include "Pgsql_Connection.h"
|
#include "Pgsql_Connection.h"
|
||||||
#include "TypeSelectionItemModel.h"
|
#include "TypeSelectionItemModel.h"
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ Expected<OpenDatabase*> OpenDatabase::createOpenDatabase(const ConnectionConfig
|
||||||
OpenDatabase::OpenDatabase(const ConnectionConfig& cfg, QObject *parent)
|
OpenDatabase::OpenDatabase(const ConnectionConfig& cfg, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_config(cfg)
|
, m_config(cfg)
|
||||||
, m_catalogue(std::make_shared<PgDatabaseCatalogue>())
|
, m_catalogue(std::make_shared<PgDatabaseCatalog>())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ bool OpenDatabase::Init()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<PgDatabaseCatalogue> OpenDatabase::catalogue()
|
std::shared_ptr<PgDatabaseCatalog> OpenDatabase::catalogue()
|
||||||
{
|
{
|
||||||
return m_catalogue;
|
return m_catalogue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include "Expected.h"
|
#include "Expected.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class PgDatabaseCatalogue;
|
class PgDatabaseCatalog;
|
||||||
class TypeSelectionItemModel;
|
class TypeSelectionItemModel;
|
||||||
|
|
||||||
/** Instances of this class represent a single database on which atleast one
|
/** Instances of this class represent a single database on which atleast one
|
||||||
|
|
@ -22,7 +22,7 @@ public:
|
||||||
OpenDatabase& operator=(const OpenDatabase &) = delete;
|
OpenDatabase& operator=(const OpenDatabase &) = delete;
|
||||||
~OpenDatabase();
|
~OpenDatabase();
|
||||||
|
|
||||||
std::shared_ptr<PgDatabaseCatalogue> catalogue();
|
std::shared_ptr<PgDatabaseCatalog> catalogue();
|
||||||
TypeSelectionItemModel* typeSelectionModel();
|
TypeSelectionItemModel* typeSelectionModel();
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConnectionConfig m_config;
|
ConnectionConfig m_config;
|
||||||
std::shared_ptr<PgDatabaseCatalogue> m_catalogue;
|
std::shared_ptr<PgDatabaseCatalog> m_catalogue;
|
||||||
|
|
||||||
TypeSelectionItemModel *m_typeSelectionModel = nullptr;
|
TypeSelectionItemModel *m_typeSelectionModel = nullptr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "PgAuthIdContainer.h"
|
#include "PgAuthIdContainer.h"
|
||||||
#include "Pgsql_Connection.h"
|
#include "Pgsql_Connection.h"
|
||||||
#include "PgDatabaseCatalogue.h"
|
#include "PgDatabaseCatalog.h"
|
||||||
|
|
||||||
std::string PgAuthIdContainer::getLoadQuery() const
|
std::string PgAuthIdContainer::getLoadQuery() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,50 @@
|
||||||
#include "PgClass.h"
|
#include "PgClass.h"
|
||||||
|
|
||||||
PgClass::PgClass() = default;
|
void operator<<(RelPersistence &s, const Pgsql::Value &v)
|
||||||
|
{
|
||||||
|
//s = static_cast<T>(v);
|
||||||
|
const char *c = v.c_str();
|
||||||
|
switch (*c) {
|
||||||
|
case 'p':
|
||||||
|
s = RelPersistence::Permanent;
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
s = RelPersistence::Unlogged;
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
s = RelPersistence::Temporary;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator<<(RelKind &s, const Pgsql::Value &v)
|
||||||
|
{
|
||||||
|
//s = static_cast<T>(v);
|
||||||
|
const char *c = v.c_str();
|
||||||
|
switch (*c) {
|
||||||
|
case 'r':
|
||||||
|
s = RelKind::Table;
|
||||||
|
break;
|
||||||
|
case 'i':
|
||||||
|
s = RelKind::Index;
|
||||||
|
break;
|
||||||
|
case 'S':
|
||||||
|
s = RelKind::Sequence;
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
s = RelKind::View;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
s = RelKind::MaterializedView;
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
s = RelKind::Composite;
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
s = RelKind::Toast;
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
s = RelKind::ForeignTable;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,60 @@
|
||||||
#ifndef PGCLASS_H
|
#ifndef PGCLASS_H
|
||||||
#define PGCLASS_H
|
#define PGCLASS_H
|
||||||
|
|
||||||
|
#include "Pgsql_Value.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <libpq-fe.h>
|
#include <libpq-fe.h>
|
||||||
|
|
||||||
|
enum class RelPersistence {
|
||||||
|
Permanent, // p
|
||||||
|
Unlogged, // u
|
||||||
|
Temporary // t
|
||||||
|
};
|
||||||
|
|
||||||
|
void operator<<(RelPersistence &s, const Pgsql::Value &v);
|
||||||
|
|
||||||
|
enum class RelKind {
|
||||||
|
Table, // r
|
||||||
|
Index, // i
|
||||||
|
Sequence, // S
|
||||||
|
View, // v
|
||||||
|
MaterializedView, // m
|
||||||
|
Composite, // c
|
||||||
|
Toast, // t
|
||||||
|
ForeignTable // f
|
||||||
|
};
|
||||||
|
|
||||||
|
void operator<<(RelKind &s, const Pgsql::Value &v);
|
||||||
|
|
||||||
class PgClass {
|
class PgClass {
|
||||||
public:
|
public:
|
||||||
PgClass();
|
|
||||||
|
|
||||||
Oid oid = InvalidOid;
|
Oid oid = InvalidOid;
|
||||||
QString relname;
|
QString name;
|
||||||
Oid relnamespace = InvalidOid;
|
Oid relnamespace = InvalidOid;
|
||||||
Oid reltype = InvalidOid;
|
Oid type = InvalidOid;
|
||||||
Oid reloftype = InvalidOid;
|
Oid oftype = InvalidOid;
|
||||||
Oid relowner = InvalidOid;
|
Oid owner = InvalidOid;
|
||||||
Oid relam = InvalidOid;
|
Oid am = InvalidOid;
|
||||||
Oid relfilename = InvalidOid;
|
Oid filenode = InvalidOid;
|
||||||
Oid reltablespace = InvalidOid;
|
Oid tablespace = InvalidOid;
|
||||||
int relpages_est = 0;
|
int pages_est = 0;
|
||||||
float reltuples_est = 0;
|
float tuples_est = 0.0f;
|
||||||
int relallvisible = 0;
|
Oid toastrelid = InvalidOid;
|
||||||
|
bool isshared = false;
|
||||||
|
RelPersistence persistence;
|
||||||
|
RelKind kind;
|
||||||
|
bool hasoids = false;
|
||||||
|
bool ispopulated;
|
||||||
|
int frozenxid;
|
||||||
|
int minmxid;
|
||||||
|
QString acl;
|
||||||
|
QString options;
|
||||||
|
|
||||||
|
bool operator==(Oid _oid) const { return oid == _oid; }
|
||||||
|
bool operator==(const QString &n) const { return name == n; }
|
||||||
|
bool operator<(Oid _oid) const { return oid < _oid; }
|
||||||
|
bool operator<(const PgClass &rhs) const { return oid < rhs.oid; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
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());
|
||||||
|
|
||||||
|
}
|
||||||
24
pglab/PgClassContainer.h
Normal file
24
pglab/PgClassContainer.h
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef PGCLASSCONTAINER_H
|
||||||
|
#define PGCLASSCONTAINER_H
|
||||||
|
|
||||||
|
#include "PgContainer.h"
|
||||||
|
#include "PgClass.h"
|
||||||
|
|
||||||
|
namespace Pgsql {
|
||||||
|
|
||||||
|
class Result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class PgClassContainer: public PgContainer<PgClass> {
|
||||||
|
public:
|
||||||
|
using PgContainer<PgClass>::PgContainer;
|
||||||
|
|
||||||
|
virtual std::string getLoadQuery() const override;
|
||||||
|
virtual void load(const Pgsql::Result &res) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PGCLASSCONTAINER_H
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <libpq-fe.h>
|
#include <libpq-fe.h>
|
||||||
|
|
||||||
|
|
||||||
class PgDatabaseCatalogue;
|
class PgDatabaseCatalog;
|
||||||
|
|
||||||
class IPgContainter {
|
class IPgContainter {
|
||||||
public:
|
public:
|
||||||
|
|
@ -23,7 +23,7 @@ class PgContainer: public IPgContainter {
|
||||||
public:
|
public:
|
||||||
using t_Container = std::vector<T>; ///< Do not assume it will stay a vector only expect bidirectional access
|
using t_Container = std::vector<T>; ///< Do not assume it will stay a vector only expect bidirectional access
|
||||||
|
|
||||||
explicit PgContainer(std::weak_ptr<PgDatabaseCatalogue> cat)
|
explicit PgContainer(std::weak_ptr<PgDatabaseCatalog> cat)
|
||||||
: m_catalogue(cat)
|
: m_catalogue(cat)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ public:
|
||||||
return m_container.at(idx);
|
return m_container.at(idx);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
std::weak_ptr<PgDatabaseCatalogue> m_catalogue;
|
std::weak_ptr<PgDatabaseCatalog> m_catalogue;
|
||||||
t_Container m_container;
|
t_Container m_container;
|
||||||
private:
|
private:
|
||||||
T m_invalidInstance;
|
T m_invalidInstance;
|
||||||
|
|
|
||||||
151
pglab/PgDatabaseCatalog.cpp
Normal file
151
pglab/PgDatabaseCatalog.cpp
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
#include "PgDatabaseCatalog.h"
|
||||||
|
#include "PgTypeContainer.h"
|
||||||
|
#include "PgDatabaseContainer.h"
|
||||||
|
#include "PgAuthIdContainer.h"
|
||||||
|
#include "PgClassContainer.h"
|
||||||
|
#include "Pgsql_Connection.h"
|
||||||
|
|
||||||
|
|
||||||
|
QString getRoleNameFromOid(const PgDatabaseCatalog &cat, Oid oid)
|
||||||
|
{
|
||||||
|
QString name;
|
||||||
|
auto auth_ids = cat.authIds();
|
||||||
|
if (auth_ids) {
|
||||||
|
const PgAuthId& auth_id = auth_ids->getByOid(oid);
|
||||||
|
if (auth_id.valid()) {
|
||||||
|
name = auth_id.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getRoleDisplayString(const PgDatabaseCatalog &cat, Oid oid)
|
||||||
|
{
|
||||||
|
QString name = getRoleNameFromOid(cat, oid);
|
||||||
|
return QString("%1 (%2)").arg(name).arg(oid);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getNamespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid)
|
||||||
|
{
|
||||||
|
//QString name;
|
||||||
|
// auto c = cat.();
|
||||||
|
// if (auth_ids) {
|
||||||
|
// const PgAuthId& auth_id = auth_ids->getByOid(oid);
|
||||||
|
// if (auth_id.valid()) {
|
||||||
|
// name = auth_id.name;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//return name;
|
||||||
|
// TODO load list and lookup name
|
||||||
|
return QString("ns %1").arg(oid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getTablespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid)
|
||||||
|
{
|
||||||
|
// TODO load list and lookup name
|
||||||
|
return QString("ts %1").arg(oid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PgDatabaseCatalog::PgDatabaseCatalog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PgDatabaseCatalog::~PgDatabaseCatalog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PgDatabaseCatalog::loadAll(Pgsql::Connection &conn)
|
||||||
|
{
|
||||||
|
loadTypes(conn);
|
||||||
|
loadDatabases(conn);
|
||||||
|
loadAuthIds(conn);
|
||||||
|
loadClasses(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PgDatabaseCatalog::loadInfo(Pgsql::Connection &conn)
|
||||||
|
{
|
||||||
|
Pgsql::Result r = conn.query("SHOW server_version_num");
|
||||||
|
if (r && r.resultStatus() == PGRES_TUPLES_OK)
|
||||||
|
if (r.rows() == 1)
|
||||||
|
m_serverVersion << r.get(0, 0);
|
||||||
|
|
||||||
|
r = conn.query("SELECT version()");
|
||||||
|
if (r && r.resultStatus() == PGRES_TUPLES_OK)
|
||||||
|
if (r.rows() == 1)
|
||||||
|
m_serverVersionString = r.get(0, 0).asQString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(Pgsql::Connection &conn, IPgContainter &pg_cont)
|
||||||
|
{
|
||||||
|
std::string q = pg_cont.getLoadQuery();
|
||||||
|
Pgsql::Result result = conn.query(q.c_str());
|
||||||
|
if (result && result.resultStatus() == PGRES_TUPLES_OK)
|
||||||
|
pg_cont.load(result);
|
||||||
|
else
|
||||||
|
throw std::runtime_error("Query failed");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PgDatabaseCatalog::loadTypes(Pgsql::Connection &conn)
|
||||||
|
{
|
||||||
|
if (!m_types)
|
||||||
|
m_types = std::make_shared<PgTypeContainer>(shared_from_this());
|
||||||
|
|
||||||
|
load(conn, *m_types);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PgDatabaseCatalog::loadDatabases(Pgsql::Connection &conn)
|
||||||
|
{
|
||||||
|
if (!m_databases)
|
||||||
|
m_databases = std::make_shared<PgDatabaseContainer>(shared_from_this());
|
||||||
|
|
||||||
|
load(conn, *m_databases);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PgDatabaseCatalog::loadAuthIds(Pgsql::Connection &conn)
|
||||||
|
{
|
||||||
|
if (!m_authIds)
|
||||||
|
m_authIds = std::make_shared<PgAuthIdContainer>(shared_from_this());
|
||||||
|
|
||||||
|
load(conn, *m_authIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PgDatabaseCatalog::loadClasses(Pgsql::Connection &conn)
|
||||||
|
{
|
||||||
|
if (!m_classes)
|
||||||
|
m_classes = std::make_shared<PgClassContainer>(shared_from_this());
|
||||||
|
|
||||||
|
load(conn, *m_classes);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString& PgDatabaseCatalog::serverVersionString() const
|
||||||
|
{
|
||||||
|
return m_serverVersionString;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PgDatabaseCatalog::serverVersion() const
|
||||||
|
{
|
||||||
|
return m_serverVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<const PgTypeContainer> PgDatabaseCatalog::types() const
|
||||||
|
{
|
||||||
|
return m_types;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<const PgDatabaseContainer> PgDatabaseCatalog::databases() const
|
||||||
|
{
|
||||||
|
return m_databases;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<const PgAuthIdContainer> PgDatabaseCatalog::authIds() const
|
||||||
|
{
|
||||||
|
return m_authIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<const PgClassContainer> PgDatabaseCatalog::classes() const
|
||||||
|
{
|
||||||
|
return m_classes;
|
||||||
|
}
|
||||||
|
|
@ -12,17 +12,18 @@ namespace Pgsql {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PgTypeContainer;
|
|
||||||
class PgDatabaseContainer;
|
|
||||||
class PgAuthIdContainer;
|
class PgAuthIdContainer;
|
||||||
|
class PgClassContainer;
|
||||||
|
class PgDatabaseContainer;
|
||||||
|
class PgTypeContainer;
|
||||||
|
|
||||||
class PgDatabaseCatalogue: public std::enable_shared_from_this<PgDatabaseCatalogue> {
|
class PgDatabaseCatalog: public std::enable_shared_from_this<PgDatabaseCatalog> {
|
||||||
public:
|
public:
|
||||||
PgDatabaseCatalogue();
|
PgDatabaseCatalog();
|
||||||
PgDatabaseCatalogue(const PgDatabaseCatalogue&) = delete;
|
PgDatabaseCatalog(const PgDatabaseCatalog&) = delete;
|
||||||
PgDatabaseCatalogue& operator = (const PgDatabaseCatalogue&) = delete;
|
PgDatabaseCatalog& operator = (const PgDatabaseCatalog&) = delete;
|
||||||
|
|
||||||
~PgDatabaseCatalogue();
|
~PgDatabaseCatalog();
|
||||||
|
|
||||||
|
|
||||||
void loadAll(Pgsql::Connection &conn);
|
void loadAll(Pgsql::Connection &conn);
|
||||||
|
|
@ -30,6 +31,7 @@ public:
|
||||||
void loadTypes(Pgsql::Connection &conn);
|
void loadTypes(Pgsql::Connection &conn);
|
||||||
void loadDatabases(Pgsql::Connection &conn);
|
void loadDatabases(Pgsql::Connection &conn);
|
||||||
void loadAuthIds(Pgsql::Connection &conn);
|
void loadAuthIds(Pgsql::Connection &conn);
|
||||||
|
void loadClasses(Pgsql::Connection &conn);
|
||||||
|
|
||||||
const QString& serverVersionString() const;
|
const QString& serverVersionString() const;
|
||||||
int serverVersion() const;
|
int serverVersion() const;
|
||||||
|
|
@ -37,16 +39,20 @@ public:
|
||||||
std::shared_ptr<const PgTypeContainer> types() const;
|
std::shared_ptr<const PgTypeContainer> types() const;
|
||||||
std::shared_ptr<const PgDatabaseContainer> databases() const;
|
std::shared_ptr<const PgDatabaseContainer> databases() const;
|
||||||
std::shared_ptr<const PgAuthIdContainer> authIds() const;
|
std::shared_ptr<const PgAuthIdContainer> authIds() const;
|
||||||
|
std::shared_ptr<const PgClassContainer> classes() const;
|
||||||
private:
|
private:
|
||||||
QString m_serverVersionString;
|
QString m_serverVersionString;
|
||||||
int m_serverVersion;
|
int m_serverVersion;
|
||||||
std::shared_ptr<PgTypeContainer> m_types;
|
std::shared_ptr<PgTypeContainer> m_types;
|
||||||
std::shared_ptr<PgDatabaseContainer> m_databases;
|
std::shared_ptr<PgDatabaseContainer> m_databases;
|
||||||
std::shared_ptr<PgAuthIdContainer> m_authIds;
|
std::shared_ptr<PgAuthIdContainer> m_authIds;
|
||||||
|
std::shared_ptr<PgClassContainer> m_classes;
|
||||||
};
|
};
|
||||||
|
|
||||||
QString getRoleNameFromOid(std::shared_ptr<const PgDatabaseCatalogue> cat, Oid oid);
|
QString getRoleNameFromOid(const PgDatabaseCatalog &cat, Oid oid);
|
||||||
QString getRoleDisplayString(std::shared_ptr<const PgDatabaseCatalogue> cat, Oid oid);
|
QString getRoleDisplayString(const PgDatabaseCatalog &cat, Oid oid);
|
||||||
|
QString getNamespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid);
|
||||||
|
QString getTablespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid);
|
||||||
|
|
||||||
|
|
||||||
#endif // PGSQLDATABASECATALOGUE_H
|
#endif // PGSQLDATABASECATALOGUE_H
|
||||||
|
|
@ -1,114 +0,0 @@
|
||||||
#include "PgDatabaseCatalogue.h"
|
|
||||||
#include "PgTypeContainer.h"
|
|
||||||
#include "PgDatabaseContainer.h"
|
|
||||||
#include "PgAuthIdContainer.h"
|
|
||||||
#include "Pgsql_Connection.h"
|
|
||||||
|
|
||||||
|
|
||||||
QString getRoleNameFromOid(std::shared_ptr<const PgDatabaseCatalogue> cat, Oid oid)
|
|
||||||
{
|
|
||||||
QString name;
|
|
||||||
auto auth_ids = cat->authIds();
|
|
||||||
if (auth_ids) {
|
|
||||||
const PgAuthId& auth_id = auth_ids->getByOid(oid);
|
|
||||||
if (auth_id.valid()) {
|
|
||||||
name = auth_id.name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getRoleDisplayString(std::shared_ptr<const PgDatabaseCatalogue> cat, Oid oid)
|
|
||||||
{
|
|
||||||
QString name = getRoleNameFromOid(cat, oid);
|
|
||||||
return QString("%1 (%2)").arg(name).arg(oid);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PgDatabaseCatalogue::PgDatabaseCatalogue()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
PgDatabaseCatalogue::~PgDatabaseCatalogue()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void PgDatabaseCatalogue::loadAll(Pgsql::Connection &conn)
|
|
||||||
{
|
|
||||||
loadTypes(conn);
|
|
||||||
loadDatabases(conn);
|
|
||||||
loadAuthIds(conn);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PgDatabaseCatalogue::loadInfo(Pgsql::Connection &conn)
|
|
||||||
{
|
|
||||||
Pgsql::Result r = conn.query("SHOW server_version_num");
|
|
||||||
if (r && r.resultStatus() == PGRES_TUPLES_OK)
|
|
||||||
if (r.rows() == 1)
|
|
||||||
m_serverVersion << r.get(0, 0);
|
|
||||||
|
|
||||||
r = conn.query("SELECT version()");
|
|
||||||
if (r && r.resultStatus() == PGRES_TUPLES_OK)
|
|
||||||
if (r.rows() == 1)
|
|
||||||
m_serverVersionString = r.get(0, 0).asQString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void load(Pgsql::Connection &conn, IPgContainter &pg_cont)
|
|
||||||
{
|
|
||||||
std::string q = pg_cont.getLoadQuery();
|
|
||||||
Pgsql::Result result = conn.query(q.c_str());
|
|
||||||
if (result && result.resultStatus() == PGRES_TUPLES_OK)
|
|
||||||
pg_cont.load(result);
|
|
||||||
else
|
|
||||||
throw std::runtime_error("Query failed");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PgDatabaseCatalogue::loadTypes(Pgsql::Connection &conn)
|
|
||||||
{
|
|
||||||
if (!m_types)
|
|
||||||
m_types = std::make_shared<PgTypeContainer>(shared_from_this());
|
|
||||||
|
|
||||||
load(conn, *m_types);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PgDatabaseCatalogue::loadDatabases(Pgsql::Connection &conn)
|
|
||||||
{
|
|
||||||
if (!m_databases)
|
|
||||||
m_databases = std::make_shared<PgDatabaseContainer>(shared_from_this());
|
|
||||||
|
|
||||||
load(conn, *m_databases);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PgDatabaseCatalogue::loadAuthIds(Pgsql::Connection &conn)
|
|
||||||
{
|
|
||||||
if (!m_authIds)
|
|
||||||
m_authIds = std::make_shared<PgAuthIdContainer>(shared_from_this());
|
|
||||||
|
|
||||||
load(conn, *m_authIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString& PgDatabaseCatalogue::serverVersionString() const
|
|
||||||
{
|
|
||||||
return m_serverVersionString;
|
|
||||||
}
|
|
||||||
|
|
||||||
int PgDatabaseCatalogue::serverVersion() const
|
|
||||||
{
|
|
||||||
return m_serverVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<const PgTypeContainer> PgDatabaseCatalogue::types() const
|
|
||||||
{
|
|
||||||
return m_types;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<const PgDatabaseContainer> PgDatabaseCatalogue::databases() const
|
|
||||||
{
|
|
||||||
return m_databases;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<const PgAuthIdContainer> PgDatabaseCatalogue::authIds() const
|
|
||||||
{
|
|
||||||
return m_authIds;
|
|
||||||
}
|
|
||||||
|
|
@ -2,9 +2,6 @@
|
||||||
#include "Pgsql_Connection.h"
|
#include "Pgsql_Connection.h"
|
||||||
#include "Pgsql_Col.h"
|
#include "Pgsql_Col.h"
|
||||||
|
|
||||||
//PgDatabaseContainer::PgDatabaseContainer(PgDatabaseCatalogue *cat)
|
|
||||||
// : PgContainer<PgDatabase>(cat)
|
|
||||||
//{}
|
|
||||||
|
|
||||||
std::string PgDatabaseContainer::getLoadQuery() const
|
std::string PgDatabaseContainer::getLoadQuery() const
|
||||||
{
|
{
|
||||||
|
|
@ -20,17 +17,6 @@ void PgDatabaseContainer::load(const Pgsql::Result &res)
|
||||||
for (auto row : res) {
|
for (auto row : res) {
|
||||||
Pgsql::Col col(row);
|
Pgsql::Col col(row);
|
||||||
PgDatabase v;
|
PgDatabase v;
|
||||||
// v.oid << row.get(0); // InvalidOid;
|
|
||||||
// v.name << row.get(1);
|
|
||||||
// v.dba << row.get(2); // owner?
|
|
||||||
// v.encoding << row.get(3);
|
|
||||||
// v.collate << row.get(4);
|
|
||||||
// v.ctype << row.get(5);
|
|
||||||
// v.isTemplate << row.get(6);
|
|
||||||
// v.allowConn << row.get(7);
|
|
||||||
// v.connLimit << row.get(8);
|
|
||||||
// v.tablespace << row.get(9);
|
|
||||||
// v.acl << row.get(10);
|
|
||||||
col >> v.oid >> v.name >> v.dba >> v.encoding >> v.collate >> v.ctype >> v.isTemplate
|
col >> v.oid >> v.name >> v.dba >> v.encoding >> v.collate >> v.ctype >> v.isTemplate
|
||||||
>> v.allowConn >> v.connLimit >> v.tablespace >> v.acl;
|
>> v.allowConn >> v.connLimit >> v.tablespace >> v.acl;
|
||||||
m_container.push_back(v);
|
m_container.push_back(v);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef PGDATABASECONTAINER_H
|
#ifndef PGDATABASECONTAINER_H
|
||||||
#define PGDATABASECONTAINER_H
|
#define PGDATABASECONTAINER_H
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "PgContainer.h"
|
#include "PgContainer.h"
|
||||||
#include "PgDatabase.h"
|
#include "PgDatabase.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "QueryParamListController.h"
|
#include "QueryParamListController.h"
|
||||||
#include "OpenDatabase.h"
|
#include "OpenDatabase.h"
|
||||||
#include "PgDatabaseCatalogue.h"
|
#include "PgDatabaseCatalog.h"
|
||||||
#include "PgTypeContainer.h"
|
#include "PgTypeContainer.h"
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
#include "json/json.h"
|
#include "json/json.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "OpenDatabase.h"
|
#include "OpenDatabase.h"
|
||||||
#include "PgDatabaseCatalogue.h"
|
#include "PgDatabaseCatalog.h"
|
||||||
#include "QueryParamListController.h"
|
#include "QueryParamListController.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "GlobalIoService.h"
|
#include "GlobalIoService.h"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "OpenDatabase.h"
|
#include "OpenDatabase.h"
|
||||||
#include "DatabasesTableModel.h"
|
#include "DatabasesTableModel.h"
|
||||||
#include "RolesTableModel.h"
|
#include "RolesTableModel.h"
|
||||||
#include "PgDatabaseCatalogue.h"
|
#include "PgDatabaseCatalog.h"
|
||||||
|
|
||||||
ServerWindow::ServerWindow(MasterController *master, QWidget *parent)
|
ServerWindow::ServerWindow(MasterController *master, QWidget *parent)
|
||||||
: ASyncWindow(parent)
|
: ASyncWindow(parent)
|
||||||
|
|
|
||||||
121
pglab/TablesTableModel.cpp
Normal file
121
pglab/TablesTableModel.cpp
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
#include "TablesTableModel.h"
|
||||||
|
#include "PgDatabaseCatalog.h"
|
||||||
|
#include "PgClass.h"
|
||||||
|
#include "PgClassContainer.h"
|
||||||
|
#include "Pgsql_declare.h"
|
||||||
|
|
||||||
|
TablesTableModel::TablesTableModel(QObject *parent)
|
||||||
|
: BaseTableModel(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TablesTableModel::setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat)
|
||||||
|
{
|
||||||
|
beginResetModel();
|
||||||
|
m_catalog = cat;
|
||||||
|
|
||||||
|
// Later afscheiden naar filter functie
|
||||||
|
auto classes = cat->classes();
|
||||||
|
|
||||||
|
// How many?
|
||||||
|
int n = 0;
|
||||||
|
for (const auto &e : *classes)
|
||||||
|
if (e.kind == RelKind::Table) ++n;
|
||||||
|
|
||||||
|
m_tables.clear();
|
||||||
|
m_tables.reserve(n); // reserve space
|
||||||
|
for (const auto &e : *classes) {
|
||||||
|
if (e.kind == RelKind::Table) {
|
||||||
|
m_tables.push_back(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariant TablesTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
|
{
|
||||||
|
QVariant v;
|
||||||
|
if (orientation == Qt::Horizontal) {
|
||||||
|
if (role == Qt::DisplayRole) {
|
||||||
|
switch (section) {
|
||||||
|
case NameCol:
|
||||||
|
v = tr("Name");
|
||||||
|
break;
|
||||||
|
case OwnerCol:
|
||||||
|
v = tr("Owner");
|
||||||
|
break;
|
||||||
|
case TablespaceCol:
|
||||||
|
v = tr("Tablespace");
|
||||||
|
break;
|
||||||
|
case OptionsCol:
|
||||||
|
v = tr("Options");
|
||||||
|
break;
|
||||||
|
case AclCol:
|
||||||
|
v = tr("ACL");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Basic functionality:
|
||||||
|
int TablesTableModel::rowCount(const QModelIndex &) const
|
||||||
|
{
|
||||||
|
return m_tables.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
int TablesTableModel::columnCount(const QModelIndex &) const
|
||||||
|
{
|
||||||
|
return colCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
Oid TablesTableModel::getType(int column) const
|
||||||
|
{
|
||||||
|
Oid oid;
|
||||||
|
switch (column) {
|
||||||
|
case TablespaceCol:
|
||||||
|
case OwnerCol:
|
||||||
|
case NameCol:
|
||||||
|
case OptionsCol:
|
||||||
|
case AclCol:
|
||||||
|
default:
|
||||||
|
oid = Pgsql::VARCHAROID;
|
||||||
|
}
|
||||||
|
return oid;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant TablesTableModel::getData(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QVariant v;
|
||||||
|
const auto &t = m_tables[index.row()];
|
||||||
|
switch (index.column()) {
|
||||||
|
case NameCol:
|
||||||
|
v = formatTableName(t);
|
||||||
|
break;
|
||||||
|
case OwnerCol:
|
||||||
|
v = getRoleDisplayString(*m_catalog, t.owner);
|
||||||
|
break;
|
||||||
|
case TablespaceCol:
|
||||||
|
v = getTablespaceDisplayString(*m_catalog, t.tablespace);
|
||||||
|
break;
|
||||||
|
case OptionsCol:
|
||||||
|
v = t.options;
|
||||||
|
break;
|
||||||
|
case AclCol:
|
||||||
|
v = t.acl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TablesTableModel::formatTableName(const PgClass &cls) const
|
||||||
|
{
|
||||||
|
const char * format = "%2 (%1)";
|
||||||
|
QString ns_name = getNamespaceDisplayString(*m_catalog, cls.relnamespace);
|
||||||
|
return QString(format).arg(ns_name).arg(cls.name);
|
||||||
|
}
|
||||||
46
pglab/TablesTableModel.h
Normal file
46
pglab/TablesTableModel.h
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef TABLESTABLEMODEL_H
|
||||||
|
#define TABLESTABLEMODEL_H
|
||||||
|
|
||||||
|
#include "BaseTableModel.h"
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class PgClass;
|
||||||
|
class PgDatabaseCatalog;
|
||||||
|
|
||||||
|
class TablesTableModel: public BaseTableModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum e_Columns : int {
|
||||||
|
NameCol, ///< either table, ns.table or table (ns) depending on settings/filters
|
||||||
|
OwnerCol,
|
||||||
|
TablespaceCol,
|
||||||
|
OptionsCol,
|
||||||
|
AclCol,
|
||||||
|
colCount };
|
||||||
|
|
||||||
|
TablesTableModel(QObject *parent);
|
||||||
|
|
||||||
|
void setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat);
|
||||||
|
|
||||||
|
// Header:
|
||||||
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||||
|
|
||||||
|
// Basic functionality:
|
||||||
|
int rowCount(const QModelIndex &parent) const override;
|
||||||
|
int columnCount(const QModelIndex &parent) const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual Oid getType(int column) const override;
|
||||||
|
virtual QVariant getData(const QModelIndex &index) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
using t_Tables = std::vector<PgClass>;
|
||||||
|
|
||||||
|
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
|
||||||
|
t_Tables m_tables;
|
||||||
|
|
||||||
|
QString formatTableName(const PgClass &cls) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TABLESTABLEMODEL_H
|
||||||
|
|
@ -42,7 +42,6 @@ SOURCES += main.cpp\
|
||||||
util.cpp \
|
util.cpp \
|
||||||
DatabaseInspectorWidget.cpp \
|
DatabaseInspectorWidget.cpp \
|
||||||
PgType.cpp \
|
PgType.cpp \
|
||||||
PgDatabaseCatalogue.cpp \
|
|
||||||
PgTypeContainer.cpp \
|
PgTypeContainer.cpp \
|
||||||
TuplesResultWidget.cpp \
|
TuplesResultWidget.cpp \
|
||||||
PgNamespace.cpp \
|
PgNamespace.cpp \
|
||||||
|
|
@ -69,7 +68,10 @@ PgDatabaseCatalogue.cpp \
|
||||||
ResultTableModelUtil.cpp \
|
ResultTableModelUtil.cpp \
|
||||||
BaseTableModel.cpp \
|
BaseTableModel.cpp \
|
||||||
QueryParamListController.cpp \
|
QueryParamListController.cpp \
|
||||||
TablesPage.cpp
|
TablesPage.cpp \
|
||||||
|
PgClassContainer.cpp \
|
||||||
|
TablesTableModel.cpp \
|
||||||
|
PgDatabaseCatalog.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
QueryResultModel.h \
|
QueryResultModel.h \
|
||||||
|
|
@ -85,7 +87,6 @@ HEADERS += \
|
||||||
util.h \
|
util.h \
|
||||||
DatabaseInspectorWidget.h \
|
DatabaseInspectorWidget.h \
|
||||||
PgType.h \
|
PgType.h \
|
||||||
PgDatabaseCatalogue.h \
|
|
||||||
PgTypeContainer.h \
|
PgTypeContainer.h \
|
||||||
TuplesResultWidget.h \
|
TuplesResultWidget.h \
|
||||||
PgNamespace.h \
|
PgNamespace.h \
|
||||||
|
|
@ -113,7 +114,10 @@ PgDatabaseCatalogue.h \
|
||||||
ResultTableModelUtil.h \
|
ResultTableModelUtil.h \
|
||||||
BaseTableModel.h \
|
BaseTableModel.h \
|
||||||
QueryParamListController.h \
|
QueryParamListController.h \
|
||||||
TablesPage.h
|
TablesPage.h \
|
||||||
|
PgClassContainer.h \
|
||||||
|
TablesTableModel.h \
|
||||||
|
PgDatabaseCatalog.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
DatabaseWindow.ui \
|
DatabaseWindow.ui \
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,17 @@ Value::operator bool() const
|
||||||
return std::strcmp(m_val, "t") == 0;
|
return std::strcmp(m_val, "t") == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value::operator float() const
|
||||||
|
{
|
||||||
|
return std::stof(m_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
Value::operator double() const
|
||||||
|
{
|
||||||
|
return std::stod(m_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Value::isString() const
|
bool Value::isString() const
|
||||||
{
|
{
|
||||||
return m_typ == CHAROID
|
return m_typ == CHAROID
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ namespace Pgsql {
|
||||||
operator Oid() const;
|
operator Oid() const;
|
||||||
operator long long() const;
|
operator long long() const;
|
||||||
operator bool() const;
|
operator bool() const;
|
||||||
|
operator float() const;
|
||||||
|
operator double() const;
|
||||||
|
|
||||||
bool isString() const;
|
bool isString() const;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue