Skip to content
Snippets Groups Projects
Commit 43bb05ab authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

cta-catalogue-schema-verify now checks for indexes finishing by _I or by _IDX

parent f4905cca
Branches
Tags
No related merge requests found
......@@ -37,6 +37,12 @@ void CatalogueMetadataGetter::removeObjectNameNotContaining(std::list<std::strin
}) != wordsNotToTriggerRemoval.end();
});
}
void CatalogueMetadataGetter::removeObjectNameNotMatches(std::list<std::string> &objects, const cta::utils::Regex &regex){
objects.remove_if([&regex](const std::string &object){
return !regex.has_match(object);
});
}
CatalogueMetadataGetter::CatalogueMetadataGetter(cta::rdbms::Conn& conn):m_conn(conn){}
......@@ -68,7 +74,8 @@ std::list<std::string> CatalogueMetadataGetter::getTableNames(){
std::list<std::string> CatalogueMetadataGetter::getIndexNames(){
std::list<std::string> indexNames = m_conn.getIndexNames();
removeObjectNameNotContaining(indexNames,{"_IDX"});
cta::utils::Regex regexIndexes("(.*_IDX$)|(.*_I$)");
removeObjectNameNotMatches(indexNames,regexIndexes);
return indexNames;
}
......
......@@ -31,6 +31,7 @@ class CatalogueMetadataGetter {
rdbms::Conn& m_conn;
void removeObjectNameContaining(std::list<std::string>& objects, const std::list<std::string> &wordsToTriggerRemoval);
void removeObjectNameNotContaining(std::list<std::string>& objects, const std::list<std::string> &wordsNotToTriggerRemoval);
void removeObjectNameNotMatches(std::list<std::string> &objects, const cta::utils::Regex &regex);
public:
CatalogueMetadataGetter(cta::rdbms::Conn & conn);
virtual ~CatalogueMetadataGetter();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment