diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6ad0a82045347f15c803f495c71adf3cc1107024..d18349769bad06f420a575f6c2f36cafd3a5db54 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ stages: - build:rpm - build:dockerimage - rename:dockerimage + - dbunittests - test - regressions - shouldfail @@ -125,7 +126,7 @@ cta_valgrind: dbunittests_postgresql: except: - tags - stage: test + stage: dbunittests variables: CTAREPODIR: /tmp/repo image: gitlab-registry.cern.ch/linuxsupport/cc7-base @@ -163,6 +164,40 @@ dbunittests_postgresql: tags: - docker +dbunittests_mysql: + except: + - tags + stage: dbunittests + variables: + CTAREPODIR: /tmp/repo + image: gitlab-registry.cern.ch/linuxsupport/cc7-base + script: + - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/* /etc/yum.repos.d/ + - yum -y install yum-plugin-priorities createrepo + - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/ + - mkdir -p ${CTAREPODIR}; cp -r build_rpm/RPM ${CTAREPODIR} + - createrepo ${CTAREPODIR}; echo -e "[cta-artifacts]\nname=CTA artifacts\nbaseurl=file://${CTAREPODIR}\ngpgcheck=0\nenabled=1\npriority=2" > /etc/yum.repos.d/cta-artifacts.repo + - yum -y --nogpgcheck install cta-systemtests cta-debuginfo sqlite-debuginfo --enablerepo=debug + - yum -y install cta-catalogueutils + - yum -y install lsof mariadb-server + - echo '[mariadb]' > /etc/my.cnf.d/cta_server_listen.cnf + - echo 'bind-address=localhost' >> /etc/my.cnf.d/cta_server_listen.cnf + - mysql_install_db --user=mysql + - /usr/bin/mysqld_safe > /dev/null 2>&1 < /dev/null & + - sleep 5 + - echo 'create database cta;' | mysql + - echo 'create user cta;' | mysql + - echo 'grant all privileges on *.* to cta@localhost' | mysql + - CTA_CATALOGUE_CONF=/etc/cta/cta-catalogue.conf + - echo CTA_CATALOGUE_CONF=${CTA_CATALOGUE_CONF} + - echo 'mysql://cta@localhost:3306/cta' > ${CTA_CATALOGUE_CONF} + - /usr/bin/cta-catalogue-schema-create ${CTA_CATALOGUE_CONF} + - /usr/bin/cta-rdbmsUnitTests ${CTA_CATALOGUE_CONF} + - kill `ps -ef | egrep '^mysql.*/usr/libexec/mysqld' | awk '{print $2;}'` + + tags: + - docker + ctageneric_docker: except: - tags diff --git a/catalogue/CreateSchemaCmd.cpp b/catalogue/CreateSchemaCmd.cpp index c23111e5369946909223a3bcdef0eec8f6816f5e..fbde93d438ab25d6dd05d23b52e48e36adcfa741 100644 --- a/catalogue/CreateSchemaCmd.cpp +++ b/catalogue/CreateSchemaCmd.cpp @@ -23,6 +23,7 @@ #include "catalogue/PostgresCatalogueSchema.hpp" #include "catalogue/SqliteCatalogueSchema.hpp" #include "common/exception/Exception.hpp" +#include "common/utils/utils.hpp" #include "rdbms/ConnPool.hpp" #include "rdbms/Login.hpp" #include "rdbms/AutocommitMode.hpp" @@ -71,19 +72,19 @@ int CreateSchemaCmd::exceptionThrowingMain(const int argc, char *const *const ar case rdbms::Login::DBTYPE_SQLITE: { SqliteCatalogueSchema schema; - conn.executeNonQueries(schema.sql); + executeNonQueries(conn, schema.sql); } break; case rdbms::Login::DBTYPE_POSTGRESQL: { PostgresCatalogueSchema schema; - conn.executeNonQueries(schema.sql); + executeNonQueries(conn, schema.sql); } break; case rdbms::Login::DBTYPE_MYSQL: { MysqlCatalogueSchema schema; - conn.executeNonQueries(schema.sql); + executeNonQueries(conn, schema.sql); // execute triggers auto triggers = schema.triggers(); @@ -95,7 +96,7 @@ int CreateSchemaCmd::exceptionThrowingMain(const int argc, char *const *const ar case rdbms::Login::DBTYPE_ORACLE: { OracleCatalogueSchema schema; - conn.executeNonQueries(schema.sql); + executeNonQueries(conn, schema.sql); } break; case rdbms::Login::DBTYPE_NONE: @@ -131,5 +132,29 @@ void CreateSchemaCmd::printUsage(std::ostream &os) { CreateSchemaCmdLineArgs::printUsage(os); } +//------------------------------------------------------------------------------ +// executeNonQueries +//------------------------------------------------------------------------------ +void CreateSchemaCmd::executeNonQueries(rdbms::Conn &conn, const std::string &sqlStmts) { + try { + std::string::size_type searchPos = 0; + std::string::size_type findResult = std::string::npos; + + while(std::string::npos != (findResult = sqlStmts.find(';', searchPos))) { + // Calculate the length of the current statement without the trailing ';' + const std::string::size_type stmtLen = findResult - searchPos; + const std::string sqlStmt = utils::trimString(sqlStmts.substr(searchPos, stmtLen)); + searchPos = findResult + 1; + + if(0 < sqlStmt.size()) { // Ignore empty statements + conn.executeNonQuery(sqlStmt); + } + } + + } catch(exception::Exception &ex) { + throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str()); + } +} + } // namespace catalogue } // namespace cta diff --git a/catalogue/CreateSchemaCmd.hpp b/catalogue/CreateSchemaCmd.hpp index cae11221e303e371135196e0b016eccb2b727b43..086126ef3dc8986e329211a744cf0e0e02ffb26d 100644 --- a/catalogue/CreateSchemaCmd.hpp +++ b/catalogue/CreateSchemaCmd.hpp @@ -72,6 +72,19 @@ private: */ bool tableExists(const std::string tableName, rdbms::Conn &conn) const; + /** + * Parses the specified string of multiple SQL statements separated by + * semicolons and calls executeNonQuery() for each statement found. + * + * Please note that this method does not support statements that themselves + * contain one more semicolons. + * + * @param conn The database connection. + * @param sqlStmts Multiple SQL statements separated by semicolons. + * Statements that themselves contain one more semicolons are not supported. + */ + void executeNonQueries(rdbms::Conn &conn, const std::string &sqlStmts); + }; // class CreateSchemaCmd } // namespace catalogue diff --git a/catalogue/PostgresCatalogue.cpp b/catalogue/PostgresCatalogue.cpp index 640174ba186c7a61494a7a615a8bea93f3d9c232..579245dc2a334edcb7685aa6696bc10da72da8c9 100644 --- a/catalogue/PostgresCatalogue.cpp +++ b/catalogue/PostgresCatalogue.cpp @@ -894,27 +894,15 @@ void PostgresCatalogue::deleteArchiveFile(const std::string &diskInstanceName, c // beginCreateTemporarySetDeferred //------------------------------------------------------------------------------ void PostgresCatalogue::beginCreateTemporarySetDeferred(rdbms::Conn &conn) const { - const char *const sql_temptables = - "BEGIN;" - "CREATE TEMPORARY TABLE TEMP_ARCHIVE_FILE_BATCH (" - "LIKE ARCHIVE_FILE) " - "ON COMMIT DROP;" - "ALTER TABLE TEMP_ARCHIVE_FILE_BATCH " - "ADD COLUMN STORAGE_CLASS_NAME VARCHAR(100);" - "ALTER TABLE TEMP_ARCHIVE_FILE_BATCH " - "ALTER COLUMN STORAGE_CLASS_ID DROP NOT NULL;" - "CREATE INDEX TEMP_A_F_B_ARCHIVE_FILE_ID_I ON " - "TEMP_ARCHIVE_FILE_BATCH(ARCHIVE_FILE_ID);" - "CREATE INDEX TEMP_A_F_B_DIN_SCN_I ON " - "TEMP_ARCHIVE_FILE_BATCH(DISK_INSTANCE_NAME, STORAGE_CLASS_NAME);" - "CREATE TEMPORARY TABLE TEMP_TAPE_FILE_BATCH(" - "ARCHIVE_FILE_ID NUMERIC(20,0)) " - "ON COMMIT DROP;" - "CREATE INDEX TEMP_T_F_B_ARCHIVE_FILE_ID_I ON " - "TEMP_TAPE_FILE_BATCH(ARCHIVE_FILE_ID);" - "SET CONSTRAINTS ARCHIVE_FILE_DIN_DFI_UN DEFERRED"; - - conn.executeNonQueries(sql_temptables); + conn.executeNonQuery("BEGIN"); + conn.executeNonQuery("CREATE TEMPORARY TABLE TEMP_ARCHIVE_FILE_BATCH (LIKE ARCHIVE_FILE) ON COMMIT DROP"); + conn.executeNonQuery("ALTER TABLE TEMP_ARCHIVE_FILE_BATCH ADD COLUMN STORAGE_CLASS_NAME VARCHAR(100)"); + conn.executeNonQuery("ALTER TABLE TEMP_ARCHIVE_FILE_BATCH ALTER COLUMN STORAGE_CLASS_ID DROP NOT NULL"); + conn.executeNonQuery("CREATE INDEX TEMP_A_F_B_ARCHIVE_FILE_ID_I ON TEMP_ARCHIVE_FILE_BATCH(ARCHIVE_FILE_ID)"); + conn.executeNonQuery("CREATE INDEX TEMP_A_F_B_DIN_SCN_I ON TEMP_ARCHIVE_FILE_BATCH(DISK_INSTANCE_NAME, STORAGE_CLASS_NAME)"); + conn.executeNonQuery("CREATE TEMPORARY TABLE TEMP_TAPE_FILE_BATCH(ARCHIVE_FILE_ID NUMERIC(20,0)) ON COMMIT DROP"); + conn.executeNonQuery("CREATE INDEX TEMP_T_F_B_ARCHIVE_FILE_ID_I ON TEMP_TAPE_FILE_BATCH(ARCHIVE_FILE_ID)"); + conn.executeNonQuery("SET CONSTRAINTS ARCHIVE_FILE_DIN_DFI_UN DEFERRED"); } diff --git a/catalogue/SchemaCreatingSqliteCatalogue.cpp b/catalogue/SchemaCreatingSqliteCatalogue.cpp index e492e78fb9e7146f972d76535482cdc3e4c7d8d0..8a472a3fb9923c161c2bb8edfdba08d331f0cab4 100644 --- a/catalogue/SchemaCreatingSqliteCatalogue.cpp +++ b/catalogue/SchemaCreatingSqliteCatalogue.cpp @@ -18,6 +18,7 @@ #include "catalogue/SqliteCatalogueSchema.hpp" #include "catalogue/SchemaCreatingSqliteCatalogue.hpp" +#include "common/utils/utils.hpp" namespace cta { namespace catalogue { @@ -45,7 +46,31 @@ void SchemaCreatingSqliteCatalogue::createCatalogueSchema() { try { const SqliteCatalogueSchema schema; auto conn = m_connPool.getConn(); - conn.executeNonQueries(schema.sql); + executeNonQueries(conn, schema.sql); + } catch(exception::Exception &ex) { + throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str()); + } +} + +//------------------------------------------------------------------------------ +// executeNonQueries +//------------------------------------------------------------------------------ +void SchemaCreatingSqliteCatalogue::executeNonQueries(rdbms::Conn &conn, const std::string &sqlStmts) { + try { + std::string::size_type searchPos = 0; + std::string::size_type findResult = std::string::npos; + + while(std::string::npos != (findResult = sqlStmts.find(';', searchPos))) { + // Calculate the length of the current statement without the trailing ';' + const std::string::size_type stmtLen = findResult - searchPos; + const std::string sqlStmt = utils::trimString(sqlStmts.substr(searchPos, stmtLen)); + searchPos = findResult + 1; + + if(0 < sqlStmt.size()) { // Ignore empty statements + conn.executeNonQuery(sqlStmt); + } + } + } catch(exception::Exception &ex) { throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str()); } diff --git a/catalogue/SchemaCreatingSqliteCatalogue.hpp b/catalogue/SchemaCreatingSqliteCatalogue.hpp index fe265c3932deb6fb38d00a91ba58f33e23c9b368..8e623454ca16db929a909e3ca6b2660f5ff9209c 100644 --- a/catalogue/SchemaCreatingSqliteCatalogue.hpp +++ b/catalogue/SchemaCreatingSqliteCatalogue.hpp @@ -61,6 +61,19 @@ private: */ void createCatalogueSchema(); + /** + * Parses the specified string of multiple SQL statements separated by + * semicolons and calls executeNonQuery() for each statement found. + * + * Please note that this method does not support statements that themselves + * contain one more semicolons. + * + * @param conn The database connection. + * @param sqlStmts Multiple SQL statements separated by semicolons. + * Statements that themselves contain one more semicolons are not supported. + */ + void executeNonQueries(rdbms::Conn &conn, const std::string &sqlStmts); + }; // class SchemaCreatingSqliteCatalogue } // namespace catalogue diff --git a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init.sh b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init.sh index 4dcef3daacc4d1a114435eb4575cfc861f887c2c..c3a9de15a990ac93c05c888d2dd1f50992db9fe8 100755 --- a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init.sh +++ b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/init.sh @@ -78,9 +78,8 @@ else fi -: <<'COMMENT_LABEL_PART' if [ ! $LIBRARYTYPE == "mhvtl" ]; then - echo "Real tapes, not labelling"; + echo "Real tapes - do nothing"; else # library management # BEWARE STORAGE SLOTS START @1 and DRIVE SLOTS START @0!! @@ -91,22 +90,21 @@ else # normally, there is no need to rewind with virtual tapes... mtx -f /dev/${LIBRARYDEVICE} unload $(echo ${unload} | sed -e 's/^.*-slot//') $(echo ${unload} | sed -e 's/drive//;s/-.*//') || echo "COULD NOT UNLOAD TAPE" done - echo "Labelling tapes using the first drive in ${LIBRARYNAME}: ${DRIVENAMES[${driveslot}]} on /dev/${DRIVEDEVICES[${driveslot}]}:" - for ((i=0; i<${#TAPES[@]}; i++)); do - vid=${TAPES[${i}]} - tapeslot=$((${i}+1)) # tape slot is 1 for tape[0] and so on... - - echo -n "${vid} in slot ${tapeslot} " - mtx -f /dev/${LIBRARYDEVICE} load ${tapeslot} ${driveslot} - cd /tmp - echo "VOL1${vid} CASTOR 3">label.file - mt -f /dev/${DRIVEDEVICES[${driveslot}]} rewind - dd if=label.file of=/dev/${DRIVEDEVICES[${driveslot}]} bs=80 count=1 - mt -f /dev/${DRIVEDEVICES[${driveslot}]} rewind - mtx -f /dev/${LIBRARYDEVICE} unload ${tapeslot} ${driveslot} - echo "OK" - done +# echo "Labelling tapes using the first drive in ${LIBRARYNAME}: ${DRIVENAMES[${driveslot}]} on /dev/${DRIVEDEVICES[${driveslot}]}:" +# for ((i=0; i<${#TAPES[@]}; i++)); do +# vid=${TAPES[${i}]} +# tapeslot=$((${i}+1)) # tape slot is 1 for tape[0] and so on... +# +# echo -n "${vid} in slot ${tapeslot} " +# mtx -f /dev/${LIBRARYDEVICE} load ${tapeslot} ${driveslot} +# cd /tmp +# echo "VOL1${vid} CASTOR 3">label.file +# mt -f /dev/${DRIVEDEVICES[${driveslot}]} rewind +# dd if=label.file of=/dev/${DRIVEDEVICES[${driveslot}]} bs=80 count=1 +# mt -f /dev/${DRIVEDEVICES[${driveslot}]} rewind +# mtx -f /dev/${LIBRARYDEVICE} unload ${tapeslot} ${driveslot} +# echo "OK" +# done fi -COMMENT_LABEL_PART echo "### INIT COMPLETED ###" diff --git a/rdbms/CMakeLists.txt b/rdbms/CMakeLists.txt index b674fc05c12687ec01913e8649f5671d9232f19e..a3fa9ad9df1423869bfd41044a83b795f10f201a 100644 --- a/rdbms/CMakeLists.txt +++ b/rdbms/CMakeLists.txt @@ -29,8 +29,7 @@ set (RDBMS_LIB_SRC_FILES rdbms.cpp Rset.cpp Stmt.cpp - StmtPool.cpp - UnexpectedSemicolon.cpp) + StmtPool.cpp) add_library (ctardbms SHARED ${RDBMS_LIB_SRC_FILES}) diff --git a/rdbms/Conn.cpp b/rdbms/Conn.cpp index 665aa1ac097272aa37ce9ffb8532d166f701ad81..7c5530109a55f37b9062b9108772ba238d82ca2a 100644 --- a/rdbms/Conn.cpp +++ b/rdbms/Conn.cpp @@ -21,7 +21,6 @@ #include "rdbms/Conn.hpp" #include "rdbms/ConnPool.hpp" #include "rdbms/rdbms.hpp" -#include "rdbms/UnexpectedSemicolon.hpp" namespace cta { namespace rdbms { @@ -115,40 +114,16 @@ Stmt Conn::createStmt(const std::string &sql) { } } -//------------------------------------------------------------------------------ -// executeNonQueries -//------------------------------------------------------------------------------ -void Conn::executeNonQueries(const std::string &sqlStmts) { - try { - std::string::size_type searchPos = 0; - std::string::size_type findResult = std::string::npos; - - while(std::string::npos != (findResult = sqlStmts.find(';', searchPos))) { - // Calculate the length of the current statement without the trailing ';' - const std::string::size_type stmtLen = findResult - searchPos; - const std::string sqlStmt = utils::trimString(sqlStmts.substr(searchPos, stmtLen)); - searchPos = findResult + 1; - - if(0 < sqlStmt.size()) { // Ignore empty statements - executeNonQuery(sqlStmt); - } - } - - } catch(exception::Exception &ex) { - throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str()); - } -} - //------------------------------------------------------------------------------ // executeNonQuery //------------------------------------------------------------------------------ void Conn::executeNonQuery(const std::string &sql) { if(nullptr != m_connAndStmts && nullptr != m_connAndStmts->conn) { - if(std::string::npos != sql.find(";")) { - UnexpectedSemicolon ex; - ex.getMessage() << "Encountered unexpected semicolon in " << getSqlForException(sql); - throw ex; - } +// if(std::string::npos != sql.find(";")) { +// UnexpectedSemicolon ex; +// ex.getMessage() << "Encountered unexpected semicolon in " << getSqlForException(sql); +// throw ex; +// } m_connAndStmts->conn->executeNonQuery(sql); } else { throw exception::Exception(std::string(__FUNCTION__) + " failed: Conn does not contain a connection"); diff --git a/rdbms/Conn.hpp b/rdbms/Conn.hpp index 4d3f6b140c6c8e0379a1477e6c0fec6bd6ce3efa..6805e3ff87b4a83e8557bbf74edd3317cf235b15 100644 --- a/rdbms/Conn.hpp +++ b/rdbms/Conn.hpp @@ -117,17 +117,6 @@ public: */ Stmt createStmt(const std::string &sql); - /** - * Convenience method that parses the specified string of multiple SQL - * statements and calls executeNonQuery() for each individual statement found. - * - * Please note that each statement should be a non-query terminated by a - * semicolon. - * - * @param sqlStmts The SQL statements to be executed. - */ - void executeNonQueries(const std::string &sqlStmts); - /** * Executes the statement. * diff --git a/rdbms/ConnTest.cpp b/rdbms/ConnTest.cpp index dc76a611fa0fe439e62546cff20e7328933823a3..75db5e60a7fe52e7cf03e666aadbaea0df659ff9 100644 --- a/rdbms/ConnTest.cpp +++ b/rdbms/ConnTest.cpp @@ -20,7 +20,6 @@ #include "rdbms/ConnPool.hpp" #include "rdbms/ConnTest.hpp" #include "rdbms/Login.hpp" -#include "rdbms/UnexpectedSemicolon.hpp" #include <gtest/gtest.h> @@ -149,43 +148,6 @@ TEST_P(cta_rdbms_ConnTest, createTableInMemoryDatabase_executeNonQuery) { } } -TEST_P(cta_rdbms_ConnTest, createTableInMemoryDatabase_executeNonQuery_semicolon) { - using namespace cta::rdbms; - - const std::string sql = "CREATE TABLE POOLED_STMT_TEST(ID INTEGER);"; - - { - const Login login(Login::DBTYPE_SQLITE, "", "", "file::memory:?cache=shared", "", 0); - const uint64_t maxNbConns = 1; - ConnPool connPool(login, maxNbConns); - auto conn = connPool.getConn(); - - ASSERT_TRUE(conn.getTableNames().empty()); - - ASSERT_THROW(conn.executeNonQuery(sql), UnexpectedSemicolon); - } -} - -TEST_P(cta_rdbms_ConnTest, createTableInMemoryDatabase_executeNonQueries) { - using namespace cta::rdbms; - - const std::string sql = "CREATE TABLE POOLED_STMT_TEST(ID INTEGER);"; - - // First in-memory database - { - const Login login(Login::DBTYPE_SQLITE, "", "", "file::memory:?cache=shared", "", 0); - const uint64_t maxNbConns = 1; - ConnPool connPool(login, maxNbConns); - auto conn = connPool.getConn(); - - ASSERT_TRUE(conn.getTableNames().empty()); - - conn.executeNonQueries(sql); - - ASSERT_EQ(1, conn.getTableNames().size()); - } -} - TEST_P(cta_rdbms_ConnTest, createSameTableInTwoSeparateInMemoryDatabases_executeNonQuery) { using namespace cta::rdbms; @@ -220,38 +182,4 @@ TEST_P(cta_rdbms_ConnTest, createSameTableInTwoSeparateInMemoryDatabases_execute } } -TEST_P(cta_rdbms_ConnTest, createSameTableInTwoSeparateInMemoryDatabases_executeNonQueries) { - using namespace cta::rdbms; - - const std::string sql = "CREATE TABLE POOLED_STMT_TEST(ID INTEGER);"; - - // First in-memory database - { - const Login login(Login::DBTYPE_SQLITE, "", "", "file::memory:?cache=shared", "", 0); - const uint64_t maxNbConns = 1; - ConnPool connPool(login, maxNbConns); - auto conn = connPool.getConn(); - - ASSERT_TRUE(conn.getTableNames().empty()); - - conn.executeNonQueries(sql); - - ASSERT_EQ(1, conn.getTableNames().size()); - } - - // Second in-memory database - { - const Login login(Login::DBTYPE_SQLITE, "", "", "file::memory:?cache=shared", "", 0); - const uint64_t maxNbConns = 1; - ConnPool connPool(login, maxNbConns); - auto conn = connPool.getConn(); - - ASSERT_TRUE(conn.getTableNames().empty()); - - conn.executeNonQueries(sql); - - ASSERT_EQ(1, conn.getTableNames().size()); - } -} - } // namespace unitTests diff --git a/rdbms/UnexpectedSemicolon.cpp b/rdbms/UnexpectedSemicolon.cpp deleted file mode 100644 index c2f084aacf059ad37b0682c770a17d8fbc6fcb05..0000000000000000000000000000000000000000 --- a/rdbms/UnexpectedSemicolon.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The CERN Tape Archive (CTA) project - * Copyright (C) 2015 CERN - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "UnexpectedSemicolon.hpp" - -namespace cta { -namespace rdbms { - -//------------------------------------------------------------------------------ -// constructor -//------------------------------------------------------------------------------ -UnexpectedSemicolon::UnexpectedSemicolon(const std::string &context, const bool embedBacktrace): - Exception(context, embedBacktrace) { -} - -} // namespace rdbms -} // namespace cta diff --git a/rdbms/UnexpectedSemicolon.hpp b/rdbms/UnexpectedSemicolon.hpp deleted file mode 100644 index 50b0961acde6306085bcd250dd7dce139250dae9..0000000000000000000000000000000000000000 --- a/rdbms/UnexpectedSemicolon.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The CERN Tape Archive (CTA) project - * Copyright (C) 2015 CERN - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#pragma once - -#include "common/exception/Exception.hpp" - -namespace cta { -namespace rdbms { - -/** - * Encountered an unexpected semicolon. - */ -class UnexpectedSemicolon: public exception::Exception { -public: - - /** - * Constructor. - * - * @param context optional context string added to the message - * at initialisation time. - * @param embedBacktrace whether to embed a backtrace of where the - * exception was throw in the message - */ - UnexpectedSemicolon(const std::string &context = "", const bool embedBacktrace = true); - -}; // class UnexpectedSemicolon - -} // namespace rdbms -} // namespace cta