Commit b6794b9e authored by Daniele Kruse's avatar Daniele Kruse
Browse files

Added the unique pointer for sqlite statements with custom deleter and fixed...

Added the unique pointer for sqlite statements with custom deleter and fixed the error reporting for SQLite prepare
parent d9fbd95c
This diff is collapsed.
cmake_minimum_required (VERSION 2.6)
add_library (ctanameserver SHARED
MockNameServer.cpp
NameServer.cpp)
add_library (ctanameservertest SHARED
MockNameServer.cpp
MockNameServerFactory.cpp
MockNameServerTest.cpp
NameServerFactory.cpp)
......
......@@ -41,6 +41,7 @@ set (CTA_SCHEDULER_SRC_FILES
SchedulerDatabase.cpp
SecurityIdentity.cpp
SqliteColumnNameToIndex.cpp
SQLiteStatementDeleter.cpp
StorageClass.cpp
Tape.cpp
TapeException.cpp
......
This diff is collapsed.
/*
* 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 "scheduler/SQLiteStatementDeleter.hpp"
//------------------------------------------------------------------------------
// operator()
//------------------------------------------------------------------------------
void cta::SQLiteStatementDeleter::operator() (sqlite3_stmt * ptr) {
sqlite3_finalize(ptr);
}
\ No newline at end of file
/*
* 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 <sqlite3.h>
namespace cta {
/**
* Deleter class used by unique_ptrs of sqlite3_stmts.
*/
struct SQLiteStatementDeleter{
/**
* Overloading the () operator
*
* @param ptr: the statement pointer to delete
*/
void operator() (sqlite3_stmt * ptr);
};
} // namespace cta
\ No newline at end of file
......@@ -7,4 +7,4 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../middletier)
include_directories (${XROOTD_INCLUDE_DIR} ${XROOTD_PRIVATE_INCLUDE_DIR})
add_library (XrdProFst MODULE XrdProFilesystem.cpp XrdProFile.cpp XrdProDir.cpp ParsedRequest.cpp)
target_link_libraries (XrdProFst ctascheduler)
target_link_libraries (XrdProFst ctascheduler ctacommon ctamiddletiersqlite ctanameserver)
......@@ -923,7 +923,7 @@ int XrdProFilesystem::executeLsllibCommand(const ParsedRequest &req, XrdOucErrIn
try {
std::list<cta::LogicalLibrary> llibs = m_adminApi.getLogicalLibraries(requester);
std::ostringstream responseSS;
responseSS << "[OK] Listing of the archive routes:";
responseSS << "[OK] Listing of the logical libraries:";
for(std::list<cta::LogicalLibrary>::iterator it = llibs.begin(); it != llibs.end(); it++) {
responseSS << "\n" << it->getName()
<< " " << it->getCreator().getUid()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment