Reorganize files in pglablib
The enitities and containers of the catalog now go into catalog subfolder Models go into model
This commit is contained in:
parent
56cbeea183
commit
f0c1035378
121 changed files with 226 additions and 183 deletions
|
|
@ -1,77 +0,0 @@
|
|||
#include "PgIndex.h"
|
||||
#include "PgDatabaseCatalog.h"
|
||||
#include "PgClassContainer.h"
|
||||
#include "PgAmContainer.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
QString PgIndex::getAm() const
|
||||
{
|
||||
auto&& cat = catalog();
|
||||
QString result;
|
||||
auto idxcls = cat.classes()->getByKey(oid());
|
||||
if (idxcls) {
|
||||
auto am = cat.ams()->getByKey(idxcls->am);
|
||||
if (am)
|
||||
result = am->name; // objectName();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString PgIndex::createSql() const
|
||||
{
|
||||
return definition + ";";
|
||||
|
||||
// const PgClass *table_class = catalog.classes()->getByKey(index.relid);
|
||||
// const PgClass *index_class = catalog.classes()->getByKey(index.indexrelid);
|
||||
|
||||
// QString result;
|
||||
// result = "CREATE ";
|
||||
// if (index.isunique)
|
||||
// result += "UNIQUE ";
|
||||
// result += "INDEX "
|
||||
//// % quoteIdent(getIndexDisplayString(catalog, index.indexrelid))
|
||||
// % quoteIdent(index_class.name)
|
||||
// % "\n ON " % genFQTableName(catalog, table_class);
|
||||
//// % "\n USING " % index_class.am lookup in pg_am table
|
||||
// return result;
|
||||
|
||||
#if 0
|
||||
+ wxT("\n USING ") + GetIndexType()
|
||||
+ wxT("\n (");
|
||||
if (GetProcName().IsNull())
|
||||
str += GetQuotedColumns();
|
||||
else
|
||||
{
|
||||
str += GetQuotedSchemaPrefix(GetProcNamespace()) + qtIdent(GetProcName()) + wxT("(") + GetQuotedColumns() + wxT(")");
|
||||
if (!this->GetOperatorClasses().IsNull())
|
||||
str += wxT(" ") + GetOperatorClasses();
|
||||
}
|
||||
|
||||
str += wxT(")");
|
||||
|
||||
if (GetConnection()->BackendMinimumVersion(8, 2) && GetFillFactor().Length() > 0)
|
||||
str += wxT("\n WITH (FILLFACTOR=") + GetFillFactor() + wxT(")");
|
||||
|
||||
if (GetConnection()->BackendMinimumVersion(8, 0) && tablespace != GetDatabase()->GetDefaultTablespace())
|
||||
str += wxT("\nTABLESPACE ") + qtIdent(tablespace);
|
||||
|
||||
AppendIfFilled(str, wxT("\n WHERE "), GetConstraint());
|
||||
|
||||
str += wxT(";\n");
|
||||
|
||||
if (GetConnection()->BackendMinimumVersion(7, 5))
|
||||
if (GetIsClustered())
|
||||
str += wxT("ALTER TABLE ") + GetQuotedSchemaPrefix(GetIdxSchema()) + qtIdent(GetIdxTable())
|
||||
+ wxT(" CLUSTER ON ") + qtIdent(GetName())
|
||||
+ wxT(";\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
QString PgIndex::dropSql() const
|
||||
{
|
||||
QString result;
|
||||
result = "DROP INDEX "
|
||||
% fullyQualifiedQuotedObjectName()
|
||||
% ";";
|
||||
return result;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue