From 85b52cdda4e297b91a13f8f1234204212cf2d557 Mon Sep 17 00:00:00 2001 From: jdochoa Date: Fri, 20 Oct 2023 17:10:27 -0600 Subject: [PATCH] User Collations --- html-templates/COLLATION.html | 4 +- src/gui/ContextMenuMetadataItemVisitor.cpp | 7 +-- src/gui/ContextMenuMetadataItemVisitor.h | 4 +- src/gui/ExecuteSqlFrame.cpp | 31 ++++++++++++ src/gui/FRStyle.cpp | 2 +- src/gui/controls/DBHTreeControl.cpp | 6 +-- src/gui/controls/DataGridRows.cpp | 2 +- src/ibpp/service.cpp | 6 +-- src/metadata/Collation.cpp | 48 ++++++++++--------- src/metadata/Collation.h | 12 ++--- src/metadata/CreateDDLVisitor.cpp | 7 +-- src/metadata/MetadataClasses.h | 19 ++++---- .../MetadataItemCreateStatementVisitor.cpp | 2 +- .../MetadataItemCreateStatementVisitor.h | 2 +- .../MetadataItemDescriptionVisitor.cpp | 4 +- src/metadata/MetadataItemVisitor.cpp | 10 ++-- src/metadata/MetadataItemVisitor.h | 2 +- src/metadata/database.cpp | 31 ++++++------ src/metadata/database.h | 4 +- src/metadata/metadataitem.h | 4 +- 20 files changed, 121 insertions(+), 86 deletions(-) diff --git a/html-templates/COLLATION.html b/html-templates/COLLATION.html index 3ea125b4..0836e078 100644 --- a/html-templates/COLLATION.html +++ b/html-templates/COLLATION.html @@ -11,7 +11,9 @@ href="fr://edit_description?parent_window={%parent_window%}&object_handle={%object_handle%}&object_type=COLLATION&object_name={%object_name%}">edit]

- +
Collation info
Collation info[edit]
{%collationinfo:source%}
diff --git a/src/gui/ContextMenuMetadataItemVisitor.cpp b/src/gui/ContextMenuMetadataItemVisitor.cpp index 57edda12..d2433a34 100644 --- a/src/gui/ContextMenuMetadataItemVisitor.cpp +++ b/src/gui/ContextMenuMetadataItemVisitor.cpp @@ -490,7 +490,7 @@ void MainObjectMenuMetadataItemVisitor::visitCharacterSet(CharacterSet& charset) addPropertiesItem(); } -void MainObjectMenuMetadataItemVisitor::visitCharacterSets(CharacterSets& charsets) +void MainObjectMenuMetadataItemVisitor::visitCharacterSets(CharacterSets& /*charsets*/) { addRefreshItem(); } @@ -498,16 +498,17 @@ void MainObjectMenuMetadataItemVisitor::visitCharacterSets(CharacterSets& charse void MainObjectMenuMetadataItemVisitor::visitCollation(Collation& collation) { addAlterItem(collation); + addDropItem(collation); addSeparator(); addPropertiesItem(); } -void MainObjectMenuMetadataItemVisitor::visitCollations(Collations& collations) +void MainObjectMenuMetadataItemVisitor::visitSysCollations(SysCollations& /*collations*/) { addRefreshItem(); } -void MainObjectMenuMetadataItemVisitor::visitUserCollations(UserCollations& coolations) +void MainObjectMenuMetadataItemVisitor::visitCollations(Collations& coolations) { addCreateItem(); addSeparator(); diff --git a/src/gui/ContextMenuMetadataItemVisitor.h b/src/gui/ContextMenuMetadataItemVisitor.h index 0bcfbf33..4d15cf77 100644 --- a/src/gui/ContextMenuMetadataItemVisitor.h +++ b/src/gui/ContextMenuMetadataItemVisitor.h @@ -78,8 +78,8 @@ class MainObjectMenuMetadataItemVisitor : public MetadataItemVisitor virtual void visitCharacterSet(CharacterSet& charset); virtual void visitCharacterSets(CharacterSets& charsets); virtual void visitCollation(Collation& collation); - virtual void visitCollations(Collations& collations); - virtual void visitUserCollations(UserCollations& coolations); + virtual void visitSysCollations(SysCollations& collations); + virtual void visitCollations(Collations& coolations); protected: wxMenu* menuM; diff --git a/src/gui/ExecuteSqlFrame.cpp b/src/gui/ExecuteSqlFrame.cpp index 6c429801..4a587701 100644 --- a/src/gui/ExecuteSqlFrame.cpp +++ b/src/gui/ExecuteSqlFrame.cpp @@ -3782,3 +3782,34 @@ bool EditPackageBodyHandler::handleURI(URI& uri) p->getAlterBody()); return true; } + + +class EditCollationHandler : public URIHandler, + private MetadataItemURIHandlerHelper, private GUIURIHandlerHelper +{ +public: + EditCollationHandler() {} + bool handleURI(URI& uri); +private: + // singleton; registers itself on creation. + static const EditCollationHandler handlerInstance; +}; + +const EditCollationHandler EditCollationHandler::handlerInstance; + +bool EditCollationHandler::handleURI(URI& uri) +{ + if (uri.action != "edit_collation") + return false; + + Collation* c = extractMetadataItemFromURI(uri); + wxWindow* w = getParentWindow(uri); + if (!c || !w) + return true; + + CreateDDLVisitor cdv; + c->acceptVisitor(&cdv); + showSql(w->GetParent(), _("Editing Collation"), c->getDatabase(), + c->getAlterSql()); + return true; +} diff --git a/src/gui/FRStyle.cpp b/src/gui/FRStyle.cpp index 36a3a380..3270dadb 100644 --- a/src/gui/FRStyle.cpp +++ b/src/gui/FRStyle.cpp @@ -214,7 +214,7 @@ FRStyles& FRStyles::operator=(const FRStyles& sa) return *this; } -bool FRStyles::operator==(const FRStyles& sa) +bool FRStyles::operator==(const FRStyles& /*sa*/) { return false; } diff --git a/src/gui/controls/DBHTreeControl.cpp b/src/gui/controls/DBHTreeControl.cpp index c6c8f9b4..0f9819e6 100644 --- a/src/gui/controls/DBHTreeControl.cpp +++ b/src/gui/controls/DBHTreeControl.cpp @@ -305,8 +305,8 @@ class DBHTreeItemVisitor: public MetadataItemVisitor virtual void visitCharacterSet(CharacterSet& characterset); virtual void visitCharacterSets(CharacterSets& charactersets); virtual void visitCollation(Collation& collation); + virtual void visitSysCollations(SysCollations& collations); virtual void visitCollations(Collations& collations); - virtual void visitUserCollations(UserCollations& collations); virtual void visitColumn(Column& column); virtual void visitDatabase(Database& database); virtual void visitDomain(Domain& domain); @@ -406,12 +406,12 @@ void DBHTreeItemVisitor::visitCollation(Collation& collation) setNodeProperties(&collation, ART_Collation); } -void DBHTreeItemVisitor::visitCollations(Collations& collations) +void DBHTreeItemVisitor::visitSysCollations(SysCollations& collations) { setNodeProperties(&collations, ART_Collations); } -void DBHTreeItemVisitor::visitUserCollations(UserCollations& collations) +void DBHTreeItemVisitor::visitCollations(Collations& collations) { setNodeProperties(&collations, ART_Collations); } diff --git a/src/gui/controls/DataGridRows.cpp b/src/gui/controls/DataGridRows.cpp index 41f7a30c..5ecad363 100644 --- a/src/gui/controls/DataGridRows.cpp +++ b/src/gui/controls/DataGridRows.cpp @@ -1666,7 +1666,7 @@ unsigned StringColumnDef::getBufferSize() } void StringColumnDef::setValue(DataGridRowBuffer* buffer, unsigned col, - const IBPP::Statement& statement, wxMBConv* converter, Database* db) + const IBPP::Statement& statement, wxMBConv* converter, Database* /*db*/) { wxASSERT(buffer); if (statement->ColumnType(col) == IBPP::sdBoolean) // Firebird v3 diff --git a/src/ibpp/service.cpp b/src/ibpp/service.cpp index f109ba26..166bcf36 100644 --- a/src/ibpp/service.cpp +++ b/src/ibpp/service.cpp @@ -524,7 +524,7 @@ void ServiceImpl::Shutdown(const std::string& dbfile, IBPP::DSM flags, int secti Wait(); } -void ServiceImpl::Restart(const std::string& dbfile, IBPP::DSM flags ) +void ServiceImpl::Restart(const std::string& dbfile, IBPP::DSM /*flags*/) { if (mHandle == 0) throw LogicExceptionImpl("Service::Restart", _("Service is not connected.")); @@ -600,7 +600,7 @@ void ServiceImpl::Repair(const std::string& dbfile, IBPP::RPF flags) } void ServiceImpl::StartBackup( - const std::string& dbfile, const std::string& bkfile, const std::string& outfile, + const std::string& dbfile, const std::string& bkfile, const std::string& /*outfile*/, const int factor, IBPP::BRF flags, const std::string& cryptName, const std::string& keyHolder, const std::string& keyName, const std::string& skipData, const std::string& includeData, const int verboseInteval, @@ -688,7 +688,7 @@ void ServiceImpl::StartBackup( } void ServiceImpl::StartRestore( - const std::string& bkfile, const std::string& dbfile, const std::string& outfile, + const std::string& bkfile, const std::string& dbfile, const std::string& /*outfile*/, int pagesize, int buffers, IBPP::BRF flags, const std::string& cryptName, const std::string& keyHolder, const std::string& keyName, const std::string& skipData, const std::string& includeData, const int verboseInteval, diff --git a/src/metadata/Collation.cpp b/src/metadata/Collation.cpp index c219a354..478b68e3 100644 --- a/src/metadata/Collation.cpp +++ b/src/metadata/Collation.cpp @@ -184,46 +184,48 @@ const wxString Collation::getTypeName() const wxString Collation::getSource() { ensurePropertiesLoaded(); - wxString sql ="FOR " + getDatabase()->getCharsetById(characterSetIdM)->getName_() + " \n"; + wxString sql =" FOR " + getDatabase()->getCharsetById(characterSetIdM)->getName_() + " \n"; if (!getBaseCollectionName().IsEmpty()) - sql =+ "FROM EXTERNAL ('" + getBaseCollectionName() + "') "; + sql += " FROM EXTERNAL ('" + getBaseCollectionName() + "') "; if(getAttributes() & TEXTTYPE_ATTR_CASE_INSENSITIVE) - sql += ", \nPAD SPACE"; + sql += "\n PAD SPACE"; if (getAttributes() & TEXTTYPE_ATTR_PAD_SPACE) - sql += ", \nCASE INSENSITIVE"; + sql += "\n CASE INSENSITIVE"; if (getAttributes() & TEXTTYPE_ATTR_ACCENT_INSENSITIVE) - sql += ", \nACCENT INSENSITIVE"; + sql += "\n ACCENT INSENSITIVE"; if (!getSpecificAttibutes().IsEmpty()) - sql += ", \n'" + getSpecificAttibutes() + "'"; + sql += "\n '" + getSpecificAttibutes() + "'"; return sql; } wxString Collation::getAlterSql() { - return "ALTER COLLATION " + getName_() + "\n" + getSource() + ";\n"; + return getDropSqlStatement()+"\n\n " + + "CREATE COLLATION " + getName_() + "\n" + getSource() + ";\n"; } -void Collations::loadChildren() +void SysCollations::loadChildren() { load(0); } -Collations::Collations(DatabasePtr database) - : MetadataCollection(ntCollations, database, _("Collation")) +SysCollations::SysCollations(DatabasePtr database) + : MetadataCollection(ntCollations, database, _("SysCollation")) { } -void Collations::acceptVisitor(MetadataItemVisitor* visitor) +void SysCollations::acceptVisitor(MetadataItemVisitor* visitor) { - visitor->visitCollations(*this); + visitor->visitSysCollations(*this); } -void Collations::load(ProgressIndicator* progressIndicator) +void SysCollations::load(ProgressIndicator* progressIndicator) { DatabasePtr db = getDatabase(); wxString stmt( " Select RDB$COLLATION_NAME " @@ -233,27 +235,27 @@ void Collations::load(ProgressIndicator* progressIndicator) setItems(db->loadIdentifiers(stmt, progressIndicator)); } -const wxString Collations::getTypeName() const +const wxString SysCollations::getTypeName() const { - return "COLLATION_COLLECTION"; + return "SYSCOLLATION_COLLECTION"; } -void UserCollations::loadChildren() +void Collations::loadChildren() { load(0); } -UserCollations::UserCollations(DatabasePtr database) - : MetadataCollection(ntUserCollations, database, _("Collation")) +Collations::Collations(DatabasePtr database) + : MetadataCollection(ntCollations, database, _("Collation")) { } -void UserCollations::acceptVisitor(MetadataItemVisitor* visitor) +void Collations::acceptVisitor(MetadataItemVisitor* visitor) { - visitor->visitUserCollations(*this); + visitor->visitCollations(*this); } -void UserCollations::load(ProgressIndicator* progressIndicator) +void Collations::load(ProgressIndicator* progressIndicator) { DatabasePtr db = getDatabase(); wxString stmt(" Select RDB$COLLATION_NAME " @@ -263,7 +265,7 @@ void UserCollations::load(ProgressIndicator* progressIndicator) setItems(db->loadIdentifiers(stmt, progressIndicator)); } -const wxString UserCollations::getTypeName() const +const wxString Collations::getTypeName() const { - return "USERCOLLATION_COLLECTION"; + return "COLLATION_COLLECTION"; } diff --git a/src/metadata/Collation.h b/src/metadata/Collation.h index 2156a6dc..69c6806e 100644 --- a/src/metadata/Collation.h +++ b/src/metadata/Collation.h @@ -35,7 +35,7 @@ #define TEXTTYPE_ATTR_CASE_INSENSITIVE 2 #define TEXTTYPE_ATTR_ACCENT_INSENSITIVE 4 -class Collations; +class SysCollations; class Collation : public MetadataItem { @@ -45,7 +45,7 @@ class Collation : public MetadataItem wxString baseCollectionNameM; wxString specificAttibutesM; - friend class Collations; + friend class SysCollations; protected: static std::string getLoadStatement(bool list); void loadProperties(IBPP::Statement& statement, wxMBConv* converter); @@ -79,12 +79,12 @@ class Collation : public MetadataItem }; -class Collations : public MetadataCollection +class SysCollations : public MetadataCollection { protected: virtual void loadChildren(); public: - Collations(DatabasePtr database); + SysCollations(DatabasePtr database); virtual void acceptVisitor(MetadataItemVisitor* visitor); void load(ProgressIndicator* progressIndicator); @@ -92,12 +92,12 @@ class Collations : public MetadataCollection }; -class UserCollations : public MetadataCollection +class Collations : public MetadataCollection { protected: virtual void loadChildren(); public: - UserCollations(DatabasePtr database); + Collations(DatabasePtr database); virtual void acceptVisitor(MetadataItemVisitor* visitor); void load(ProgressIndicator* progressIndicator); diff --git a/src/metadata/CreateDDLVisitor.cpp b/src/metadata/CreateDDLVisitor.cpp index e6f8a6fc..9e84c534 100644 --- a/src/metadata/CreateDDLVisitor.cpp +++ b/src/metadata/CreateDDLVisitor.cpp @@ -118,7 +118,8 @@ wxString CreateDDLVisitor::getSuffixSql() const void CreateDDLVisitor::visitCollation(Collation& collation) { - preSqlM += "CREATE " + collation.getName_() + " \n" + collation.getSource() + "; \n"; + preSqlM += "CREATE COLLATION " + collation.getName_() + " \n" + + collation.getSource() + "\n; \n"; postSqlM << getCommentOn(collation); sqlM = preSqlM + postSqlM; @@ -210,7 +211,7 @@ void CreateDDLVisitor::visitDatabase(Database& d) { preSqlM << "/********************* COLLATES **********************/\n\n"; - iterateit(this, d.getUserCollations(), progressIndicatorM); + iterateit(this, d.getCollations(), progressIndicatorM); preSqlM << "/********************* ROLES **********************/\n\n"; iterateit(this, d.getRoles(), progressIndicatorM); @@ -877,6 +878,6 @@ void CreateDDLVisitor::visitView(View& v) sqlM += preSqlM + "\n" + postSqlM + grantSqlM; } -void CreateDDLVisitor::visitCharacterSet(CharacterSet& characterset) +void CreateDDLVisitor::visitCharacterSet(CharacterSet& /*characterset*/) { } diff --git a/src/metadata/MetadataClasses.h b/src/metadata/MetadataClasses.h index c9428295..e5d44721 100644 --- a/src/metadata/MetadataClasses.h +++ b/src/metadata/MetadataClasses.h @@ -39,8 +39,8 @@ typedef std::shared_ptr CollationPtr; typedef std::vector CollationPtrs; class Collations; typedef std::shared_ptr CollationsPtr; -class UserCollations; -typedef std::shared_ptr UserCollationsPtr; +class SysCollations; +typedef std::shared_ptr SysCollationsPtr; class Column; @@ -81,6 +81,8 @@ typedef std::shared_ptr DomainPtr; typedef std::vector DomainPtrs; class Domains; typedef std::shared_ptr DomainsPtr; +class SysDomains; +typedef std::shared_ptr SysDomainsPtr; class Exception; typedef std::shared_ptr ExceptionPtr; @@ -126,6 +128,8 @@ typedef std::shared_ptr PackagePtr; typedef std::vector PackagePtrs; class Packages; typedef std::shared_ptr PackagesPtr; +class SysPackages; +typedef std::shared_ptr SysPackagesPtr; class Parameter; typedef std::shared_ptr ParameterPtr; @@ -146,6 +150,8 @@ typedef std::shared_ptr RolePtr; typedef std::vector RolePtrs; class Roles; typedef std::shared_ptr RolesPtr; +class SysRoles; +typedef std::shared_ptr SysRolesPtr; class Root; typedef std::shared_ptr RootPtr; @@ -155,15 +161,6 @@ typedef std::shared_ptr ServerPtr; typedef std::weak_ptr ServerWeakPtr; typedef std::vector ServerPtrs; -class SysDomains; -typedef std::shared_ptr SysDomainsPtr; - -class SysPackages; -typedef std::shared_ptr SysPackagesPtr; - -class SysRoles; -typedef std::shared_ptr SysRolesPtr; - class GTTable; typedef std::shared_ptr GTTablePtr; typedef std::vector GTTablePtrs; diff --git a/src/metadata/MetadataItemCreateStatementVisitor.cpp b/src/metadata/MetadataItemCreateStatementVisitor.cpp index 9ee3b0a1..09aa9271 100644 --- a/src/metadata/MetadataItemCreateStatementVisitor.cpp +++ b/src/metadata/MetadataItemCreateStatementVisitor.cpp @@ -374,7 +374,7 @@ void MetadataItemCreateStatementVisitor::visitCharacterSets(CharacterSets& /*cha statementM = getCreateCharacterSetStatement(); } -void MetadataItemCreateStatementVisitor::visitUserCollations(UserCollations& collations) +void MetadataItemCreateStatementVisitor::visitCollations(Collations& /*collations*/) { statementM = getCreateCollationStatment(); diff --git a/src/metadata/MetadataItemCreateStatementVisitor.h b/src/metadata/MetadataItemCreateStatementVisitor.h index a70e28cf..57733876 100644 --- a/src/metadata/MetadataItemCreateStatementVisitor.h +++ b/src/metadata/MetadataItemCreateStatementVisitor.h @@ -52,7 +52,7 @@ class MetadataItemCreateStatementVisitor : public MetadataItemVisitor virtual void visitCharacterSets(CharacterSets& characterSets); - virtual void visitUserCollations(UserCollations& collations); + virtual void visitCollations(Collations& collations); virtual void visitDBTriggers(DBTriggers& triggers); virtual void visitDDLTriggers(DDLTriggers& triggers); virtual void visitDMLTriggers(DMLTriggers& triggers); diff --git a/src/metadata/MetadataItemDescriptionVisitor.cpp b/src/metadata/MetadataItemDescriptionVisitor.cpp index 46ff13ba..45fb512d 100644 --- a/src/metadata/MetadataItemDescriptionVisitor.cpp +++ b/src/metadata/MetadataItemDescriptionVisitor.cpp @@ -117,7 +117,7 @@ void LoadDescriptionVisitor::loadDescription(MetadataItem* object, } } -void LoadDescriptionVisitor::visitCharcterSet(CharacterSet& charterSet) +void LoadDescriptionVisitor::visitCharcterSet(CharacterSet& /*charterSet*/) { } @@ -276,7 +276,7 @@ void SaveDescriptionVisitor::saveDescription(MetadataItem* object, tr1->Commit(); } -void SaveDescriptionVisitor::visitCharacterSet(CharacterSet& charterSet) +void SaveDescriptionVisitor::visitCharacterSet(CharacterSet& /*charterSet*/) { } diff --git a/src/metadata/MetadataItemVisitor.cpp b/src/metadata/MetadataItemVisitor.cpp index 17b70e72..c1888485 100644 --- a/src/metadata/MetadataItemVisitor.cpp +++ b/src/metadata/MetadataItemVisitor.cpp @@ -51,17 +51,17 @@ void MetadataItemVisitor::visitCharacterSets(CharacterSets&) defaultAction(); } -void MetadataItemVisitor::visitCollation(Collation& collation) +void MetadataItemVisitor::visitCollation(Collation&) { defaultAction(); } -void MetadataItemVisitor::visitCollations(Collations& collations) +void MetadataItemVisitor::visitSysCollations(SysCollations&) { defaultAction(); } -void MetadataItemVisitor::visitUserCollations(UserCollations& collations) +void MetadataItemVisitor::visitCollations(Collations&) { defaultAction(); } @@ -122,12 +122,12 @@ void MetadataItemVisitor::visitUDFs(UDFs&) defaultAction(); } -void MetadataItemVisitor::visitUser(User& ) +void MetadataItemVisitor::visitUser(User&) { defaultAction(); } -void MetadataItemVisitor::visitUsers(Users& ) +void MetadataItemVisitor::visitUsers(Users&) { defaultAction(); } diff --git a/src/metadata/MetadataItemVisitor.h b/src/metadata/MetadataItemVisitor.h index 20314554..b64560be 100644 --- a/src/metadata/MetadataItemVisitor.h +++ b/src/metadata/MetadataItemVisitor.h @@ -39,8 +39,8 @@ class MetadataItemVisitor: public Visitor virtual void visitCharacterSet(CharacterSet& characterSet); virtual void visitCharacterSets(CharacterSets& characterSets); virtual void visitCollation(Collation& collation); + virtual void visitSysCollations(SysCollations& collations); virtual void visitCollations(Collations& collations); - virtual void visitUserCollations(UserCollations& collations); virtual void visitColumn(Column& column); virtual void visitDatabase(Database& database); virtual void visitDBTrigger(DBTrigger& trigger); diff --git a/src/metadata/database.cpp b/src/metadata/database.cpp index 2340b42a..d6fcf853 100644 --- a/src/metadata/database.cpp +++ b/src/metadata/database.cpp @@ -323,7 +323,7 @@ void Database::getIdentifiers(std::vector& temp) checkConnected(_("getIdentifiers")); std::transform(characterSetsM->begin(), characterSetsM->end(), std::back_inserter(temp), std::mem_fn(&MetadataItem::getIdentifier)); - std::transform(userCollationsM->begin(), userCollationsM->end(), + std::transform(collationsM->begin(), collationsM->end(), std::back_inserter(temp), std::mem_fn(&MetadataItem::getIdentifier)); std::transform(tablesM->begin(), tablesM->end(), std::back_inserter(temp), std::mem_fn(&MetadataItem::getIdentifier)); @@ -568,7 +568,7 @@ MetadataItem* Database::findByNameAndType(NodeType nt, const wxString& name) return characterSetsM->findByName(name).get(); break; case ntCollation: - return userCollationsM->findByName(name).get(); + return collationsM->findByName(name).get(); break; case ntTable: return tablesM->findByName(name).get(); @@ -680,7 +680,7 @@ void Database::dropObject(MetadataItem* object) characterSetsM->remove((CharacterSet*)object); break; case ntCollation: - userCollationsM->remove((Collation*)object); + collationsM->remove((Collation*)object); break; case ntTable: tablesM->remove((Table*)object); @@ -752,7 +752,7 @@ void Database::addObject(NodeType type, const wxString& name) characterSetsM->insert(name); break; case ntCollation: - userCollationsM->insert(name); + collationsM->insert(name); break; case ntTable: tablesM->insert(name); @@ -1151,8 +1151,8 @@ void Database::connect(const wxString& password, ProgressIndicator* indicator) characterSetsM.reset(new CharacterSets(me)); initializeLockCount(characterSetsM, lockCount); - userCollationsM.reset(new UserCollations(me)); - initializeLockCount(userCollationsM, lockCount); + collationsM.reset(new Collations(me)); + initializeLockCount(collationsM, lockCount); userDomainsM.reset(new Domains(me)); initializeLockCount(userDomainsM, lockCount); sysDomainsM.reset(new SysDomains(me)); @@ -1353,7 +1353,7 @@ void Database::loadCollections(ProgressIndicator* progressIndicator) characterSetsM->load(progressIndicator); pih.init(_("User Collations"), collectionCount, 22); - userCollationsM->load(progressIndicator); + collationsM->load(progressIndicator); } @@ -1460,7 +1460,7 @@ void Database::setDisconnected() sysIndicesM.reset(); usrIndicesM.reset(); characterSetsM.reset(); - userCollationsM.reset(); + collationsM.reset(); if (config().get("HideDisconnectedDatabases", false)) getServer()->notifyObservers(); @@ -1628,11 +1628,11 @@ CharacterSetsPtr Database::getCharacterSets() return characterSetsM; } -UserCollationsPtr Database::getUserCollations() +CollationsPtr Database::getCollations() { - wxASSERT(userCollationsM); - userCollationsM->ensureChildrenLoaded(); - return userCollationsM; + wxASSERT(collationsM); + collationsM->ensureChildrenLoaded(); + return collationsM; } DBTriggersPtr Database::getDBTriggers() @@ -1663,7 +1663,8 @@ void Database::getCollections(std::vector& temp, bool system) ensureChildrenLoaded(); if (system && showSystemCharacterSet()) temp.push_back(characterSetsM.get()); - temp.push_back(userCollationsM.get()); + + temp.push_back(collationsM.get()); if (getInfo().getODSVersionIsHigherOrEqualTo(11.1)) temp.push_back(DBTriggersM.get()); @@ -1737,7 +1738,7 @@ void Database::lockChildren() sysIndicesM->lockSubject(); usrIndicesM->lockSubject(); characterSetsM->lockSubject(); - userCollationsM->lockSubject(); + collationsM->lockSubject(); } } @@ -1769,7 +1770,7 @@ void Database::unlockChildren() sysDomainsM->unlockSubject(); userDomainsM->unlockSubject(); characterSetsM->unlockSubject(); - userCollationsM->unlockSubject(); + collationsM->unlockSubject(); } } diff --git a/src/metadata/database.h b/src/metadata/database.h index 7291d652..1c4c0de4 100644 --- a/src/metadata/database.h +++ b/src/metadata/database.h @@ -186,7 +186,7 @@ class Database: public MetadataItem, DatabaseInfo databaseInfoM; CharacterSetsPtr characterSetsM; - UserCollationsPtr userCollationsM; + CollationsPtr collationsM; DBTriggersPtr DBTriggersM; DDLTriggersPtr DDLTriggersM; DMLTriggersPtr DMLtriggersM; @@ -253,7 +253,7 @@ class Database: public MetadataItem, void getCollections(std::vector& temp, bool system); CharacterSetsPtr getCharacterSets(); - UserCollationsPtr getUserCollations(); + CollationsPtr getCollations(); DBTriggersPtr getDBTriggers(); DDLTriggersPtr getDDLTriggers(); DMLTriggersPtr getDMLTriggers(); diff --git a/src/metadata/metadataitem.h b/src/metadata/metadataitem.h index 4dbf9ba6..c84b760c 100644 --- a/src/metadata/metadataitem.h +++ b/src/metadata/metadataitem.h @@ -69,8 +69,8 @@ typedef enum { ntUnknown, ntRoot, ntServer, ntDatabase, ntUser, ntUsers, ntSystem, ntCharacterSet, ntChartersets, - ntCollation, ntCollations, - ntUserColletion, ntUserCollations, + ntSysCollation, ntSysCollations, + ntCollation, ntCollations, ntLastType } NodeType;