diff --git a/catalogue/SchemaChecker.cpp b/catalogue/SchemaChecker.cpp index 5023984a31ec9e9dc52aab1f9baff93b3c7e3929..755db61387797791a383697ccbbe8ea6f7ce032e 100644 --- a/catalogue/SchemaChecker.cpp +++ b/catalogue/SchemaChecker.cpp @@ -47,7 +47,10 @@ SchemaChecker::Status SchemaChecker::compareSchema(){ } void SchemaChecker::checkNoParallelTables(){ - + std::list<std::string> parallelTables = m_catalogueConn.getParallelTableNames(); + for(auto& table:parallelTables) { + std::cout << "WARNING : " << table << " is set as PARALLEL" << std::endl; + } } }} \ No newline at end of file diff --git a/catalogue/VerifySchemaCmd.cpp b/catalogue/VerifySchemaCmd.cpp index 586582276157a3dea3b5c44b82f10626ad40cbb9..0b6b4b4e508fc2622aa90eed8bb2b548b3385d23 100644 --- a/catalogue/VerifySchemaCmd.cpp +++ b/catalogue/VerifySchemaCmd.cpp @@ -79,8 +79,8 @@ int VerifySchemaCmd::exceptionThrowingMain(const int argc, char *const *const ar if(!cmdLineArgs.allSchemaDirectoryPath.empty()){ cta::catalogue::SchemaChecker schemaChecker(login.dbType,conn); schemaChecker.useSQLiteSchemaComparer(allSchemasDirectoryPath); - SchemaChecker::Status comparisonStatus = schemaChecker.compareSchema(); schemaChecker.checkNoParallelTables(); + SchemaChecker::Status comparisonStatus = schemaChecker.compareSchema(); if(comparisonStatus == SchemaChecker::Status::FAILURE){ return 1; diff --git a/rdbms/Conn.cpp b/rdbms/Conn.cpp index 7c5530109a55f37b9062b9108772ba238d82ca2a..2ad3d798c70bf22b597ae970fd46ccdb2900157a 100644 --- a/rdbms/Conn.cpp +++ b/rdbms/Conn.cpp @@ -230,5 +230,13 @@ std::list<std::string> Conn::getTriggerNames() { } } +std::list<std::string> Conn::getParallelTableNames(){ + if(nullptr != m_connAndStmts && nullptr != m_connAndStmts->conn) { + return m_connAndStmts->conn->getParallelTableNames(); + } else { + throw exception::Exception(std::string(__FUNCTION__) + " failed: Conn does not contain a connection"); + } +} + } // namespace rdbms } // namespace cta diff --git a/rdbms/Conn.hpp b/rdbms/Conn.hpp index 6805e3ff87b4a83e8557bbf74edd3317cf235b15..ee896af911608ac44f5d48a43469cbaa7025a847 100644 --- a/rdbms/Conn.hpp +++ b/rdbms/Conn.hpp @@ -198,6 +198,18 @@ public: */ std::list<std::string> getTriggerNames(); + /** + * Returns the names of all the tables that have been set as PARALLEL + * in alphabetical order. + * + * If the underlying database technologies does not support PARALLEL + * them this method simply returns an empty list. + * + * @return the names of all the tables that have been set as PARALLEL + * in alphabetical order. + */ + std::list<std::string> getParallelTableNames(); + /** * Get a pointer to the connection wrapper implementation * diff --git a/rdbms/wrapper/ConnWrapper.hpp b/rdbms/wrapper/ConnWrapper.hpp index 9a7d9efa109f387415af9ae1748e42d543d9b6f9..bc15d15ef961859b6e44490574deda919121f496 100644 --- a/rdbms/wrapper/ConnWrapper.hpp +++ b/rdbms/wrapper/ConnWrapper.hpp @@ -143,6 +143,18 @@ public: * alphabetical order. */ virtual std::list<std::string> getTriggerNames() = 0; + + /** + * Returns the names of all the tables that have been set as PARALLEL + * in alphabetical order. + * + * If the underlying database technologies does not support PARALLEL + * them this method simply returns an empty list. + * + * @return the names of all the tables that have been set as PARALLEL + * in alphabetical order. + */ + virtual std::list<std::string> getParallelTableNames() = 0; }; // class ConnWrapper diff --git a/rdbms/wrapper/MysqlConn.cpp b/rdbms/wrapper/MysqlConn.cpp index 1a93a556c8c43f6f62371fe570735dd314f8f92e..fe9af34b7be371560e80bbbd60a8d25ea63af88c 100644 --- a/rdbms/wrapper/MysqlConn.cpp +++ b/rdbms/wrapper/MysqlConn.cpp @@ -338,6 +338,10 @@ std::list<std::string> MysqlConn::getTriggerNames() { } } +std::list<std::string> MysqlConn::getParallelTableNames(){ + return std::list<std::string>(); +} + } // namespace wrapper } // namespace rdbms } // namespace cta diff --git a/rdbms/wrapper/MysqlConn.hpp b/rdbms/wrapper/MysqlConn.hpp index 105322975be0103744874be0c6f80ed17f7a3bc5..814323a2d77f4c98ce95f15bc5f2ce5a6a8be284 100644 --- a/rdbms/wrapper/MysqlConn.hpp +++ b/rdbms/wrapper/MysqlConn.hpp @@ -171,6 +171,18 @@ public: */ std::list<std::string> getTriggerNames() override; + /** + * Returns the names of all the tables that have been set as PARALLEL + * in alphabetical order. + * + * If the underlying database technologies does not support PARALLEL + * them this method simply returns an empty list. + * + * @return the names of all the tables that have been set as PARALLEL + * in alphabetical order. + */ + std::list<std::string> getParallelTableNames() override; + private: /** diff --git a/rdbms/wrapper/OcciConn.cpp b/rdbms/wrapper/OcciConn.cpp index f21a20a60da3784161759a12f28a5a0f98332a08..ef48c1c2f7bb7bf47d457f4880bb054ef63c1657 100644 --- a/rdbms/wrapper/OcciConn.cpp +++ b/rdbms/wrapper/OcciConn.cpp @@ -284,6 +284,34 @@ std::list<std::string> OcciConn::getTriggerNames() { return std::list<std::string>(); } +//------------------------------------------------------------------------------ +// getParallelTriggerNames +//------------------------------------------------------------------------------ +std::list<std::string> OcciConn::getParallelTableNames() { + try { + std::list<std::string> names; + const char *const sql = + "SELECT " + "TABLE_NAME " + "FROM " + "USER_TABLES " + "WHERE " + "DEGREE NOT LIKE '%1%' " + "ORDER BY " + "TABLE_NAME"; + auto stmt = createStmt(sql); + auto rset = stmt->executeQuery(); + while (rset->next()) { + auto name = rset->columnOptionalString("TABLE_NAME"); + names.push_back(name.value()); + } + + return names; + } catch(exception::Exception &ex) { + throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str()); + } +} + //------------------------------------------------------------------------------ // isOpen //------------------------------------------------------------------------------ diff --git a/rdbms/wrapper/OcciConn.hpp b/rdbms/wrapper/OcciConn.hpp index cb7e55b0816f42ccb8d5b75d14c1de33fbb79457..0ca4cb8c7d924b1ab3806725335816a14db829b8 100644 --- a/rdbms/wrapper/OcciConn.hpp +++ b/rdbms/wrapper/OcciConn.hpp @@ -157,6 +157,18 @@ public: * alphabetical order. */ std::list<std::string> getTriggerNames() override; + + /** + * Returns the names of all the tables that have been set as PARALLEL + * in alphabetical order. + * + * If the underlying database technologies does not support PARALLEL + * them this method simply returns an empty list. + * + * @return the names of all the tables that have been set as PARALLEL + * in alphabetical order. + */ + std::list<std::string> getParallelTableNames() override; private: diff --git a/rdbms/wrapper/PostgresConn.cpp b/rdbms/wrapper/PostgresConn.cpp index e27ee6792f14e7e0b40beb5de3b21b9c5fced5c7..166b4229522246c88b32f89ef8b7351ac22b6680 100644 --- a/rdbms/wrapper/PostgresConn.cpp +++ b/rdbms/wrapper/PostgresConn.cpp @@ -320,6 +320,10 @@ std::list<std::string> PostgresConn::getTriggerNames() { return std::list<std::string>(); } +std::list<std::string> PostgresConn::getParallelTableNames(){ + return std::list<std::string>(); +} + //------------------------------------------------------------------------------ // isOpen //------------------------------------------------------------------------------ diff --git a/rdbms/wrapper/PostgresConn.hpp b/rdbms/wrapper/PostgresConn.hpp index ce67db9c29127f10de1bc327628b5e46cb7b484b..518bccac5117d148b44bee60b446351441bd341e 100644 --- a/rdbms/wrapper/PostgresConn.hpp +++ b/rdbms/wrapper/PostgresConn.hpp @@ -111,6 +111,18 @@ public: */ std::list<std::string> getTriggerNames() override; + /** + * Returns the names of all the tables that have been set as PARALLEL + * in alphabetical order. + * + * If the underlying database technologies does not support PARALLEL + * them this method simply returns an empty list. + * + * @return the names of all the tables that have been set as PARALLEL + * in alphabetical order. + */ + std::list<std::string> getParallelTableNames() override; + /** * Returns the names of all the column and their type as a map for the given * table in the database schema. diff --git a/rdbms/wrapper/SqliteConn.cpp b/rdbms/wrapper/SqliteConn.cpp index cd1be217d786f44f12e892e7034c285b77e7be36..3033088405d3f656d05907b29b4b2dc83e248e48 100644 --- a/rdbms/wrapper/SqliteConn.cpp +++ b/rdbms/wrapper/SqliteConn.cpp @@ -363,6 +363,11 @@ std::list<std::string> SqliteConn::getTriggerNames() { return std::list<std::string>(); } + +std::list<std::string> SqliteConn::getParallelTableNames(){ + return std::list<std::string>(); +} + } // namespace wrapper } // namespace rdbms } // namespace cta diff --git a/rdbms/wrapper/SqliteConn.hpp b/rdbms/wrapper/SqliteConn.hpp index ff703c96dfadf14347b0f1705da8916995d43e20..c2e3e002eeea7b9bc069424e2666dcc862bea61f 100644 --- a/rdbms/wrapper/SqliteConn.hpp +++ b/rdbms/wrapper/SqliteConn.hpp @@ -160,6 +160,18 @@ public: */ std::list<std::string> getTriggerNames() override; + /** + * Returns the names of all the tables that have been set as PARALLEL + * in alphabetical order. + * + * If the underlying database technologies does not support PARALLEL + * them this method simply returns an empty list. + * + * @return the names of all the tables that have been set as PARALLEL + * in alphabetical order. + */ + std::list<std::string> getParallelTableNames() override; + /** * This is an SqliteConn specific method that prints the database schema to * the specified output stream.