Commit 5acc3454 authored by Steven Murray's avatar Steven Murray
Browse files

Split cta::catalogue into cta::catalogue and cta::rdbms

parent 51c159dc
......@@ -114,6 +114,7 @@ ELSE(DEFINED PackageOnly)
add_subdirectory(cmdline)
add_subdirectory(common)
add_subdirectory(objectstore)
add_subdirectory(rdbms)
add_subdirectory(remotens)
add_subdirectory(scheduler)
add_subdirectory(tapeserver)
......
......@@ -23,32 +23,14 @@ include_directories (${ORACLE-INSTANTCLIENT_INCLUDE_DIRS})
set (CATALOGUE_LIB_SRC_FILES
ArchiveFileRow.cpp
ArchiveFileItor.cpp
AutoRollback.cpp
Catalogue.cpp
CatalogueFactory.cpp
ColumnNameToIdx.cpp
ColumnNameToIdxAndType.cpp
DbConn.cpp
DbLogin.cpp
DbRset.cpp
DbStmt.cpp
InMemoryCatalogue.cpp
InMemoryCatalogueSchema.cpp
TapeFileWritten.cpp
NullDbValue.cpp
OcciConn.cpp
OcciEnv.cpp
OcciEnvSingleton.cpp
OcciRset.cpp
OcciStmt.cpp
OracleCatalogue.cpp
ParamNameToIdx.cpp
RdbmsCatalogue.cpp
Sqlite.cpp
SqliteCatalogue.cpp
SqliteConn.cpp
SqliteRset.cpp
SqliteStmt.cpp
TapeForWriting.cpp
UserError.cpp)
......@@ -59,6 +41,7 @@ install (TARGETS ctacatalogue DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
target_link_libraries (ctacatalogue
ctacommon
ctardbms
${ORACLE-INSTANTCLIENT_LIBRARIES}
${SQLITE_LIBRARIES})
......@@ -91,11 +74,11 @@ add_custom_command(OUTPUT InMemoryCatalogueSchema.cpp
set(IN_MEMORY_CATALOGUE_UNIT_TESTS_LIB_SRC_FILES
CatalogueTest.cpp
CatalogueFactoryTest.cpp
DbLoginFactory.cpp
DbLoginTest.cpp
ParamNameToIdxTest.cpp
../rdbms/DbLoginFactory.cpp
../rdbms/DbLoginTest.cpp
../rdbms/ParamNameToIdxTest.cpp
InMemoryCatalogueTest.cpp
SqliteStmtTest.cpp)
../rdbms/SqliteStmtTest.cpp)
add_library (ctainmemorycatalogueunittests SHARED
${IN_MEMORY_CATALOGUE_UNIT_TESTS_LIB_SRC_FILES})
......@@ -108,7 +91,7 @@ install(TARGETS ctainmemorycatalogueunittests DESTINATION usr/${CMAKE_INSTALL_LI
set (CATALOGUE_UNIT_TESTS_LIB_SRC_FILES
CatalogueTest.cpp
DbConfigCatalogueTest.cpp
DbLoginFactory.cpp)
../rdbms/DbLoginFactory.cpp)
add_library (ctacatalogueunittests SHARED
${CATALOGUE_UNIT_TESTS_LIB_SRC_FILES})
......
......@@ -28,16 +28,16 @@ namespace catalogue {
//------------------------------------------------------------------------------
// create
//------------------------------------------------------------------------------
Catalogue *CatalogueFactory::create(const DbLogin &dbLogin) {
Catalogue *CatalogueFactory::create(const rdbms::DbLogin &dbLogin) {
try {
switch(dbLogin.dbType) {
case DbLogin::DBTYPE_IN_MEMORY:
case rdbms::DbLogin::DBTYPE_IN_MEMORY:
return new InMemoryCatalogue();
case DbLogin::DBTYPE_ORACLE:
case rdbms::DbLogin::DBTYPE_ORACLE:
return new OracleCatalogue(dbLogin.username, dbLogin.password, dbLogin.database);
case DbLogin::DBTYPE_SQLITE:
case rdbms::DbLogin::DBTYPE_SQLITE:
return new SqliteCatalogue(dbLogin.database);
case DbLogin::DBTYPE_NONE:
case rdbms::DbLogin::DBTYPE_NONE:
throw exception::Exception("Cannot create a catalogue without a database type");
default:
{
......
......@@ -19,7 +19,7 @@
#pragma once
#include "catalogue/Catalogue.hpp"
#include "catalogue/DbLogin.hpp"
#include "rdbms/DbLogin.hpp"
#include <memory>
#include <mutex>
......@@ -46,7 +46,7 @@ public:
* @return The newly created CTA catalogue object. Please note that it is the
* responsibility of the caller to delete the returned CTA catalogue object.
*/
static Catalogue *create(const DbLogin &dbLogin);
static Catalogue *create(const rdbms::DbLogin &dbLogin);
}; // class CatalogueFactory
......
......@@ -58,7 +58,7 @@ TEST_F(cta_catalogue_CatalogueFactoryTest, instance_in_memory) {
using namespace cta;
using namespace cta::catalogue;
DbLogin dbLogin(DbLogin::DBTYPE_IN_MEMORY, "", "", "");
rdbms::DbLogin dbLogin(rdbms::DbLogin::DBTYPE_IN_MEMORY, "", "", "");
std::unique_ptr<Catalogue> catalogue(CatalogueFactory::create(dbLogin));
ASSERT_TRUE(NULL != catalogue.get());
......
......@@ -20,9 +20,9 @@
#include "catalogue/ArchiveFileRow.hpp"
#include "catalogue/CatalogueFactory.hpp"
#include "catalogue/DbLoginFactory.hpp"
#include "catalogue/UserError.hpp"
#include "common/exception/Exception.hpp"
#include "rdbms/DbLoginFactory.hpp"
#include <gtest/gtest.h>
#include <map>
......@@ -31,7 +31,7 @@
namespace unitTests {
class cta_catalogue_CatalogueTest : public ::testing::TestWithParam<cta::catalogue::DbLoginFactory*> {
class cta_catalogue_CatalogueTest : public ::testing::TestWithParam<cta::rdbms::DbLoginFactory*> {
public:
/**
......
......@@ -26,7 +26,7 @@ namespace {
* details are specified in a database configuration file passed on the
* command-line to the catalogue unit-tests program.
*/
class DbConfigFileLoginFactory: public cta::catalogue::DbLoginFactory {
class DbConfigFileLoginFactory: public cta::rdbms::DbLoginFactory {
public:
/**
......@@ -40,9 +40,9 @@ public:
*
* @return A newly created DbLogin object.
*/
virtual cta::catalogue::DbLogin create() {
virtual cta::rdbms::DbLogin create() {
using namespace cta::catalogue;
return DbLogin::parseFile(g_cmdLineArgs.dbConfigPath);
return cta::rdbms::DbLogin::parseFile(g_cmdLineArgs.dbConfigPath);
}
}; // class OracleDbLoginFactory
......@@ -53,6 +53,6 @@ DbConfigFileLoginFactory g_dbConfigLoginFactory;
namespace unitTests {
INSTANTIATE_TEST_CASE_P(DbConfigFile, cta_catalogue_CatalogueTest,
::testing::Values(dynamic_cast<cta::catalogue::DbLoginFactory*>(&g_dbConfigLoginFactory)));
::testing::Values(dynamic_cast<cta::rdbms::DbLoginFactory*>(&g_dbConfigLoginFactory)));
} // namespace unitTests
......@@ -18,7 +18,7 @@
#include "catalogue/InMemoryCatalogue.hpp"
#include "catalogue/RdbmsCatalogueSchema.hpp"
#include "catalogue/SqliteConn.hpp"
#include "rdbms/SqliteConn.hpp"
namespace cta {
namespace catalogue {
......@@ -27,7 +27,7 @@ namespace catalogue {
// constructor
//------------------------------------------------------------------------------
InMemoryCatalogue::InMemoryCatalogue() {
std::unique_ptr<SqliteConn> sqliteConn(new SqliteConn(":memory:"));
std::unique_ptr<rdbms::SqliteConn> sqliteConn(new rdbms::SqliteConn(":memory:"));
m_conn.reset(sqliteConn.release());
createCatalogueSchema();
}
......@@ -51,7 +51,7 @@ void InMemoryCatalogue::executeNonQueryMultiStmt(const std::string &multiStmt) {
const std::string::size_type length = findResult - searchPos + 1;
const std::string sql = multiStmt.substr(searchPos, length);
searchPos = findResult + 1;
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->executeNonQuery();
}
}
......
......@@ -25,7 +25,7 @@ namespace {
/**
* Creates DbLogin objects for in-memory catalogue databases.
*/
class InMemoryDbLoginFactory: public cta::catalogue::DbLoginFactory {
class InMemoryDbLoginFactory: public cta::rdbms::DbLoginFactory {
public:
/**
......@@ -39,9 +39,9 @@ public:
*
* @return A newly created DbLogin object.
*/
virtual cta::catalogue::DbLogin create() {
virtual cta::rdbms::DbLogin create() {
using namespace cta::catalogue;
return DbLogin(DbLogin::DBTYPE_IN_MEMORY, "", "", "");
return cta::rdbms::DbLogin(cta::rdbms::DbLogin::DBTYPE_IN_MEMORY, "", "", "");
}
}; // class InMemoryDbLoginFactory
......@@ -50,6 +50,6 @@ InMemoryDbLoginFactory g_inMemoryDbLoginFactory;
} // anonymous namespace
INSTANTIATE_TEST_CASE_P(InMemory, cta_catalogue_CatalogueTest,
::testing::Values(dynamic_cast<cta::catalogue::DbLoginFactory*>(&g_inMemoryDbLoginFactory)));
::testing::Values(dynamic_cast<cta::rdbms::DbLoginFactory*>(&g_inMemoryDbLoginFactory)));
} // namespace unitTests
......@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/OcciConn.hpp"
#include "catalogue/OcciEnvSingleton.hpp"
#include "rdbms/OcciConn.hpp"
#include "rdbms/OcciEnvSingleton.hpp"
#include "catalogue/OracleCatalogue.hpp"
#include "catalogue/UserError.hpp"
#include "common/exception/Exception.hpp"
......@@ -33,7 +33,7 @@ OracleCatalogue::OracleCatalogue(
const std::string &username,
const std::string &password,
const std::string &database) {
m_conn.reset(OcciEnvSingleton::instance().createConn(username, password, database));
m_conn.reset(rdbms::OcciEnvSingleton::instance().createConn(username, password, database));
}
//------------------------------------------------------------------------------
......@@ -77,9 +77,9 @@ common::dataStructures::ArchiveFile OracleCatalogue::deleteArchiveFile(const uin
"WHERE "
"ARCHIVE_FILE.ARCHIVE_FILE_ID = :ARCHIVE_FILE_ID "
"FOR UPDATE";
std::unique_ptr<DbStmt> selectStmt(m_conn->createStmt(selectSql));
std::unique_ptr<rdbms::DbStmt> selectStmt(m_conn->createStmt(selectSql));
selectStmt->bindUint64(":ARCHIVE_FILE_ID", archiveFileId);
std::unique_ptr<DbRset> selectRset(selectStmt->executeQuery());
std::unique_ptr<rdbms::DbRset> selectRset(selectStmt->executeQuery());
while(selectRset->next()) {
if(NULL == archiveFile.get()) {
archiveFile.reset(new common::dataStructures::ArchiveFile);
......@@ -121,14 +121,14 @@ common::dataStructures::ArchiveFile OracleCatalogue::deleteArchiveFile(const uin
{
const char *const sql = "DELETE FROM TAPE_FILE WHERE ARCHIVE_FILE_ID = :ARCHIVE_FILE_ID";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindUint64(":ARCHIVE_FILE_ID", archiveFileId);
stmt->executeNonQuery();
}
{
const char *const sql = "DELETE FROM ARCHIVE_FILE WHERE ARCHIVE_FILE_ID = :ARCHIVE_FILE_ID";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindUint64(":ARCHIVE_FILE_ID", archiveFileId);
stmt->executeNonQuery();
}
......@@ -154,8 +154,8 @@ uint64_t OracleCatalogue::getNextArchiveFileId() {
"FROM "
"DUAL";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
if (!rset->next()) {
throw exception::Exception(std::string("Result set is unexpectedly empty"));
}
......@@ -208,9 +208,9 @@ common::dataStructures::Tape OracleCatalogue::selectTapeForUpdate(const std::str
"VID = :VID "
"FOR UPDATE";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":VID", vid);
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
if (!rset->next()) {
throw exception::Exception(std::string("The tape with VID " + vid + " does not exist"));
}
......
......@@ -17,7 +17,7 @@
*/
#include "catalogue/ArchiveFileRow.hpp"
#include "catalogue/AutoRollback.hpp"
#include "rdbms/AutoRollback.hpp"
#include "catalogue/RdbmsCatalogue.hpp"
#include "catalogue/RdbmsCatalogueSchema.hpp"
#include "catalogue/UserError.hpp"
......@@ -101,7 +101,7 @@ void RdbmsCatalogue::createAdminUser(
":LAST_UPDATE_USER_NAME,"
":LAST_UPDATE_HOST_NAME,"
":LAST_UPDATE_TIME)";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":ADMIN_USER_NAME", username);
......@@ -135,9 +135,9 @@ bool RdbmsCatalogue::adminUserExists(const std::string adminUsername) const {
"ADMIN_USER "
"WHERE "
"ADMIN_USER_NAME = :ADMIN_USER_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":ADMIN_USER_NAME", adminUsername);
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
return rset->next();
} catch (exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
......@@ -150,7 +150,7 @@ bool RdbmsCatalogue::adminUserExists(const std::string adminUsername) const {
void RdbmsCatalogue::deleteAdminUser(const std::string &username) {
try {
const char *const sql = "DELETE FROM ADMIN_USER WHERE ADMIN_USER_NAME = :ADMIN_USER_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":ADMIN_USER_NAME", username);
stmt->executeNonQuery();
......@@ -186,8 +186,8 @@ RdbmsCatalogue::getAdminUsers() const {
"LAST_UPDATE_TIME AS LAST_UPDATE_TIME "
"FROM "
"ADMIN_USER";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
while (rset->next()) {
common::dataStructures::AdminUser admin;
......@@ -255,7 +255,7 @@ void RdbmsCatalogue::createAdminHost(
":LAST_UPDATE_USER_NAME,"
":LAST_UPDATE_HOST_NAME,"
":LAST_UPDATE_TIME)";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":ADMIN_HOST_NAME", hostName);
......@@ -289,9 +289,9 @@ bool RdbmsCatalogue::adminHostExists(const std::string adminHost) const {
"ADMIN_HOST "
"WHERE "
"ADMIN_HOST_NAME = :ADMIN_HOST_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":ADMIN_HOST_NAME", adminHost);
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
return rset->next();
} catch (exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
......@@ -304,7 +304,7 @@ bool RdbmsCatalogue::adminHostExists(const std::string adminHost) const {
void RdbmsCatalogue::deleteAdminHost(const std::string &hostName) {
try {
const char *const sql = "DELETE FROM ADMIN_HOST WHERE ADMIN_HOST_NAME = :ADMIN_HOST_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":ADMIN_HOST_NAME", hostName);
stmt->executeNonQuery();
......@@ -339,8 +339,8 @@ std::list<common::dataStructures::AdminHost> RdbmsCatalogue::getAdminHosts() con
"LAST_UPDATE_TIME AS LAST_UPDATE_TIME "
"FROM "
"ADMIN_HOST";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
while (rset->next()) {
common::dataStructures::AdminHost host;
......@@ -411,7 +411,7 @@ void RdbmsCatalogue::createStorageClass(
":LAST_UPDATE_USER_NAME,"
":LAST_UPDATE_HOST_NAME,"
":LAST_UPDATE_TIME)";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":STORAGE_CLASS_NAME", name);
stmt->bindUint64(":NB_COPIES", nbCopies);
......@@ -446,9 +446,9 @@ bool RdbmsCatalogue::storageClassExists(const std::string &storageClassName) con
"STORAGE_CLASS "
"WHERE "
"STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":STORAGE_CLASS_NAME", storageClassName);
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
return rset->next();
} catch (exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
......@@ -465,7 +465,7 @@ void RdbmsCatalogue::deleteStorageClass(const std::string &name) {
"STORAGE_CLASS "
"WHERE "
"STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":STORAGE_CLASS_NAME", name);
......@@ -503,8 +503,8 @@ std::list<common::dataStructures::StorageClass>
"LAST_UPDATE_TIME AS LAST_UPDATE_TIME "
"FROM "
"STORAGE_CLASS";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
while (rset->next()) {
common::dataStructures::StorageClass storageClass;
......@@ -585,7 +585,7 @@ void RdbmsCatalogue::createTapePool(
":LAST_UPDATE_USER_NAME,"
":LAST_UPDATE_HOST_NAME,"
":LAST_UPDATE_TIME)";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":TAPE_POOL_NAME", name);
stmt->bindUint64(":NB_PARTIAL_TAPES", nbPartialTapes);
......@@ -621,9 +621,9 @@ bool RdbmsCatalogue::tapePoolExists(const std::string &tapePoolName) const {
"TAPE_POOL "
"WHERE "
"TAPE_POOL_NAME = :TAPE_POOL_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":TAPE_POOL_NAME", tapePoolName);
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
return rset->next();
} catch (exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
......@@ -636,7 +636,7 @@ bool RdbmsCatalogue::tapePoolExists(const std::string &tapePoolName) const {
void RdbmsCatalogue::deleteTapePool(const std::string &name) {
try {
const char *const sql = "DELETE FROM TAPE_POOL WHERE TAPE_POOL_NAME = :TAPE_POOL_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":TAPE_POOL_NAME", name);
stmt->executeNonQuery();
......@@ -673,8 +673,8 @@ std::list<common::dataStructures::TapePool> RdbmsCatalogue::getTapePools() const
"LAST_UPDATE_TIME AS LAST_UPDATE_TIME "
"FROM "
"TAPE_POOL";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
while (rset->next()) {
common::dataStructures::TapePool pool;
......@@ -759,7 +759,7 @@ void RdbmsCatalogue::createArchiveRoute(
":LAST_UPDATE_USER_NAME,"
":LAST_UPDATE_HOST_NAME,"
":LAST_UPDATE_TIME)";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":STORAGE_CLASS_NAME", storageClassName);
stmt->bindUint64(":COPY_NB", copyNb);
......@@ -792,7 +792,7 @@ void RdbmsCatalogue::deleteArchiveRoute(const std::string &storageClassName, con
"WHERE "
"STORAGE_CLASS_NAME = :STORAGE_CLASS_NAME AND "
"COPY_NB = :COPY_NB";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":STORAGE_CLASS_NAME", storageClassName);
stmt->bindUint64(":COPY_NB", copyNb);
stmt->executeNonQuery();
......@@ -834,8 +834,8 @@ std::list<common::dataStructures::ArchiveRoute>
"LAST_UPDATE_TIME AS LAST_UPDATE_TIME "
"FROM "
"ARCHIVE_ROUTE";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
while (rset->next()) {
common::dataStructures::ArchiveRoute route;
......@@ -911,7 +911,7 @@ void RdbmsCatalogue::createLogicalLibrary(
":LAST_UPDATE_USER_NAME,"
":LAST_UPDATE_HOST_NAME,"
":LAST_UPDATE_TIME)";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":LOGICAL_LIBRARY_NAME", name);
......@@ -945,9 +945,9 @@ bool RdbmsCatalogue::logicalLibraryExists(const std::string &logicalLibraryName)
"LOGICAL_LIBRARY "
"WHERE "
"LOGICAL_LIBRARY_NAME = :LOGICAL_LIBRARY_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":LOGICAL_LIBRARY_NAME", logicalLibraryName);
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
return rset->next();
} catch (exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
......@@ -960,7 +960,7 @@ bool RdbmsCatalogue::logicalLibraryExists(const std::string &logicalLibraryName)
void RdbmsCatalogue::deleteLogicalLibrary(const std::string &name) {
try {
const char *const sql = "DELETE FROM LOGICAL_LIBRARY WHERE LOGICAL_LIBRARY_NAME = :LOGICAL_LIBRARY_NAME";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":LOGICAL_LIBRARY_NAME", name);
stmt->executeNonQuery();
......@@ -996,8 +996,8 @@ std::list<common::dataStructures::LogicalLibrary>
"LAST_UPDATE_TIME AS LAST_UPDATE_TIME "
"FROM "
"LOGICAL_LIBRARY";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
while (rset->next()) {
common::dataStructures::LogicalLibrary lib;
......@@ -1088,7 +1088,7 @@ void RdbmsCatalogue::createTape(
":LAST_UPDATE_USER_NAME,"
":LAST_UPDATE_HOST_NAME,"
":LAST_UPDATE_TIME)";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":VID", vid);
stmt->bindString(":LOGICAL_LIBRARY_NAME", logicalLibraryName);
......@@ -1131,9 +1131,9 @@ bool RdbmsCatalogue::tapeExists(const std::string &vid) const {
"TAPE "
"WHERE "
"VID = :VID";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":VID", vid);
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
return rset->next();
} catch (exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
......@@ -1146,7 +1146,7 @@ bool RdbmsCatalogue::tapeExists(const std::string &vid) const {
void RdbmsCatalogue::deleteTape(const std::string &vid) {
try {
const char *const sql = "DELETE FROM TAPE WHERE VID = :VID";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":VID", vid);
stmt->executeNonQuery();
......@@ -1246,7 +1246,7 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(const TapeSearc
sql += " LBP_IS_ON = :LBP_IS_ON";
}
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
if(searchCriteria.vid) stmt->bindString(":VID", searchCriteria.vid.value());
if(searchCriteria.logicalLibrary) stmt->bindString(":LOGICAL_LIBRARY_NAME", searchCriteria.logicalLibrary.value());
......@@ -1256,7 +1256,7 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(const TapeSearc
if(searchCriteria.full) stmt->bindUint64(":IS_FULL", searchCriteria.full.value() ? 1 : 0);
if(searchCriteria.lbp) stmt->bindUint64(":LBP_IS_ON", searchCriteria.lbp.value() ? 1 : 0);
std::unique_ptr<DbRset> rset(stmt->executeQuery());
std::unique_ptr<rdbms::DbRset> rset(stmt->executeQuery());
while (rset->next()) {
common::dataStructures::Tape tape;
......@@ -1295,7 +1295,7 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(const TapeSearc
//------------------------------------------------------------------------------
// getTapeLogFromRset
//------------------------------------------------------------------------------
optional<common::dataStructures::TapeLog> RdbmsCatalogue::getTapeLogFromRset(const DbRset &rset,
optional<common::dataStructures::TapeLog> RdbmsCatalogue::getTapeLogFromRset(const rdbms::DbRset &rset,
const std::string &driveColName, const std::string &timeColName) const {
try {
const optional<std::string> drive = rset.columnOptionalText(driveColName);
......@@ -1503,7 +1503,7 @@ void RdbmsCatalogue::createMountPolicy(
":LAST_UPDATE_USER_NAME,"
":LAST_UPDATE_HOST_NAME,"
":LAST_UPDATE_TIME)";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":MOUNT_POLICY_NAME", name);
......@@ -1580,7 +1580,7 @@ void RdbmsCatalogue::createRequesterMountRule(
":LAST_UPDATE_USER_NAME,"
":LAST_UPDATE_HOST_NAME,"
":LAST_UPDATE_TIME)";
std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql));
std::unique_ptr<rdbms::DbStmt> stmt(m_conn->createStmt(sql));
stmt->bindString(":REQUESTER_NAME", requesterName);
stmt->bindString(":MOUNT_POLICY_NAME", mountPolicyName);
......@@ -1625,8 +1625,8 @@ std::list<common::dataStructures::RequesterMountRule> RdbmsCatalogue::getRequest
"LAST_UPDATE_TIME AS LAST_UPDATE_TIME "
"FROM "
"REQUESTER_MOUNT_RULE";
std::unique_ptr<DbStmt