Tab with list of sequences and create sql for selected sequence.
This commit is contained in:
parent
769307c821
commit
437736a023
19 changed files with 507 additions and 63 deletions
|
|
@ -16,6 +16,7 @@
|
|||
#include "PgCollationContainer.h"
|
||||
#include "PgInheritsContainer.h"
|
||||
#include "PgLanguageContainer.h"
|
||||
#include "PgSequenceContainer.h"
|
||||
#include "Pgsql_Connection.h"
|
||||
#include "Pgsql_oids.h"
|
||||
|
||||
|
|
@ -137,56 +138,69 @@ void PgDatabaseCatalog::loadAll(Pgsql::Connection &conn,
|
|||
loadInfo(conn);
|
||||
const int count = 12;
|
||||
int n = 0;
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
|
||||
auto pf = [&] () -> bool {
|
||||
return progress_callback && !progress_callback(++n, count);
|
||||
};
|
||||
|
||||
if (pf()) return;
|
||||
|
||||
// First load server objects
|
||||
load2(m_authIds, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_tablespaces, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_databases, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
|
||||
// Load database objects
|
||||
load2(m_languages, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_namespaces, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_collations, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_classes, conn); // needs namespaces
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_attributes, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_constraints, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_indexes, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_ams, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_triggers, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_types, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_procs, conn);
|
||||
if (progress_callback && !progress_callback(++n, count))
|
||||
return;
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_inherits, conn);
|
||||
progress_callback && progress_callback(++n, count);
|
||||
if (pf()) return;
|
||||
|
||||
load2(m_sequences, conn);
|
||||
// {
|
||||
// if (!m_sequences)
|
||||
// m_sequences = std::make_shared<PgSequenceContainer>(*this);
|
||||
// m_sequences->load(conn);
|
||||
|
||||
// }
|
||||
pf();
|
||||
|
||||
refreshed(this, All);
|
||||
}
|
||||
|
|
@ -206,27 +220,6 @@ void PgDatabaseCatalog::loadInfo(Pgsql::Connection &conn)
|
|||
m_dbName = conn.getDBName();
|
||||
}
|
||||
|
||||
void load(Pgsql::Connection &conn, IPgContainer &pg_cont)
|
||||
{
|
||||
//QThread::msleep(400);
|
||||
std::string q = pg_cont.getLoadQuery();
|
||||
Pgsql::Result result = conn.query(q.c_str());
|
||||
if (result && result.resultStatus() == PGRES_TUPLES_OK) {
|
||||
//boost::timer::auto_cpu_timer t;
|
||||
pg_cont.load(result);
|
||||
}
|
||||
else {
|
||||
auto details = result.diagDetails();
|
||||
if (details.state == "42501") { // permission denied
|
||||
// ignore this for now
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("Query failed\n" + details.errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const QString& PgDatabaseCatalog::serverVersionString() const
|
||||
{
|
||||
return m_serverVersionString;
|
||||
|
|
@ -311,3 +304,8 @@ std::shared_ptr<const PgLanguageContainer> PgDatabaseCatalog::languages() const
|
|||
{
|
||||
return m_languages;
|
||||
}
|
||||
|
||||
std::shared_ptr<const PgSequenceContainer> PgDatabaseCatalog::sequences() const
|
||||
{
|
||||
return m_sequences;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue