Moved several files from pglab project to pglablib
This commit is contained in:
parent
206d734ff5
commit
f4538069cb
44 changed files with 45 additions and 44 deletions
|
|
@ -1,79 +0,0 @@
|
|||
#ifndef PGSQLDATABASECATALOGUE_H
|
||||
#define PGSQLDATABASECATALOGUE_H
|
||||
|
||||
#include <libpq-fe.h>
|
||||
#include <QString>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace Pgsql {
|
||||
|
||||
class Connection;
|
||||
|
||||
}
|
||||
|
||||
class PgAttributeContainer;
|
||||
class PgAuthIdContainer;
|
||||
class PgClassContainer;
|
||||
class PgConstraintContainer;
|
||||
class PgDatabaseContainer;
|
||||
class PgIndexContainer;
|
||||
class PgNamespaceContainer;
|
||||
class PgTypeContainer;
|
||||
|
||||
class PgDatabaseCatalog: public std::enable_shared_from_this<PgDatabaseCatalog> {
|
||||
public:
|
||||
PgDatabaseCatalog();
|
||||
PgDatabaseCatalog(const PgDatabaseCatalog&) = delete;
|
||||
PgDatabaseCatalog& operator = (const PgDatabaseCatalog&) = delete;
|
||||
~PgDatabaseCatalog();
|
||||
|
||||
void loadAll(Pgsql::Connection &conn,
|
||||
std::function<bool(int, int)> progress_callback);
|
||||
|
||||
void loadInfo(Pgsql::Connection &conn);
|
||||
|
||||
const QString& serverVersionString() const;
|
||||
int serverVersion() const;
|
||||
|
||||
std::shared_ptr<const PgAttributeContainer> attributes() const;
|
||||
std::shared_ptr<const PgAuthIdContainer> authIds() const;
|
||||
std::shared_ptr<const PgClassContainer> classes() const;
|
||||
std::shared_ptr<const PgConstraintContainer> constraints() const;
|
||||
std::shared_ptr<const PgDatabaseContainer> databases() const;
|
||||
std::shared_ptr<const PgIndexContainer> indexes() const;
|
||||
std::shared_ptr<const PgNamespaceContainer> namespaces() const;
|
||||
std::shared_ptr<const PgTypeContainer> types() const;
|
||||
private:
|
||||
QString m_serverVersionString;
|
||||
int m_serverVersion;
|
||||
|
||||
std::shared_ptr<PgAttributeContainer> m_attributes;
|
||||
std::shared_ptr<PgAuthIdContainer> m_authIds;
|
||||
std::shared_ptr<PgClassContainer> m_classes;
|
||||
std::shared_ptr<PgConstraintContainer> m_constraints;
|
||||
std::shared_ptr<PgDatabaseContainer> m_databases;
|
||||
std::shared_ptr<PgIndexContainer> m_indexes;
|
||||
std::shared_ptr<PgNamespaceContainer> m_namespaces;
|
||||
std::shared_ptr<PgTypeContainer> m_types;
|
||||
|
||||
template <typename T>
|
||||
void load2(std::shared_ptr<T> &ptr, Pgsql::Connection &conn)
|
||||
{
|
||||
if (!ptr)
|
||||
ptr = std::make_shared<T>(shared_from_this());
|
||||
|
||||
load(conn, *ptr);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
QString getRoleNameFromOid(const PgDatabaseCatalog &cat, Oid oid);
|
||||
QString getRoleDisplayString(const PgDatabaseCatalog &cat, Oid oid);
|
||||
QString getNamespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid);
|
||||
QString getTablespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid);
|
||||
QString getTypeDisplayString(const PgDatabaseCatalog &cat, Oid oid, int32_t typmod = -1);
|
||||
|
||||
|
||||
#endif // PGSQLDATABASECATALOGUE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue